aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2019-06-12 18:34:46 +0200
committerKevin Wolf <kwolf@redhat.com>2020-09-07 12:31:31 +0200
commit7cc734a9ea1c57afe3b3fdeaba33b6a7da73bca2 (patch)
tree1f3b74b70b7cad9842435a2c70258b9e59f3ed69 /blockdev.c
parent07cd7b659a7169ed4c5c6b45b48d8351566ed4cb (diff)
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>
Diffstat (limited to 'blockdev.c')
-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;
}