[PATCH 2/2] Properly mark auto-added 'terminator' virStorageSource

Peter Krempa pkrempa at redhat.com
Fri Jun 30 12:28:47 UTC 2023


All backing chain members which were auto-added by image detection,
including the terminating element, should have the 'detected' property
set to true. This is needed to properly strip the detected elements in
some cases, e.g. for the status XML where we could treat some images as
manually terminated even when it was auto-detected.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_domain.c            | 4 +++-
 src/storage_file/storage_source.c | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 94587638c3..25d1a0cb1b 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -7841,8 +7841,10 @@ qemuDomainDetermineDiskChain(virQEMUDriver *driver,
         disksrc->format < VIR_STORAGE_FILE_BACKING) {

         /* terminate the chain for such images as the code below would do */
-        if (!disksrc->backingStore)
+        if (!disksrc->backingStore) {
             disksrc->backingStore = virStorageSourceNew();
+            disksrc->backingStore->detected = true;
+        }

         /* we assume that FD-passed disks always exist */
         if (virStorageSourceIsFD(disksrc))
diff --git a/src/storage_file/storage_source.c b/src/storage_file/storage_source.c
index 47fc1edbd2..3c50239e29 100644
--- a/src/storage_file/storage_source.c
+++ b/src/storage_file/storage_source.c
@@ -1420,6 +1420,7 @@ virStorageSourceGetMetadataRecurse(virStorageSource *src,
     } else {
         /* add terminator */
         src->backingStore = virStorageSourceNew();
+        src->backingStore->detected = true;
     }

     return 0;
-- 
2.41.0



More information about the libvir-list mailing list