aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2022-12-15 17:24:48 -0500
committerJuan Quintela <quintela@redhat.com>2023-02-06 19:22:56 +0100
commitdb18dee7d7b069653ae748d68d9d99313dde74c4 (patch)
treead31fe4c95342cd885826052f5948768a9da441a /migration
parentd71920d42548d2bad17544cb488b09cece81a821 (diff)
downloadqemu-db18dee7d7b069653ae748d68d9d99313dde74c4.zip
qemu-db18dee7d7b069653ae748d68d9d99313dde74c4.tar.gz
qemu-db18dee7d7b069653ae748d68d9d99313dde74c4.tar.bz2
migration: Show downtime during postcopy phase
The downtime should be displayed during postcopy phase because the switchover phase is done. OTOH it's weird to show "expected downtime" which can confuse what does that mean if the switchover has already happened anyway. This is a slight ABI change on QMP, but I assume it shouldn't affect anyone. Reviewed-by: Leonardo Bras <leobras@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/migration.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/migration/migration.c b/migration/migration.c
index f321e41..4f4d798 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1051,20 +1051,30 @@ bool migration_is_running(int state)
}
}
+static bool migrate_show_downtime(MigrationState *s)
+{
+ return (s->state == MIGRATION_STATUS_COMPLETED) || migration_in_postcopy();
+}
+
static void populate_time_info(MigrationInfo *info, MigrationState *s)
{
info->has_status = true;
info->has_setup_time = true;
info->setup_time = s->setup_time;
+
if (s->state == MIGRATION_STATUS_COMPLETED) {
info->has_total_time = true;
info->total_time = s->total_time;
- info->has_downtime = true;
- info->downtime = s->downtime;
} else {
info->has_total_time = true;
info->total_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME) -
s->start_time;
+ }
+
+ if (migrate_show_downtime(s)) {
+ info->has_downtime = true;
+ info->downtime = s->downtime;
+ } else {
info->has_expected_downtime = true;
info->expected_downtime = s->expected_downtime;
}