summaryrefslogtreecommitdiff
path: root/softmmu/qdev-monitor.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-10-27 04:44:18 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-12-15 12:51:48 -0500
commit164dafd1744c69d268b89015977e19d8a9617fdf (patch)
tree7c3f6a9c5dfb766bdd25cfa87f37201095cd674f /softmmu/qdev-monitor.c
parent69e92bd558d71fdbd0c1989391b20edcc700daa9 (diff)
remove preconfig state
The preconfig state is only used if -incoming is not specified, which makes the RunState state machine more tricky than it need be. However there is already an equivalent condition which works even with -incoming, namely qdev_hotplug. Use it instead of a separate runstate. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'softmmu/qdev-monitor.c')
-rw-r--r--softmmu/qdev-monitor.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
index 8c072e3efc..3f1e67267d 100644
--- a/softmmu/qdev-monitor.c
+++ b/softmmu/qdev-monitor.c
@@ -25,6 +25,7 @@
#include "sysemu/arch_init.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-qdev.h"
+#include "qapi/qmp/dispatch.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qerror.h"
#include "qemu/config-file.h"
@@ -983,3 +984,14 @@ int qemu_global_option(const char *str)
return 0;
}
+
+bool qmp_command_available(const QmpCommand *cmd, Error **errp)
+{
+ if (!qdev_hotplug &&
+ !(cmd->options & QCO_ALLOW_PRECONFIG)) {
+ error_setg(errp, "The command '%s' is permitted only after machine initialization has completed",
+ cmd->name);
+ return false;
+ }
+ return true;
+}