diff options
| author | Stefan Hajnoczi <stefanha@redhat.com> | 2025-07-17 11:18:52 -0400 |
|---|---|---|
| committer | Stefan Hajnoczi <stefanha@redhat.com> | 2025-07-17 11:18:52 -0400 |
| commit | 3656e761bcdd207b7759cdcd608212d2a6f9c12d (patch) | |
| tree | ca9c480845f067b58e5e771e20dc9c3055f27cd2 /python/qemu/utils/qom.py | |
| parent | 6e1875dd966ee2c16c150766ed221cdb29ec5557 (diff) | |
| parent | 64e4375b2b1efb634876a119a7378c50be5d195b (diff) | |
| download | focaccia-qemu-3656e761bcdd207b7759cdcd608212d2a6f9c12d.tar.gz focaccia-qemu-3656e761bcdd207b7759cdcd608212d2a6f9c12d.zip | |
Merge tag 'pull-qapi-2025-07-16' of https://repo.or.cz/qemu/armbru into staging
QAPI patches patches for 2025-07-16 # -----BEGIN PGP SIGNATURE----- # # iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmh34AYSHGFybWJydUBy # ZWRoYXQuY29tAAoJEDhwtADrkYZTiw4P/iFXG7aZvnMC1OwJ0bUKJIIWTwcxrio2 # ELKvxHplktZe+KUHPoH+l+5j9ytSl8k6BKlMZgiqJv6pVVFUXlYmwPZ19Rtwi2o5 # 62J2Lq/f33JSFh/ROqgM88gey61nxtL8eK2+Y2CxBGL3rd39VF/qto9HzE48kITM # iDPKeCzcikDg0QIlnj4afP1wNbJawFBW60JAugaEdHG5VBhjcPQTDI1bMaSLpUJu # 8d+v3bHLTM8FqHnkIdxQWDTnMwI9SVfqovzoDbsVw4sa9Ptt8GdKnUHUbNRtyeNp # 9zRu01ztMV9zuByAwsRm2ECdTwxsOVhVp4nFUxM24u2eTO6Pixe1sgogrtxcUVIf # tQuorYqeu1AAEyqz2iYFxrxKgsqRkA/etQCzibg+1coKlmLi7UTra4F0LEUWUMxZ # iXLGlnDZx9iwQq5iVHDb0zSzbBSlAamYK5HX4p8E7skJ7yaSwwZGgfQAr4JfJ7Yu # 73k4nuRHcLYIoyv02KE8npHFE62I0hH5YvJ2G9vQ2GJtw0vbCcVn01G3PYCe/P6/ # RXLSWAZmIyON7FAst1MZd2sF+0QG0beEt81bUrGbKEZY8qhXL4/mABmJvOp+eNJ6 # 23Z2bFNBkjCMxsJYQL8h9E9Zg/VAvxFJRoGClEPV+PfjCIy/wZPR8gUeYVPuDya4 # 63sn7GO5hu3c # =+Yt5 # -----END PGP SIGNATURE----- # gpg: Signature made Wed 16 Jul 2025 13:23:18 EDT # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * tag 'pull-qapi-2025-07-16' of https://repo.or.cz/qemu/armbru: python: fix editable installs for modern pip/setuptools MAINTAINERS: Add docs/requirements.txt docs: Bump sphinx to 6.2.1 tests/qtest/qom-test: unit test for qom-list-get python: use qom-list-get qom: qom-list-get Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'python/qemu/utils/qom.py')
| -rw-r--r-- | python/qemu/utils/qom.py | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/python/qemu/utils/qom.py b/python/qemu/utils/qom.py index 426a0f245f..05e5f14179 100644 --- a/python/qemu/utils/qom.py +++ b/python/qemu/utils/qom.py @@ -31,8 +31,7 @@ QOM commands: ## import argparse - -from qemu.qmp import ExecuteError +from typing import List from .qom_common import QOMCommand @@ -224,28 +223,34 @@ class QOMTree(QOMCommand): super().__init__(args) self.path = args.path - def _list_node(self, path: str) -> None: - print(path) - items = self.qom_list(path) - for item in items: - if item.child: - continue - try: - rsp = self.qmp.cmd('qom-get', path=path, - property=item.name) - print(f" {item.name}: {rsp} ({item.type})") - except ExecuteError as err: - print(f" {item.name}: <EXCEPTION: {err!s}> ({item.type})") - print('') - for item in items: - if not item.child: - continue + def _list_nodes(self, paths: List[str]) -> None: + all_paths_props = self.qom_list_get(paths) + i = 0 + + for props in all_paths_props: + path = paths[i] + i = i + 1 + print(path) if path == '/': path = '' - self._list_node(f"{path}/{item.name}") + newpaths = [] + + for item in props.properties: + if item.child: + newpaths += [f"{path}/{item.name}"] + else: + value = item.value + if value is None: + value = "<EXCEPTION: property could not be read>" + print(f" {item.name}: {value} ({item.type})") + + print('') + + if newpaths: + self._list_nodes(newpaths) def run(self) -> int: - self._list_node(self.path) + self._list_nodes([self.path]) return 0 |