render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From a229c76e2a5008dbdbcad996ae4f75a3d51b709f Mon Sep 17 00:00:00 2001
Message-Id: <a229c76e2a5008dbdbcad996ae4f75a3d51b709f@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 12 May 2020 17:24:10 +0200
Subject: [PATCH] qemu: snapshot: Allow snapshots of read-only disks when we
 can create them
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

With -blockdev or when reusing externally created images and thus
without the need for formatting the image we actually can support
snapshots of read-only disks. Arguably it's not very useful so they are
not done by default but users of libvirt such as oVirt are actually
using this.

https://bugzilla.redhat.com/show_bug.cgi?id=1832204

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit fe574ea1f52daebddfdc91dd27234059c375e4bf)
Message-Id: <2f8f6e53de334a6e3c2d91711fe4dbd81d8b3ee8.1589296861.git.pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 26215f8d6a..7ae8641577 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14968,7 +14968,7 @@ qemuDomainSnapshotPrepareDiskExternal(virDomainDiskDefPtr disk,
     int err;
     int rc;
 
-    if (disk->src->readonly) {
+    if (disk->src->readonly && !(reuse || blockdev)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("external snapshot for readonly disk %s "
                          "is not supported"), disk->dst);
-- 
2.26.2