summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Reitz2019-06-12 18:34:46 +0200
committerKevin Wolf2020-09-07 12:31:31 +0200
commit7cc734a9ea1c57afe3b3fdeaba33b6a7da73bca2 (patch)
tree1f3b74b70b7cad9842435a2c70258b9e59f3ed69
parentblock/null: Implement bdrv_get_allocated_file_size (diff)
downloadqemu-7cc734a9ea1c57afe3b3fdeaba33b6a7da73bca2.tar.gz
qemu-7cc734a9ea1c57afe3b3fdeaba33b6a7da73bca2.tar.xz
qemu-7cc734a9ea1c57afe3b3fdeaba33b6a7da73bca2.zip
blockdev: Use CAF in external_snapshot_prepare()
This allows us to differentiate between filters and nodes with COW backing files: Filters cannot be used as overlays at all (for this function). Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--blockdev.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/blockdev.c b/blockdev.c
index 862aa1b9aa..57ee41b73e 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1562,7 +1562,12 @@ static void external_snapshot_prepare(BlkActionState *common,
goto out;
}
- if (state->new_bs->backing != NULL) {
+ if (state->new_bs->drv->is_filter) {
+ error_setg(errp, "Filters cannot be used as overlays");
+ goto out;
+ }
+
+ if (bdrv_cow_child(state->new_bs)) {
error_setg(errp, "The overlay already has a backing image");
goto out;
}