From nobody Mon Feb 9 17:34:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1609759850; cv=none; d=zohomail.com; s=zohoarc; b=b2CtLjFhlagBnNopVbT3xX1pX1s0Q+vZopk+hPYrKABLpLLl6okKl+hHVZ6YVM+am+MxTGGIxt/kQdWX4kgcDA/JZwbz4h0L46s6jaqiHjplKzsGOawEckPwxkysjVScU3rHR2GeHXqiimqoVBPVYHN2cLosrwQtaqDoc5zjBdQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609759850; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XPq+s355VXhZF9ewlHGTRIOj6N/6dbSRKEIkO49IxEc=; b=GF2n23rkA4A+3gohcLPC3JcTE5q02LKXE527VxWXCl089pB518x57rjo5/3UJNJwHjp3cBpyD06Z9j1axXhhvEUqLY1C4sw1PQizprOVqyUlDOZtavkxQ03JCowp6gtIqUMuHkJn/iwjFhbleHL8lk/4nhIVvjvnmpFQWZmLJBo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1609759850039671.3942208330946; Mon, 4 Jan 2021 03:30:50 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-399-m75_SBtjP6mhbswJsJobEQ-1; Mon, 04 Jan 2021 06:30:46 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 171D1190B2AE; Mon, 4 Jan 2021 11:30:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E8EBC5D9D3; Mon, 4 Jan 2021 11:30:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B00351809CA4; Mon, 4 Jan 2021 11:30:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 104BUWkA006537 for ; Mon, 4 Jan 2021 06:30:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id 24D0D5D761; Mon, 4 Jan 2021 11:30:32 +0000 (UTC) Received: from work.redhat.com (ovpn-112-122.ams2.redhat.com [10.36.112.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8EAE65D756; Mon, 4 Jan 2021 11:30:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609759848; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=XPq+s355VXhZF9ewlHGTRIOj6N/6dbSRKEIkO49IxEc=; b=XL/lTOjgQ+ZeyM+gZSTOh+y24S/ww6hat4HW8zXv0GQMTaVIP8sHCHBf7O7V6yYOCAm69L 26J9Zp5TmuOG7kGMvAq5WfNN1QWd64fcL6wNe1nWXQHADgmfSY39DeBu8nNaWye9iOy5Jk lQ5CSWHkrm/3tXF64va9D1lKH5arZgk= X-MC-Unique: m75_SBtjP6mhbswJsJobEQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 7/9] cpu-gather: Use actions instead of flags for action argument Date: Mon, 4 Jan 2021 12:30:17 +0100 Message-Id: <20210104113019.106513-8-twiederh@redhat.com> In-Reply-To: <20210104113019.106513-1-twiederh@redhat.com> References: <20210104113019.106513-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This allows for the functionality of cpu-cpuid.py script to be integrated more naturally in a later patch. Changes the way this script should be called: cpu-gather.py -> cpu-gather.py cpu-gather.py --gather -> cpu-gather.py gather cpu-gather.py --parse -> cpu-gather.py parse cpu-gather.py --gather --parse -> cpu-gather.py full Signed-off-by: Tim Wiederhake --- tests/cputestdata/cpu-gather.py | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index a01c615504..5ca19e5f2b 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -324,21 +324,22 @@ def main(): help=3D"Path to qemu. " "If unset, will try '/usr/bin/qemu-system-x86_64', " "'/usr/bin/qemu-kvm', and '/usr/libexec/qemu-kvm'.") - parser.add_argument( - "--gather", - action=3D"store_true", - help=3D"Acquire data on target system. This is the default. " - "If '--parse' is not set, outputs data on stdout.") - parser.add_argument( - "--parse", - action=3D"store_true", - help=3D"Parse data for libvirt use. " - "If '--gather' is not set, expects input on stdin.") + subparsers =3D parser.add_subparsers(dest=3D"action") + subparsers.add_parser( + "gather", + help=3D"Acquire data on target system and outputs to stdout. " + "This is the default. ") + subparsers.add_parser( + "parse", + help=3D"Reads data from stdin and parses data for libvirt use.") + subparsers.add_parser( + "full", + help=3D"Equivalent to `cpu-gather gather | cpu-gather parse`.") =20 args =3D parser.parse_args() =20 - if not args.gather and not args.parse: - args.gather =3D True + if not args.action: + args.action =3D "gather" =20 if not args.path_to_qemu: args.path_to_qemu =3D "qemu-system-x86_64" @@ -350,13 +351,13 @@ def main(): if os.path.isfile(f): args.path_to_qemu =3D f =20 - if args.gather: + if args.action in ["gather", "full"]: data =3D gather(args) - if not args.parse: + if args.action =3D=3D "gather": json.dump(data, sys.stdout, indent=3D2) =20 - if args.parse: - if not args.gather: + if args.action in ["parse", "full"]: + if args.action =3D=3D "parse": data =3D json.load(sys.stdin) parse(data) =20 --=20 2.26.2