If the value returned from a monitor method call is a string, treat it as
human monitor output.  Otherwise treat it as QMP output.

Signed-off-by: Michael Goldish <mgold...@redhat.com>
---
 client/tests/kvm/kvm_test_utils.py |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/client/tests/kvm/kvm_test_utils.py 
b/client/tests/kvm/kvm_test_utils.py
index c3b6b8a..9fdea87 100644
--- a/client/tests/kvm/kvm_test_utils.py
+++ b/client/tests/kvm/kvm_test_utils.py
@@ -120,15 +120,24 @@ def migrate(vm, env=None):
     # Helper functions
     def mig_finished():
         o = vm.monitor.info("migrate")
-        return "status: active" not in o
+        if isinstance(o, str):
+            return "status: active" not in o
+        else:
+            return o.get("status") != "active"
 
     def mig_succeeded():
         o = vm.monitor.info("migrate")
-        return "status: completed" in o
+        if isinstance(o, str):
+            return "status: completed" in o
+        else:
+            return o.get("status") == "completed"
 
     def mig_failed():
         o = vm.monitor.info("migrate")
-        return "status: failed" in o
+        if isinstance(o, str):
+            return "status: failed" in o
+        else:
+            return o.get("status") == "failed"
 
     # Clone the source VM and ask the clone to wait for incoming migration
     dest_vm = vm.clone()
-- 
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to