[libvirt] [PATCH 07/10] qemu: disable internal snapshot of readonly disk

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Thu Dec 27 10:20:49 UTC 2018

Now in case of active domain such a snapshot will complete
successfully but disk will not have a correspondent internal snapshot
as qemu will not make one. In case of inactive domain operation
will finish successfully too but disk snapshot will be done.

Let's disable such a snapshot because as described above in case
of active domain it is not possible now and in both cases it does
not make much sense. We recently disable external snapshot of
readonly disk too in [1].

[1] 067aad26b - qemu: disable external snapshot of readonly disk

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>
 src/qemu/qemu_driver.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c6fba1a..506d8ab 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14811,6 +14811,13 @@ qemuDomainSnapshotPrepareDiskInternal(virDomainDiskDefPtr disk,
     int actualType;
+    if (disk->src->readonly) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("internal snapshot for readonly disk %s "
+                         "is not supported"), disk->dst);
+        return -1;
+    }
     /* active disks are handled by qemu itself so no need to worry about those */
     if (active)
         return 0;

More information about the libvir-list mailing list