]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuProcessHandleIOError: Prefer lookup by node name
authorPeter Krempa <pkrempa@redhat.com>
Fri, 24 Jan 2025 16:17:51 +0000 (17:17 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 4 Feb 2025 13:40:54 +0000 (14:40 +0100)
When qemu reports a node name for an I/O error we should prefer the
lookup by node name instead as it gives us the path to the specific
image which caused the error instead of the top level image path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/qemu/qemu_process.c

index 80a73643f06b2dea9f6d749c77541ea4ee5bd074..1849f686342d2a67032e8f8a26bb9cdf883a61ba 100644 (file)
@@ -837,22 +837,26 @@ qemuProcessHandleIOError(qemuMonitor *mon G_GNUC_UNUSED,
     const char *eventPath = "";
     const char *eventAlias = "";
     const char *eventReason = "";
-    virDomainDiskDef *disk;
+    virDomainDiskDef *disk = NULL;
+    virStorageSource *src = NULL;
 
     virObjectLock(vm);
     priv = QEMU_DOMAIN_PRIVATE(vm);
 
-    if (device)
+    if (nodename)
+        disk = qemuDomainDiskLookupByNodename(vm->def, priv->backup, nodename, &src);
+
+    if (!disk)
         disk = qemuProcessFindDomainDiskByAliasOrQOM(vm, device, NULL);
-    else if (nodename)
-        disk = qemuDomainDiskLookupByNodename(vm->def, NULL, nodename, NULL);
-    else
-        disk = NULL;
 
-    if (disk) {
-        eventPath = virDomainDiskGetSource(disk);
+    if (!src && disk)
+        src = disk->src;
+
+    if (disk)
         eventAlias = disk->info.alias;
-    }
+
+    if (src && src->path)
+        eventPath = src->path;
 
     if (nospace)
         eventReason = "enospc";