Skip to content

Commit

Permalink
monitor: Move hmp_loadvm from monitor.c to hmp.c
Browse files Browse the repository at this point in the history
We are going to move the rest of hmp snapshots functions there instead
of monitor.c.

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
  • Loading branch information
Juan Quintela committed May 4, 2017
1 parent c34c2f3 commit 52b2620
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
13 changes: 13 additions & 0 deletions hmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions hmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ void hmp_snapshot_blkdev_internal(Monitor *mon, const QDict *qdict);
void hmp_snapshot_delete_blkdev_internal(Monitor *mon, const QDict *qdict);
void hmp_drive_mirror(Monitor *mon, const QDict *qdict);
void hmp_drive_backup(Monitor *mon, const QDict *qdict);
void hmp_loadvm(Monitor *mon, const QDict *qdict);
void hmp_migrate_cancel(Monitor *mon, const QDict *qdict);
void hmp_migrate_incoming(Monitor *mon, const QDict *qdict);
void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict);
Expand Down
13 changes: 0 additions & 13 deletions monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include "net/slirp.h"
#include "sysemu/char.h"
#include "ui/qemu-spice.h"
#include "sysemu/sysemu.h"
#include "sysemu/numa.h"
#include "monitor/monitor.h"
#include "qemu/config-file.h"
Expand Down Expand Up @@ -1954,18 +1953,6 @@ void qmp_closefd(const char *fdname, Error **errp)
error_setg(errp, QERR_FD_NOT_FOUND, fdname);
}

static 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();
}
}

int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp)
{
mon_fd_t *monfd;
Expand Down

0 comments on commit 52b2620

Please sign in to comment.