提交 c82abfde 编写于 作者: E Eric Blake

backup: qemu: Detect node names at domain startup

If we are using -blockdev, then node names are always available
(because we set them).  But when not using it, we have to scrape node
names from QMP, and want to do so as infrequently as possible.  We
were scraping node names after reconnecting a new libvirtd to an
existing guest (see qemuProcessReconnect), and after any block job
that may have changed the set of node names we care about (legacy
block jobs), but forgot to scrape the names when first starting a
guest.  Do so now in order to allow the checkpoint code to always have
access to a node name without having to repeat a node name scrape
itself.

Future patches may need to clean up qemuDomainSetBlockThreshold (if
node names are always available, then it doesn't need to repeat a
scrape) and/or hotplug and media changes (if the addition of new nodes
can result in a null node name, then scraping at that point in time
would be appropriate).  But for now, this patch addresses only the
most common instance of a missing node name.
Signed-off-by: NEric Blake <eblake@redhat.com>
Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 c0533b65
...@@ -7060,6 +7060,8 @@ qemuProcessRefreshState(virQEMUDriverPtr driver, ...@@ -7060,6 +7060,8 @@ qemuProcessRefreshState(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob) qemuDomainAsyncJob asyncJob)
{ {
qemuDomainObjPrivatePtr priv = vm->privateData;
VIR_DEBUG("Fetching list of active devices"); VIR_DEBUG("Fetching list of active devices");
if (qemuDomainUpdateDeviceList(driver, vm, asyncJob) < 0) if (qemuDomainUpdateDeviceList(driver, vm, asyncJob) < 0)
return -1; return -1;
...@@ -7075,6 +7077,9 @@ qemuProcessRefreshState(virQEMUDriverPtr driver, ...@@ -7075,6 +7077,9 @@ qemuProcessRefreshState(virQEMUDriverPtr driver,
VIR_DEBUG("Updating disk data"); VIR_DEBUG("Updating disk data");
if (qemuProcessRefreshDisks(driver, vm, asyncJob) < 0) if (qemuProcessRefreshDisks(driver, vm, asyncJob) < 0)
return -1; return -1;
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) &&
qemuBlockNodeNamesDetect(driver, vm, asyncJob) < 0)
return -1;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册