mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
migration: Set downtime_start even for postcopy
Postcopy calculates its downtime separately. It always sets MigrationState.downtime properly, but not MigrationState.downtime_start. Make postcopy do the same as other modes on properly recording the timestamp when the VM is going to be stopped. Drop the temporary variable in postcopy_start() along the way. Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Message-ID: <20231030163346.765724-2-peterx@redhat.com>
This commit is contained in:
parent
c64a59552e
commit
62f5da7dd1
1 changed files with 3 additions and 2 deletions
|
@ -2126,7 +2126,6 @@ static int postcopy_start(MigrationState *ms, Error **errp)
|
||||||
int ret;
|
int ret;
|
||||||
QIOChannelBuffer *bioc;
|
QIOChannelBuffer *bioc;
|
||||||
QEMUFile *fb;
|
QEMUFile *fb;
|
||||||
int64_t time_at_stop = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
|
|
||||||
uint64_t bandwidth = migrate_max_postcopy_bandwidth();
|
uint64_t bandwidth = migrate_max_postcopy_bandwidth();
|
||||||
bool restart_block = false;
|
bool restart_block = false;
|
||||||
int cur_state = MIGRATION_STATUS_ACTIVE;
|
int cur_state = MIGRATION_STATUS_ACTIVE;
|
||||||
|
@ -2148,6 +2147,8 @@ static int postcopy_start(MigrationState *ms, Error **errp)
|
||||||
qemu_mutex_lock_iothread();
|
qemu_mutex_lock_iothread();
|
||||||
trace_postcopy_start_set_run();
|
trace_postcopy_start_set_run();
|
||||||
|
|
||||||
|
ms->downtime_start = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
|
||||||
|
|
||||||
qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, NULL);
|
qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, NULL);
|
||||||
global_state_store();
|
global_state_store();
|
||||||
ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
|
ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
|
||||||
|
@ -2250,7 +2251,7 @@ static int postcopy_start(MigrationState *ms, Error **errp)
|
||||||
ms->postcopy_after_devices = true;
|
ms->postcopy_after_devices = true;
|
||||||
migration_call_notifiers(ms);
|
migration_call_notifiers(ms);
|
||||||
|
|
||||||
ms->downtime = qemu_clock_get_ms(QEMU_CLOCK_REALTIME) - time_at_stop;
|
ms->downtime = qemu_clock_get_ms(QEMU_CLOCK_REALTIME) - ms->downtime_start;
|
||||||
|
|
||||||
qemu_mutex_unlock_iothread();
|
qemu_mutex_unlock_iothread();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue