aboutsummaryrefslogtreecommitdiff
path: root/hmp.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2017-04-18 11:40:56 +0200
committerJuan Quintela <quintela@redhat.com>2017-05-04 10:33:24 +0200
commit52b262051209bcf6064ca3a8bc8dbe0c04a6960d (patch)
tree2b6cec3746d50fd0b6f4dce481624b32a5bb38b9 /hmp.c
parentc34c2f3701e38a06bc9849bee9eac9131a4fdaad (diff)
monitor: Move hmp_loadvm from monitor.c to hmp.c
We are going to move the rest of hmp snapshots functions there instead of monitor.c. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'hmp.c')
-rw-r--r--hmp.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/hmp.c b/hmp.c
index ab407d6fd0..f6b8738c2d 100644
--- a/hmp.c
+++ b/hmp.c
@@ -19,6 +19,7 @@
#include "net/eth.h"
#include "sysemu/char.h"
#include "sysemu/block-backend.h"
+#include "sysemu/sysemu.h"
#include "qemu/config-file.h"
#include "qemu/option.h"
#include "qemu/timer.h"
@@ -1268,6 +1269,18 @@ void hmp_snapshot_delete_blkdev_internal(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, &err);
}
+void hmp_loadvm(Monitor *mon, const QDict *qdict)
+{
+ int saved_vm_running = runstate_is_running();
+ const char *name = qdict_get_str(qdict, "name");
+
+ vm_stop(RUN_STATE_RESTORE_VM);
+
+ if (load_vmstate(name) == 0 && saved_vm_running) {
+ vm_start();
+ }
+}
+
void hmp_migrate_cancel(Monitor *mon, const QDict *qdict)
{
qmp_migrate_cancel(NULL);