]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuDomainGetStorageSourceByDevstr: Look also in 'mirror' chain
authorPeter Krempa <pkrempa@redhat.com>
Wed, 15 Jul 2020 10:51:40 +0000 (12:51 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 21 Jul 2020 07:52:46 +0000 (09:52 +0200)
A disk can have a mirror, look also in its backing chain.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
src/qemu/qemu_domain.c

index dc17fa093d614d60d657ce3105c642f09c8c61cc..1a48a9aa5b2defaa26bc885b2773ef61fc7ba29c 100644 (file)
@@ -11669,11 +11669,16 @@ qemuDomainGetStorageSourceByDevstr(const char *devstr,
     }
 
     if (idx == 0)
-        src = disk->src;
-    else
-        src = virStorageFileChainLookup(disk->src, NULL, NULL, idx, NULL);
+        return disk->src;
+
+    if ((src = virStorageFileChainLookup(disk->src, NULL, NULL, idx, NULL)))
+        return src;
 
-    return src;
+    if (disk->mirror &&
+        (src = virStorageFileChainLookup(disk->mirror, NULL, NULL, idx, NULL)))
+        return src;
+
+    return NULL;
 }