Patchwork [03/13] savevm: add error parameter to qemu_savevm_state_begin()

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

Comments

Pavel Hrdina - Jan. 9, 2013, 3:17 p.m.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 include/sysemu/sysemu.h | 3 ++-
 migration.c             | 2 +-
 savevm.c                | 7 +++++--
 3 files changed, 8 insertions(+), 4 deletions(-)

Patch

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 28a783e..e50f990 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -74,7 +74,8 @@  void qemu_announce_self(void);
 
 bool qemu_savevm_state_blocked(Error **errp);
 int qemu_savevm_state_begin(QEMUFile *f,
-                            const MigrationParams *params);
+                            const MigrationParams *params,
+                            Error **errp);
 int qemu_savevm_state_iterate(QEMUFile *f);
 int qemu_savevm_state_complete(QEMUFile *f);
 void qemu_savevm_state_cancel(QEMUFile *f);
diff --git a/migration.c b/migration.c
index c69e864..cb38867 100644
--- a/migration.c
+++ b/migration.c
@@ -678,7 +678,7 @@  static bool migrate_fd_put_ready(MigrationState *s, uint64_t max_size)
     if (s->first_time) {
         s->first_time = false;
         DPRINTF("beginning savevm\n");
-        ret = qemu_savevm_state_begin(s->file, &s->params);
+        ret = qemu_savevm_state_begin(s->file, &s->params, NULL);
         if (ret < 0) {
             DPRINTF("failed, %d\n", ret);
             migrate_fd_error(s);
diff --git a/savevm.c b/savevm.c
index fae0cba..e2ecb0b 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1557,7 +1557,8 @@  bool qemu_savevm_state_blocked(Error **errp)
 }
 
 int qemu_savevm_state_begin(QEMUFile *f,
-                            const MigrationParams *params)
+                            const MigrationParams *params,
+                            Error **errp)
 {
     SaveStateEntry *se;
     int ret;
@@ -1598,11 +1599,13 @@  int qemu_savevm_state_begin(QEMUFile *f,
         ret = se->ops->save_live_setup(f, se->opaque);
         if (ret < 0) {
             qemu_savevm_state_cancel(f);
+            error_setg(errp, "Failed to begin vmstate save.");
             return ret;
         }
     }
     ret = qemu_file_get_error(f);
     if (ret != 0) {
+        error_setg_errno(errp, errno, "Failed to begin vmstate save.");
         qemu_savevm_state_cancel(f);
     }
 
@@ -1758,7 +1761,7 @@  static int qemu_savevm_state(QEMUFile *f)
         goto out;
     }
 
-    ret = qemu_savevm_state_begin(f, &params);
+    ret = qemu_savevm_state_begin(f, &params, NULL);
     if (ret < 0)
         goto out;