[v1,3/8] tests: migrate: simplify wait_active()

Submitted by Victor Toso on Oct. 7, 2019, 12:19 p.m.

Details

Message ID 20191007121935.22567-3-victortoso@redhat.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Victor Toso Oct. 7, 2019, 12:19 p.m.
From: Victor Toso <me@victortoso.com>

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>
---
 tests/migrate.py | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/tests/migrate.py b/tests/migrate.py
index f471ddfc..375e59a0 100755
--- a/tests/migrate.py
+++ b/tests/migrate.py
@@ -117,20 +117,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 ret.has_key("return"):
-            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):