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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Victor Toso <me@xxxxxxxxxxxxxx>

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

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):
-- 
2.21.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]