render / rpms / libvirt

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