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

qemu: Pass correct qemuCaps to virDomainDefPostParse

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 virDomainDefPostParse.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 bbcfa07b
......@@ -8326,6 +8326,7 @@ static int
qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
virDomainDeviceDefPtr dev,
virCapsPtr caps,
virQEMUCapsPtr qemuCaps,
unsigned int parse_flags,
virDomainXMLOptionPtr xmlopt)
{
......@@ -8517,7 +8518,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
return -1;
}
if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt, NULL) < 0)
if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt, qemuCaps) < 0)
return -1;
return 0;
......@@ -8528,6 +8529,7 @@ static int
qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
virDomainDeviceDefPtr dev,
virCapsPtr caps,
virQEMUCapsPtr qemuCaps,
unsigned int parse_flags,
virDomainXMLOptionPtr xmlopt)
{
......@@ -8709,7 +8711,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
return -1;
}
if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt, NULL) < 0)
if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt, qemuCaps) < 0)
return -1;
return 0;
......@@ -8719,6 +8721,7 @@ static int
qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef,
virDomainDeviceDefPtr dev,
virCapsPtr caps,
virQEMUCapsPtr qemuCaps,
unsigned int parse_flags,
virDomainXMLOptionPtr xmlopt)
{
......@@ -8814,7 +8817,7 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef,
return -1;
}
if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt, NULL) < 0)
if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt, qemuCaps) < 0)
return -1;
return 0;
......@@ -8866,7 +8869,7 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr vm,
false) < 0)
goto cleanup;
if (qemuDomainAttachDeviceConfig(vmdef, devConf, caps,
if (qemuDomainAttachDeviceConfig(vmdef, devConf, caps, priv->qemuCaps,
parse_flags,
driver->xmlopt) < 0)
goto cleanup;
......@@ -9031,7 +9034,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
/* virDomainDefCompatibleDevice call is delayed until we know the
* device we're going to update. */
if ((ret = qemuDomainUpdateDeviceConfig(vmdef, dev, caps,
if ((ret = qemuDomainUpdateDeviceConfig(vmdef, dev, caps, priv->qemuCaps,
parse_flags,
driver->xmlopt)) < 0)
goto endjob;
......@@ -9126,7 +9129,7 @@ qemuDomainDetachDeviceLiveAndConfig(virQEMUDriverPtr driver,
if (!vmdef)
goto cleanup;
if (qemuDomainDetachDeviceConfig(vmdef, dev, caps,
if (qemuDomainDetachDeviceConfig(vmdef, dev, caps, priv->qemuCaps,
parse_flags,
driver->xmlopt) < 0)
goto cleanup;
......@@ -9212,7 +9215,7 @@ qemuDomainDetachDeviceAliasLiveAndConfig(virQEMUDriverPtr driver,
if (virDomainDefFindDevice(vmdef, alias, &dev, true) < 0)
goto cleanup;
if (qemuDomainDetachDeviceConfig(vmdef, &dev, caps,
if (qemuDomainDetachDeviceConfig(vmdef, &dev, caps, priv->qemuCaps,
parse_flags, driver->xmlopt) < 0)
goto cleanup;
}
......
......@@ -5615,7 +5615,7 @@ qemuProcessInit(virQEMUDriverPtr driver,
if (vm->def->postParseFailed) {
VIR_DEBUG("re-running the post parse callback");
if (virDomainDefPostParse(vm->def, caps, 0, driver->xmlopt, NULL) < 0)
if (virDomainDefPostParse(vm->def, caps, 0, driver->xmlopt, priv->qemuCaps) < 0)
goto cleanup;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册