Properly mark auto-added 'terminator' virStorageSource

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>
This commit is contained in:
Peter Krempa 2023-05-16 10:18:55 +02:00
parent 49aca0a845
commit c90c97a734
2 changed files with 4 additions and 1 deletions

View 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))

View File

@ -1420,6 +1420,7 @@ virStorageSourceGetMetadataRecurse(virStorageSource *src,
} else {
/* add terminator */
src->backingStore = virStorageSourceNew();
src->backingStore->detected = true;
}
return 0;