render / rpms / libvirt

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