mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
qemu: Fix a possible deadlock in p2p migration
Two more calls to remote libvirtd have to be surrounded by
qemuDomainObjEnterRemoteWithDriver() and
qemuDomainObjExitRemoteWithDriver() to prevent possible deadlock between
two communicating libvirt daemons.
See commit f0c8e1cb37
for further details.
This commit is contained in:
parent
4186f92935
commit
584c13f356
@ -11625,24 +11625,38 @@ static int doPeer2PeerMigrate(virDomainPtr dom,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
virConnectPtr dconn = NULL;
|
virConnectPtr dconn = NULL;
|
||||||
char *dom_xml;
|
char *dom_xml;
|
||||||
|
bool p2p;
|
||||||
|
|
||||||
/* the order of operations is important here; we make sure the
|
/* the order of operations is important here; we make sure the
|
||||||
* destination side is completely setup before we touch the source
|
* destination side is completely setup before we touch the source
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
qemuDomainObjEnterRemoteWithDriver(driver, vm);
|
||||||
dconn = virConnectOpen(uri);
|
dconn = virConnectOpen(uri);
|
||||||
|
qemuDomainObjExitRemoteWithDriver(driver, vm);
|
||||||
if (dconn == NULL) {
|
if (dconn == NULL) {
|
||||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
_("Failed to connect to remote libvirt URI %s"), uri);
|
_("Failed to connect to remote libvirt URI %s"), uri);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
|
|
||||||
VIR_DRV_FEATURE_MIGRATION_P2P)) {
|
qemuDomainObjEnterRemoteWithDriver(driver, vm);
|
||||||
|
p2p = VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
|
||||||
|
VIR_DRV_FEATURE_MIGRATION_P2P);
|
||||||
|
qemuDomainObjExitRemoteWithDriver(driver, vm);
|
||||||
|
if (!p2p) {
|
||||||
qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||||
_("Destination libvirt does not support peer-to-peer migration protocol"));
|
_("Destination libvirt does not support peer-to-peer migration protocol"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* domain may have been stopped while we were talking to remote daemon */
|
||||||
|
if (!virDomainObjIsActive(vm)) {
|
||||||
|
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
_("guest unexpectedly quit"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
dom_xml = qemudVMDumpXML(driver, vm,
|
dom_xml = qemudVMDumpXML(driver, vm,
|
||||||
VIR_DOMAIN_XML_SECURE |
|
VIR_DOMAIN_XML_SECURE |
|
||||||
VIR_DOMAIN_XML_UPDATE_CPU);
|
VIR_DOMAIN_XML_UPDATE_CPU);
|
||||||
|
Loading…
Reference in New Issue
Block a user