Blame SOURCES/libvirt-qemu-Fix-domfsinfo-for-non-PCI-device-information-from-guest-agent.patch

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