[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 25/34] block: Allow specifying child options in reop
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PATCH 25/34] block: Allow specifying child options in reopen |
Date: |
Fri, 8 May 2015 19:21:57 +0200 |
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 <address@hidden>
---
block.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/block.c b/block.c
index ef39c74..8a31d62 100644
--- a/block.c
+++ b/block.c
@@ -1644,15 +1644,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);
--
1.8.3.1
- Re: [Qemu-block] [Qemu-devel] [PATCH 17/34] qcow2: Leave s unchanged on qcow2_update_options() failure, (continued)
- [Qemu-block] [PATCH 21/34] block: Consider all block layer options in append_open_options, Kevin Wolf, 2015/05/08
- [Qemu-block] [PATCH 22/34] block: Exclude nested options only for children in append_open_options(), Kevin Wolf, 2015/05/08
- [Qemu-block] [PATCH 23/34] block: Pass driver-specific options to .bdrv_refresh_filename(), Kevin Wolf, 2015/05/08
- [Qemu-block] [PATCH 25/34] block: Allow specifying child options in reopen,
Kevin Wolf <=
- [Qemu-block] [PATCH 26/34] block: reopen: Document option precedence and refactor accordingly, Kevin Wolf, 2015/05/08
- [Qemu-block] [PATCH 24/34] block: Keep "driver" in bs->options, Kevin Wolf, 2015/05/08
- [Qemu-block] [PATCH 27/34] block: Add infrastructure for option inheritance, Kevin Wolf, 2015/05/08
- [Qemu-block] [PATCH 28/34] block: Introduce bs->explicit_options, Kevin Wolf, 2015/05/08