]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Properly mark auto-added 'terminator' virStorageSource
authorPeter Krempa <pkrempa@redhat.com>
Tue, 16 May 2023 08:18:55 +0000 (10:18 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 20 Jul 2023 12:58:35 +0000 (14:58 +0200)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_domain.c
src/storage_file/storage_source.c

index a9ed5f5901e6dce8e2c626587db6f522d1567910..6eea8a9fa5aeec56010967a2d2310f828fbe0ccf 100644 (file)
@@ -7890,8 +7890,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))
index 47fc1edbd246c463c29a57dc06d37a93229e310e..3c50239e29824ecd590b07097f92c54de286f0b9 100644 (file)
@@ -1420,6 +1420,7 @@ virStorageSourceGetMetadataRecurse(virStorageSource *src,
     } else {
         /* add terminator */
         src->backingStore = virStorageSourceNew();
+        src->backingStore->detected = true;
     }
 
     return 0;