In addition to the start of switchover (previously @downtime_start), add other timestamps during saving of state and return path.
For precopy migration, it should be able to capture the principal steps of switchover. Resume-side downtime is sadly only possible when return path is enabled. Signed-off-by: Joao Martins <joao.m.mart...@oracle.com> --- qapi/migration.json | 16 +++++++++++++++- migration/migration.c | 5 +++++ migration/savevm.c | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/qapi/migration.json b/qapi/migration.json index b836cc881d33..2d91fbcb22ff 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -199,10 +199,24 @@ # @start:Timestamp taken at the start of the switchover right before # we stop the VM. # +# @stop: Timestamp taken after stopping the VM. +# +# @precopy-iterable: Timestamp taken after copying all iterable state +# in stop copy phase. +# +# @precopy-noniterable: Timestamp taken after copying all non iterable +# state in stop copy phase. +# +# @resume-return-path: Timestamp taken after return path has finished +# migration on destination. It is zero if +# 'return-path' is not enabled. +# # Since: 8.2 ## { 'enum': 'MigrationDowntime', - 'data': [ 'start' ] } + 'data': [ 'start', 'stop', 'precopy-iterable', 'precopy-noniterable', + 'resume-return-path' ] } + ## # @MigrationInfo: diff --git a/migration/migration.c b/migration/migration.c index dd955c61acc7..d06840024a1e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2348,6 +2348,8 @@ static void migration_completion(MigrationState *s) ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); trace_migration_completion_vm_stop(ret); + migration_set_timestamp(MIGRATION_DOWNTIME_STOP); + if (ret >= 0) { ret = migration_maybe_pause(s, ¤t_active_state, MIGRATION_STATUS_DEVICE); @@ -2401,6 +2403,7 @@ static void migration_completion(MigrationState *s) trace_migration_return_path_end_before(); rp_error = await_return_path_close_on_source(s); trace_migration_return_path_end_after(rp_error); + migration_set_timestamp(MIGRATION_DOWNTIME_RESUME_RETURN_PATH); if (rp_error) { goto fail; } @@ -3166,6 +3169,8 @@ static void *bg_migration_thread(void *opaque) if (vm_stop_force_state(RUN_STATE_PAUSED)) { goto fail; } + migration_set_timestamp(MIGRATION_DOWNTIME_STOP); + /* * Put vCPUs in sync with shadow context structures, then * save their state to channel-buffer along with devices. diff --git a/migration/savevm.c b/migration/savevm.c index bb3e99194c60..e93701ff2393 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1468,6 +1468,7 @@ int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postcopy) } } + migration_set_timestamp(MIGRATION_DOWNTIME_PRECOPY_ITERABLE); return 0; } @@ -1524,6 +1525,7 @@ int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f, json_writer_free(vmdesc); ms->vmdesc = NULL; + migration_set_timestamp(MIGRATION_DOWNTIME_PRECOPY_NONITERABLE); return 0; } -- 2.39.3