diff options
author | Juan Quintela <quintela@redhat.com> | 2012-10-03 20:16:24 +0200 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2013-01-17 13:54:18 +0100 |
commit | 76f5933aea281a52149b39a1a78a43565dc9715c (patch) | |
tree | a09d2ef823d194f80e7a2f91698708f210831308 /migration.c | |
parent | afe419319de1e5e98b131368ba14f85f98ab3a76 (diff) | |
download | qemu-76f5933aea281a52149b39a1a78a43565dc9715c.tar.gz qemu-76f5933aea281a52149b39a1a78a43565dc9715c.tar.bz2 qemu-76f5933aea281a52149b39a1a78a43565dc9715c.zip |
migration: move beginning stage to the migration thread
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'migration.c')
-rw-r--r-- | migration.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/migration.c b/migration.c index 380f3cb618..7ae1d939d6 100644 --- a/migration.c +++ b/migration.c @@ -674,17 +674,6 @@ static bool migrate_fd_put_ready(MigrationState *s, uint64_t max_size) qemu_mutex_unlock_iothread(); return false; } - if (s->first_time) { - s->first_time = false; - DPRINTF("beginning savevm\n"); - ret = qemu_savevm_state_begin(s->file, &s->params); - if (ret < 0) { - DPRINTF("failed, %d\n", ret); - migrate_fd_error(s); - qemu_mutex_unlock_iothread(); - return false; - } - } DPRINTF("iterate\n"); pending_size = qemu_savevm_state_pending(s->file, max_size); @@ -733,6 +722,17 @@ static void *buffered_file_thread(void *opaque) int64_t initial_time = qemu_get_clock_ms(rt_clock); int64_t max_size = 0; bool last_round = false; + int ret; + + qemu_mutex_lock_iothread(); + DPRINTF("beginning savevm\n"); + ret = qemu_savevm_state_begin(s->file, &s->params); + if (ret < 0) { + DPRINTF("failed, %d\n", ret); + qemu_mutex_unlock_iothread(); + goto out; + } + qemu_mutex_unlock_iothread(); while (true) { int64_t current_time = qemu_get_clock_ms(rt_clock); @@ -768,6 +768,10 @@ static void *buffered_file_thread(void *opaque) } } +out: + if (ret < 0) { + migrate_fd_error(s); + } g_free(s->buffer); return NULL; } @@ -789,8 +793,6 @@ void migrate_fd_connect(MigrationState *s) s->buffer_size = 0; s->buffer_capacity = 0; - s->first_time = true; - s->xfer_limit = s->bandwidth_limit / XFER_LIMIT_RATIO; s->complete = false; |