blockdev: add x-blockdev-set-iothread force boolean
When a node is already associated with a BlockBackend the
x-blockdev-set-iothread command refuses to set the IOThread. This is to
prevent accidentally changing the IOThread when the nodes are in use.
When the nodes are created with -drive they automatically get a
BlockBackend. In that case we know nothing is using them yet and it's
safe to set the IOThread. Add a force boolean to override the check.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20171207201320.19284-4-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 741d6c4..a8cdbc3 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -3962,6 +3962,9 @@
#
# @iothread: the name of the IOThread object or null for the main loop
#
+# @force: true if the node and its children should be moved when a BlockBackend
+# is already attached
+#
# Note: this command is experimental and intended for test cases that need
# control over IOThreads only.
#
@@ -3984,4 +3987,5 @@
##
{ 'command': 'x-blockdev-set-iothread',
'data' : { 'node-name': 'str',
- 'iothread': 'StrOrNull' } }
+ 'iothread': 'StrOrNull',
+ '*force': 'bool' } }