diff mbox series

[31/33] migration: push Error **errp into qemu_savevm_state_resume_prepare()

Message ID 20210204171907.901471-32-berrange@redhat.com (mailing list archive)
State New, archived
Headers show
Series migration: capture error reports into Error object | expand

Commit Message

Daniel P. Berrangé Feb. 4, 2021, 5:19 p.m. UTC
This is an incremental step in converting vmstate loading code to report
via Error objects instead of printing directly to the console/monitor.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 migration/migration.c | 9 ++++-----
 migration/savevm.c    | 5 +++--
 migration/savevm.h    | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/migration/migration.c b/migration/migration.c
index 984276d066..3f0586842d 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -3165,16 +3165,15 @@  static int postcopy_resume_handshake(MigrationState *s)
 static int postcopy_do_resume(MigrationState *s)
 {
     int ret;
+    Error *local_err = NULL;
 
     /*
      * Call all the resume_prepare() hooks, so that modules can be
      * ready for the migration resume.
      */
-    ret = qemu_savevm_state_resume_prepare(s);
-    if (ret) {
-        error_report("%s: resume_prepare() failure detected: %d",
-                     __func__, ret);
-        return ret;
+    if (qemu_savevm_state_resume_prepare(s, &local_err) < 0) {
+        error_report_err(local_err);
+        return -1;
     }
 
     /*
diff --git a/migration/savevm.c b/migration/savevm.c
index 994a7c7dab..1d9790aa5b 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1194,7 +1194,7 @@  int qemu_savevm_state_setup(QEMUFile *f, Error **errp)
     return 0;
 }
 
-int qemu_savevm_state_resume_prepare(MigrationState *s)
+int qemu_savevm_state_resume_prepare(MigrationState *s, Error **errp)
 {
     SaveStateEntry *se;
     int ret;
@@ -1212,7 +1212,8 @@  int qemu_savevm_state_resume_prepare(MigrationState *s)
         }
         ret = se->ops->resume_prepare(s, se->opaque);
         if (ret < 0) {
-            return ret;
+            error_setg_errno(errp, -ret, "failed state resume prepare");
+            return -1;
         }
     }
 
diff --git a/migration/savevm.h b/migration/savevm.h
index a91e097b51..b0c40e38a7 100644
--- a/migration/savevm.h
+++ b/migration/savevm.h
@@ -32,7 +32,7 @@ 
 bool qemu_savevm_state_blocked(Error **errp);
 int qemu_savevm_state_setup(QEMUFile *f, Error **errp);
 bool qemu_savevm_state_guest_unplug_pending(void);
-int qemu_savevm_state_resume_prepare(MigrationState *s);
+int qemu_savevm_state_resume_prepare(MigrationState *s, Error **errp);
 void qemu_savevm_state_header(QEMUFile *f);
 int qemu_savevm_state_iterate(QEMUFile *f, bool postcopy, Error **errp);
 void qemu_savevm_state_cleanup(void);