提交 b900f738 编写于 作者: J Jiri Denemark

qemu: Pass qemuCaps to qemuMigrationAnyPrepareDef

Since qemuDomainDefPostParse callback requires qemuCaps, we need to make
sure it gets the capabilities stored in the domain's private data if the
domain is running. Passing NULL may cause QEMU capabilities probing to
be triggered in case QEMU binary changed in the meantime. When this
happens while a running domain object is locked, QMP event delivered to
the domain before QEMU capabilities probing finishes will deadlock the
event loop.

This patch fixes all paths leading to qemuMigrationAnyPrepareDef.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 fd60aefe
......@@ -12651,7 +12651,7 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
goto cleanup;
}
if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
if (!(def = qemuMigrationAnyPrepareDef(driver, NULL, dom_xml, dname, &origname)))
goto cleanup;
if (virDomainMigratePrepareTunnelEnsureACL(dconn, def) < 0)
......@@ -12712,7 +12712,7 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
goto cleanup;
}
if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
if (!(def = qemuMigrationAnyPrepareDef(driver, NULL, dom_xml, dname, &origname)))
goto cleanup;
if (virDomainMigratePrepare2EnsureACL(dconn, def) < 0)
......@@ -12951,7 +12951,7 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
QEMU_MIGRATION_DESTINATION)))
goto cleanup;
if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
if (!(def = qemuMigrationAnyPrepareDef(driver, NULL, dom_xml, dname, &origname)))
goto cleanup;
if (virDomainMigratePrepare3EnsureACL(dconn, def) < 0)
......@@ -13038,7 +13038,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
goto cleanup;
}
if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
if (!(def = qemuMigrationAnyPrepareDef(driver, NULL, dom_xml, dname, &origname)))
goto cleanup;
if (virDomainMigratePrepare3ParamsEnsureACL(dconn, def) < 0)
......@@ -13092,7 +13092,7 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
QEMU_MIGRATION_DESTINATION)))
goto cleanup;
if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
if (!(def = qemuMigrationAnyPrepareDef(driver, NULL, dom_xml, dname, &origname)))
goto cleanup;
if (virDomainMigratePrepareTunnel3EnsureACL(dconn, def) < 0)
......@@ -13151,7 +13151,7 @@ qemuDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
QEMU_MIGRATION_DESTINATION)))
goto cleanup;
if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
if (!(def = qemuMigrationAnyPrepareDef(driver, NULL, dom_xml, dname, &origname)))
goto cleanup;
if (virDomainMigratePrepareTunnel3ParamsEnsureACL(dconn, def) < 0)
......
......@@ -2861,6 +2861,7 @@ qemuMigrationDstPrepareDirect(virQEMUDriverPtr driver,
virDomainDefPtr
qemuMigrationAnyPrepareDef(virQEMUDriverPtr driver,
virQEMUCapsPtr qemuCaps,
const char *dom_xml,
const char *dname,
char **origname)
......@@ -2878,7 +2879,8 @@ qemuMigrationAnyPrepareDef(virQEMUDriverPtr driver,
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
return NULL;
if (!(def = virDomainDefParseString(dom_xml, caps, driver->xmlopt, NULL,
if (!(def = virDomainDefParseString(dom_xml, caps, driver->xmlopt,
qemuCaps,
VIR_DOMAIN_DEF_PARSE_INACTIVE |
VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)))
goto cleanup;
......@@ -3422,7 +3424,9 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
if (flags & VIR_MIGRATE_PERSIST_DEST) {
if (persist_xml) {
if (!(persistDef = qemuMigrationAnyPrepareDef(driver, persist_xml,
if (!(persistDef = qemuMigrationAnyPrepareDef(driver,
priv->qemuCaps,
persist_xml,
NULL, NULL)))
goto error;
} else {
......
......@@ -115,6 +115,7 @@ qemuMigrationSrcBegin(virConnectPtr conn,
virDomainDefPtr
qemuMigrationAnyPrepareDef(virQEMUDriverPtr driver,
virQEMUCapsPtr qemuCaps,
const char *dom_xml,
const char *dname,
char **origname);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册