File bab7ad4c-libxl-mig-job-fix.patch of Package libvirt.11695
commit bab7ad4cebb4bc808ebc77510655d6b71e8e4a17
Author: Jim Fehlig <jfehlig@suse.com>
Date: Tue Jul 8 15:17:58 2014 -0600
libxl: acquire job though begin phase only
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.
Index: libvirt-1.2.5/src/libxl/libxl_driver.c
===================================================================
--- libvirt-1.2.5.orig/src/libxl/libxl_driver.c
+++ libvirt-1.2.5/src/libxl/libxl_driver.c
@@ -4496,11 +4496,8 @@ libxlDomainMigratePerform3Params(virDoma
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;
Index: libvirt-1.2.5/src/libxl/libxl_migration.c
===================================================================
--- libvirt-1.2.5.orig/src/libxl/libxl_migration.c
+++ libvirt-1.2.5/src/libxl/libxl_migration.c
@@ -216,6 +216,10 @@ libxlDomainMigrationBegin(virConnectPtr
xml = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE);
+ endjob:
+ if (!libxlDomainObjEndJob(driver, vm))
+ vm = NULL;
+
cleanup:
if (vm)
virObjectUnlock(vm);
@@ -223,11 +227,6 @@ libxlDomainMigrationBegin(virConnectPtr
virDomainDefFree(tmpdef);
virObjectUnref(cfg);
return xml;
-
- endjob:
- if (!libxlDomainObjEndJob(driver, vm))
- vm = NULL;
- goto cleanup;
}
virDomainDefPtr
@@ -469,11 +468,6 @@ libxlDomainMigrationPerform(libxlDriverP
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;
@@ -580,8 +574,6 @@ libxlDomainMigrationConfirm(libxlDriverP
ret = 0;
cleanup:
- if (!libxlDomainObjEndJob(driver, vm))
- vm = NULL;
if (event)
libxlDomainEventQueue(driver, event);
if (vm)