render / rpms / libvirt

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