mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-21 13:15:25 +00:00
qemu-replies-tool: Dump 'device-list-properties'
The order of properties in 'device-list-properties' can hange arbitrarily and git is not great at picking the contexts in JSON to help seeing what changed. The new --dump-device-list-properties produces a stable order of properties and dumps also the type and default value mainly useful for comparing two .replies files. Example output: $ ./scripts/qemu-replies-tool.py tests/qemucapabilitiesdata/caps_9.0.0_x86_64.replies --dump-device-list-properties (dev) ICH9-LPC acpi-index uint32 (0) (dev) ICH9-LPC acpi-pci-hotplug-with-bridge-support bool (dev) ICH9-LPC acpi_disable_cmd uint8 (dev) ICH9-LPC acpi_enable_cmd uint8 (dev) ICH9-LPC addr int32 (-1) (dev) ICH9-LPC cpu-hotplug-legacy bool (dev) ICH9-LPC disable_s3 uint8 (dev) ICH9-LPC disable_s4 uint8 Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
910e25afa3
commit
610f1300c5
@ -404,6 +404,32 @@ def dump_qom_list_types(conv):
|
||||
print('(qom) ' + t)
|
||||
|
||||
|
||||
def dump_device_list_properties(conv):
|
||||
devices = []
|
||||
|
||||
for (cmd, rep) in conv:
|
||||
if cmd['execute'] == 'device-list-properties':
|
||||
if 'return' in rep:
|
||||
for arg in rep['return']:
|
||||
for k in arg:
|
||||
if k not in ['name', 'type', 'description', 'default-value']:
|
||||
raise Exception("Unhandled 'device-list-properties' typename '%s' field '%s'" % (cmd['arguments']['typename'], k))
|
||||
|
||||
if 'default-value' in arg:
|
||||
defval = ' (%s)' % str(arg['default-value'])
|
||||
else:
|
||||
defval = ''
|
||||
|
||||
devices.append('%s %s %s%s' % (cmd['arguments']['typename'],
|
||||
arg['name'],
|
||||
arg['type'],
|
||||
defval))
|
||||
devices.sort()
|
||||
|
||||
for d in devices:
|
||||
print('(dev) ' + d)
|
||||
|
||||
|
||||
def process_one(filename, args):
|
||||
try:
|
||||
conv = qemu_replies_load(filename)
|
||||
@ -423,6 +449,10 @@ def process_one(filename, args):
|
||||
dump_qom_list_types(conv)
|
||||
dumped = True
|
||||
|
||||
if args.dump_all or args.dump_device_list_properties:
|
||||
dump_device_list_properties(conv)
|
||||
dumped = True
|
||||
|
||||
if dumped:
|
||||
return True
|
||||
|
||||
@ -472,6 +502,11 @@ functional impact on libvirt.
|
||||
Dumps all types returned by 'qom-list-types' in a stable order with the
|
||||
'parent' property dropped as it's not relevant for libvirt.
|
||||
|
||||
--dump-device-list-properties
|
||||
|
||||
Dumps all properties of all devices queried by libvirt in stable order
|
||||
along with types and default values.
|
||||
|
||||
The tool can be also used to programmaticaly modify the '.replies' file by
|
||||
editing the 'modify_replies' method directly in the source, or for
|
||||
re-formatting and re-numbering the '.replies' file to conform with the required
|
||||
@ -505,6 +540,9 @@ parser.add_argument('--dump-qmp-query-strings', action='store_true',
|
||||
parser.add_argument('--dump-qom-list-types', action='store_true',
|
||||
help='dump data from qom-list-types in a stable order')
|
||||
|
||||
parser.add_argument('--dump-device-list-properties', action='store_true',
|
||||
help='dump all devices and their properties')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
files = []
|
||||
|
Loading…
Reference in New Issue
Block a user