Blame SOURCES/libvirt-qemu-snapshot-Prevent-too-nested-domain-XML-when-doing-inactive-snapshot.patch

a41c76
From 97dafbcc080bdb3253dbd451c94ab8f687b156ba Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <97dafbcc080bdb3253dbd451c94ab8f687b156ba@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Tue, 4 Feb 2020 15:07:48 +0100
a41c76
Subject: [PATCH] qemu: snapshot: Prevent too-nested domain XML when doing
a41c76
 inactive snapshot
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Similarly to 510d154a0b41aa70aadabc0918d16dee22882394 we need to prevent
a41c76
doing too deeply nested backing chains and reject them with a sane error
a41c76
message.
a41c76
a41c76
Add a loop to go through the snapshots prior to attempting actually
a41c76
creating them to prevent some possible inconsistent scenarios.
a41c76
a41c76
We don't need to do it when reusing backing chains as we'll be
a41c76
re-detecting the backing chain in that case anyways.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Eric Blake <eblake@redhat.com>
a41c76
(cherry picked from commit b168fa88b85dec181882816ab65a59a6c4500667)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1524278
a41c76
Message-Id: <3272682df55dcc564055a2badb0c61d4680c81a9.1580824112.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/qemu/qemu_driver.c | 3 +++
a41c76
 1 file changed, 3 insertions(+)
a41c76
a41c76
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
a41c76
index 5c72db2544..833cf9f3d9 100644
a41c76
--- a/src/qemu/qemu_driver.c
a41c76
+++ b/src/qemu/qemu_driver.c
a41c76
@@ -14632,6 +14632,9 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDriverPtr driver,
a41c76
         if (!snapdisk->src->format)
a41c76
             snapdisk->src->format = VIR_STORAGE_FILE_QCOW2;
a41c76
 
a41c76
+        if (qemuDomainStorageSourceValidateDepth(defdisk->src, 1, defdisk->dst) < 0)
a41c76
+            return -1;
a41c76
+
a41c76
         /* creates cmd line args: qemu-img create -f qcow2 -o */
a41c76
         if (!(cmd = virCommandNewArgList(qemuImgPath,
a41c76
                                          "create",
a41c76
-- 
a41c76
2.25.0
a41c76