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

qemu: Pass qemuCaps to qemuDomainSaveImageOpen

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 qemuDomainSaveImageOpen.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 900c5952
...@@ -6805,6 +6805,7 @@ qemuDomainSaveImageUpdateDef(virQEMUDriverPtr driver, ...@@ -6805,6 +6805,7 @@ qemuDomainSaveImageUpdateDef(virQEMUDriverPtr driver,
/** /**
* qemuDomainSaveImageOpen: * qemuDomainSaveImageOpen:
* @driver: qemu driver data * @driver: qemu driver data
* @qemuCaps: pointer to qemuCaps if the domain is running or NULL
* @path: path of the save image * @path: path of the save image
* @ret_def: returns domain definition created from the XML stored in the image * @ret_def: returns domain definition created from the XML stored in the image
* @ret_data: returns structure filled with data from the image header * @ret_data: returns structure filled with data from the image header
...@@ -6819,6 +6820,7 @@ qemuDomainSaveImageUpdateDef(virQEMUDriverPtr driver, ...@@ -6819,6 +6820,7 @@ qemuDomainSaveImageUpdateDef(virQEMUDriverPtr driver,
*/ */
static int ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4) static int ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
qemuDomainSaveImageOpen(virQEMUDriverPtr driver, qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
virQEMUCapsPtr qemuCaps,
const char *path, const char *path,
virDomainDefPtr *ret_def, virDomainDefPtr *ret_def,
virQEMUSaveDataPtr *ret_data, virQEMUSaveDataPtr *ret_data,
...@@ -6943,7 +6945,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, ...@@ -6943,7 +6945,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
} }
/* Create a domain from this XML */ /* Create a domain from this XML */
if (!(def = virDomainDefParseString(data->xml, caps, driver->xmlopt, NULL, if (!(def = virDomainDefParseString(data->xml, caps, driver->xmlopt, qemuCaps,
VIR_DOMAIN_DEF_PARSE_INACTIVE | VIR_DOMAIN_DEF_PARSE_INACTIVE |
VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE))) VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)))
goto error; goto error;
...@@ -7126,7 +7128,7 @@ qemuDomainRestoreFlags(virConnectPtr conn, ...@@ -7126,7 +7128,7 @@ qemuDomainRestoreFlags(virConnectPtr conn,
virNWFilterReadLockFilterUpdates(); virNWFilterReadLockFilterUpdates();
fd = qemuDomainSaveImageOpen(driver, path, &def, &data, fd = qemuDomainSaveImageOpen(driver, NULL, path, &def, &data,
(flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) != 0, (flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) != 0,
&wrapperFd, false, false); &wrapperFd, false, false);
if (fd < 0) if (fd < 0)
...@@ -7223,7 +7225,7 @@ qemuDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *path, ...@@ -7223,7 +7225,7 @@ qemuDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *path,
virCheckFlags(VIR_DOMAIN_SAVE_IMAGE_XML_SECURE, NULL); virCheckFlags(VIR_DOMAIN_SAVE_IMAGE_XML_SECURE, NULL);
fd = qemuDomainSaveImageOpen(driver, path, &def, &data, fd = qemuDomainSaveImageOpen(driver, NULL, path, &def, &data,
false, NULL, false, false); false, NULL, false, false);
if (fd < 0) if (fd < 0)
...@@ -7261,7 +7263,7 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path, ...@@ -7261,7 +7263,7 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path,
else if (flags & VIR_DOMAIN_SAVE_PAUSED) else if (flags & VIR_DOMAIN_SAVE_PAUSED)
state = 0; state = 0;
fd = qemuDomainSaveImageOpen(driver, path, &def, &data, fd = qemuDomainSaveImageOpen(driver, NULL, path, &def, &data,
false, NULL, true, false); false, NULL, true, false);
if (fd < 0) if (fd < 0)
...@@ -7345,7 +7347,7 @@ qemuDomainManagedSaveGetXMLDesc(virDomainPtr dom, unsigned int flags) ...@@ -7345,7 +7347,7 @@ qemuDomainManagedSaveGetXMLDesc(virDomainPtr dom, unsigned int flags)
goto cleanup; goto cleanup;
} }
if ((fd = qemuDomainSaveImageOpen(driver, path, &def, &data, if ((fd = qemuDomainSaveImageOpen(driver, priv->qemuCaps, path, &def, &data,
false, NULL, false, false)) < 0) false, NULL, false, false)) < 0)
goto cleanup; goto cleanup;
...@@ -7412,7 +7414,7 @@ qemuDomainObjRestore(virConnectPtr conn, ...@@ -7412,7 +7414,7 @@ qemuDomainObjRestore(virConnectPtr conn,
virQEMUSaveDataPtr data = NULL; virQEMUSaveDataPtr data = NULL;
virFileWrapperFdPtr wrapperFd = NULL; virFileWrapperFdPtr wrapperFd = NULL;
fd = qemuDomainSaveImageOpen(driver, path, &def, &data, fd = qemuDomainSaveImageOpen(driver, NULL, path, &def, &data,
bypass_cache, &wrapperFd, false, true); bypass_cache, &wrapperFd, false, true);
if (fd < 0) { if (fd < 0) {
if (fd == -3) if (fd == -3)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册