]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: snapshot: Prevent too-nested domain XML when doing inactive snapshot
authorPeter Krempa <pkrempa@redhat.com>
Mon, 20 Jan 2020 15:04:56 +0000 (16:04 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 27 Jan 2020 13:02:01 +0000 (14:02 +0100)
Similarly to 510d154a0b41aa70aadabc0918d16dee22882394 we need to prevent
doing too deeply nested backing chains and reject them with a sane error
message.

Add a loop to go through the snapshots prior to attempting actually
creating them to prevent some possible inconsistent scenarios.

We don't need to do it when reusing backing chains as we'll be
re-detecting the backing chain in that case anyways.

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

index a833951e47d284ccd068747679564812bb103af8..fc080b4a484fc8de608c5bd99348ad85a8b10721 100644 (file)
@@ -14653,6 +14653,9 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDriverPtr driver,
         if (!snapdisk->src->format)
             snapdisk->src->format = VIR_STORAGE_FILE_QCOW2;
 
+        if (qemuDomainStorageSourceValidateDepth(defdisk->src, 1, defdisk->dst) < 0)
+            return -1;
+
         /* creates cmd line args: qemu-img create -f qcow2 -o */
         if (!(cmd = virCommandNewArgList(qemuImgPath,
                                          "create",