[PATCH 8/8] qemuDomainGetStorageSourceByDevstr: Lookup also '<dataStore>'

Peter Krempa posted 8 patches 1 month ago
[PATCH 8/8] qemuDomainGetStorageSourceByDevstr: Lookup also '<dataStore>'
Posted by Peter Krempa 1 month ago
The <dataStore> volumes have their own 'id' so we need to be able to
look them up for the given image chain.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_domain.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 4499fed6bc..1fc4e2f33f 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9260,12 +9260,18 @@ qemuDomainGetStorageSourceByDevstr(const char *devstr,
     for (n = disk->src; virStorageSourceIsBacking(n); n = n->backingStore) {
         if (n->id == idx)
             return n;
+
+        if (n->dataFileStore && n->dataFileStore->id == idx)
+            return n->dataFileStore;
     }

     if (disk->mirror) {
         for (n = disk->mirror; virStorageSourceIsBacking(n); n = n->backingStore) {
             if (n->id == idx)
                 return n;
+
+            if (n->dataFileStore && n->dataFileStore->id == idx)
+                return n->dataFileStore;
         }
     }

@@ -9281,6 +9287,9 @@ qemuDomainGetStorageSourceByDevstr(const char *devstr,
             for (n = backupdisk->store; virStorageSourceIsBacking(n); n = n->backingStore) {
                 if (n->id == idx)
                     return n;
+
+                if (n->dataFileStore && n->dataFileStore->id == idx)
+                    return n->dataFileStore;
             }
         }
     }
-- 
2.47.0