qemu_announce_self() were moved to vm_start(). This is because we may want to let guest to send the gratuitous packets. After this change, we need to check the previous run state (RUN_STATE_INMIGRATE) to decide whether an announcement is needed.
Signed-off-by: Jason Wang <jasow...@redhat.com> --- migration.c | 1 - vl.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/migration.c b/migration.c index 00fa1e3..1ce6b5c 100644 --- a/migration.c +++ b/migration.c @@ -88,7 +88,6 @@ void process_incoming_migration(QEMUFile *f) fprintf(stderr, "load of migration failed\n"); exit(0); } - qemu_announce_self(); DPRINTF("successfully loaded vm state\n"); /* Make sure all file formats flush their mutable metadata */ diff --git a/vl.c b/vl.c index 65f11f2..4742b1b 100644 --- a/vl.c +++ b/vl.c @@ -1261,11 +1261,15 @@ void vm_state_notify(int running, RunState state) void vm_start(void) { if (!runstate_is_running()) { + RunState prev_run_state = current_run_state; cpu_enable_ticks(); runstate_set(RUN_STATE_RUNNING); vm_state_notify(1, RUN_STATE_RUNNING); resume_all_vcpus(); monitor_protocol_event(QEVENT_RESUME, NULL); + if (prev_run_state == RUN_STATE_INMIGRATE) { + qemu_announce_self(); + } } }