diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2011-08-09 14:44:25 -0300 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2011-09-15 16:39:32 -0300 |
commit | 6e0ca8820dddd04056c43327f3b3699f572d03d4 (patch) | |
tree | 64018477e73c610089fafd118b43a626d2f4565c /monitor.c | |
parent | 9e37b9dc5bf037453e062ee515014875cd05068d (diff) | |
download | qemu-6e0ca8820dddd04056c43327f3b3699f572d03d4.zip qemu-6e0ca8820dddd04056c43327f3b3699f572d03d4.tar.gz qemu-6e0ca8820dddd04056c43327f3b3699f572d03d4.tar.bz2 |
HMP: info status: Print the VM state
Today our printf format for the "info status" command is:
VM status: %s
Where the string can be "running", "running (single step mode)" or
"paused".
This commit extends it to:
VM status: %s (%s)
The second string corresponds to the "status" field as returned
by the query-status QMP command and it's only printed if "status"
is not "running" or "paused".
Example:
VM status: paused (shutdown)
PS: libvirt uses "info status" when using HMP, but the new format
should not break it.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -2618,6 +2618,7 @@ static int do_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret_data) static void do_info_status_print(Monitor *mon, const QObject *data) { QDict *qdict; + const char *status; qdict = qobject_to_qdict(data); @@ -2631,6 +2632,11 @@ static void do_info_status_print(Monitor *mon, const QObject *data) monitor_printf(mon, "paused"); } + status = qdict_get_str(qdict, "status"); + if (strcmp(status, "paused") && strcmp(status, "running")) { + monitor_printf(mon, " (%s)", status); + } + monitor_printf(mon, "\n"); } |