]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: blockjob: Ensure that config disk source is identical when modifying it
authorPeter Krempa <pkrempa@redhat.com>
Wed, 24 Jul 2019 15:33:38 +0000 (17:33 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 25 Jul 2019 11:21:33 +0000 (13:21 +0200)
qemuBlockJobRewriteConfigDiskSource rewrites the disk source only
according to the 'target'. This means that if someone would change the
inactive config of the VM to refer to a different disk a block job would
rewrite it when finishing a job which modifies the disk source.

Make sure that this does not happen by verifying that the source of the
config disk is the same.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
ACKed-by: Eric Blake <eblake@redhat.com>
src/qemu/qemu_blockjob.c

index 487ef24d5c380ba633750a09762d1b0c906b537c..1e19347b03a88f2a397b9acd3883f0529cab572c 100644 (file)
@@ -479,6 +479,9 @@ qemuBlockJobRewriteConfigDiskSource(virDomainObjPtr vm,
     if (!(persistDisk = virDomainDiskByName(vm->newDef, disk->dst, false)))
         return;
 
+    if (!virStorageSourceIsSameLocation(disk->src, persistDisk->src))
+        return;
+
     if (!(copy = virStorageSourceCopy(newsrc, false)) ||
         virStorageSourceInitChainElement(copy, persistDisk->src, true) < 0) {
         VIR_WARN("Unable to update persistent definition on vm %s after block job",