From c1605fba8512fc77f3e2e2bdbbca56e14a086893 Mon Sep 17 00:00:00 2001 Message-Id: From: Thomas Huth Date: Fri, 2 Oct 2020 12:32:11 +0200 Subject: [PATCH] qemu: Fix domfsinfo for non-PCI device information from guest agent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qemuAgentFSInfoToPublic() currently only sets the devAlias for PCI devices. However, the QEMU guest agent could also provide the device name in the "dev" field of the response for other devices instead (well, at least after fixing another problem in the current QEMU guest agent...). So if creating the devAlias from the PCI information failed, let's fall back to the name provided by the guest agent. This helps to fix the empty "Target" fields that occur when running "virsh domfsinfo" on s390x where CCW devices are used for the guest instead of PCI devices. Also add a proper debug message here in case we completely failed to set the device alias, since this problem here was very hard to debug: The only two error messages that I've seen were "Unable to get filesystem information" and "Unable to encode message payload" - which only indicates that something went wrong in the RPC call. No debug message indicated the real problem, so I had to learn the hard way why the RPC call failed (it apparently does not like devAlias left to be NULL) and where the real problem comes from. Reviewed-by: Daniel P. Berrangé Signed-off-by: Thomas Huth (cherry picked from commit f8333b3b0a7fdbc1f18ed501c043ac7618b86a16) Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1858771 Message-Id: <20201002103211.250169-2-thuth@redhat.com> Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0f06974a1b..80a4a43e2e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -21996,14 +21996,17 @@ qemuAgentFSInfoToPublic(qemuAgentFSInfoPtr agent, qemuAgentDiskInfoPtr agentdisk = agent->disks[i]; virDomainDiskDefPtr diskDef; - if (!(diskDef = virDomainDiskByAddress(vmdef, - &agentdisk->pci_controller, - agentdisk->bus, - agentdisk->target, - agentdisk->unit))) - continue; - - ret->devAlias[i] = g_strdup(diskDef->dst); + diskDef = virDomainDiskByAddress(vmdef, + &agentdisk->pci_controller, + agentdisk->bus, + agentdisk->target, + agentdisk->unit); + if (diskDef != NULL) + ret->devAlias[i] = g_strdup(diskDef->dst); + else if (agentdisk->devnode != NULL) + ret->devAlias[i] = g_strdup(agentdisk->devnode); + else + VIR_DEBUG("Missing devnode name for '%s'.", ret->mountpoint); } return ret; -- 2.28.0