diff options
author | Juan Quintela <quintela@redhat.com> | 2011-02-22 23:32:54 +0100 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2011-10-20 13:23:53 +0200 |
commit | 458cf28e6b01ff9b87a20d199d42b1c1c904cd29 (patch) | |
tree | 7b560cabe08e0f78b626b46eba843332742ca623 /migration.c | |
parent | 67afff79111f0ce1ae20010c27a30b5ec61f362c (diff) | |
download | qemu-458cf28e6b01ff9b87a20d199d42b1c1c904cd29.tar.gz qemu-458cf28e6b01ff9b87a20d199d42b1c1c904cd29.tar.bz2 qemu-458cf28e6b01ff9b87a20d199d42b1c1c904cd29.zip |
migration: Introduce migrate_fd_completed() for consistency
This function is a bit different of the others that change the state,
in the sense that if migrate_fd_cleanup() returns an error, it set the
status to error, not completed.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration.c')
-rw-r--r-- | migration.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/migration.c b/migration.c index ee4ef4ba6f..a7c7b41b61 100644 --- a/migration.c +++ b/migration.c @@ -317,6 +317,18 @@ void migrate_fd_error(MigrationState *s) migrate_fd_cleanup(s); } +static void migrate_fd_completed(MigrationState *s) +{ + DPRINTF("setting completed state\n"); + if (migrate_fd_cleanup(s) < 0) { + s->state = MIG_STATE_ERROR; + } else { + s->state = MIG_STATE_COMPLETED; + runstate_set(RUN_STATE_POSTMIGRATE); + } + notifier_list_notify(&migration_state_notifiers, NULL); +} + static void migrate_fd_put_notify(void *opaque) { MigrationState *s = opaque; @@ -375,13 +387,7 @@ static void migrate_fd_put_ready(void *opaque) if (qemu_savevm_state_complete(s->mon, s->file) < 0) { migrate_fd_error(s); } else { - if (migrate_fd_cleanup(s) < 0) { - migrate_fd_error(s); - } else { - s->state = MIG_STATE_COMPLETED; - runstate_set(RUN_STATE_POSTMIGRATE); - notifier_list_notify(&migration_state_notifiers, NULL); - } + migrate_fd_completed(s); } if (s->get_status(s) != MIG_STATE_COMPLETED) { if (old_vm_running) { |