]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qmp: make qmp.py easier to use
authorAnthony Liguori <aliguori@us.ibm.com>
Mon, 20 Feb 2012 22:28:29 +0000 (16:28 -0600)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 22 Feb 2012 18:18:26 +0000 (12:18 -0600)
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
QMP/qmp.py

index c7dbea076da6a6afe16dc71d6293489302e9defe..36ecc1dfaeaae18528f00bfd4b902f1076452a98 100644 (file)
@@ -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.