From 2c6d9ca48c7133ceba45577e8ca567a524aeb3f0 Mon Sep 17 00:00:00 2001 From: Andrey Shinkevich Date: Thu, 6 Aug 2020 22:35:54 +0300 Subject: qcow2.py: Introduce '-j' key to dump in JSON format Add the command key to the qcow2.py arguments list to dump QCOW2 metadata in JSON format. Here is the suggested way to do that. The implementation of the dump in JSON format is in the patch that follows. Signed-off-by: Andrey Shinkevich Reviewed-by: Vladimir Sementsov-Ogievskiy Message-Id: <1596742557-320265-9-git-send-email-andrey.shinkevich@virtuozzo.com> Signed-off-by: Eric Blake --- tests/qemu-iotests/qcow2_format.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/qemu-iotests/qcow2_format.py') diff --git a/tests/qemu-iotests/qcow2_format.py b/tests/qemu-iotests/qcow2_format.py index 574249bc46..de0adcbf9d 100644 --- a/tests/qemu-iotests/qcow2_format.py +++ b/tests/qemu-iotests/qcow2_format.py @@ -109,7 +109,7 @@ class Qcow2Struct(metaclass=Qcow2StructMeta): self.__dict__ = dict((field[2], values[i]) for i, field in enumerate(self.fields)) - def dump(self): + def dump(self, is_json=False): for f in self.fields: value = self.__dict__[f[2]] if isinstance(f[1], str): @@ -408,7 +408,7 @@ class QcowHeader(Qcow2Struct): buf = buf[0:header_bytes-1] fd.write(buf) - def dump_extensions(self): + def dump_extensions(self, is_json=False): for ex in self.extensions: print('Header extension:') ex.dump() -- cgit v1.2.3