From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55386) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V03eM-0001vg-40 for qemu-devel@nongnu.org; Fri, 19 Jul 2013 01:54:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V03eL-0003Jj-6o for qemu-devel@nongnu.org; Fri, 19 Jul 2013 01:54:42 -0400 Received: from mail-qa0-x22b.google.com ([2607:f8b0:400d:c00::22b]:39707) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V03eL-0003Jd-2T for qemu-devel@nongnu.org; Fri, 19 Jul 2013 01:54:41 -0400 Received: by mail-qa0-f43.google.com with SMTP id d13so4023764qak.9 for ; Thu, 18 Jul 2013 22:54:40 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <51E8D492.3060008@redhat.com> Date: Fri, 19 Jul 2013 07:54:26 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1372862071-28225-1-git-send-email-pbonzini@redhat.com> <1372862071-28225-13-git-send-email-pbonzini@redhat.com> <51E84A4F.9030900@redhat.com> <20130719044831.GB14330@stefanha-thinkpad.redhat.com> In-Reply-To: <20130719044831.GB14330@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 12/17] qemu-img: add a "map" subcommand List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: kwolf@redhat.com, pl@kamp.de, qemu-devel@nongnu.org, stefanha@redhat.com Il 19/07/2013 06:48, Stefan Hajnoczi ha scritto: > On Thu, Jul 18, 2013 at 02:04:31PM -0600, Eric Blake wrote: >> On 07/03/2013 08:34 AM, Paolo Bonzini wrote: >>> This command dumps the metadata of an entire chain, in either tabular or JSON >>> format. >>> >>> Signed-off-by: Paolo Bonzini >>> --- >>> qemu-img-cmds.hx | 6 ++ >>> qemu-img.c | 186 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ >>> 2 files changed, 192 insertions(+) >>> >> >>> + case OFORMAT_JSON: >>> + printf("%s{ 'depth': %d, 'start': %lld, 'length': %lld, " >>> + "'zero': %s, 'data': %s", >>> + (e->start == 0 ? "[" : ",\n"), >>> + e->depth, (long long) e->start, (long long) e->length, >>> + (e->flags & BDRV_BLOCK_ZERO) ? "true" : "false", >>> + (e->flags & BDRV_BLOCK_DATA) ? "true" : "false"); >>> + if (e->flags & BDRV_BLOCK_OFFSET_VALID) { >>> + printf(", 'offset': %lld", (long long) e->offset); >>> + } >>> + putchar('}'); >> >> Can we please get this format documented in qapi-schema.json, even if we >> aren't using qapi to generate it yet? > > Paolo: Please send a follow-up patch documenting the json schema, I've > already merged this series. > > I was although thinking about qemu-iotests for qemu-img map, but it's > tricky since the allocation is an internal detail of the image format. > Perhaps a test case using raw? If you have interesting cases with sparse images, even raw depends on how the underlying file system splits extents. I can do a simple test that ignores the 'offset' field. Paolo