@@ -242,7 +242,8 @@ ETEXI
.args_type = "name:s?",
.params = "[tag|id]",
.help = "save a VM snapshot. If no tag or id are provided, a new snapshot is created",
- .mhandler.cmd = do_savevm,
+ .user_print = monitor_user_noop,
+ .mhandler.cmd_new = do_savevm,
},
STEXI
@@ -1664,7 +1664,7 @@ static int del_existing_snapshots(const char *name)
return 0;
}
-void do_savevm(Monitor *mon, const QDict *qdict)
+int do_savevm(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
DriveInfo *dinfo;
BlockDriverState *bs, *bs1;
@@ -1683,7 +1683,7 @@ void do_savevm(Monitor *mon, const QDict *qdict)
bs = get_bs_snapshots();
if (!bs) {
qerror_report(QERR_SNAPSHOT_NO_DEVICE);
- return;
+ return -1;
}
/* ??? Should this occur after vm_stop? */
@@ -1717,6 +1717,7 @@ void do_savevm(Monitor *mon, const QDict *qdict)
/* Delete old snapshots of the same name */
if (name && del_existing_snapshots(name) < 0) {
+ ret = -1;
goto the_end;
}
@@ -1739,6 +1740,7 @@ void do_savevm(Monitor *mon, const QDict *qdict)
sn->vm_state_size = (bs == bs1 ? vm_state_size : 0);
ret = bdrv_snapshot_create(bs1, sn);
if (ret < 0) {
+ /* FIXME: will report multiple failures in QMP */
qerror_report(QERR_SNAPSHOT_CREATE_FAILED,
bdrv_get_device_name(bs1), get_errno_string(ret));
}
@@ -1748,6 +1750,7 @@ void do_savevm(Monitor *mon, const QDict *qdict)
the_end:
if (saved_vm_running)
vm_start();
+ return (ret < 0 ? -1 : 0);
}
int load_vmstate(const char *name)
@@ -53,7 +53,7 @@ int qemu_exit_requested(void);
extern qemu_irq qemu_system_powerdown;
void qemu_system_reset(void);
-void do_savevm(Monitor *mon, const QDict *qdict);
+int do_savevm(Monitor *mon, const QDict *qdict, QObject **ret_data);
int load_vmstate(const char *name);
int do_delvm(Monitor *mon, const QDict *qdict, QObject **ret_data);
void do_info_snapshots(Monitor *mon);
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> --- qemu-monitor.hx | 3 ++- savevm.c | 7 +++++-- sysemu.h | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-)