From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:42077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RaCOe-0002xb-22 for qemu-devel@nongnu.org; Mon, 12 Dec 2011 15:22:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RaCOc-0000eK-GH for qemu-devel@nongnu.org; Mon, 12 Dec 2011 15:22:47 -0500 Received: from cpe-70-123-132-139.austin.res.rr.com ([70.123.132.139]:44532 helo=localhost6.localdomain6) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RaCOc-0000eE-3v for qemu-devel@nongnu.org; Mon, 12 Dec 2011 15:22:46 -0500 From: Anthony Liguori Date: Mon, 12 Dec 2011 14:18:14 -0600 Message-Id: <1323721273-32404-19-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 018/197] qom: add test tools (v2) 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 --- v1 -> v2 - fix comments (Stefan) --- QMP/qom-get | 26 ++++++++++++++++++++++++++ QMP/qom-list | 30 ++++++++++++++++++++++++++++++ QMP/qom-set | 21 +++++++++++++++++++++ 3 files changed, 77 insertions(+), 0 deletions(-) create mode 100755 QMP/qom-get create mode 100755 QMP/qom-list create mode 100755 QMP/qom-set diff --git a/QMP/qom-get b/QMP/qom-get new file mode 100755 index 0000000..e6c063a --- /dev/null +++ b/QMP/qom-get @@ -0,0 +1,26 @@ +#!/usr/bin/python +## +# QEMU Object Model test tools +# +# Copyright IBM, Corp. 2011 +# +# Authors: +# Anthony Liguori +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. See +# the COPYING file in the top-level directory. +## + +import sys +from qmp import QEMUMonitorProtocol + +srv = QEMUMonitorProtocol('/tmp/server.sock') +srv.connect() + +path, prop = sys.argv[1].rsplit('.', 1) +rsp = srv.command('qom-get', path=path, property=prop) +if type(rsp) == dict: + for i in rsp.keys(): + print '%s: %s' % (i, rsp[i]) +else: + print rsp diff --git a/QMP/qom-list b/QMP/qom-list new file mode 100755 index 0000000..b91f814 --- /dev/null +++ b/QMP/qom-list @@ -0,0 +1,30 @@ +#!/usr/bin/python +## +# QEMU Object Model test tools +# +# Copyright IBM, Corp. 2011 +# +# Authors: +# Anthony Liguori +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. See +# the COPYING file in the top-level directory. +## + +import sys +from qmp import QEMUMonitorProtocol + +srv = QEMUMonitorProtocol('/tmp/server.sock') +srv.connect() + +if len(sys.argv) == 1: + print '/' + sys.exit(0) + +for item in srv.command('qom-list', path=sys.argv[1]): + if item['type'].startswith('child<'): + print '%s/' % item['name'] + elif item['type'].startswith('link<'): + print '@%s/' % item['name'] + else: + print '%s' % item['name'] diff --git a/QMP/qom-set b/QMP/qom-set new file mode 100755 index 0000000..c5589d8 --- /dev/null +++ b/QMP/qom-set @@ -0,0 +1,21 @@ +#!/usr/bin/python +## +# QEMU Object Model test tools +# +# Copyright IBM, Corp. 2011 +# +# Authors: +# Anthony Liguori +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. See +# the COPYING file in the top-level directory. +## + +import sys +from qmp import QEMUMonitorProtocol + +srv = QEMUMonitorProtocol('/tmp/server.sock') +srv.connect() + +path, prop = sys.argv[1].rsplit('.', 1) +print srv.command('qom-set', path=path, property=prop, value=sys.argv[2]) -- 1.7.4.1