summaryrefslogtreecommitdiff
path: root/migration.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2011-09-13 15:11:38 +0200
committerJuan Quintela <quintela@redhat.com>2011-10-20 13:23:51 +0200
commitc0b2ba46c5ceb806a1639bb86b0b457309674b23 (patch)
treed88ae0dcdad2cd4423ea771ca3f567e7e7073481 /migration.c
parent3a230256e8418f5cc9761f36feb6952d7ca38d73 (diff)
downloadqemu-c0b2ba46c5ceb806a1639bb86b0b457309674b23.tar.gz
qemu-c0b2ba46c5ceb806a1639bb86b0b457309674b23.tar.bz2
qemu-c0b2ba46c5ceb806a1639bb86b0b457309674b23.zip
migration: simplify state assignmente
Once there, make sure that if we already know that there is one error, just call migration_fd_cleanup() with the ERROR state. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'migration.c')
-rw-r--r--migration.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/migration.c b/migration.c
index 77a51adc5b..7fd6c23fa5 100644
--- a/migration.c
+++ b/migration.c
@@ -371,7 +371,6 @@ void migrate_fd_put_ready(void *opaque)
DPRINTF("iterate\n");
if (qemu_savevm_state_iterate(s->mon, s->file) == 1) {
- int state;
int old_vm_running = runstate_is_running();
DPRINTF("done iterating\n");
@@ -381,20 +380,18 @@ void migrate_fd_put_ready(void *opaque)
if (old_vm_running) {
vm_start();
}
- state = MIG_STATE_ERROR;
- } else {
- state = MIG_STATE_COMPLETED;
+ s->state = MIG_STATE_ERROR;
}
if (migrate_fd_cleanup(s) < 0) {
if (old_vm_running) {
vm_start();
}
- state = MIG_STATE_ERROR;
+ s->state = MIG_STATE_ERROR;
}
- if (state == MIG_STATE_COMPLETED) {
+ if (s->state == MIG_STATE_ACTIVE) {
+ s->state = MIG_STATE_COMPLETED;
runstate_set(RUN_STATE_POSTMIGRATE);
}
- s->state = state;
notifier_list_notify(&migration_state_notifiers, NULL);
}
}