From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:42060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RaCOV-0002Qr-RO for qemu-devel@nongnu.org; Mon, 12 Dec 2011 15:22:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RaCOU-0000dY-PJ for qemu-devel@nongnu.org; Mon, 12 Dec 2011 15:22:39 -0500 Received: from cpe-70-123-132-139.austin.res.rr.com ([70.123.132.139]:44519 helo=localhost6.localdomain6) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RaCOU-0000dS-Is for qemu-devel@nongnu.org; Mon, 12 Dec 2011 15:22:38 -0500 From: Anthony Liguori Date: Mon, 12 Dec 2011 14:18:13 -0600 Message-Id: <1323721273-32404-18-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1323721273-32404-1-git-send-email-aliguori@us.ibm.com> References: <1323721273-32404-1-git-send-email-aliguori@us.ibm.com> Subject: [Qemu-devel] [PATCH v3 017/197] 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: Kevin Wolf , Peter Maydell , Anthony Liguori , Stefan Hajnoczi , Jan Kiszka , Markus Armbruster , Luiz Capitulino Signed-off-by: Anthony Liguori --- 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