Skip to content

Commit fca9aef

Browse files
xzpeterFabiano Rosas
authored andcommitted
migration/block: Make late-block-active the default
Migration capability 'late-block-active' controls when the block drives will be activated. If enabled, block drives will only be activated until VM starts, either src runstate was "live" (RUNNING, or SUSPENDED), or it'll be postponed until qmp_cont(). Let's do this unconditionally. There's no harm to delay activation of block drives. Meanwhile there's no ABI breakage if dest does it, because src QEMU has nothing to do with it, so it's no concern on ABI breakage. IIUC we could avoid introducing this cap when introducing it before, but now it's still not too late to just always do it. Cap now prone to removal, but it'll be for later patches. Signed-off-by: Peter Xu <[email protected]> Reviewed-by: Fabiano Rosas <[email protected]> Message-Id: <[email protected]> Signed-off-by: Fabiano Rosas <[email protected]>
1 parent e4e5e89 commit fca9aef

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

migration/migration.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -743,24 +743,6 @@ static void process_incoming_migration_bh(void *opaque)
743743

744744
trace_vmstate_downtime_checkpoint("dst-precopy-bh-enter");
745745

746-
/* If capability late_block_activate is set:
747-
* Only fire up the block code now if we're going to restart the
748-
* VM, else 'cont' will do it.
749-
* This causes file locking to happen; so we don't want it to happen
750-
* unless we really are starting the VM.
751-
*/
752-
if (!migrate_late_block_activate() ||
753-
(autostart && runstate_is_live(migration_get_target_runstate()))) {
754-
/* Make sure all file formats throw away their mutable metadata.
755-
* If we get an error here, just don't restart the VM yet. */
756-
bdrv_activate_all(&local_err);
757-
if (local_err) {
758-
error_report_err(local_err);
759-
local_err = NULL;
760-
autostart = false;
761-
}
762-
}
763-
764746
/*
765747
* This must happen after all error conditions are dealt with and
766748
* we're sure the VM is going to be running on this host.
@@ -775,7 +757,25 @@ static void process_incoming_migration_bh(void *opaque)
775757

776758
if (runstate_is_live(migration_get_target_runstate())) {
777759
if (autostart) {
778-
vm_start();
760+
/*
761+
* Block activation is always delayed until VM starts, either
762+
* here (which means we need to start the dest VM right now..),
763+
* or until qmp_cont() later.
764+
*
765+
* We used to have cap 'late-block-activate' but now we do this
766+
* unconditionally, as it has no harm but only benefit. E.g.,
767+
* it's not part of migration ABI on the time of disk activation.
768+
*
769+
* Make sure all file formats throw away their mutable
770+
* metadata. If error, don't restart the VM yet.
771+
*/
772+
bdrv_activate_all(&local_err);
773+
if (local_err) {
774+
error_report_err(local_err);
775+
local_err = NULL;
776+
} else {
777+
vm_start();
778+
}
779779
} else {
780780
runstate_set(RUN_STATE_PAUSED);
781781
}

0 commit comments

Comments
 (0)