提交 bab7ad4c 编写于 作者: J Jim Fehlig

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.
上级 c4f66bb8
...@@ -4491,11 +4491,8 @@ libxlDomainMigratePerform3Params(virDomainPtr dom, ...@@ -4491,11 +4491,8 @@ libxlDomainMigratePerform3Params(virDomainPtr dom,
goto cleanup; goto cleanup;
if (libxlDomainMigrationPerform(driver, vm, dom_xml, dconnuri, if (libxlDomainMigrationPerform(driver, vm, dom_xml, dconnuri,
uri, dname, flags) < 0) { uri, dname, flags) < 0)
/* Job terminated and vm unlocked if MigrationPerform failed */
vm = NULL;
goto cleanup; goto cleanup;
}
ret = 0; ret = 0;
......
...@@ -215,6 +215,10 @@ libxlDomainMigrationBegin(virConnectPtr conn, ...@@ -215,6 +215,10 @@ libxlDomainMigrationBegin(virConnectPtr conn,
xml = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE); xml = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE);
endjob:
if (!libxlDomainObjEndJob(driver, vm))
vm = NULL;
cleanup: cleanup:
if (vm) if (vm)
virObjectUnlock(vm); virObjectUnlock(vm);
...@@ -222,11 +226,6 @@ libxlDomainMigrationBegin(virConnectPtr conn, ...@@ -222,11 +226,6 @@ libxlDomainMigrationBegin(virConnectPtr conn,
virDomainDefFree(tmpdef); virDomainDefFree(tmpdef);
virObjectUnref(cfg); virObjectUnref(cfg);
return xml; return xml;
endjob:
if (!libxlDomainObjEndJob(driver, vm))
vm = NULL;
goto cleanup;
} }
virDomainDefPtr virDomainDefPtr
...@@ -468,11 +467,6 @@ libxlDomainMigrationPerform(libxlDriverPrivatePtr driver, ...@@ -468,11 +467,6 @@ libxlDomainMigrationPerform(libxlDriverPrivatePtr driver,
virObjectLock(vm); virObjectLock(vm);
cleanup: cleanup:
/* If failure, terminate the job started in MigrationBegin */
if (ret == -1) {
if (libxlDomainObjEndJob(driver, vm))
virObjectUnlock(vm);
}
VIR_FORCE_CLOSE(sockfd); VIR_FORCE_CLOSE(sockfd);
virURIFree(uri); virURIFree(uri);
return ret; return ret;
...@@ -578,8 +572,6 @@ libxlDomainMigrationConfirm(libxlDriverPrivatePtr driver, ...@@ -578,8 +572,6 @@ libxlDomainMigrationConfirm(libxlDriverPrivatePtr driver,
ret = 0; ret = 0;
cleanup: cleanup:
if (!libxlDomainObjEndJob(driver, vm))
vm = NULL;
if (event) if (event)
libxlDomainEventQueue(driver, event); libxlDomainEventQueue(driver, event);
if (vm) if (vm)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册