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(a)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