Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> writes:
Add a command that can replace bs in following BdrvChild structures:
- qdev blk root child - block-export blk root child - any child of BlockDriverState selected by child-name
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
[...]
diff --git a/qapi/block-core.json b/qapi/block-core.json index b82af74256..9cc7c3d140 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -6334,3 +6334,27 @@ ## { 'struct': 'DummyBlockCoreForceArrays', 'data': { 'unused-block-graph-info': ['BlockGraphInfo'] } } + +## +# @blockdev-replace: +# +# Replace a block-node associated with device (@parent should be +# QOM path, and @child should be "root") or with block-export (@parent +# should be export name, and @child should be "root") or any child +# of block-node (@parent should be node-name, and @child should be any +# if its children names) with @new-child block-node.
of its
+# +# @parent: QOM path or block-export or node-name, which @child should +# be repalced. If several matching parents exist, the command
replaced
+# will fail
End the sentence with a period, please.
+# +# @child: child to replace. Must be "root" when parent is QOM path or +# block-export
Likewise.
+# +# @new-child: node-name of the block-node, which should become a +# replacement for @child's current block-node
Likewise. Indent one more, please.
+# +# Since 11.0 +##
Let's see whether I understand... @parent determines which of the three cases mentioned in the commit message it ids: * If @parent is a QOM path, case 1. * If @parent is a block export name (@id in BlockExportOptions and BlockExportInfo), case 2. * If @parent is a block node name (@node-name in BlockdevOptions and BlockDeviceInfo), case 3. Correct? Problem: this is ambiguous. A @parent "foo" could in fact be any of the three cases. 3. If a block node named "foo" exists, it's case 3. 2. If a block export named "foo" exists, it's also case 2. 1. If exactly one QOM object named "foo" exists, it's also case 1. Why? "foo" is a syntactically valid partial QOM path. Partial QOM paths are a convenience feature that is virtually unknown (and possibly ill-advised): you can omit leading path components as long as there's no ambiguity. Peeking ahead in the series... PATCH 8 appears to deprecate the ambiguity between case 2. and 3. I think we need to do better. More questions... In case 1 and 2, @child "should be root". What happens when it's something else? In case 3, @child "should be any if its children names". I figure the command fails when it isn't.
+{ 'command': 'blockdev-replace', + 'data': { 'parent': 'str', 'child': 'str', 'new-child': 'str' } }
[...]