aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2011-09-12 17:54:20 -0300
committerLuiz Capitulino <lcapitulino@redhat.com>2011-10-04 11:02:57 -0300
commit1fa9a5e4aea36b4d21e42323ae43879c908af576 (patch)
treec9e8bb26d83383227fc37b3686f2365424bc83cc /vl.c
parent0461d5a699cb8825039400b76839115e35b73d65 (diff)
qapi: Convert query-status
Please, note that the RunState type as defined in sysemu.h and its runstate_as_string() function are being dropped in favor of the RunState type generated by the QAPI. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/vl.c b/vl.c
index ba4a151ada..dbf77781a7 100644
--- a/vl.c
+++ b/vl.c
@@ -147,6 +147,7 @@ int main(int argc, char **argv)
#include "qemu-config.h"
#include "qemu-objects.h"
#include "qemu-options.h"
+#include "qmp-commands.h"
#ifdef CONFIG_VIRTFS
#include "fsdev/qemu-fsdev.h"
#endif
@@ -375,22 +376,6 @@ static const RunStateTransition runstate_transitions_def[] = {
static bool runstate_valid_transitions[RUN_STATE_MAX][RUN_STATE_MAX];
-static const char *const runstate_name_tbl[RUN_STATE_MAX] = {
- [RUN_STATE_DEBUG] = "debug",
- [RUN_STATE_INMIGRATE] = "incoming-migration",
- [RUN_STATE_INTERNAL_ERROR] = "internal-error",
- [RUN_STATE_IO_ERROR] = "io-error",
- [RUN_STATE_PAUSED] = "paused",
- [RUN_STATE_POSTMIGRATE] = "post-migrate",
- [RUN_STATE_PRELAUNCH] = "prelaunch",
- [RUN_STATE_FINISH_MIGRATE] = "finish-migrate",
- [RUN_STATE_RESTORE_VM] = "restore-vm",
- [RUN_STATE_RUNNING] = "running",
- [RUN_STATE_SAVE_VM] = "save-vm",
- [RUN_STATE_SHUTDOWN] = "shutdown",
- [RUN_STATE_WATCHDOG] = "watchdog",
-};
-
bool runstate_check(RunState state)
{
return current_run_state == state;
@@ -419,15 +404,20 @@ void runstate_set(RunState new_state)
current_run_state = new_state;
}
-const char *runstate_as_string(void)
+int runstate_is_running(void)
{
- assert(current_run_state < RUN_STATE_MAX);
- return runstate_name_tbl[current_run_state];
+ return runstate_check(RUN_STATE_RUNNING);
}
-int runstate_is_running(void)
+StatusInfo *qmp_query_status(Error **errp)
{
- return runstate_check(RUN_STATE_RUNNING);
+ StatusInfo *info = g_malloc0(sizeof(*info));
+
+ info->running = runstate_is_running();
+ info->singlestep = singlestep;
+ info->status = current_run_state;
+
+ return info;
}
/***********************************************************/