diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index b5f8703574ca7194f8c73040ca40a1824f01a0b4..b27581eae0f01ff94f4be55f983c965e87df812c 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 334aa85a86cd342c60c4cdc284caf7756fd3d9d9..ce3f9d58032ecd797c55d0f4c3e9332803123aca 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)