qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org, quintela@redhat.com, peterx@redhat.com
Cc: peter.maydell@linaro.org, cohuck@redhat.com, rth@twiddle.net
Subject: [Qemu-devel] [PATCH 4/5] migration: Route errors up through vmstate_save
Date: Tue, 19 Sep 2017 19:00:37 +0100	[thread overview]
Message-ID: <20170919180038.26056-5-dgilbert@redhat.com> (raw)
In-Reply-To: <20170919180038.26056-1-dgilbert@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Route the errors from vsmtate_save_state back up through
vmstate_save and out to the normal device state path.
That's the normal error path done.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 migration/savevm.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/migration/savevm.c b/migration/savevm.c
index 8d18a57ca0..c22a2fd758 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -751,14 +751,14 @@ static void vmstate_save_old_style(QEMUFile *f, SaveStateEntry *se, QJSON *vmdes
     }
 }
 
-static void vmstate_save(QEMUFile *f, SaveStateEntry *se, QJSON *vmdesc)
+static int vmstate_save(QEMUFile *f, SaveStateEntry *se, QJSON *vmdesc)
 {
     trace_vmstate_save(se->idstr, se->vmsd ? se->vmsd->name : "(old)");
     if (!se->vmsd) {
         vmstate_save_old_style(f, se, vmdesc);
-        return;
+        return 0;
     }
-    vmstate_save_state(f, se->vmsd, se->opaque, vmdesc);
+    return vmstate_save_state(f, se->vmsd, se->opaque, vmdesc);
 }
 
 /*
@@ -1147,7 +1147,11 @@ int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only,
         json_prop_int(vmdesc, "instance_id", se->instance_id);
 
         save_section_header(f, se, QEMU_VM_SECTION_FULL);
-        vmstate_save(f, se, vmdesc);
+        ret = vmstate_save(f, se, vmdesc);
+        if (ret) {
+            qemu_file_set_error(f, ret);
+            return ret;
+        }
         trace_savevm_section_end(se->idstr, se->section_id, 0);
         save_section_footer(f, se);
 
@@ -1289,6 +1293,8 @@ static int qemu_save_device_state(QEMUFile *f)
     cpu_synchronize_all_states();
 
     QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
+        int ret;
+
         if (se->is_ram) {
             continue;
         }
@@ -1301,7 +1307,10 @@ static int qemu_save_device_state(QEMUFile *f)
 
         save_section_header(f, se, QEMU_VM_SECTION_FULL);
 
-        vmstate_save(f, se, NULL);
+        ret = vmstate_save(f, se, NULL);
+        if (ret) {
+            return ret;
+        }
 
         save_section_footer(f, se);
     }
-- 
2.13.5

  parent reply	other threads:[~2017-09-19 18:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19 18:00 [Qemu-devel] [PATCH 0/5] migration: let pre_save fail Dr. David Alan Gilbert (git)
2017-09-19 18:00 ` [Qemu-devel] [PATCH 1/5] migration: pre_save return int Dr. David Alan Gilbert (git)
2017-09-20 13:57   ` Cornelia Huck
2017-09-20 14:32     ` Dr. David Alan Gilbert
2017-09-19 18:00 ` [Qemu-devel] [PATCH 2/5] migration: check pre_save return in vmstate_save_state Dr. David Alan Gilbert (git)
2017-09-19 18:00 ` [Qemu-devel] [PATCH 3/5] migration: wire vmstate_save_state errors up to vmstate_subsection_save Dr. David Alan Gilbert (git)
2017-09-19 18:00 ` Dr. David Alan Gilbert (git) [this message]
2017-09-19 18:00 ` [Qemu-devel] [PATCH 5/5] migration: Route more error paths Dr. David Alan Gilbert (git)
2017-09-20  3:31   ` Peter Xu
2017-09-20 15:45     ` Dr. David Alan Gilbert
2017-09-20  3:55   ` Fam Zheng
2017-09-20 13:26     ` Eric Blake
2017-09-20 14:20     ` Dr. David Alan Gilbert
2017-09-20 15:32       ` Eric Blake
2017-09-20 14:30   ` Cornelia Huck
2017-09-20 15:57     ` Dr. David Alan Gilbert
2017-09-20 16:00       ` Cornelia Huck

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=20170919180038.26056-5-dgilbert@redhat.com \
    --to=dgilbert@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=rth@twiddle.net \
    /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).