[libvirt] [PATCH] qemu: snapshot: better error for active external readonly disk
Peter Krempa
pkrempa at redhat.com
Wed Nov 7 14:55:20 UTC 2018
On Mon, Oct 29, 2018 at 13:35:36 +0300, Nikolay Shirokovskiy wrote:
> 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 at 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.
We should not allow doing this at all then. Not even when inactive.
> 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;
> + }
Please put this into qemuDomainSnapshotPrepareDiskExternal.
qemuDomainSnapshotPrepare is already too long and we don't need to make
it even longer.
Also as noted I don't think we should allow this even when inactive.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20181107/c80c7f8a/attachment-0001.sig>
More information about the libvir-list
mailing list