|
|
ed5979 |
From d8caed018afb0f60f449e971398d2a8d6c2992e7 Mon Sep 17 00:00:00 2001
|
|
|
ed5979 |
From: Hanna Reitz <hreitz@redhat.com>
|
|
|
ed5979 |
Date: Mon, 20 Jun 2022 18:26:55 +0200
|
|
|
ed5979 |
Subject: [PATCH 08/20] block/vmdk: Change extent info type
|
|
|
ed5979 |
|
|
|
ed5979 |
RH-Author: Hanna Czenczek <hreitz@redhat.com>
|
|
|
ed5979 |
RH-MergeRequest: 145: Show protocol-level information in qemu-img info
|
|
|
ed5979 |
RH-Bugzilla: 1860292
|
|
|
ed5979 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ed5979 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
ed5979 |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
ed5979 |
RH-Commit: [3/12] efe50a2797c679ce6bb5faa423047461a34e6792 (hreitz/qemu-kvm-c-9-s)
|
|
|
ed5979 |
|
|
|
ed5979 |
VMDK's implementation of .bdrv_get_specific_info() returns information
|
|
|
ed5979 |
about its extent files, ostensibly in the form of ImageInfo objects.
|
|
|
ed5979 |
However, it does not get this information through
|
|
|
ed5979 |
bdrv_query_image_info(), but fills only a select few fields with custom
|
|
|
ed5979 |
information that does not always match the fields' purposes.
|
|
|
ed5979 |
|
|
|
ed5979 |
For example, @format, which is supposed to be a block driver name, is
|
|
|
ed5979 |
filled with the extent type, e.g. SPARSE or FLAT.
|
|
|
ed5979 |
|
|
|
ed5979 |
In ImageInfo, @compressed shows whether the data that can be seen in the
|
|
|
ed5979 |
image is stored in compressed form or not. For example, a compressed
|
|
|
ed5979 |
qcow2 image will store compressed data in its data file, but when
|
|
|
ed5979 |
accessing the qcow2 node, you will see normal data. This is not how
|
|
|
ed5979 |
VMDK uses the @compressed field for its extent files: Instead, it
|
|
|
ed5979 |
signifies whether accessing the extent file will yield compressed data
|
|
|
ed5979 |
(which the VMDK driver then (de-)compresses).
|
|
|
ed5979 |
|
|
|
ed5979 |
Create a new structure to represent the extent information. This allows
|
|
|
ed5979 |
us to clarify the fields' meanings, and it clearly shows that these are
|
|
|
ed5979 |
not complete ImageInfo objects. (That is, if a user wants an extent
|
|
|
ed5979 |
file's ImageInfo object, they will need to query it separately, and will
|
|
|
ed5979 |
not get it from ImageInfoSpecificVmdk.extents.)
|
|
|
ed5979 |
|
|
|
ed5979 |
Note that this removes the last use of ['ImageInfo'] (i.e. an array of
|
|
|
ed5979 |
ImageInfo objects), so the QAPI generator will no longer generate
|
|
|
ed5979 |
ImageInfoList by default. However, we use it in qemu-img.c, so we need
|
|
|
ed5979 |
to create a dummy object to force the generate to create that type,
|
|
|
ed5979 |
similarly to DummyForceArrays in machine.json (introduced in commit
|
|
|
ed5979 |
9f08c8ec73878122ad4b061ed334f0437afaaa32 ("qapi: Lazy creation of array
|
|
|
ed5979 |
types")).
|
|
|
ed5979 |
|
|
|
ed5979 |
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
|
|
|
ed5979 |
Message-Id: <20220620162704.80987-4-hreitz@redhat.com>
|
|
|
ed5979 |
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ed5979 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ed5979 |
(cherry picked from commit 456e75171a85c19a5bfa202eefcbdc4ef1692f05)
|
|
|
ed5979 |
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
|
|
|
ed5979 |
---
|
|
|
ed5979 |
block/vmdk.c | 8 ++++----
|
|
|
ed5979 |
qapi/block-core.json | 38 +++++++++++++++++++++++++++++++++++++-
|
|
|
ed5979 |
2 files changed, 41 insertions(+), 5 deletions(-)
|
|
|
ed5979 |
|
|
|
ed5979 |
diff --git a/block/vmdk.c b/block/vmdk.c
|
|
|
ed5979 |
index 26376352b9..4435b9880b 100644
|
|
|
ed5979 |
--- a/block/vmdk.c
|
|
|
ed5979 |
+++ b/block/vmdk.c
|
|
|
ed5979 |
@@ -2901,12 +2901,12 @@ static int vmdk_has_zero_init(BlockDriverState *bs)
|
|
|
ed5979 |
return 1;
|
|
|
ed5979 |
}
|
|
|
ed5979 |
|
|
|
ed5979 |
-static ImageInfo *vmdk_get_extent_info(VmdkExtent *extent)
|
|
|
ed5979 |
+static VmdkExtentInfo *vmdk_get_extent_info(VmdkExtent *extent)
|
|
|
ed5979 |
{
|
|
|
ed5979 |
- ImageInfo *info = g_new0(ImageInfo, 1);
|
|
|
ed5979 |
+ VmdkExtentInfo *info = g_new0(VmdkExtentInfo, 1);
|
|
|
ed5979 |
|
|
|
ed5979 |
bdrv_refresh_filename(extent->file->bs);
|
|
|
ed5979 |
- *info = (ImageInfo){
|
|
|
ed5979 |
+ *info = (VmdkExtentInfo){
|
|
|
ed5979 |
.filename = g_strdup(extent->file->bs->filename),
|
|
|
ed5979 |
.format = g_strdup(extent->type),
|
|
|
ed5979 |
.virtual_size = extent->sectors * BDRV_SECTOR_SIZE,
|
|
|
ed5979 |
@@ -2985,7 +2985,7 @@ static ImageInfoSpecific *vmdk_get_specific_info(BlockDriverState *bs,
|
|
|
ed5979 |
int i;
|
|
|
ed5979 |
BDRVVmdkState *s = bs->opaque;
|
|
|
ed5979 |
ImageInfoSpecific *spec_info = g_new0(ImageInfoSpecific, 1);
|
|
|
ed5979 |
- ImageInfoList **tail;
|
|
|
ed5979 |
+ VmdkExtentInfoList **tail;
|
|
|
ed5979 |
|
|
|
ed5979 |
*spec_info = (ImageInfoSpecific){
|
|
|
ed5979 |
.type = IMAGE_INFO_SPECIFIC_KIND_VMDK,
|
|
|
ed5979 |
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
|
|
ed5979 |
index f5d822cbd6..4b9365167f 100644
|
|
|
ed5979 |
--- a/qapi/block-core.json
|
|
|
ed5979 |
+++ b/qapi/block-core.json
|
|
|
ed5979 |
@@ -124,7 +124,33 @@
|
|
|
ed5979 |
'create-type': 'str',
|
|
|
ed5979 |
'cid': 'int',
|
|
|
ed5979 |
'parent-cid': 'int',
|
|
|
ed5979 |
- 'extents': ['ImageInfo']
|
|
|
ed5979 |
+ 'extents': ['VmdkExtentInfo']
|
|
|
ed5979 |
+ } }
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+##
|
|
|
ed5979 |
+# @VmdkExtentInfo:
|
|
|
ed5979 |
+#
|
|
|
ed5979 |
+# Information about a VMDK extent file
|
|
|
ed5979 |
+#
|
|
|
ed5979 |
+# @filename: Name of the extent file
|
|
|
ed5979 |
+#
|
|
|
ed5979 |
+# @format: Extent type (e.g. FLAT or SPARSE)
|
|
|
ed5979 |
+#
|
|
|
ed5979 |
+# @virtual-size: Number of bytes covered by this extent
|
|
|
ed5979 |
+#
|
|
|
ed5979 |
+# @cluster-size: Cluster size in bytes (for non-flat extents)
|
|
|
ed5979 |
+#
|
|
|
ed5979 |
+# @compressed: Whether this extent contains compressed data
|
|
|
ed5979 |
+#
|
|
|
ed5979 |
+# Since: 8.0
|
|
|
ed5979 |
+##
|
|
|
ed5979 |
+{ 'struct': 'VmdkExtentInfo',
|
|
|
ed5979 |
+ 'data': {
|
|
|
ed5979 |
+ 'filename': 'str',
|
|
|
ed5979 |
+ 'format': 'str',
|
|
|
ed5979 |
+ 'virtual-size': 'int',
|
|
|
ed5979 |
+ '*cluster-size': 'int',
|
|
|
ed5979 |
+ '*compressed': 'bool'
|
|
|
ed5979 |
} }
|
|
|
ed5979 |
|
|
|
ed5979 |
##
|
|
|
ed5979 |
@@ -5754,3 +5780,13 @@
|
|
|
ed5979 |
'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
|
|
|
ed5979 |
'returns': 'SnapshotInfo',
|
|
|
ed5979 |
'allow-preconfig': true }
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+##
|
|
|
ed5979 |
+# @DummyBlockCoreForceArrays:
|
|
|
ed5979 |
+#
|
|
|
ed5979 |
+# Not used by QMP; hack to let us use ImageInfoList internally
|
|
|
ed5979 |
+#
|
|
|
ed5979 |
+# Since: 8.0
|
|
|
ed5979 |
+##
|
|
|
ed5979 |
+{ 'struct': 'DummyBlockCoreForceArrays',
|
|
|
ed5979 |
+ 'data': { 'unused-image-info': ['ImageInfo'] } }
|
|
|
ed5979 |
--
|
|
|
ed5979 |
2.31.1
|
|
|
ed5979 |
|