From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhG7R-00057b-L7 for qemu-devel@nongnu.org; Tue, 06 Sep 2016 09:08:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhG7M-0001WM-90 for qemu-devel@nongnu.org; Tue, 06 Sep 2016 09:08:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38368) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhG7M-0001WH-3J for qemu-devel@nongnu.org; Tue, 06 Sep 2016 09:08:48 -0400 Date: Tue, 6 Sep 2016 14:08:43 +0100 From: "Daniel P. Berrange" Message-ID: <20160906130843.GI10095@redhat.com> Reply-To: "Daniel P. Berrange" References: <1473157086-12062-1-git-send-email-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1473157086-12062-1-git-send-email-dgilbert@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2] qom: Implement qom-get HMP command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert (git)" Cc: qemu-devel@nongnu.org, lcapitulino@redhat.com, afaerber@suse.de, armbru@redhat.com, pbonzini@redhat.com, kwolf@redhat.com, arei.gonglei@huawei.com On Tue, Sep 06, 2016 at 11:18:06AM +0100, Dr. David Alan Gilbert (git) wr= ote: > From: "Dr. David Alan Gilbert" >=20 > This started off as Andreas F=C3=A4rber's implementation from > March 2015, but after feedback from Paolo morphed into > using the json output which handles structs reasonably. >=20 > Use with qom-list to find the members of an object. >=20 > (qemu) qom-get /backend/console[0]/device/vga.rom[0] size > 65536 > (qemu) qom-get /machine smm > "auto" > (qemu) qom-get /machine rtc-time > { > "tm_year": 116, > "tm_sec": 0, > "tm_hour": 9, > "tm_min": 46, > "tm_mon": 8, > "tm_mday": 6 > } I'm not really a fan of us exposing JSON in the HMP, as it rather seems to defeat the purpose of using the HMP. > -- > v2 > switched from using string-output-visitor to qobject_to_json_pretty, > drop string-output-visitor patch. IIUC, you switched because string-output-visitor could not handle complex types. I have previously written a text-output-visitor that could do this correctly, since we have this exact same requirement for 'qemu-info info' to print out the extra-block specific data in human friendly format for the LUKS driver. https://lists.gnu.org/archive/html/qemu-devel/2016-06/msg01727.html With your example that ought to lead to output looking like (qemu) qom-get /machine rtc-time tm_year: 116 tm_sec: 0 tm_hour: 9 tm_min: 46 tm_mon: 8 tm_mday: 6 which i think is more suitable for the HMP. Regards, Daniel --=20 |: http://berrange.com -o- http://www.flickr.com/photos/dberrange= / :| |: http://libvirt.org -o- http://virt-manager.or= g :| |: http://autobuild.org -o- http://search.cpan.org/~danberr= / :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vn= c :|