From c82abfdea95368650eaec7ac59ca4c8b7197a506 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 23 Jul 2019 22:04:25 -0500 Subject: [PATCH] backup: qemu: Detect node names at domain startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Daniel P. Berrangé --- src/qemu/qemu_process.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 75205bc121..53b8ff36f6 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -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; } -- GitLab