aboutsummaryrefslogtreecommitdiff
path: root/savevm.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2011-10-19 15:22:18 +0200
committerJuan Quintela <quintela@redhat.com>2011-10-20 13:23:52 +0200
commit2975725f6b3d634dbe924ea9d9f4d86b8a5b217d (patch)
treef6a28a67ab95c169cedd0aa237a45cf4e438c28a /savevm.c
parent42802d47dd09c6e70763676bb2ba59136427ec6a (diff)
migration: make *save_live return errors
Make *save_live() return negative values when there is one error, and updates all callers to check for the error. Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'savevm.c')
-rw-r--r--savevm.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/savevm.c b/savevm.c
index 5b340b695f..9e9c7835a0 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1534,7 +1534,11 @@ int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable,
qemu_put_be32(f, se->instance_id);
qemu_put_be32(f, se->version_id);
- se->save_live_state(mon, f, QEMU_VM_SECTION_START, se->opaque);
+ ret = se->save_live_state(mon, f, QEMU_VM_SECTION_START, se->opaque);
+ if (ret < 0) {
+ qemu_savevm_state_cancel(mon, f);
+ return ret;
+ }
}
ret = qemu_file_get_error(f);
if (ret != 0) {
@@ -1565,7 +1569,7 @@ int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f)
qemu_put_be32(f, se->section_id);
ret = se->save_live_state(mon, f, QEMU_VM_SECTION_PART, se->opaque);
- if (!ret) {
+ if (ret <= 0) {
/* Do not proceed to the next vmstate before this one reported
completion of the current stage. This serializes the migration
and reduces the probability that a faster changing state is
@@ -1586,6 +1590,7 @@ int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f)
int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f)
{
SaveStateEntry *se;
+ int ret;
cpu_synchronize_all_states();
@@ -1597,7 +1602,10 @@ int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f)
qemu_put_byte(f, QEMU_VM_SECTION_END);
qemu_put_be32(f, se->section_id);
- se->save_live_state(mon, f, QEMU_VM_SECTION_END, se->opaque);
+ ret = se->save_live_state(mon, f, QEMU_VM_SECTION_END, se->opaque);
+ if (ret < 0) {
+ return ret;
+ }
}
QTAILQ_FOREACH(se, &savevm_handlers, entry) {