qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: peterx@redhat.com, farosas@suse.de
Subject: [PATCH 3/3] migration/postcopy-ram: Improve error reporting after loadvm failure
Date: Sat, 15 Nov 2025 09:35:00 +0100	[thread overview]
Message-ID: <20251115083500.2753895-4-armbru@redhat.com> (raw)
In-Reply-To: <20251115083500.2753895-1-armbru@redhat.com>

One of two error messages show __func__.  Drop it; it doesn't help
users, and developers can grep for the message.  This also permits
de-duplicating the code to prepend to the error message.

Both error messages show a numeric error code.  I doubt that's
helpful, but I'm leaving it alone.

Use error_append_hint() for explaining that some dirty bitmaps may be
lost.  Polish the prose.

Don't faff around with g_clear_pointer(), it's not worth its keep
here.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 migration/postcopy-ram.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 3f98dcb6fd..7c9fe61041 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -2146,25 +2146,24 @@ static void *postcopy_listen_thread(void *opaque)
     if (load_res < 0) {
         qemu_file_set_error(f, load_res);
         dirty_bitmap_mig_cancel_incoming();
+        error_prepend(&local_err,
+                      "loadvm failed during postcopy: %d: ", load_res);
         if (postcopy_state_get() == POSTCOPY_INCOMING_RUNNING &&
             !migrate_postcopy_ram() && migrate_dirty_bitmaps())
         {
-            error_report("%s: loadvm failed during postcopy: %d: %s. All states "
-                         "are migrated except dirty bitmaps. Some dirty "
-                         "bitmaps may be lost, and present migrated dirty "
-                         "bitmaps are correctly migrated and valid.",
-                         __func__, load_res, error_get_pretty(local_err));
-            g_clear_pointer(&local_err, error_free);
+            error_append_hint(&local_err,
+                              "All state is migrated except dirty bitmaps."
+                              " Some dirty bitmaps may be lost, but any"
+                              " migrated dirty bitmaps are valid.");
+            error_report_err(local_err);
         } else {
             /*
              * Something went fatally wrong and we have a bad state, QEMU will
              * exit depending on if postcopy-exit-on-error is true, but the
              * migration cannot be recovered.
              */
-            error_prepend(&local_err,
-                          "loadvm failed during postcopy: %d: ", load_res);
             migrate_set_error(migr, local_err);
-            g_clear_pointer(&local_err, error_report_err);
+            error_report_err(local_err);
             migrate_set_state(&mis->state, mis->state, MIGRATION_STATUS_FAILED);
             goto out;
         }
-- 
2.49.0



  parent reply	other threads:[~2025-11-15  9:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-15  8:34 [PATCH 0/3] migration: Error fixes and improvements Markus Armbruster
2025-11-15  8:34 ` [PATCH 1/3] migration: Plug memory leaks after migrate_set_error() Markus Armbruster
2025-11-15  8:34 ` [PATCH 2/3] migration: Use warn_reportf_err() where appropriate Markus Armbruster
2025-11-17 15:47   ` Fabiano Rosas
2025-11-15  8:35 ` Markus Armbruster [this message]
2025-11-17 15:50   ` [PATCH 3/3] migration/postcopy-ram: Improve error reporting after loadvm failure Fabiano Rosas
2025-11-17 16:03 ` [PATCH 0/3] migration: Error fixes and improvements Peter Xu
2025-11-18  7:44   ` Markus Armbruster
2025-11-18 17:35     ` Peter Xu
2025-11-19  7:45       ` Markus Armbruster
2025-11-19 20:58         ` Peter Xu
2025-11-20 10:30           ` Migration and the Job abstraction (was: [PATCH 0/3] migration: Error fixes and improvements) Markus Armbruster
2025-11-20 12:16             ` Kevin Wolf
2025-11-21 12:38           ` [PATCH 0/3] migration: Error fixes and improvements Fabiano Rosas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251115083500.2753895-4-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=farosas@suse.de \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).