[PATCH 3/5] qemu: snapshot: Allow snapshots of read-only disks when we can create them

Peter Krempa posted 5 patches 5 years, 9 months ago
[PATCH 3/5] qemu: snapshot: Allow snapshots of read-only disks when we can create them
Posted by Peter Krempa 5 years, 9 months ago
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>
---
 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 1c7c87128d..29d964f1e8 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14683,7 +14683,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

Re: [PATCH 3/5] qemu: snapshot: Allow snapshots of read-only disks when we can create them
Posted by Ján Tomko 5 years, 9 months ago
On a Monday in 2020, Peter Krempa wrote:
>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>
>---
> src/qemu/qemu_driver.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano