Blame SOURCES/libvirt-qemu-snapshot-Allow-snapshots-of-read-only-disks-when-we-can-create-them.patch

a41c76
From a229c76e2a5008dbdbcad996ae4f75a3d51b709f Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <a229c76e2a5008dbdbcad996ae4f75a3d51b709f@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Tue, 12 May 2020 17:24:10 +0200
a41c76
Subject: [PATCH] qemu: snapshot: Allow snapshots of read-only disks when we
a41c76
 can create them
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
With -blockdev or when reusing externally created images and thus
a41c76
without the need for formatting the image we actually can support
a41c76
snapshots of read-only disks. Arguably it's not very useful so they are
a41c76
not done by default but users of libvirt such as oVirt are actually
a41c76
using this.
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1832204
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit fe574ea1f52daebddfdc91dd27234059c375e4bf)
a41c76
Message-Id: <2f8f6e53de334a6e3c2d91711fe4dbd81d8b3ee8.1589296861.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
---
a41c76
 src/qemu/qemu_driver.c | 2 +-
a41c76
 1 file changed, 1 insertion(+), 1 deletion(-)
a41c76
a41c76
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
a41c76
index 26215f8d6a..7ae8641577 100644
a41c76
--- a/src/qemu/qemu_driver.c
a41c76
+++ b/src/qemu/qemu_driver.c
a41c76
@@ -14968,7 +14968,7 @@ qemuDomainSnapshotPrepareDiskExternal(virDomainDiskDefPtr disk,
a41c76
     int err;
a41c76
     int rc;
a41c76
 
a41c76
-    if (disk->src->readonly) {
a41c76
+    if (disk->src->readonly && !(reuse || blockdev)) {
a41c76
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
a41c76
                        _("external snapshot for readonly disk %s "
a41c76
                          "is not supported"), disk->dst);
a41c76
-- 
a41c76
2.26.2
a41c76