|
|
9bac43 |
From 322e74b00634817abd82f66d8c98effc07d532a8 Mon Sep 17 00:00:00 2001
|
|
|
9bac43 |
From: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9bac43 |
Date: Fri, 22 Dec 2017 11:08:57 +0100
|
|
|
9bac43 |
Subject: [PATCH 39/42] blockdev: add x-blockdev-set-iothread force boolean
|
|
|
9bac43 |
|
|
|
9bac43 |
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9bac43 |
Message-id: <20171222110900.24813-18-stefanha@redhat.com>
|
|
|
9bac43 |
Patchwork-id: 78495
|
|
|
9bac43 |
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH 17/20] blockdev: add x-blockdev-set-iothread force boolean
|
|
|
9bac43 |
Bugzilla: 1519721
|
|
|
9bac43 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
When a node is already associated with a BlockBackend the
|
|
|
9bac43 |
x-blockdev-set-iothread command refuses to set the IOThread. This is to
|
|
|
9bac43 |
prevent accidentally changing the IOThread when the nodes are in use.
|
|
|
9bac43 |
|
|
|
9bac43 |
When the nodes are created with -drive they automatically get a
|
|
|
9bac43 |
BlockBackend. In that case we know nothing is using them yet and it's
|
|
|
9bac43 |
safe to set the IOThread. Add a force boolean to override the check.
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9bac43 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
9bac43 |
Message-id: 20171207201320.19284-4-stefanha@redhat.com
|
|
|
9bac43 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9bac43 |
(cherry picked from commit 882e9b89af7c1086d97cee11b2437337e756fa00)
|
|
|
9bac43 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9bac43 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
---
|
|
|
9bac43 |
blockdev.c | 11 ++++++-----
|
|
|
9bac43 |
qapi/block-core.json | 6 +++++-
|
|
|
9bac43 |
2 files changed, 11 insertions(+), 6 deletions(-)
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/blockdev.c b/blockdev.c
|
|
|
9bac43 |
index 6cbe627..17e2cf1 100644
|
|
|
9bac43 |
--- a/blockdev.c
|
|
|
9bac43 |
+++ b/blockdev.c
|
|
|
9bac43 |
@@ -4192,7 +4192,7 @@ BlockJobInfoList *qmp_query_block_jobs(Error **errp)
|
|
|
9bac43 |
}
|
|
|
9bac43 |
|
|
|
9bac43 |
void qmp_x_blockdev_set_iothread(const char *node_name, StrOrNull *iothread,
|
|
|
9bac43 |
- Error **errp)
|
|
|
9bac43 |
+ bool has_force, bool force, Error **errp)
|
|
|
9bac43 |
{
|
|
|
9bac43 |
AioContext *old_context;
|
|
|
9bac43 |
AioContext *new_context;
|
|
|
9bac43 |
@@ -4204,10 +4204,11 @@ void qmp_x_blockdev_set_iothread(const char *node_name, StrOrNull *iothread,
|
|
|
9bac43 |
return;
|
|
|
9bac43 |
}
|
|
|
9bac43 |
|
|
|
9bac43 |
- /* If we want to allow more extreme test scenarios this guard could be
|
|
|
9bac43 |
- * removed. For now it protects against accidents. */
|
|
|
9bac43 |
- if (bdrv_has_blk(bs)) {
|
|
|
9bac43 |
- error_setg(errp, "Node %s is in use", node_name);
|
|
|
9bac43 |
+ /* Protects against accidents. */
|
|
|
9bac43 |
+ if (!(has_force && force) && bdrv_has_blk(bs)) {
|
|
|
9bac43 |
+ error_setg(errp, "Node %s is associated with a BlockBackend and could "
|
|
|
9bac43 |
+ "be in use (use force=true to override this check)",
|
|
|
9bac43 |
+ node_name);
|
|
|
9bac43 |
return;
|
|
|
9bac43 |
}
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
|
|
9bac43 |
index d579c99..305f7ff 100644
|
|
|
9bac43 |
--- a/qapi/block-core.json
|
|
|
9bac43 |
+++ b/qapi/block-core.json
|
|
|
9bac43 |
@@ -3895,6 +3895,9 @@
|
|
|
9bac43 |
#
|
|
|
9bac43 |
# @iothread: the name of the IOThread object or null for the main loop
|
|
|
9bac43 |
#
|
|
|
9bac43 |
+# @force: true if the node and its children should be moved when a BlockBackend
|
|
|
9bac43 |
+# is already attached
|
|
|
9bac43 |
+#
|
|
|
9bac43 |
# Note: this command is experimental and intended for test cases that need
|
|
|
9bac43 |
# control over IOThreads only.
|
|
|
9bac43 |
#
|
|
|
9bac43 |
@@ -3917,4 +3920,5 @@
|
|
|
9bac43 |
##
|
|
|
9bac43 |
{ 'command': 'x-blockdev-set-iothread',
|
|
|
9bac43 |
'data' : { 'node-name': 'str',
|
|
|
9bac43 |
- 'iothread': 'StrOrNull' } }
|
|
|
9bac43 |
+ 'iothread': 'StrOrNull',
|
|
|
9bac43 |
+ '*force': 'bool' } }
|
|
|
9bac43 |
--
|
|
|
9bac43 |
1.8.3.1
|
|
|
9bac43 |
|