diff mbox

[22/22] savevm: Convert do_loadvm() to QObject

Message ID 1271797792-24571-23-git-send-email-lcapitulino@redhat.com
State New
Headers show

Commit Message

Luiz Capitulino April 20, 2010, 9:09 p.m. UTC
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c       |    7 +++++--
 qemu-monitor.hx |    3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/monitor.c b/monitor.c
index 542c858..32f0396 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2465,18 +2465,21 @@  static int do_closefd(Monitor *mon, const QDict *qdict, QObject **ret_data)
     return -1;
 }
 
-static void do_loadvm(Monitor *mon, const QDict *qdict)
+static int do_loadvm(Monitor *mon, const QDict *qdict, QObject **ret_data)
 {
+    int ret;
     int saved_vm_running  = vm_running;
     const char *name = qdict_get_str(qdict, "name");
 
     vm_stop(0);
 
-    load_vmstate(name);
+    ret = load_vmstate(name);
 
     if (saved_vm_running) {
         vm_start();
     }
+
+    return (ret < 0 ? -1 : 0);
 }
 
 int monitor_get_fd(Monitor *mon, const char *fdname)
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index 9a699d4..d1d02b0 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -260,7 +260,8 @@  ETEXI
         .args_type  = "name:s",
         .params     = "tag|id",
         .help       = "restore a VM snapshot from its tag or id",
-        .mhandler.cmd = do_loadvm,
+        .user_print = monitor_user_noop,
+        .mhandler.cmd_new = do_loadvm,
     },
 
 STEXI