[libvirt] [PATCH v3 3/3] libxl: begin job on perform phase

Joao Martins joao.m.martins at oracle.com
Wed Jan 20 19:00:08 UTC 2016


Add a job LIBXL_JOB_MODIFY in the perform phase to prevent
changes to the domain from happening during migration.

Signed-off-by: Joao Martins <joao.m.martins at oracle.com>
---
 src/libxl/libxl_driver.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 28220b2..73ed448 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -5341,18 +5341,25 @@ libxlDomainMigratePerform3Params(virDomainPtr dom,
     if (virDomainMigratePerform3ParamsEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;
 
+    if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
+        goto cleanup;
+
     if (flags & VIR_MIGRATE_PEER2PEER) {
         if (libxlDomainMigrationPerformP2P(driver, vm, dom->conn, dom_xml,
                                            dconnuri, uri, dname, flags) < 0)
-            goto cleanup;
+            goto endjob;
     } else {
         if (libxlDomainMigrationPerform(driver, vm, dom_xml, dconnuri,
                                         uri, dname, flags) < 0)
-            goto cleanup;
+            goto endjob;
     }
 
     ret = 0;
 
+ endjob:
+    if (!libxlDomainObjEndJob(driver, vm))
+        vm = NULL;
+
  cleanup:
     if (vm)
         virObjectUnlock(vm);
-- 
2.1.4




More information about the libvir-list mailing list