diff mbox

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

Message ID 1453316408-30373-4-git-send-email-joao.m.martins@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Joao Martins Jan. 20, 2016, 7 p.m. UTC
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@oracle.com>
---
 src/libxl/libxl_driver.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
diff mbox

Patch

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);