aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Shinkevich <andrey.shinkevich@virtuozzo.com>2020-08-06 22:35:57 +0300
committerEric Blake <eblake@redhat.com>2020-08-21 08:56:09 -0500
commit76bbbb2d8bcd635f787ddf448bad9c68f3299dee (patch)
treeb1f3dd4f7f7257a3c5c95f331a4dda0f49b8bd52
parent4edcca57412d2b54537b4fc2b10ebfa1b920192c (diff)
iotests: dump QCOW2 header in JSON in #303
Extend the test case #303 by dumping QCOW2 image metadata in JSON format. Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <1596742557-320265-12-git-send-email-andrey.shinkevich@virtuozzo.com> Signed-off-by: Eric Blake <eblake@redhat.com>
-rwxr-xr-xtests/qemu-iotests/3033
-rw-r--r--tests/qemu-iotests/303.out76
2 files changed, 79 insertions, 0 deletions
diff --git a/tests/qemu-iotests/303 b/tests/qemu-iotests/303
index e9accdc7bc..6c21774483 100755
--- a/tests/qemu-iotests/303
+++ b/tests/qemu-iotests/303
@@ -58,3 +58,6 @@ add_bitmap(1, 0, 6, False)
add_bitmap(2, 6, 8, True)
dump = ['qcow2.py', disk, 'dump-header']
subprocess.run(dump)
+# Dump the metadata in JSON format
+dump.append('-j')
+subprocess.run(dump)
diff --git a/tests/qemu-iotests/303.out b/tests/qemu-iotests/303.out
index 70828e05f1..7fa1edef0d 100644
--- a/tests/qemu-iotests/303.out
+++ b/tests/qemu-iotests/303.out
@@ -80,3 +80,79 @@ extra_data_size 0
Bitmap table type size offset
0 all-zeroes 0 0
+{
+ "magic": 1363560955,
+ "version": 3,
+ "backing_file_offset": 0,
+ "backing_file_size": 0,
+ "cluster_bits": 16,
+ "size": 10485760,
+ "crypt_method": 0,
+ "l1_size": 1,
+ "l1_table_offset": 196608,
+ "refcount_table_offset": 65536,
+ "refcount_table_clusters": 1,
+ "nb_snapshots": 0,
+ "snapshot_offset": 0,
+ "incompatible_features": 0,
+ "compatible_features": 0,
+ "autoclear_features": 1,
+ "refcount_order": 4,
+ "header_length": 112
+}
+
+[
+ {
+ "name": "Feature table",
+ "magic": 1745090647,
+ "length": 336,
+ "data_str": "<binary>"
+ },
+ {
+ "name": "Bitmaps",
+ "magic": 595929205,
+ "length": 24,
+ "data": {
+ "nb_bitmaps": 2,
+ "reserved32": 0,
+ "bitmap_directory_size": 64,
+ "bitmap_directory_offset": 10289152,
+ "bitmap_directory": [
+ {
+ "name": "bitmap-1",
+ "bitmap_table_offset": 10158080,
+ "bitmap_table_size": 1,
+ "flags": 2,
+ "type": 1,
+ "granularity_bits": 15,
+ "name_size": 8,
+ "extra_data_size": 0,
+ "bitmap_table": [
+ {
+ "type": "serialized",
+ "offset": 10092544,
+ "reserved": 0
+ }
+ ]
+ },
+ {
+ "name": "bitmap-2",
+ "bitmap_table_offset": 10223616,
+ "bitmap_table_size": 1,
+ "flags": 0,
+ "type": 1,
+ "granularity_bits": 16,
+ "name_size": 8,
+ "extra_data_size": 0,
+ "bitmap_table": [
+ {
+ "type": "all-zeroes",
+ "offset": 0,
+ "reserved": 0
+ }
+ ]
+ }
+ ]
+ }
+ }
+]