diff options
author | Victor Toso <me@victortoso.com> | 2019-09-30 11:22:37 +0200 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2020-03-04 16:09:37 +0000 |
commit | 57af035749fb9cddad001c27b530c4030249a056 (patch) | |
tree | eef3a85a78e154578f6a0e8dee866bea29eb4629 /tests | |
parent | f75236bf423bc400bda8c4ad409c44b09bd080d4 (diff) |
migrate.py: simplify wait_active()
We are only interested in the running state of qmp (or VCPUS) here
which is what we check. Moving this check to the try branch allows
removing some extra checks.
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/migrate.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/tests/migrate.py b/tests/migrate.py index a1478ce9..ef7d4f79 100755 --- a/tests/migrate.py +++ b/tests/migrate.py @@ -129,20 +129,16 @@ def start_client(client, spice_port): return Popen(client_cmd.split(), executable=client) def wait_active(q, active): - events = ["RESUME"] if active else ["STOP"] while True: try: ret = q.cmd("query-status") + if ret["return"]["running"] == active: + break except: # ValueError time.sleep(0.1) continue - if ret and "return" in ret.keys(): - if ret["return"]["running"] == active: - break - for e in q.get_events(): - if e["event"] in events: - break + time.sleep(0.5) def wait_for_event(q, event): |