From: Alberto Garcia Date: Tue, 3 Nov 2015 10:32:35 +0000 (+0200) Subject: block: Disallow snapshots if the overlay doesn't support backing files X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=08b24cfe376;p=qemu.git block: Disallow snapshots if the overlay doesn't support backing files This addresses scenarios like this one: { 'execute': 'blockdev-add', 'arguments': { 'options': { 'driver': 'qcow2', 'node-name': 'new0', 'file': { 'driver': 'file', 'filename': 'new.qcow2', 'node-name': 'file0' } } } } { 'execute': 'blockdev-snapshot', 'arguments': { 'node': 'virtio0', 'overlay': 'file0' } } Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- diff --git a/blockdev.c b/blockdev.c index 3598b01419..3197791c7b 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1678,6 +1678,11 @@ static void external_snapshot_prepare(BlkTransactionState *common, if (state->new_bs->backing != NULL) { error_setg(errp, "The snapshot already has a backing image"); + return; + } + + if (!state->new_bs->drv->supports_backing) { + error_setg(errp, "The snapshot does not support backing images"); } }