aboutsummaryrefslogtreecommitdiff
path: root/monitor
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 /monitor
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 'monitor')
-rw-r--r--monitor/hmp.c7
-rw-r--r--monitor/qmp-cmds.c5
2 files changed, 6 insertions, 6 deletions
diff --git a/monitor/hmp.c b/monitor/hmp.c
index d40f4f4391..f2fe192d69 100644
--- a/monitor/hmp.c
+++ b/monitor/hmp.c
@@ -24,6 +24,7 @@
#include "qemu/osdep.h"
#include <dirent.h>
+#include "hw/qdev-core.h"
#include "monitor-internal.h"
#include "qapi/error.h"
#include "qapi/qmp/qdict.h"
@@ -215,7 +216,7 @@ static bool cmd_can_preconfig(const HMPCommand *cmd)
static bool cmd_available(const HMPCommand *cmd)
{
- return !runstate_check(RUN_STATE_PRECONFIG) || cmd_can_preconfig(cmd);
+ return qdev_hotplug || cmd_can_preconfig(cmd);
}
static void help_cmd_dump_one(Monitor *mon,
@@ -658,8 +659,8 @@ static const HMPCommand *monitor_parse_command(MonitorHMP *hmp_mon,
return NULL;
}
if (!cmd_available(cmd)) {
- monitor_printf(mon, "Command '%.*s' not available with -preconfig "
- "until after exit_preconfig.\n",
+ monitor_printf(mon, "Command '%.*s' not available "
+ "until machine initialization has completed.\n",
(int)(p - cmdp_start), cmdp_start);
return NULL;
}
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index 6223a28e8b..639a219294 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -104,9 +104,8 @@ void qmp_system_powerdown(Error **errp)
void qmp_x_exit_preconfig(Error **errp)
{
- if (!runstate_check(RUN_STATE_PRECONFIG)) {
- error_setg(errp, "The command is permitted only in '%s' state",
- RunState_str(RUN_STATE_PRECONFIG));
+ if (qdev_hotplug) {
+ error_setg(errp, "The command is permitted only before machine initialization");
return;
}
qemu_exit_preconfig_request();