aboutsummaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/qcow2.py
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2019-11-07 17:36:49 +0100
committerMax Reitz <mreitz@redhat.com>2020-01-06 13:43:06 +0100
commit0485e6ee4cc8a2cec5984cb00218b66e103684f0 (patch)
tree6e7039e77c10e13ad6baba86af15a4bfcf42d30f /tests/qemu-iotests/qcow2.py
parent1aa6630e7b30ae61ed4b990374e7226699f4c76c (diff)
downloadqemu-0485e6ee4cc8a2cec5984cb00218b66e103684f0.zip
qemu-0485e6ee4cc8a2cec5984cb00218b66e103684f0.tar.gz
qemu-0485e6ee4cc8a2cec5984cb00218b66e103684f0.tar.bz2
iotests/qcow2.py: Split feature fields into bits
Print the feature fields as a set of bits so that filtering is easier. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Message-id: 20191107163708.833192-4-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/qcow2.py')
-rwxr-xr-xtests/qemu-iotests/qcow2.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py
index d813b4f..91e4420 100755
--- a/tests/qemu-iotests/qcow2.py
+++ b/tests/qemu-iotests/qcow2.py
@@ -42,9 +42,9 @@ class QcowHeader:
[ uint64_t, '%#x', 'snapshot_offset' ],
# Version 3 header fields
- [ uint64_t, '%#x', 'incompatible_features' ],
- [ uint64_t, '%#x', 'compatible_features' ],
- [ uint64_t, '%#x', 'autoclear_features' ],
+ [ uint64_t, 'mask', 'incompatible_features' ],
+ [ uint64_t, 'mask', 'compatible_features' ],
+ [ uint64_t, 'mask', 'autoclear_features' ],
[ uint32_t, '%d', 'refcount_order' ],
[ uint32_t, '%d', 'header_length' ],
];
@@ -130,7 +130,17 @@ class QcowHeader:
def dump(self):
for f in QcowHeader.fields:
- print("%-25s" % f[2], f[1] % self.__dict__[f[2]])
+ value = self.__dict__[f[2]]
+ if f[1] == 'mask':
+ bits = []
+ for bit in range(64):
+ if value & (1 << bit):
+ bits.append(bit)
+ value_str = str(bits)
+ else:
+ value_str = f[1] % value
+
+ print("%-25s" % f[2], value_str)
print("")
def dump_extensions(self):