From c90c97a734d680da9e9d78e8d61fdc6020ff31d5 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 16 May 2023 10:18:55 +0200 Subject: [PATCH] Properly mark auto-added 'terminator' virStorageSource MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- 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 a9ed5f5901..6eea8a9fa5 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -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)) 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;