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>
This commit is contained in:
Paolo Bonzini 2020-10-27 04:44:18 -04:00
parent 69e92bd558
commit 164dafd174
11 changed files with 34 additions and 29 deletions

View file

@ -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;
}