mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: blockjob: Copy non-detected chain fully in qemuBlockJobRewriteConfigDiskSource
Rather than copying just the top level image, let's copy the full user provided backing chain. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
4807051b02
commit
7b8db52f5b
@ -521,6 +521,7 @@ qemuBlockJobRewriteConfigDiskSource(virDomainObjPtr vm,
|
||||
{
|
||||
virDomainDiskDefPtr persistDisk = NULL;
|
||||
VIR_AUTOUNREF(virStorageSourcePtr) copy = NULL;
|
||||
virStorageSourcePtr n;
|
||||
|
||||
if (!vm->newDef)
|
||||
return;
|
||||
@ -531,14 +532,24 @@ qemuBlockJobRewriteConfigDiskSource(virDomainObjPtr vm,
|
||||
if (!virStorageSourceIsSameLocation(disk->src, persistDisk->src))
|
||||
return;
|
||||
|
||||
if (!(copy = virStorageSourceCopy(newsrc, false)) ||
|
||||
if (!(copy = virStorageSourceCopy(newsrc, true)) ||
|
||||
virStorageSourceInitChainElement(copy, persistDisk->src, true) < 0) {
|
||||
VIR_WARN("Unable to update persistent definition on vm %s after block job",
|
||||
vm->def->name);
|
||||
return;
|
||||
}
|
||||
|
||||
qemuBlockJobCleanStorageSourceRuntime(copy);
|
||||
for (n = copy; virStorageSourceIsBacking(n); n = n->backingStore) {
|
||||
qemuBlockJobCleanStorageSourceRuntime(n);
|
||||
|
||||
/* discard any detected backing store */
|
||||
if (virStorageSourceIsBacking(n->backingStore) &&
|
||||
n->backingStore->detected) {
|
||||
virObjectUnref(n->backingStore);
|
||||
n->backingStore = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
virObjectUnref(persistDisk->src);
|
||||
VIR_STEAL_PTR(persistDisk->src, copy);
|
||||
|
Loading…
x
Reference in New Issue
Block a user