From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:49339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rzbj7-0000UR-Tn for qemu-devel@nongnu.org; Mon, 20 Feb 2012 17:28:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rzbj6-0001O0-VN for qemu-devel@nongnu.org; Mon, 20 Feb 2012 17:28:57 -0500 Received: from mail-pw0-f45.google.com ([209.85.160.45]:58244) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rzbj6-0001Nh-Qh for qemu-devel@nongnu.org; Mon, 20 Feb 2012 17:28:56 -0500 Received: by mail-pw0-f45.google.com with SMTP id ro12so8190827pbb.4 for ; Mon, 20 Feb 2012 14:28:56 -0800 (PST) Sender: fluxion From: Michael Roth Date: Mon, 20 Feb 2012 16:28:29 -0600 Message-Id: <1329776910-17289-2-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1329776910-17289-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1329776910-17289-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 1/2] qmp: make qmp.py easier to use List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com From: Anthony Liguori Signed-off-by: Anthony Liguori Signed-off-by: Michael Roth --- 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