summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlberto Garcia2015-11-03 11:32:35 +0100
committerKevin Wolf2015-11-11 16:25:48 +0100
commit08b24cfe3765f4b739700778814048e7d9a045fe (patch)
treeece881c5e0c550972730db1419cbc0c846335d6b
parentthrottle: Use bs->throttle_state instead of bs->io_limits_enabled (diff)
downloadqemu-08b24cfe3765f4b739700778814048e7d9a045fe.tar.gz
qemu-08b24cfe3765f4b739700778814048e7d9a045fe.tar.xz
qemu-08b24cfe3765f4b739700778814048e7d9a045fe.zip
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 <berto@igalia.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--blockdev.c5
1 files changed, 5 insertions, 0 deletions
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");
}
}