aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2011-08-29 16:02:57 -0300
committerLuiz Capitulino <lcapitulino@redhat.com>2011-09-15 16:39:32 -0300
commit9e37b9dc5bf037453e062ee515014875cd05068d (patch)
tree76bc2d70b1db12fe3c9e371fec78c0b003c1da63 /vl.c
parent6667b23f300ff08a47a73821ce2fb7f773754969 (diff)
downloadqemu-9e37b9dc5bf037453e062ee515014875cd05068d.zip
qemu-9e37b9dc5bf037453e062ee515014875cd05068d.tar.gz
qemu-9e37b9dc5bf037453e062ee515014875cd05068d.tar.bz2
QMP: query-status: Introduce 'status' key
This new key reports the current VM status to clients. Please, check the documentation being added in this commit for more details. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/vl.c b/vl.c
index 686e491..08591c3 100644
--- a/vl.c
+++ b/vl.c
@@ -378,6 +378,22 @@ static const RunStateTransition runstate_transitions_def[] = {
static bool runstate_valid_transitions[RSTATE_MAX][RSTATE_MAX];
+static const char *const runstate_name_tbl[RSTATE_MAX] = {
+ [RSTATE_DEBUG] = "debug",
+ [RSTATE_IN_MIGRATE] = "incoming-migration",
+ [RSTATE_PANICKED] = "internal-error",
+ [RSTATE_IO_ERROR] = "io-error",
+ [RSTATE_PAUSED] = "paused",
+ [RSTATE_POST_MIGRATE] = "post-migrate",
+ [RSTATE_PRE_LAUNCH] = "prelaunch",
+ [RSTATE_PRE_MIGRATE] = "finish-migrate",
+ [RSTATE_RESTORE] = "restore-vm",
+ [RSTATE_RUNNING] = "running",
+ [RSTATE_SAVEVM] = "save-vm",
+ [RSTATE_SHUTDOWN] = "shutdown",
+ [RSTATE_WATCHDOG] = "watchdog",
+};
+
bool runstate_check(RunState state)
{
return current_run_state == state;
@@ -406,6 +422,13 @@ void runstate_set(RunState new_state)
current_run_state = new_state;
}
+const char *runstate_as_string(void)
+{
+ assert(current_run_state > RSTATE_NO_STATE &&
+ current_run_state < RSTATE_MAX);
+ return runstate_name_tbl[current_run_state];
+}
+
int runstate_is_running(void)
{
return runstate_check(RSTATE_RUNNING);