summaryrefslogtreecommitdiffstats
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf2015-05-08 15:14:15 +0200
committerKevin Wolf2015-12-18 14:34:42 +0100
commit4c9dfe5d8a7eb956513593720b8d1a9ca2c5a7f9 (patch)
tree02997607857e4d42e173989db4b3d14448e81d1d /block.c
parentblock: Keep "driver" in bs->options (diff)
downloadqemu-4c9dfe5d8a7eb956513593720b8d1a9ca2c5a7f9.tar.gz
qemu-4c9dfe5d8a7eb956513593720b8d1a9ca2c5a7f9.tar.xz
qemu-4c9dfe5d8a7eb956513593720b8d1a9ca2c5a7f9.zip
block: Allow specifying child options in reopen
If the child was defined in the same context (-drive argument or blockdev-add QMP command) as its parent, a reopen of the parent should work the same and allow changing options of the child. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/block.c b/block.c
index 2c41fffc9f..9c42b17498 100644
--- a/block.c
+++ b/block.c
@@ -1720,15 +1720,23 @@ BlockReopenQueue *bdrv_reopen_queue(BlockReopenQueue *bs_queue,
flags &= ~BDRV_O_PROTOCOL;
QLIST_FOREACH(child, &bs->children, next) {
+ QDict *new_child_options;
+ char *child_key_dot;
int child_flags;
+ /* reopen can only change the options of block devices that were
+ * implicitly created and inherited options. For other (referenced)
+ * block devices, a syntax like "backing.foo" results in an error. */
if (child->bs->inherits_from != bs) {
continue;
}
+ child_key_dot = g_strdup_printf("%s.", child->name);
+ qdict_extract_subqdict(options, &new_child_options, child_key_dot);
+ g_free(child_key_dot);
+
child_flags = child->role->inherit_flags(flags);
- /* TODO Pass down child flags (backing.*, extents.*, ...) */
- bdrv_reopen_queue(bs_queue, child->bs, NULL, child_flags);
+ bdrv_reopen_queue(bs_queue, child->bs, new_child_options, child_flags);
}
bs_entry = g_new0(BlockReopenQueueEntry, 1);