[libvirt] [PATCH] qemu: snapshot: better error for active external readonly disk

Nikolay Shirokovskiy posted 1 patch 5 years, 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1540809336-908029-1-git-send-email-nshirokovskiy@virtuozzo.com
src/qemu/qemu_driver.c | 8 ++++++++
1 file changed, 8 insertions(+)
[libvirt] [PATCH] qemu: snapshot: better error for active external readonly disk
Posted by Nikolay Shirokovskiy 5 years, 5 months ago
External snapshot of readonly disk of active domain is impossible but error
message [1] is cryptic (it's source is qemu). Let's make error message more
user friendly.

The problem is libvirtd precreates snapshot image with no write permission which
is not expected by qemu.

[1] current error message
error: internal error: unable to execute QEMU command 'transaction':
                    Could not create file: Permission denied

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
---

By the way if domain is not active then snapshot is possible. However top image
will have write permissions after snapshot. We can make snapshot work for
active domain I guess if we precreate writable snapshot image, but then we end
up running readonly disk on writable image. Also making snapshot of readonly
disk is not that practical so let's just fix error message for now.

 src/qemu/qemu_driver.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a52e249..e75931e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14683,6 +14683,14 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm,
                                                       active, reuse) < 0)
                 goto cleanup;
 
+            if (dom_disk->src->readonly && active) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("external snapshot for readonly disk %s "
+                                 "of active domain is not supported"),
+                               disk->name);
+                goto cleanup;
+            }
+
             external++;
             break;
 
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list