qcow2_format.py: collect fields to dump in JSON format
authorAndrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Thu, 6 Aug 2020 19:35:55 +0000 (22:35 +0300)
committerEric Blake <eblake@redhat.com>
Fri, 21 Aug 2020 13:56:09 +0000 (08:56 -0500)
commitb4e927799cf4a75e4432ab9e94d8f74e906a149b
tree3d97f98d5b4d3f0b702ba56870c99f549791938b
parent2c6d9ca48c7133ceba45577e8ca567a524aeb3f0
qcow2_format.py: collect fields to dump in JSON format

As __dict__ is being extended with class members we do not want to
print, add the to_json() method to classes that returns a json-dumpable
object with desired fields and their values. Extend it in subclass when
necessary to print the final dictionary in the JSON output which
follows.

Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Message-Id: <1596742557-320265-10-git-send-email-andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
tests/qemu-iotests/qcow2_format.py