migrate.py: fix events race

Currently, when we run migrate.py with --client option we get stuck
waiting for SPICE_CONNECTED event on target qmp (while receiving only
QMP). Problem is, only after event SPICE_INITIALIZED in the source qmp
is that the client will be able to do migration (to properly exchange
spice messages).

So, it is a must that if we have a test where a client is connected,
to wait for SPICE_INITIALIZED event in the source qmp.

To clarify, this patches fixes the following test:

    ./migrate.py --client spicy

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
This commit is contained in:
Victor Toso 2019-10-04 15:26:09 +02:00 committed by Frediano Ziglio
parent b8c1926608
commit b124ebe53e

View File

@ -209,7 +209,7 @@ class Migrator(object):
raw_input()
# Tester can launch its own client or we wait start_client() to connect
if wait_user_connect:
if self.connected_client or wait_user_connect:
wait_for_event(self.active.qmp, 'SPICE_INITIALIZED')
self.active.qmp.cmd('client_migrate_info', {'protocol':'spice',