render / rpms / libvirt

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