qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 29/33] migration: push Error **errp into qemu_savevm_live_state()


From: Daniel P . Berrangé
Subject: [PATCH 29/33] migration: push Error **errp into qemu_savevm_live_state()
Date: Thu, 4 Feb 2021 17:19:03 +0000

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/colo.c   | 4 +++-
 migration/savevm.c | 8 ++++----
 migration/savevm.h | 2 +-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/migration/colo.c b/migration/colo.c
index 4a050ac579..a76b72c984 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -470,7 +470,9 @@ static int colo_do_checkpoint_transaction(MigrationState *s,
      * TODO: We may need a timeout mechanism to prevent COLO process
      * to be blocked here.
      */
-    qemu_savevm_live_state(s->to_dst_file);
+    if (qemu_savevm_live_state(s->to_dst_file, &local_err) < 0) {
+        goto out;
+    }
 
     qemu_fflush(fb);
 
diff --git a/migration/savevm.c b/migration/savevm.c
index deea8854db..884d12c6eb 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1594,14 +1594,14 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)
     return -1;
 }
 
-void qemu_savevm_live_state(QEMUFile *f)
+int qemu_savevm_live_state(QEMUFile *f, Error **errp)
 {
-    Error *local_err = NULL;
     /* save QEMU_VM_SECTION_END section */
-    if (qemu_savevm_state_complete_precopy(f, true, false, &local_err) < 0) {
-        error_report_err(local_err);
+    if (qemu_savevm_state_complete_precopy(f, true, false, errp) < 0) {
+        return -1;
     }
     qemu_put_byte(f, QEMU_VM_EOF);
+    return 0;
 }
 
 int qemu_save_device_state(QEMUFile *f)
diff --git a/migration/savevm.h b/migration/savevm.h
index 2d46e848cd..7abd75b668 100644
--- a/migration/savevm.h
+++ b/migration/savevm.h
@@ -59,7 +59,7 @@ void qemu_savevm_send_postcopy_ram_discard(QEMUFile *f, const 
char *name,
                                            uint64_t *start_list,
                                            uint64_t *length_list);
 void qemu_savevm_send_colo_enable(QEMUFile *f);
-void qemu_savevm_live_state(QEMUFile *f);
+int qemu_savevm_live_state(QEMUFile *f, Error **errp);
 int qemu_save_device_state(QEMUFile *f);
 
 int qemu_loadvm_state(QEMUFile *f, Error **errp);
-- 
2.29.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]