[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 17/21] docs, qapi: document qemu-img map
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH v5 17/21] docs, qapi: document qemu-img map |
Date: |
Wed, 4 Sep 2013 19:00:34 +0200 |
Eric Blake also requested including the output in qapi-schema.json,
so that it is published through the introspection mechanism.
Signed-off-by: Paolo Bonzini <address@hidden>
---
qapi-schema.json | 29 +++++++++++++++++++++++++++++
qemu-img.texi | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 84 insertions(+)
diff --git a/qapi-schema.json b/qapi-schema.json
index a51f7d2..6955898 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -813,6 +813,35 @@
{ 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
##
+# @BlockDeviceMapEntry:
+#
+# Entry in the metadata map of the device (returned by "qemu-img map")
+#
+# @start: Offset in the image of the first byte described by this entry
+# (in bytes)
+#
+# @length: Length of the range described by this entry (in bytes)
+#
+# @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
+# before reaching one for which the range is allocated. The value is
+# in the range 0 to the depth of the image chain - 1.
+#
+# @zero: the sectors in this range read as zeros
+#
+# @data: reading the image will actually read data from a file (in particular,
+# if @offset is present this means that the sectors are not simply
+# preallocated, but contain actual data in raw format)
+#
+# @offset: if present, the image file stores the data for this range in
+# raw format at the given offset.
+#
+# Since 1.7
+##
+{ 'type': 'BlockDeviceMapEntry',
+ 'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
+ 'data': 'bool', '*offset': 'int' } }
+
+##
# @BlockDirtyInfo:
#
# Block dirty bitmap information.
diff --git a/qemu-img.texi b/qemu-img.texi
index 69f1bda..8364fa1 100644
--- a/qemu-img.texi
+++ b/qemu-img.texi
@@ -213,6 +213,61 @@ To enumerate information about each disk image in the
above chain, starting from
qemu-img info --backing-chain snap2.qcow2
@end example
address@hidden map [-f @var{fmt}] address@hidden @var{filename}
+
+Dump the metadata of image @var{filename} and its backing file chain.
+In particular, this commands dumps the allocation state of every sector
+of @var{filename}, together with the topmost file that allocates it in
+the backing file chain.
+
+Two option formats are possible. The default format (@code{human})
+only dumps known-nonzero areas of the file. Known-zero parts of the
+file are omitted altogether, and likewise for parts that are not allocated
+throughout the chain. @command{qemu-img} output will identify a file
+from where the data can be read, and the offset in the file. Each line
+will include four fields, the first three of which are hexadecimal
+numbers. For example the first line of:
address@hidden
+Offset Length Mapped to File
+0 0x20000 0x50000 /tmp/overlay.qcow2
+0x100000 0x10000 0x95380000 /tmp/backing.qcow2
address@hidden example
address@hidden
+means that 0x20000 (131072) bytes starting at offset 0 in the image are
+available in /tmp/overlay.qcow2 (opened in @code{raw} format) starting
+at offset 0x50000 (327680). Data that is compressed, encrypted, or
+otherwise not available in raw format will cause an error if @code{human}
+format is in use. Note that file names can include newlines, thus it is
+not safe to parse this output format in scripts.
+
+The alternative format @code{json} will return an array of dictionaries
+in JSON format. It will include similar information in
+the @code{start}, @code{length}, @code{offset} fields;
+it will also include other more specific information:
address@hidden @minus
address@hidden
+whether the sectors contain actual data or not (boolean field @code{data};
+if false, the sectors are either unallocated or stored as optimized
+all-zero clusters);
+
address@hidden
+whether the data is known to read as zero (boolean field @code{zero});
+
address@hidden
+in order to make the output shorter, the target file is expressed as
+a @code{depth}; for example, a depth of 2 refers to the backing file
+of the backing file of @var{filename}.
address@hidden itemize
+
+In JSON format, the @code{offset} field is optional; it is absent in
+cases where @code{human} format would omit the entry or exit with an error.
+If @code{data} is false and the @code{offset} field is present, the
+corresponding sectors in the file are not yet in use, but they are
+preallocated.
+
+For more information, consult @file{include/block/block.h} in QEMU's
+source code.
+
@item snapshot [-l | -a @var{snapshot} | -c @var{snapshot} | -d @var{snapshot}
] @var{filename}
List, apply, create or delete snapshots in image @var{filename}.
--
1.8.3.1
- [Qemu-devel] [PATCH v5 08/21] block: expect errors from bdrv_co_is_allocated, (continued)
- [Qemu-devel] [PATCH v5 08/21] block: expect errors from bdrv_co_is_allocated, Paolo Bonzini, 2013/09/04
- [Qemu-devel] [PATCH v5 07/21] block: remove bdrv_is_allocated_above/bdrv_co_is_allocated_above distinction, Paolo Bonzini, 2013/09/04
- [Qemu-devel] [PATCH v5 10/21] block: make bdrv_has_zero_init return false for copy-on-write-images, Paolo Bonzini, 2013/09/04
- [Qemu-devel] [PATCH v5 11/21] block: introduce bdrv_get_block_status API, Paolo Bonzini, 2013/09/04
- [Qemu-devel] [PATCH v5 12/21] block: define get_block_status return value, Paolo Bonzini, 2013/09/04
- [Qemu-devel] [PATCH v5 13/21] block: return get_block_status data and flags for formats, Paolo Bonzini, 2013/09/04
- [Qemu-devel] [PATCH v5 09/21] qemu-img: always probe the input image for allocated sectors, Paolo Bonzini, 2013/09/04
- [Qemu-devel] [PATCH v5 14/21] block: use bdrv_has_zero_init to return BDRV_BLOCK_ZERO, Paolo Bonzini, 2013/09/04
- [Qemu-devel] [PATCH v5 16/21] qemu-img: add a "map" subcommand, Paolo Bonzini, 2013/09/04
- [Qemu-devel] [PATCH v5 15/21] block: return BDRV_BLOCK_ZERO past end of backing file, Paolo Bonzini, 2013/09/04
- [Qemu-devel] [PATCH v5 17/21] docs, qapi: document qemu-img map,
Paolo Bonzini <=
- [Qemu-devel] [PATCH v5 18/21] raw-posix: return get_block_status data and flags, Paolo Bonzini, 2013/09/04
- [Qemu-devel] [PATCH v5 19/21] raw-posix: report unwritten extents as zero, Paolo Bonzini, 2013/09/04
- [Qemu-devel] [PATCH v5 20/21] block: add default get_block_status implementation for protocols, Paolo Bonzini, 2013/09/04
- [Qemu-devel] [PATCH v5 21/21] block: look for zero blocks in bs->file, Paolo Bonzini, 2013/09/04
- Re: [Qemu-devel] [PATCH v5 00/21] Add qemu-img subcommand to dump file metadata, Stefan Hajnoczi, 2013/09/05