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=1756477678; cv=none; d=zohomail.com; s=zohoarc; b=JUJZan/f5yrS1s//qCepKNcWAmx0GSdteL7bF2iVK9zQVe4UU90XHqk9mw1RerjjLtyqpNrNlXozvutnoVEp24kc0qwrR/yK7Df8IMTVg7C6hf8RG1RgpOIemTGikVHdZa9wJpSFH3S/XFf1Q9c57qCLot5sCXCfM324CYE/ZZM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756477678; 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=mWqBiRZE8CbYEoYTZlknZ8KsVL0vniD6tQGH7EoUEcw=; b=INP6d7ktItjlp5RGvsm5HxhjCRojp6DZqDhITPokTlFBo9oZaame6O+zLTTkrOazm/g8eI/VpIhAgM8LpF6ESWjzl4dwtDtzh/QtGcYpjjZS1kHDCkBPwbcCSnRupwniWe0RINvyocrgsHhQ0L/hlgOEdcV8CF7LgveFUBfFb20= 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 1756477678822310.6913034982023; Fri, 29 Aug 2025 07:27:58 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id ED8C244159; Fri, 29 Aug 2025 10:27:57 -0400 (EDT) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id AB0744426B; Fri, 29 Aug 2025 10:20:08 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 83DE844183; Fri, 29 Aug 2025 10:19:47 -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 91F284411C for ; Fri, 29 Aug 2025 10:19:41 -0400 (EDT) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-215-5z8lXmLnM0GljYLJVxT_Sg-1; Fri, 29 Aug 2025 10:19:39 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E45AF19560A6 for ; Fri, 29 Aug 2025 14:19:38 +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 2B1211956095 for ; Fri, 29 Aug 2025 14:19:37 +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=1756477181; 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=mWqBiRZE8CbYEoYTZlknZ8KsVL0vniD6tQGH7EoUEcw=; b=UrVMsh/NBIcX6HzjsTJM0wG0qAPauxZN0uLL5p22oO8d3xgOHKYl9N1yY9rSIMN4mFnTag u81tqUcwIb8M6v2V8D8w7XNaJk3HYgzwDmW6m0fx2ZrSLljZL5xE7pNssEUnU4My43L1pK 1NpJ3vrghh+YcuJh1BdPTIWIC2tVT9g= X-MC-Unique: 5z8lXmLnM0GljYLJVxT_Sg-1 X-Mimecast-MFC-AGG-ID: 5z8lXmLnM0GljYLJVxT_Sg_1756477179 To: devel@lists.libvirt.org Subject: [PATCH 3/8] scripts: qemu-replies-tool: Dump machine types in --dump-all Date: Fri, 29 Aug 2025 16:19:27 +0200 Message-ID: <6888f9ebc155a992fd128752afbbc53dafcd165c.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: --_-NFME5h-wO13jgTTh3S2BKNQMjJC9zMGGtIOtQvM_1756477179 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: M43FLP3CSNI6LGRDHWZXQEIE2PVAFT5E X-Message-ID-Hash: M43FLP3CSNI6LGRDHWZXQEIE2PVAFT5E 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: 1756477681621116600 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Dumps the supported machine types and their deprecation state in stable human-sort order. Signed-off-by: Peter Krempa --- scripts/qemu-replies-tool.py | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/scripts/qemu-replies-tool.py b/scripts/qemu-replies-tool.py index b5e4ae46ca..211c448482 100755 --- a/scripts/qemu-replies-tool.py +++ b/scripts/qemu-replies-tool.py @@ -10,6 +10,7 @@ import argparse import json import os import sys +import re class qrtException(Exception): @@ -434,6 +435,61 @@ def dump_device_list_properties(conv): print('(dev) ' + d) +# Sort helper for version string e.g. '11.0', '1.2' etc. Tolerates empty v= ersion. +def machine_type_sorter(item): + key =3D item[0] + + if key =3D=3D '': + return [0] + + return list(map(int, key.split('.'))) + + +def dump_machine_types(conv): + machines =3D dict() + aliases =3D [] + + for c in conv: + if c['cmd']['execute'] =3D=3D 'query-machines': + for machine in c['rep']['return']: + deprecated =3D False + name =3D machine['name'] + version =3D '' + match =3D re.fullmatch(r'(.+)-(\d+\.\d+)', name) + + if match is not None: + name =3D match.group(1) + version =3D match.group(2) + + if 'deprecated' in machine: + deprecated =3D machine['deprecated'] + + if 'alias' in machine: + aliases.append('%s -> %s' % (machine['alias'], machine= ['name'])) + + if name not in machines: + machines[name] =3D {} + + machines[name][version] =3D deprecated + break + + for (machine, versions) in sorted(machines.items()): + for (version, deprecated) in sorted(versions.items(), key=3Dmachin= e_type_sorter): + d =3D '' + if deprecated: + d =3D ' (deprecated)' + + if len(version) > 0: + version =3D '-' + version + + print('(machine) %s%s%s' % (machine, version, d)) + + aliases.sort() + + for a in aliases: + print('(machine alias) ' + a) + + def process_one(filename, args): try: conv =3D qemu_replies_load(filename) @@ -452,6 +508,7 @@ def process_one(filename, args): if args.dump_all: dump_qom_list_types(conv) dump_device_list_properties(conv) + dump_machine_types(conv) dumped =3D True if dumped: --=20 2.51.0