summaryrefslogtreecommitdiffstats
path: root/migration
diff options
context:
space:
mode:
authorDr. David Alan Gilbert2017-09-25 13:29:13 +0200
committerDr. David Alan Gilbert2017-09-27 12:36:31 +0200
commit551dbd0846d23e94dbc22dcfd9cf1f8dbbf403ad (patch)
tree7b2a5051afb4fd7e10ab4229c43d1ad7e421dae1 /migration
parentmigration: pre_save return int (diff)
downloadqemu-551dbd0846d23e94dbc22dcfd9cf1f8dbbf403ad.tar.gz
qemu-551dbd0846d23e94dbc22dcfd9cf1f8dbbf403ad.tar.xz
qemu-551dbd0846d23e94dbc22dcfd9cf1f8dbbf403ad.zip
migration: check pre_save return in vmstate_save_state
Check the return value of pre_save state and fail vmstate_save_state if the pre_save failed. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20170925112917.21340-3-dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/trace-events1
-rw-r--r--migration/vmstate.c12
2 files changed, 11 insertions, 2 deletions
diff --git a/migration/trace-events b/migration/trace-events
index d2910a6e7b..6f29fcc686 100644
--- a/migration/trace-events
+++ b/migration/trace-events
@@ -40,6 +40,7 @@ savevm_state_iterate(void) ""
savevm_state_cleanup(void) ""
savevm_state_complete_precopy(void) ""
vmstate_save(const char *idstr, const char *vmsd_name) "%s, %s"
+vmstate_save_state_pre_save_res(const char *name, int res) "%s/%d"
vmstate_save_state_loop(const char *name, const char *field, int n_elems) "%s/%s[%d]"
vmstate_save_state_top(const char *idstr) "%s"
vmstate_subsection_save_loop(const char *name, const char *sub) "%s/%s"
diff --git a/migration/vmstate.c b/migration/vmstate.c
index 3226e8eb45..ae8abd3c32 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -308,15 +308,21 @@ bool vmstate_save_needed(const VMStateDescription *vmsd, void *opaque)
}
-void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
+int vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
void *opaque, QJSON *vmdesc)
{
+ int ret = 0;
VMStateField *field = vmsd->fields;
trace_vmstate_save_state_top(vmsd->name);
if (vmsd->pre_save) {
- vmsd->pre_save(opaque);
+ ret = vmsd->pre_save(opaque);
+ trace_vmstate_save_state_pre_save_res(vmsd->name, ret);
+ if (ret) {
+ error_report("pre-save failed: %s", vmsd->name);
+ return ret;
+ }
}
if (vmdesc) {
@@ -381,6 +387,8 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
}
vmstate_subsection_save(f, vmsd, opaque, vmdesc);
+
+ return 0;
}
static const VMStateDescription *