From nobody Wed Jan 15 12:51:07 2025 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1705422574315214.29805699951226; Tue, 16 Jan 2024 08:29:34 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 3D3C51BD8; Tue, 16 Jan 2024 11:29:33 -0500 (EST) Received: from lists.libvirt.org.85.43.8.in-addr.arpa (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 45C551E55; Tue, 16 Jan 2024 11:14:01 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 081561C72; Tue, 16 Jan 2024 11:13:01 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id B09BA1CE5 for ; Tue, 16 Jan 2024 11:12:58 -0500 (EST) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-154-noCge-OkPCmGGSoTP_A07g-1; Tue, 16 Jan 2024 11:12:56 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 494BB28B72E8 for ; Tue, 16 Jan 2024 16:12:56 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 967E91C060AF for ; Tue, 16 Jan 2024 16:12:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: noCge-OkPCmGGSoTP_A07g-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 09/10] qemu-replies-tool: Dump 'qom-list-types' Date: Tue, 16 Jan 2024 17:12:43 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: HVS53HZSYOBDLJ7ZTMWQCHELUCCNZL3T X-Message-ID-Hash: HVS53HZSYOBDLJ7ZTMWQCHELUCCNZL3T X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1705422574950100001 The order of entries in 'qom-list-types' sometimes changes arbitrarily. The --dump-qom-list-types produces a stable order and drops the for libvirt unneeded 'parent' information. Sample output: $ ./scripts/qemu-replies-tool.py tests/qemucapabilitiesdata/caps_9.0.0_x86_= 64.replies --dump-qom-list-types (qom) 486-v1-x86_64-cpu (qom) 486-x86_64-cpu (qom) AC97 (qom) AMDVI-PCI (qom) Broadwell-IBRS-x86_64-cpu (qom) Broadwell-noTSX-IBRS-x86_64-cpu (qom) Broadwell-noTSX-x86_64-cpu (qom) Broadwell-v1-x86_64-cpu (qom) Broadwell-v2-x86_64-cpu (qom) Broadwell-v3-x86_64-cpu [...] Signed-off-by: Peter Krempa Reviewed-by: Andrea Bolognani --- scripts/qemu-replies-tool.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/scripts/qemu-replies-tool.py b/scripts/qemu-replies-tool.py index 5dcc975756..bdd63a9460 100755 --- a/scripts/qemu-replies-tool.py +++ b/scripts/qemu-replies-tool.py @@ -375,6 +375,28 @@ def dump_qmp_probe_strings(schemalist): dump_qmp_probe_strings_iter(c, '(qmp) ' + c, [], schemadict) +def dump_qom_list_types(conv): + types =3D [] + + for (cmd, rep) in conv: + if cmd['execute'] =3D=3D 'qom-list-types': + for qomtype in rep['return']: + # validate known fields: + # 'parent' is ignored below as it causes output churn + for k in qomtype: + if k not in ['name', 'parent']: + raise Exception("Unhandled 'qom-list-types' field = '%s'" % k) + + types.append(qomtype['name']) + + break + + types.sort() + + for t in types: + print('(qom) ' + t) + + def process_one(filename, args): try: conv =3D qemu_replies_load(filename) @@ -390,6 +412,10 @@ def process_one(filename, args): dump_qmp_probe_strings(rep['return']) dumped =3D True + if args.dump_all or args.dump_qom_list_types: + dump_qom_list_types(conv) + dumped =3D True + if dumped: return True @@ -433,6 +459,11 @@ functional impact on libvirt. virQEMUCapsQMPSchemaQueries. It's useful to find specific query string without having to piece the information together from 'query-qmp-schem= a' + --dump-qom-list-types + + Dumps all types returned by 'qom-list-types' in a stable order with the + 'parent' property dropped as it's not relevant for libvirt. + The tool can be also used to programmaticaly modify the '.replies' file by editting the 'modify_replies' method directly in the source, or for re-formatting and re-numbering the '.replies' file to conform with the req= uired @@ -463,6 +494,9 @@ parser.add_argument('--dump-all', action=3D'store_true', parser.add_argument('--dump-qmp-query-strings', action=3D'store_true', help=3D'dump QMP schema in form of query strings used = to probe capabilities') +parser.add_argument('--dump-qom-list-types', action=3D'store_true', + help=3D'dump data from qom-list-types in a stable orde= r') + args =3D parser.parse_args() if not args.replyfile and not args.repliesdir: --=20 2.43.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org