migration/colo.c: Move colo_notify_compares_event to the right place

If the secondary has to failover during checkpointing, it still is
in the old state (i.e. different state than primary). Thus we can't
expose the primary state until after the checkpoint is sent.

This fixes sporadic connection reset of client connections during
failover.

Signed-off-by: Lukas Straub <lukasstraub2@web.de>
Message-Id: <d4555dd5146a54518c4d9d4efd996b7c745c6687.1589193382.git.lukasstraub2@web.de>
Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
Lukas Straub 2020-05-11 13:11:01 +02:00 committed by Dr. David Alan Gilbert
parent 92c932de6c
commit 4fa8ed25b8

View File

@ -436,12 +436,6 @@ static int colo_do_checkpoint_transaction(MigrationState *s,
goto out; goto out;
} }
qemu_event_reset(&s->colo_checkpoint_event);
colo_notify_compares_event(NULL, COLO_EVENT_CHECKPOINT, &local_err);
if (local_err) {
goto out;
}
/* Disable block migration */ /* Disable block migration */
migrate_set_block_enabled(false, &local_err); migrate_set_block_enabled(false, &local_err);
if (local_err) { if (local_err) {
@ -503,6 +497,12 @@ static int colo_do_checkpoint_transaction(MigrationState *s,
goto out; goto out;
} }
qemu_event_reset(&s->colo_checkpoint_event);
colo_notify_compares_event(NULL, COLO_EVENT_CHECKPOINT, &local_err);
if (local_err) {
goto out;
}
colo_receive_check_message(s->rp_state.from_dst_file, colo_receive_check_message(s->rp_state.from_dst_file,
COLO_MESSAGE_VMSTATE_LOADED, &local_err); COLO_MESSAGE_VMSTATE_LOADED, &local_err);
if (local_err) { if (local_err) {