From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WB6aJ-0003JE-62 for qemu-devel@nongnu.org; Wed, 05 Feb 2014 12:48:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WB6aE-0004rd-6d for qemu-devel@nongnu.org; Wed, 05 Feb 2014 12:48:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46225) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WB6aD-0004rZ-VO for qemu-devel@nongnu.org; Wed, 05 Feb 2014 12:48:22 -0500 Message-ID: <52F2795D.10708@redhat.com> Date: Wed, 05 Feb 2014 18:48:13 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1391621709-15620-1-git-send-email-afaerber@suse.de> In-Reply-To: <1391621709-15620-1-git-send-email-afaerber@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] scripts: Add qom-tree script as modern equivalent of info qtree List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, armbru@redhat.com, aliguori@amazon.com, lcapitulino@redhat.com Il 05/02/2014 18:35, Andreas F=C3=A4rber ha scritto: > Functionally it is a recursive qom-list with qom-get per non-child<> > property. Some failures needed to be handled, such as trying to read a > pointer property, which is not representable in QMP. Those print a > literal "". > > Signed-off-by: Andreas F=C3=A4rber I don't think it's a modern equivalent of anything. The two are just=20 different. "info qtree" may be focused the old concept of buses, but those buses=20 aren't going anywhere anytime soon. "info qtree" may also be focused on=20 the old concept of qdev properties (now "static" properties), but that's=20 not something that cannot be fixed. So, even though I think this script is a very welcome addition, I don't=20 think it helps settling the question of what to do with "info qtree".=20 IMO there's no good reason to exclude busless devices from "info qtree",=20 and it's a bug (of course less severe than crashing, but still a bug)=20 that the busless nand device doesn't appear there. We can apply all three patches: * qdev_try_create for busless devices (or alternatively abort when=20 creating the device, qom-test will catch that) * add qom-tree * nand: Don't use qdev_create() in nand_init() and still improve "info qtree" on top. Paolo > --- > scripts/qmp/qom-tree | 70 ++++++++++++++++++++++++++++++++++++++++++++= ++++++++ > 1 file changed, 70 insertions(+) > create mode 100755 scripts/qmp/qom-tree > > diff --git a/scripts/qmp/qom-tree b/scripts/qmp/qom-tree > new file mode 100755 > index 0000000..5fd506a > --- /dev/null > +++ b/scripts/qmp/qom-tree > @@ -0,0 +1,70 @@ > +#!/usr/bin/python > +## > +# QEMU Object Model test tools > +# > +# Copyright IBM, Corp. 2011 > +# Copyright (c) 2013 SUSE LINUX Products GmbH > +# > +# Authors: > +# Anthony Liguori > +# Andreas Faerber > +# > +# This work is licensed under the terms of the GNU GPL, version 2 or l= ater. See > +# the COPYING file in the top-level directory. > +## > + > +import sys > +import os > +from qmp import QEMUMonitorProtocol > + > +cmd, args =3D sys.argv[0], sys.argv[1:] > +socket_path =3D None > +path =3D None > +prop =3D None > + > +def usage(): > + return '''environment variables: > + QMP_SOCKET=3D > +usage: > + %s [-h] [-s ] [] > +''' % cmd > + > +def usage_error(error_msg =3D "unspecified error"): > + sys.stderr.write('%s\nERROR: %s\n' % (usage(), error_msg)) > + exit(1) > + > +if len(args) > 0: > + if args[0] =3D=3D "-h": > + print usage() > + exit(0); > + elif args[0] =3D=3D "-s": > + try: > + socket_path =3D args[1] > + except: > + usage_error("missing argument: QMP socket path or address"= ); > + args =3D args[2:] > + > +if not socket_path: > + if os.environ.has_key('QMP_SOCKET'): > + socket_path =3D os.environ['QMP_SOCKET'] > + else: > + usage_error("no QMP socket path or address given"); > + > +srv =3D QEMUMonitorProtocol(socket_path) > +srv.connect() > + > +def list_node(path): > + print '%s' % path > + items =3D srv.command('qom-list', path=3Dpath) > + for item in items: > + if not item['type'].startswith('child<'): > + try: > + print ' %s: %s (%s)' % (item['name'], srv.command('qo= m-get', path=3Dpath, property=3Ditem['name']), item['type']) > + except: > + print ' %s: (%s)' % (item['name'], item['= type']) > + print '' > + for item in items: > + if item['type'].startswith('child<'): > + list_node(path + '/' + item['name']) > + > +list_node('/machine') >