qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com
Subject: [Qemu-devel] [PATCH 1/2] qmp: make qmp.py easier to use
Date: Mon, 20 Feb 2012 16:28:29 -0600	[thread overview]
Message-ID: <1329776910-17289-2-git-send-email-mdroth@linux.vnet.ibm.com> (raw)
In-Reply-To: <1329776910-17289-1-git-send-email-mdroth@linux.vnet.ibm.com>

From: Anthony Liguori <aliguori@us.ibm.com>

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 QMP/qmp.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/QMP/qmp.py b/QMP/qmp.py
index c7dbea0..36ecc1d 100644
--- a/QMP/qmp.py
+++ b/QMP/qmp.py
@@ -128,6 +128,12 @@ class QEMUMonitorProtocol:
             qmp_cmd['id'] = id
         return self.cmd_obj(qmp_cmd)
 
+    def command(self, cmd, **kwds):
+        ret = self.cmd(cmd, kwds)
+        if ret.has_key('error'):
+            raise Exception(ret['error']['desc'])
+        return ret['return']
+
     def get_events(self, wait=False):
         """
         Get a list of available QMP events.
-- 
1.7.4.1

  reply	other threads:[~2012-02-20 22:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-20 22:28 [Qemu-devel] [PATCH v2 0/2] qom: add test tools (resend from "qom: dynamic properties") Michael Roth
2012-02-20 22:28 ` Michael Roth [this message]
2012-02-20 22:28 ` [Qemu-devel] [PATCH 2/2] qom: add test tools Michael Roth
2012-02-22  1:03   ` Andreas Färber
2012-02-22 18:54 ` [Qemu-devel] [PATCH v2 0/2] qom: add test tools (resend from "qom: dynamic properties") Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2012-02-20 20:50 [Qemu-devel] " Michael Roth
2012-02-20 20:50 ` [Qemu-devel] [PATCH 1/2] qmp: make qmp.py easier to use Michael Roth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1329776910-17289-2-git-send-email-mdroth@linux.vnet.ibm.com \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).