migration: Inactivate images after .save_live_complete_precopy()
Block migration may still access the image during its .save_live_complete_precopy() implementation, so we should only inactivate the image afterwards. Another reason for the change is that inactivating an image fails when there is still a non-device BlockBackend using it, which includes the BBs used by block migration. We want to give block migration a chance to release the BBs before trying to inactivate the image (this will be done in another patch). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com>
This commit is contained in:
parent
93c26503e0
commit
f07fa4cbf0
|
@ -1825,19 +1825,21 @@ static void migration_completion(MigrationState *s, int current_active_state,
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
|
ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
|
||||||
|
if (ret >= 0) {
|
||||||
|
qemu_file_set_rate_limit(s->to_dst_file, INT64_MAX);
|
||||||
|
qemu_savevm_state_complete_precopy(s->to_dst_file, false);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Don't mark the image with BDRV_O_INACTIVE flag if
|
* Don't mark the image with BDRV_O_INACTIVE flag if
|
||||||
* we will go into COLO stage later.
|
* we will go into COLO stage later.
|
||||||
*/
|
*/
|
||||||
if (ret >= 0 && !migrate_colo_enabled()) {
|
if (ret >= 0 && !migrate_colo_enabled()) {
|
||||||
ret = bdrv_inactivate_all();
|
ret = bdrv_inactivate_all();
|
||||||
}
|
|
||||||
if (ret >= 0) {
|
if (ret >= 0) {
|
||||||
qemu_file_set_rate_limit(s->to_dst_file, INT64_MAX);
|
|
||||||
qemu_savevm_state_complete_precopy(s->to_dst_file, false);
|
|
||||||
s->block_inactive = true;
|
s->block_inactive = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
qemu_mutex_unlock_iothread();
|
qemu_mutex_unlock_iothread();
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
Loading…
Reference in a new issue