From: Peter Krempa <[email protected]>

Handlers for dumping device and qom types have safeguards which check
that we notice interesting new fields added by qemu.

Recently two new fields were added:
 - 'qom-list-types' reports 'secure' for listed entries to denote that
   upstream QEMU considers those production grade
 - 'qom-list-properties' and friends return 'qapi-type' field which maps
   to the accepted type returned by 'query-qmp-schema'

Accept both, but output only 'secure' in the dump output. The internal
qemu types change with qemu builds so it would prevent using the dump
functionality for comparing changes in QEMU.

Signed-off-by: Peter Krempa <[email protected]>
---
 scripts/qemu-replies-tool.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/scripts/qemu-replies-tool.py b/scripts/qemu-replies-tool.py
index 21401452cf..9ae1871cb8 100755
--- a/scripts/qemu-replies-tool.py
+++ b/scripts/qemu-replies-tool.py
@@ -396,10 +396,13 @@ def dump_qom_list_types(conv, dumpprefix):
                 # validate known fields:
                 # 'parent' is ignored below as it causes output churn
                 for k in qomtype:
-                    if k not in ['name', 'parent']:
+                    if k not in ['name', 'parent', 'secure']:
                         raise Exception("Unhandled 'qom-list-types' field 
'%s'" % k)

-                types.append(qomtype['name'])
+                if 'secure' in qomtype.keys():
+                    types.append('%s (secure=%s)' % (qomtype['name'], 
qomtype['secure']))
+                else:
+                    types.append(qomtype['name'])

             c['processed'] = True

@@ -433,7 +436,9 @@ def dump_device_and_object_properties(conv, dumpprefix):

         for arg in c['rep']['return']:
             for k in arg:
-                if k not in ['name', 'type', 'description', 'default-value']:
+                # qapi-type maps to the internal qemu naming so exposing it to 
the
+                # user here is pointless and would change across qemu builds
+                if k not in ['name', 'type', 'description', 'default-value', 
'qapi-type']:
                     raise Exception("Unhandled 
'device-list-properties'/'qom-list-properties' typename '%s' field '%s'" % 
(c['cmd']['arguments']['typename'], k))

             if 'default-value' in arg:
-- 
2.56.0

Reply via email to