From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39337) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sukz3-00044P-Bh for qemu-devel@nongnu.org; Fri, 27 Jul 2012 09:53:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sukyt-0006NX-L5 for qemu-devel@nongnu.org; Fri, 27 Jul 2012 09:53:37 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:33039) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sukyt-0006NS-Ef for qemu-devel@nongnu.org; Fri, 27 Jul 2012 09:53:27 -0400 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 27 Jul 2012 07:53:26 -0600 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 375363E40045 for ; Fri, 27 Jul 2012 13:53:22 +0000 (WET) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6RDrAPV161938 for ; Fri, 27 Jul 2012 07:53:10 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6RDr82f027648 for ; Fri, 27 Jul 2012 07:53:08 -0600 From: Anthony Liguori In-Reply-To: <20120727105245.GT2225@redhat.com> References: <1343384448-21828-1-git-send-email-xiawenc@linux.vnet.ibm.com> <20120727103352.GR2225@redhat.com> <50127251.9060203@redhat.com> <20120727105245.GT2225@redhat.com> Date: Fri, 27 Jul 2012 08:52:51 -0500 Message-ID: <87r4rxe2fg.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH] let qemu-img info genereate json output List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , Paolo Bonzini Cc: Wenchao Xia , stefanha@linux.vnet.ibm.com, qemu-devel@nongnu.org "Daniel P. Berrange" writes: > On Fri, Jul 27, 2012 at 12:49:53PM +0200, Paolo Bonzini wrote: >> Il 27/07/2012 12:33, Daniel P. Berrange ha scritto: >> > #qemu-img info -j /var/lib/libvirt/images/bar.qcow2 >> > { >> > "information": { >> > "actual_size": "139264", >> > "fmt": "qcow2", >> > "virtual_size": "10485760", >> > "filename": "/var/lib/libvirt/images/bar.qcow2", >> > "cluster_size": 65536, >> > "encrypted": 0, >> > "snapshot_list": [ >> > ], >> > "dirty_flag": 0, >> > "backing_filename": "/dev/sda1" >> > }, >> > "return": 0 >> > } >> > >> > IIUC,the 'return' element here is just duplicating the qemu-img >> > exit status. I think this is rather dubious, and would rather >> > just see the stuff in the 'information' sub-block be output >> > directly. It also seems to forget to mention the backing >> > file format. >> >> I wonder if we could add this also to the QEMU monitor ("info >> block-image foo"), so that the code would be shared between qemu-img.c >> and QEMU. > > It would certainly make sense to have the code & data format shared > between the two, so apps don't need to have 2 different JSON parsers We should definitely describe the output in qapi-schema.json. Whether we also expose a QMP command--I'm not really convinced. It seems a bit unusual to me to want to get this info from an arbitrary image file from within QEMU. I'm not sure I see the use-case. I can definitely see it become exposed as part of query-block though as an image-info parameter. Regards, Anthony Liguori > > > Daniel > -- > |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| > |: http://libvirt.org -o- http://virt-manager.org :| > |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| > |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|