Patchwork [06/13] savevm: add error parameter to qemu_savevm_state()

login
register
mail settings
Submitter Pavel Hrdina
Date Jan. 9, 2013, 3:18 p.m.
Message ID <705f46ef0a25d5c793b8a9884542527c0b374f5e.1357741229.git.phrdina@redhat.com>
Download mbox | patch
Permalink /patch/210732/
State New
Headers show

Comments

Pavel Hrdina - Jan. 9, 2013, 3:18 p.m.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 savevm.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Patch

diff --git a/savevm.c b/savevm.c
index 14f61e9..b705693 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1759,7 +1759,7 @@  void qemu_savevm_state_cancel(QEMUFile *f)
     }
 }
 
-static int qemu_savevm_state(QEMUFile *f)
+static int qemu_savevm_state(QEMUFile *f, Error **errp)
 {
     int ret;
     MigrationParams params = {
@@ -1767,26 +1767,29 @@  static int qemu_savevm_state(QEMUFile *f)
         .shared = 0
     };
 
-    if (qemu_savevm_state_blocked(NULL)) {
+    if (qemu_savevm_state_blocked(errp)) {
         ret = -EINVAL;
         goto out;
     }
 
-    ret = qemu_savevm_state_begin(f, &params, NULL);
+    ret = qemu_savevm_state_begin(f, &params, errp);
     if (ret < 0)
         goto out;
 
     do {
-        ret = qemu_savevm_state_iterate(f, NULL);
+        ret = qemu_savevm_state_iterate(f, errp);
         if (ret < 0)
             goto out;
     } while (ret == 0);
 
-    ret = qemu_savevm_state_complete(f, NULL);
+    ret = qemu_savevm_state_complete(f, errp);
 
 out:
     if (ret == 0) {
         ret = qemu_file_get_error(f);
+        if (ret < 0) {
+            error_setg_errno(errp, errno, "Failed to create vmstate.");
+        }
     }
 
     return ret;
@@ -2187,7 +2190,7 @@  void do_savevm(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, "Could not open VM state file\n");
         goto the_end;
     }
-    ret = qemu_savevm_state(f);
+    ret = qemu_savevm_state(f, NULL);
     vm_state_size = qemu_ftell(f);
     qemu_fclose(f);
     if (ret < 0) {