[PATCH 3/4] libxl: acquire job though begin phase only

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



During migration, the libxl driver starts a modify job in the
begin phase, ending the job in the confirm phase.  This is
essentially VIR_MIGRATE_CHANGE_PROTECTION semantics, but the
driver does not support that flag.  Without CHANGE_PROTECTION
support, the job would never be terminated in error conditions
where migrate confirm phase is not executed.  Further attempts
to modify the domain would result in failure to acquire a job
after LIBXL_JOB_WAIT_TIME.

Similar to the qemu driver, end the job in the begin phase.
Protecting the domain object across all phases of migration can
be done in a future patch adding CHANGE_PROTECTION support.

Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
---
 src/libxl/libxl_driver.c    |  5 +----
 src/libxl/libxl_migration.c | 16 ++++------------
 2 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index b5f8703..b27581e 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -4491,11 +4491,8 @@ libxlDomainMigratePerform3Params(virDomainPtr dom,
         goto cleanup;
 
     if (libxlDomainMigrationPerform(driver, vm, dom_xml, dconnuri,
-                                    uri, dname, flags) < 0) {
-        /* Job terminated and vm unlocked if MigrationPerform failed */
-        vm = NULL;
+                                    uri, dname, flags) < 0)
         goto cleanup;
-    }
 
     ret = 0;
 
diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index 334aa85..ce3f9d5 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -215,6 +215,10 @@ libxlDomainMigrationBegin(virConnectPtr conn,
 
     xml = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE);
 
+ endjob:
+    if (!libxlDomainObjEndJob(driver, vm))
+        vm = NULL;
+
  cleanup:
     if (vm)
         virObjectUnlock(vm);
@@ -222,11 +226,6 @@ libxlDomainMigrationBegin(virConnectPtr conn,
     virDomainDefFree(tmpdef);
     virObjectUnref(cfg);
     return xml;
-
- endjob:
-    if (!libxlDomainObjEndJob(driver, vm))
-        vm = NULL;
-    goto cleanup;
 }
 
 virDomainDefPtr
@@ -468,11 +467,6 @@ libxlDomainMigrationPerform(libxlDriverPrivatePtr driver,
     virObjectLock(vm);
 
  cleanup:
-    /* If failure, terminate the job started in MigrationBegin */
-    if (ret == -1) {
-        if (libxlDomainObjEndJob(driver, vm))
-            virObjectUnlock(vm);
-    }
     VIR_FORCE_CLOSE(sockfd);
     virURIFree(uri);
     return ret;
@@ -578,8 +572,6 @@ libxlDomainMigrationConfirm(libxlDriverPrivatePtr driver,
     ret = 0;
 
  cleanup:
-    if (!libxlDomainObjEndJob(driver, vm))
-        vm = NULL;
     if (event)
         libxlDomainEventQueue(driver, event);
     if (vm)
-- 
1.8.4.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]