Patchwork [10/18] savevm: add error parameter to qemu_savevm_state_complete()

login
register
mail settings
Submitter Pavel Hrdina
Date Aug. 15, 2012, 7:41 a.m.
Message ID <6d8d1bd875f96ab4a2039878ab2420c844c71713.1345016001.git.phrdina@redhat.com>
Download mbox | patch
Permalink /patch/177572/
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    | 13 ++++++++++---
 sysemu.h    |  3 ++-
 3 files changed, 13 insertions(+), 5 deletions(-)

Patch

diff --git a/migration.c b/migration.c
index 1e71374..ec2f267 100644
--- a/migration.c
+++ b/migration.c
@@ -331,7 +331,7 @@  static void migrate_fd_put_ready(void *opaque)
         qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
         vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
 
-        if (qemu_savevm_state_complete(s->file) < 0) {
+        if (qemu_savevm_state_complete(s->file, NULL) < 0) {
             migrate_fd_error(s);
         } else {
             migrate_fd_completed(s);
diff --git a/savevm.c b/savevm.c
index 7d6db32..0f7d681 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1667,7 +1667,8 @@  int qemu_savevm_state_iterate(QEMUFile *f,
     return ret;
 }
 
-int qemu_savevm_state_complete(QEMUFile *f)
+int qemu_savevm_state_complete(QEMUFile *f,
+                               Error **errp)
 {
     SaveStateEntry *se;
     int ret;
@@ -1691,6 +1692,7 @@  int qemu_savevm_state_complete(QEMUFile *f)
         ret = se->ops->save_live_complete(f, se->opaque);
         trace_savevm_section_end(se->section_id);
         if (ret < 0) {
+            error_set(errp, QERR_GENERIC_ERROR, ret);
             return ret;
         }
     }
@@ -1720,7 +1722,12 @@  int qemu_savevm_state_complete(QEMUFile *f)
 
     qemu_put_byte(f, QEMU_VM_EOF);
 
-    return qemu_file_get_error(f);
+    ret = qemu_file_get_error(f);
+    if (ret < 0) {
+        error_set(errp, QERR_GENERIC_ERROR, ret);
+    }
+
+    return ret;
 }
 
 void qemu_savevm_state_cancel(QEMUFile *f)
@@ -1757,7 +1764,7 @@  static int qemu_savevm_state(QEMUFile *f)
             goto out;
     } while (ret == 0);
 
-    ret = qemu_savevm_state_complete(f);
+    ret = qemu_savevm_state_complete(f, NULL);
 
 out:
     if (ret == 0) {
diff --git a/sysemu.h b/sysemu.h
index 405ce98..35d6d67 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -82,7 +82,8 @@  int qemu_savevm_state_begin(QEMUFile *f,
                             Error **errp);
 int qemu_savevm_state_iterate(QEMUFile *f,
                               Error **errp);
-int qemu_savevm_state_complete(QEMUFile *f);
+int qemu_savevm_state_complete(QEMUFile *f,
+                               Error **errp);
 void qemu_savevm_state_cancel(QEMUFile *f);
 int qemu_loadvm_state(QEMUFile *f);