From: Peter Krempa Date: Wed, 6 May 2020 15:41:12 +0000 (+0200) Subject: qemu: snapshot: Allow snapshots of read-only disks when we can create them X-Git-Tag: v6.4.0-rc1~106 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe574ea1f52daebddfdc91dd27234059c375e4bf;p=thirdparty%2Flibvirt.git qemu: snapshot: Allow snapshots of read-only disks when we can create them 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 Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 63b4a49c3c..a98a2986f5 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14687,7 +14687,7 @@ qemuDomainSnapshotPrepareDiskExternal(virDomainObjPtr vm, 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);