QOMTree._list_nodes() uses @type to print non-child properties like "NAME: VALUE (TYPE)". Drop (TYPE). This affects qom-tree. Replace all other uses of @type by @kind and @qom-type. Signed-off-by: Markus Armbruster <armbru@redhat.com> --- python/qemu/utils/qom.py | 2 +- python/qemu/utils/qom_common.py | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/python/qemu/utils/qom.py b/python/qemu/utils/qom.py index 05e5f141791..9f113240f9b 100644 --- a/python/qemu/utils/qom.py +++ b/python/qemu/utils/qom.py @@ -242,7 +242,7 @@ def _list_nodes(self, paths: List[str]) -> None: value = item.value if value is None: value = "<EXCEPTION: property could not be read>" - print(f" {item.name}: {value} ({item.type})") + print(f" {item.name}: {value}") print('') diff --git a/python/qemu/utils/qom_common.py b/python/qemu/utils/qom_common.py index 8d324f29cc3..c0f684bc455 100644 --- a/python/qemu/utils/qom_common.py +++ b/python/qemu/utils/qom_common.py @@ -69,9 +69,11 @@ class ObjectPropertyValue: """ Represents a property return from e.g. qom-tree-get """ - def __init__(self, name: str, type_: str, value: object): + def __init__(self, name: str, kind: str, qom_type: Optional[str], + value: object): self.name = name - self.type = type_ + self.kind = kind + self.qom_type = qom_type self.value = value @classmethod @@ -79,13 +81,14 @@ def make(cls, value: Dict[str, Any]) -> 'ObjectPropertyValue': """ Build an ObjectPropertyValue from a Dict with an unknown shape. """ - assert value.keys() >= {'name', 'type'} - return cls(value['name'], value['type'], value.get('value')) + assert value.keys() >= {'name', 'kind'} + return cls(value['name'], value['kind'], value.get('qom-type'), + value.get('value')) @property def child(self) -> bool: """Is this property a child property?""" - return self.type.startswith('child<') + return self.kind == "child" class ObjectPropertiesValues: @@ -104,7 +107,7 @@ def make(cls, value: Dict[str, Any]) -> 'ObjectPropertiesValues': """ assert value.keys() <= {'properties'} props = [ObjectPropertyValue(item['name'], - item['type'], + item['kind'], item.get('qom-type'), item.get('value')) for item in value['properties']] return cls(props) -- 2.55.0