aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2017-05-22 17:10:38 +0200
committerKevin Wolf <kwolf@redhat.com>2017-06-09 11:45:03 +0200
commitf07fa4cbf0b16426dc5a03d4e13943143eaeb1ce (patch)
tree1e09dd4101e026bc550540e890dbb8b001029422 /migration
parent93c26503e01808bfb8cea3c25eae5be63147380e (diff)
downloadqemu-f07fa4cbf0b16426dc5a03d4e13943143eaeb1ce.zip
qemu-f07fa4cbf0b16426dc5a03d4e13943143eaeb1ce.tar.gz
qemu-f07fa4cbf0b16426dc5a03d4e13943143eaeb1ce.tar.bz2
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>
Diffstat (limited to 'migration')
-rw-r--r--migration/migration.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/migration/migration.c b/migration/migration.c
index 6f0705a..fc95acb 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1825,17 +1825,19 @@ static void migration_completion(MigrationState *s, int current_active_state,
if (!ret) {
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
* we will go into COLO stage later.
*/
if (ret >= 0 && !migrate_colo_enabled()) {
ret = bdrv_inactivate_all();
- }
- 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;
+ if (ret >= 0) {
+ s->block_inactive = true;
+ }
}
}
qemu_mutex_unlock_iothread();