]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
backup: qemu: Detect node names at domain startup
authorEric Blake <eblake@redhat.com>
Wed, 24 Jul 2019 03:04:25 +0000 (22:04 -0500)
committerEric Blake <eblake@redhat.com>
Fri, 26 Jul 2019 21:48:58 +0000 (16:48 -0500)
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: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/qemu/qemu_process.c

index 75205bc121c8007982d136fbd49f6268ebb5167a..53b8ff36f60615a77ca447eafb464c11499a7460 100644 (file)
@@ -7060,6 +7060,8 @@ qemuProcessRefreshState(virQEMUDriverPtr driver,
                         virDomainObjPtr vm,
                         qemuDomainAsyncJob asyncJob)
 {
+    qemuDomainObjPrivatePtr priv = vm->privateData;
+
     VIR_DEBUG("Fetching list of active devices");
     if (qemuDomainUpdateDeviceList(driver, vm, asyncJob) < 0)
         return -1;
@@ -7075,6 +7077,9 @@ qemuProcessRefreshState(virQEMUDriverPtr driver,
     VIR_DEBUG("Updating disk data");
     if (qemuProcessRefreshDisks(driver, vm, asyncJob) < 0)
         return -1;
+    if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) &&
+        qemuBlockNodeNamesDetect(driver, vm, asyncJob) < 0)
+        return -1;
 
     return 0;
 }