Patchwork [09/18] savevm: add error parameter to qemu_savevm_state_iterate()

login
register
mail settings
Submitter Pavel Hrdina
Date Aug. 15, 2012, 7:41 a.m.
Message ID <6d66be62f5e6e6039eefa1350366688885ee0c17.1345016001.git.phrdina@redhat.com>
Download mbox | patch
Permalink /patch/177580/
State New
Headers show

Comments

Pavel Hrdina - Aug. 15, 2012, 7:41 a.m.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 migration.c |  2 +-
 savevm.c    | 11 +++++++++--
 sysemu.h    |  3 ++-
 3 files changed, 12 insertions(+), 4 deletions(-)

Patch

diff --git a/migration.c b/migration.c
index dde4dec..1e71374 100644
--- a/migration.c
+++ b/migration.c
@@ -321,7 +321,7 @@  static void migrate_fd_put_ready(void *opaque)
     }
 
     DPRINTF("iterate\n");
-    ret = qemu_savevm_state_iterate(s->file);
+    ret = qemu_savevm_state_iterate(s->file, NULL);
     if (ret < 0) {
         migrate_fd_error(s);
     } else if (ret == 1) {
diff --git a/savevm.c b/savevm.c
index d212cb2..7d6db32 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1617,7 +1617,8 @@  int qemu_savevm_state_begin(QEMUFile *f,
  *   0 : We haven't finished, caller have to go again
  *   1 : We have finished, we can go to complete phase
  */
-int qemu_savevm_state_iterate(QEMUFile *f)
+int qemu_savevm_state_iterate(QEMUFile *f,
+                              Error **errp)
 {
     SaveStateEntry *se;
     int ret = 1;
@@ -1651,10 +1652,16 @@  int qemu_savevm_state_iterate(QEMUFile *f)
         }
     }
     if (ret != 0) {
+        if (ret < 0) {
+            error_set(errp, QERR_GENERIC_ERROR, ret);
+        }
         return ret;
     }
     ret = qemu_file_get_error(f);
     if (ret != 0) {
+        if (ret < 0) {
+            error_set(errp, QERR_GENERIC_ERROR, ret);
+        }
         qemu_savevm_state_cancel(f);
     }
     return ret;
@@ -1745,7 +1752,7 @@  static int qemu_savevm_state(QEMUFile *f)
         goto out;
 
     do {
-        ret = qemu_savevm_state_iterate(f);
+        ret = qemu_savevm_state_iterate(f, NULL);
         if (ret < 0)
             goto out;
     } while (ret == 0);
diff --git a/sysemu.h b/sysemu.h
index bc65c64..405ce98 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -80,7 +80,8 @@  bool qemu_savevm_state_blocked(Error **errp);
 int qemu_savevm_state_begin(QEMUFile *f,
                             const MigrationParams *params,
                             Error **errp);
-int qemu_savevm_state_iterate(QEMUFile *f);
+int qemu_savevm_state_iterate(QEMUFile *f,
+                              Error **errp);
 int qemu_savevm_state_complete(QEMUFile *f);
 void qemu_savevm_state_cancel(QEMUFile *f);
 int qemu_loadvm_state(QEMUFile *f);