render / rpms / libvirt

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