[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 12/38] migration: Fix !replay_can_snapshot() erro
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH v3 12/38] migration: Fix !replay_can_snapshot() error handling |
Date: |
Tue, 16 Oct 2018 19:41:32 +0200 |
Calling error_report() in a function that takes an Error ** argument
is suspicious. save_snapshot() and load_snapshot() do that, and then
fail without setting an error. Wrong. The HMP commands survive this
unscathed, since hmp_handle_error() does nothing when no error has
been set. Callers main() (on behalf of -loadvm) and
replay_vmstate_init() crash, but I'm not sure the error is possible
there.
Screwed up when commit 377b21ccea1 (v2.12.0) added incorrect error
handling right next to correct examples. Fix by calling error_setg()
instead of error_report().
Fixes: 377b21ccea1755a8b0dae822c29567c58dda6939
Cc: Paolo Bonzini <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
---
migration/savevm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/migration/savevm.c b/migration/savevm.c
index 2d10e45582..5f8eb38676 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2414,8 +2414,8 @@ int save_snapshot(const char *name, Error **errp)
AioContext *aio_context;
if (!replay_can_snapshot()) {
- error_report("Record/replay does not allow making snapshot "
- "right now. Try once more later.");
+ error_setg(errp, "Record/replay does not allow making snapshot "
+ "right now. Try once more later.");
return ret;
}
@@ -2611,8 +2611,8 @@ int load_snapshot(const char *name, Error **errp)
MigrationIncomingState *mis = migration_incoming_get_current();
if (!replay_can_snapshot()) {
- error_report("Record/replay does not allow loading snapshot "
- "right now. Try once more later.");
+ error_setg(errp, "Record/replay does not allow loading snapshot "
+ "right now. Try once more later.");
return -EINVAL;
}
--
2.17.1
- [Qemu-devel] [PATCH v3 00/38] Replace some unwise uses of error_report() & friends, Markus Armbruster, 2018/10/16
- [Qemu-devel] [PATCH v3 12/38] migration: Fix !replay_can_snapshot() error handling,
Markus Armbruster <=
- [Qemu-devel] [PATCH v3 08/38] 9pfs: Fix CLI parsing crash on error, Markus Armbruster, 2018/10/16
- [Qemu-devel] [PATCH v3 09/38] pc: Fix machine property nvdimm-persistence error handling, Markus Armbruster, 2018/10/16
- [Qemu-devel] [PATCH v3 05/38] vfio: Use warn_report() & friends to report warnings, Markus Armbruster, 2018/10/16
- [Qemu-devel] [PATCH v3 01/38] error: Fix use of error_prepend() with &error_fatal, &error_abort, Markus Armbruster, 2018/10/16
- [Qemu-devel] [PATCH v3 03/38] block: Use warn_report() & friends to report warnings, Markus Armbruster, 2018/10/16
- [Qemu-devel] [PATCH v3 18/38] vl: Clean up error reporting in parse_add_fd(), Markus Armbruster, 2018/10/16
- [Qemu-devel] [PATCH v3 07/38] char: Use error_printf() to print help and such, Markus Armbruster, 2018/10/16