Commit b161d123e77ffbd6ee96edcfb8a02541c5e9439b

Authored by aliguori
1 parent 3dd1f8ef

propagate error on failed completion (Glauber Costa)

migrate_fd_put_ready() calls qemu_savevm_state_complete(),
but the later can fail.

If it happens, re-start the vm and propagate the error up

Based on a patch by Yaniv Kamay

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6997 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 8 additions and 2 deletions
migration.c
@@ -220,13 +220,19 @@ void migrate_fd_put_ready(void *opaque) @@ -220,13 +220,19 @@ void migrate_fd_put_ready(void *opaque)
220 220
221 dprintf("iterate\n"); 221 dprintf("iterate\n");
222 if (qemu_savevm_state_iterate(s->file) == 1) { 222 if (qemu_savevm_state_iterate(s->file) == 1) {
  223 + int state;
223 dprintf("done iterating\n"); 224 dprintf("done iterating\n");
224 vm_stop(0); 225 vm_stop(0);
225 226
226 bdrv_flush_all(); 227 bdrv_flush_all();
227 - qemu_savevm_state_complete(s->file);  
228 - s->state = MIG_STATE_COMPLETED; 228 + if ((qemu_savevm_state_complete(s->file)) < 0) {
  229 + vm_start();
  230 + state = MIG_STATE_ERROR;
  231 + } else {
  232 + state = MIG_STATE_COMPLETED;
  233 + }
229 migrate_fd_cleanup(s); 234 migrate_fd_cleanup(s);
  235 + s->state = state;
230 } 236 }
231 } 237 }
232 238