[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 19/33] migration: push Error **errp into check_section_footer()
From: |
Daniel P . Berrangé |
Subject: |
[PATCH 19/33] migration: push Error **errp into check_section_footer() |
Date: |
Thu, 4 Feb 2021 17:18:53 +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/savevm.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/migration/savevm.c b/migration/savevm.c
index ace76e32f7..289a3d55bb 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2320,9 +2320,9 @@ static int loadvm_process_command(QEMUFile *f, Error
**errp)
* Read a footer off the wire and check that it matches the expected section
*
* Returns: true if the footer was good
- * false if there is a problem (and calls error_report to say why)
+ * false if there is a problem
*/
-static bool check_section_footer(QEMUFile *f, SaveStateEntry *se)
+static bool check_section_footer(QEMUFile *f, SaveStateEntry *se, Error **errp)
{
int ret;
uint8_t read_mark;
@@ -2337,21 +2337,21 @@ static bool check_section_footer(QEMUFile *f,
SaveStateEntry *se)
ret = qemu_file_get_error(f);
if (ret) {
- error_report("%s: Read section footer failed: %d",
- __func__, ret);
+ error_setg(errp, "read section footer failed: %d",
+ ret);
return false;
}
if (read_mark != QEMU_VM_SECTION_FOOTER) {
- error_report("Missing section footer for %s", se->idstr);
+ error_setg(errp, "Missing section footer for %s", se->idstr);
return false;
}
read_section_id = qemu_get_be32(f);
if (read_section_id != se->load_section_id) {
- error_report("Mismatched section id in footer for %s -"
- " read 0x%x expected 0x%x",
- se->idstr, read_section_id, se->load_section_id);
+ error_setg(errp, "Mismatched section id in footer for %s -"
+ " read 0x%x expected 0x%x",
+ se->idstr, read_section_id, se->load_section_id);
return false;
}
@@ -2418,8 +2418,7 @@ qemu_loadvm_section_start_full(QEMUFile *f,
MigrationIncomingState *mis,
" device '%s'", instance_id, idstr);
return -1;
}
- if (!check_section_footer(f, se)) {
- error_setg(errp, "failed check for device state section footer");
+ if (!check_section_footer(f, se, errp)) {
return -1;
}
@@ -2460,8 +2459,7 @@ qemu_loadvm_section_part_end(QEMUFile *f,
MigrationIncomingState *mis,
section_id, se->idstr);
return -1;
}
- if (!check_section_footer(f, se)) {
- error_setg(errp, "failed check for device state section footer");
+ if (!check_section_footer(f, se, errp)) {
return -1;
}
--
2.29.2
- Re: [PATCH 13/33] migration: push Error **errp into loadvm_postcopy_handle_run(), (continued)
- [PATCH 12/33] migration: push Error **errp into loadvm_postcopy_handle_listen(), Daniel P . Berrangé, 2021/02/04
- [PATCH 15/33] migration: make loadvm_postcopy_handle_resume() void, Daniel P . Berrangé, 2021/02/04
- [PATCH 14/33] migration: push Error **errp into loadvm_postcopy_ram_handle_discard(), Daniel P . Berrangé, 2021/02/04
- [PATCH 16/33] migration: push Error **errp into loadvm_handle_recv_bitmap(), Daniel P . Berrangé, 2021/02/04
- [PATCH 17/33] migration: push Error **errp into loadvm_process_enable_colo(), Daniel P . Berrangé, 2021/02/04
- [PATCH 18/33] migration: push Error **errp into colo_init_ram_cache(), Daniel P . Berrangé, 2021/02/04
- [PATCH 23/33] migration: simplify some error reporting in save_snapshot(), Daniel P . Berrangé, 2021/02/04
- [PATCH 19/33] migration: push Error **errp into check_section_footer(),
Daniel P . Berrangé <=
- [PATCH 21/33] migration: remove error reporting from qemu_fopen_bdrv() callers, Daniel P . Berrangé, 2021/02/04
- [PATCH 20/33] migration: push Error **errp into global_state_store(), Daniel P . Berrangé, 2021/02/04
- [PATCH 25/33] migration: push Error **errp into qemu_savevm_state_complete_precopy(), Daniel P . Berrangé, 2021/02/04
- [PATCH 22/33] migration: push Error **errp into qemu_savevm_state_iterate(), Daniel P . Berrangé, 2021/02/04
- [PATCH 28/33] migration: push Error **errp into qemu_savevm_send_packaged(), Daniel P . Berrangé, 2021/02/04
- [PATCH 31/33] migration: push Error **errp into qemu_savevm_state_resume_prepare(), Daniel P . Berrangé, 2021/02/04
- [PATCH 26/33] migration: push Error **errp into qemu_savevm_state_complete_precopy_non_iterable(), Daniel P . Berrangé, 2021/02/04
- [PATCH 32/33] migration: push Error **errp into postcopy_resume_handshake(), Daniel P . Berrangé, 2021/02/04
- [PATCH 27/33] migration: push Error **errp into qemu_savevm_state_complete_precopy(), Daniel P . Berrangé, 2021/02/04