From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Goldish Subject: [KVM-AUTOTEST PATCH 14/14] KVM test: migration: support QMP Date: Sun, 13 Jun 2010 17:33:45 +0300 Message-ID: <1276439625-32472-14-git-send-email-mgoldish@redhat.com> References: <1276439625-32472-1-git-send-email-mgoldish@redhat.com> <1276439625-32472-2-git-send-email-mgoldish@redhat.com> <1276439625-32472-3-git-send-email-mgoldish@redhat.com> <1276439625-32472-4-git-send-email-mgoldish@redhat.com> <1276439625-32472-5-git-send-email-mgoldish@redhat.com> <1276439625-32472-6-git-send-email-mgoldish@redhat.com> <1276439625-32472-7-git-send-email-mgoldish@redhat.com> <1276439625-32472-8-git-send-email-mgoldish@redhat.com> <1276439625-32472-9-git-send-email-mgoldish@redhat.com> <1276439625-32472-10-git-send-email-mgoldish@redhat.com> <1276439625-32472-11-git-send-email-mgoldish@redhat.com> <1276439625-32472-12-git-send-email-mgoldish@redhat.com> <1276439625-32472-13-git-send-email-mgoldish@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: autotest@test.kernel.org, kvm@vger.kernel.org Return-path: In-Reply-To: <1276439625-32472-13-git-send-email-mgoldish@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: autotest-bounces@test.kernel.org Errors-To: autotest-bounces@test.kernel.org List-Id: kvm.vger.kernel.org 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 --- 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