summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVictor Toso <me@victortoso.com>2019-09-30 11:22:37 +0200
committerFrediano Ziglio <fziglio@redhat.com>2020-03-04 16:09:37 +0000
commit57af035749fb9cddad001c27b530c4030249a056 (patch)
treeeef3a85a78e154578f6a0e8dee866bea29eb4629 /tests
parentf75236bf423bc400bda8c4ad409c44b09bd080d4 (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-xtests/migrate.py10
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):