Commit eeb34af986c28b8da4001d947d66e2efaaad0e66

Authored by Anthony Liguori
1 parent 1889465a

Make sure to only vm_start() a failed migration if we were running to begin

with.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing 1 changed file with 5 additions and 1 deletions
migration.c
@@ -261,12 +261,16 @@ void migrate_fd_put_ready(void *opaque) @@ -261,12 +261,16 @@ void migrate_fd_put_ready(void *opaque)
261 dprintf("iterate\n"); 261 dprintf("iterate\n");
262 if (qemu_savevm_state_iterate(s->file) == 1) { 262 if (qemu_savevm_state_iterate(s->file) == 1) {
263 int state; 263 int state;
  264 + int old_vm_running = vm_running;
  265 +
264 dprintf("done iterating\n"); 266 dprintf("done iterating\n");
265 vm_stop(0); 267 vm_stop(0);
266 268
267 bdrv_flush_all(); 269 bdrv_flush_all();
268 if ((qemu_savevm_state_complete(s->file)) < 0) { 270 if ((qemu_savevm_state_complete(s->file)) < 0) {
269 - vm_start(); 271 + if (old_vm_running) {
  272 + vm_start();
  273 + }
270 state = MIG_STATE_ERROR; 274 state = MIG_STATE_ERROR;
271 } else { 275 } else {
272 state = MIG_STATE_COMPLETED; 276 state = MIG_STATE_COMPLETED;