提交 76f5933a 编写于 作者: J Juan Quintela

migration: move beginning stage to the migration thread

Signed-off-by: NJuan Quintela <quintela@redhat.com>
Reviewed-by: NReviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 afe41931
...@@ -54,7 +54,6 @@ struct MigrationState ...@@ -54,7 +54,6 @@ struct MigrationState
bool enabled_capabilities[MIGRATION_CAPABILITY_MAX]; bool enabled_capabilities[MIGRATION_CAPABILITY_MAX];
int64_t xbzrle_cache_size; int64_t xbzrle_cache_size;
bool complete; bool complete;
bool first_time;
}; };
void process_incoming_migration(QEMUFile *f); void process_incoming_migration(QEMUFile *f);
......
...@@ -674,17 +674,6 @@ static bool migrate_fd_put_ready(MigrationState *s, uint64_t max_size) ...@@ -674,17 +674,6 @@ static bool migrate_fd_put_ready(MigrationState *s, uint64_t max_size)
qemu_mutex_unlock_iothread(); qemu_mutex_unlock_iothread();
return false; 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"); DPRINTF("iterate\n");
pending_size = qemu_savevm_state_pending(s->file, max_size); pending_size = qemu_savevm_state_pending(s->file, max_size);
...@@ -733,6 +722,17 @@ static void *buffered_file_thread(void *opaque) ...@@ -733,6 +722,17 @@ static void *buffered_file_thread(void *opaque)
int64_t initial_time = qemu_get_clock_ms(rt_clock); int64_t initial_time = qemu_get_clock_ms(rt_clock);
int64_t max_size = 0; int64_t max_size = 0;
bool last_round = false; 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) { while (true) {
int64_t current_time = qemu_get_clock_ms(rt_clock); int64_t current_time = qemu_get_clock_ms(rt_clock);
...@@ -768,6 +768,10 @@ static void *buffered_file_thread(void *opaque) ...@@ -768,6 +768,10 @@ static void *buffered_file_thread(void *opaque)
} }
} }
out:
if (ret < 0) {
migrate_fd_error(s);
}
g_free(s->buffer); g_free(s->buffer);
return NULL; return NULL;
} }
...@@ -789,8 +793,6 @@ void migrate_fd_connect(MigrationState *s) ...@@ -789,8 +793,6 @@ void migrate_fd_connect(MigrationState *s)
s->buffer_size = 0; s->buffer_size = 0;
s->buffer_capacity = 0; s->buffer_capacity = 0;
s->first_time = true;
s->xfer_limit = s->bandwidth_limit / XFER_LIMIT_RATIO; s->xfer_limit = s->bandwidth_limit / XFER_LIMIT_RATIO;
s->complete = false; s->complete = false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册