From nobody Tue Sep 9 13:55:11 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1756478308; cv=none; d=zohomail.com; s=zohoarc; b=ChbosOUiLIqOEcS6Lkt5aHEjbpS797fUrvIw1iftz58xCTHNA5jy6xI+l7ceJ8VOGFKOlietNQbALZJuyY9rYM511Yr6wFGCsWP1UFD/kbPSotjwf63tP2UxXoxPhrVQl1fuBuilyWfPTFRB9yCG/Isk7DX8nauGgy1zye3V0Uk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756478308; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=YvU3FAD6GZejL21nzY9DaNjr0nfG5KY4+IfGCJPXsS0=; b=joTjO0iP1endKnsPy93+DBI5o79F6KkvvUIm1CNIMYp6BnZUK8koCOzISfHKjqsylccX95bz5sjbGV019S0FQt9sECu4ph0kySJjLi5767+TzB4zlp/fNkn+lIvin83iyj2dO9GQwRDXa6pTTsB0qf/QfHYIRLOOxNx5M7cY9Vo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1756478308036547.5785356945731; Fri, 29 Aug 2025 07:38:28 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 744ED44154; Fri, 29 Aug 2025 10:38:27 -0400 (EDT) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 378B44440A; Fri, 29 Aug 2025 10:20:30 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 511EE44120; Fri, 29 Aug 2025 10:19:57 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id AAD704418C for ; Fri, 29 Aug 2025 10:19:47 -0400 (EDT) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-401-pHjkaAAEOaS1pYFpfZWeTw-1; Fri, 29 Aug 2025 10:19:46 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3D48B1800378 for ; Fri, 29 Aug 2025 14:19:45 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.44.22.3]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 788551956095 for ; Fri, 29 Aug 2025 14:19:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756477187; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YvU3FAD6GZejL21nzY9DaNjr0nfG5KY4+IfGCJPXsS0=; b=fG0DPbhGkGrRnxqiCUvPAX946NOOBlms5POS+Wvjp1G9TndiJ/4WMgdOQEmIaJpHnOdgq4 ddaZ0IKDjixheLM9r1wl786DM1eXh4GGQ/kHMOkHfpm2VWsd+LdeuwQvpiacitdhfuIG98 S8ocfTJaffhOnb8WnFIVmL5DYXPDxCw= X-MC-Unique: pHjkaAAEOaS1pYFpfZWeTw-1 X-Mimecast-MFC-AGG-ID: pHjkaAAEOaS1pYFpfZWeTw_1756477185 To: devel@lists.libvirt.org Subject: [PATCH 8/8] scripts: qemu-replies-tool: Add option to dump JSON commands that weren't processed by --dump-all Date: Fri, 29 Aug 2025 16:19:32 +0200 Message-ID: <036f99f66f03df6017dc897692e202c61e05c762.1756477095.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: m9zJmEFDfPiwYJeovut2Y9UYoDjOjY1is2eKNKBavW8_1756477185 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: KSX73ESTE3QDXXSNJAGGBJKF6TZK4HB7 X-Message-ID-Hash: KSX73ESTE3QDXXSNJAGGBJKF6TZK4HB7 X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1756478309124124100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa This is useful for checking that the script still covers everything when using it to compare two .replies files. Signed-off-by: Peter Krempa --- scripts/qemu-replies-tool.py | 59 ++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/scripts/qemu-replies-tool.py b/scripts/qemu-replies-tool.py index e5a1b2fb3e..cf99ecd1f3 100755 --- a/scripts/qemu-replies-tool.py +++ b/scripts/qemu-replies-tool.py @@ -401,6 +401,8 @@ def dump_qom_list_types(conv, dumpprefix): types.append(qomtype['name']) + c['processed'] =3D True + break types.sort() @@ -421,7 +423,12 @@ def dump_device_and_object_properties(conv, dumpprefix= ): if c['cmd']['execute'] =3D=3D 'qom-list-properties': prefix =3D '(qom-prop)' - if prefix is None or 'return' not in c['rep']: + if prefix is None: + continue + + c['processed'] =3D True + + if 'return' not in c['rep']: continue for arg in c['rep']['return']: @@ -458,9 +465,16 @@ def machine_type_sorter(item): def dump_machine_types(conv, dumpprefix): machines =3D dict() aliases =3D [] + dumped_kvm =3D False for c in conv: if c['cmd']['execute'] =3D=3D 'query-machines': + + c['processed'] =3D True + + if dumped_kvm: + continue + for machine in c['rep']['return']: deprecated =3D False name =3D machine['name'] @@ -481,7 +495,9 @@ def dump_machine_types(conv, dumpprefix): machines[name] =3D {} machines[name][version] =3D deprecated - break + + # Dump only the machines for the first occurence of 'query= -machines' + dumped_kvm =3D True for (machine, versions) in sorted(machines.items()): for (version, deprecated) in sorted(versions.items(), key=3Dmachin= e_type_sorter): @@ -521,17 +537,47 @@ def dump_other(conv, dumpprefix): c['rep']['return']['qemu'][= 'minor'], c['rep']['return']['qemu'][= 'micro'], c['rep']['return']['package= '])) + c['processed'] =3D True if c['cmd']['execute'] =3D=3D 'query-target': print('%s(target) %s' % (dumpprefix, c['rep']['return']['arch'= ])) + c['processed'] =3D True if c['cmd']['execute'] =3D=3D 'query-kvm': print('%s(kvm) present:%s enabled:%s' % (dumpprefix, c['rep']['return']['p= resent'], c['rep']['return']['e= nabled'])) + c['processed'] =3D True if c['cmd']['execute'] =3D=3D 'query-command-line-options': dump_command_line_options(c, dumpprefix) + c['processed'] =3D True + + +# dumps the parts of the .replies file which are not handled by the variou= s dump_ +# helpers +def dump_unprocessed(conv): + actual =3D '' + + for c in conv: + if 'processed' in c and c['processed'] is True: + continue + + # skip stuf not making sense to be processed: + # 'qmp_capabilities' - startup of QMP, no interesting data + # 'query-cpu-model-expansion' - too host dependant, nothing releva= nt + if c['cmd']['execute'] in ['qmp_capabilities', 'query-cpu-model-ex= pansion']: + continue + + # skip commands not having successful return + if 'return' not in c['rep']: + continue + + actual +=3D json.dumps(c['cmd'], indent=3D2) + '\n\n' + json.dumps= (c['rep'], indent=3D2) + + if actual !=3D '': + for line in actual.split('\n'): + print('(unprocessed) ' + line) def process_one(filename, args): @@ -551,6 +597,7 @@ def process_one(filename, args): if args.dump_all or args.dump_qmp_query_strings: dump_qmp_probe_strings(c['rep']['return'], dumpprefix) + c['processed'] =3D True dumped =3D True if args.dump_all: @@ -560,6 +607,10 @@ def process_one(filename, args): dump_machine_types(conv, dumpprefix) dumped =3D True + if args.dump_unprocessed: + dump_unprocessed(conv) + dumped =3D True + if dumped: return True @@ -635,6 +686,10 @@ 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-unprocessed', action=3D'store_true', + help=3D'dump JSON of commands unprocessed by any of th= e --dump-* options') + args =3D parser.parse_args() files =3D [] --=20 2.51.0