@@ -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:
@@ -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.
@@ -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;
}
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.martins@oracle.com> --- qapi/migration.json | 16 +++++++++++++++- migration/migration.c | 5 +++++ migration/savevm.c | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-)