From nobody Wed Feb 11 02:14:51 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=riseup.net ARC-Seal: i=1; a=rsa-sha256; t=1696959442; cv=none; d=zohomail.com; s=zohoarc; b=HLL5lr0HKjvvRctYolMCdOWWeiHYrG50SX7iEG8XS0J9MAF5bQ+RyxsTQYlqA41/K9BoZt4xZnOvyuKWUxqeEAf7vEA6IXv1oxwEkYGDsuQGQBXMm1H4LA+q3HOuOuXAzsmLUahea0Ud1st9Nz3K3693qWnWGkMhXDw105vQnM0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696959442; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OwvA907uiOHqn5xkcQjJxkK+DSP9o2OSJO9RJD1kSUw=; b=KUbsj+shXKgPPMZRQVnjXDSI0UGGSlRKo0IZPugQIoCKLK+5QNcObMqOf2fEkv9bZpLs/hbUOfwu7rhk0hFMQ7Spgcn0jVOz3dTCJJz8t790jN8yqIH9il89PBejqXo3sd9OC6euw/vGp+FtKfAYSrhFIBGYLS12v1mkgqUlmUw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1696959442984871.4547167244365; Tue, 10 Oct 2023 10:37:22 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-691-_I3qTrVRM5iqd9YA9X-Svw-1; Tue, 10 Oct 2023 13:37:09 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 76F96185A7BC; Tue, 10 Oct 2023 17:37:07 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 63545492B00; Tue, 10 Oct 2023 17:37:07 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3570719465B8; Tue, 10 Oct 2023 17:37:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 632691946597 for ; Tue, 10 Oct 2023 17:37:06 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 555A721CAC76; Tue, 10 Oct 2023 17:37:06 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast10.extmail.prod.ext.rdu2.redhat.com [10.11.55.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4D9AF21CAC6B for ; Tue, 10 Oct 2023 17:37:06 +0000 (UTC) Received: from us-smtp-inbound-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2F4E21C11714 for ; Tue, 10 Oct 2023 17:37:06 +0000 (UTC) Received: from mx1.riseup.net (mx1.riseup.net [198.252.153.129]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-256-Z9T_y8NLMH-WAxLVS-kpWw-1; Tue, 10 Oct 2023 13:36:20 -0400 Received: from mx0.riseup.net (mx0-pn.riseup.net [10.0.1.42]) (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 mx1.riseup.net (Postfix) with ESMTPS id 4S4jWK4KtVzDqp7 for ; Tue, 10 Oct 2023 17:26:53 +0000 (UTC) Received: from fews02-sea.riseup.net (fews02-sea-pn.riseup.net [10.0.1.112]) (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 mx0.riseup.net (Postfix) with ESMTPS id 4S4jW43NgMz9tBF for ; Tue, 10 Oct 2023 17:26:40 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews02-sea.riseup.net (Postfix) with ESMTPSA id 4S4jW327ggzFpcn; Tue, 10 Oct 2023 17:26:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696959442; 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=OwvA907uiOHqn5xkcQjJxkK+DSP9o2OSJO9RJD1kSUw=; b=S4fGJq9+y6bC5y0PDOMbJp1UfdJXz/EWAP1iJWHhk02ucch5x1EXAjKqs/7mpgSoeJ9d9Y zKV29n8wqYURAZHZaBvAvWucZqEfbDjQG1C83CynnCy2WrOSNakxrKN/jEmQUmPwdZTvyG 4aLI0dz4GnI7X5BiDJel+ddx2VSAWlc= X-MC-Unique: _I3qTrVRM5iqd9YA9X-Svw-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: Z9T_y8NLMH-WAxLVS-kpWw-1 X-Riseup-User-ID: DB4A989A3505D4C7BF8AD620A4C62A40B915250901BD019467549926007FF9F5 From: K Shiva Kiran To: libvir-list@redhat.com Subject: [PATCH v2 06/11] virsh: Add option --title for nwfilter-list Date: Tue, 10 Oct 2023 22:48:38 +0530 Message-ID: <20231010172509.103884-7-shiva_kr@riseup.net> In-Reply-To: <20231010172509.103884-1-shiva_kr@riseup.net> References: <20231010172509.103884-1-shiva_kr@riseup.net> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: K Shiva Kiran Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: riseup.net Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1696959444580100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Signed-off-by: K Shiva Kiran --- docs/manpages/virsh.rst | 5 ++++- tools/virsh-nwfilter.c | 36 ++++++++++++++++++++++++++++++------ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index e15f1832e7..5e03ce1e18 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -8083,10 +8083,13 @@ nwfilter-list =20 :: =20 - nwfilter-list + nwfilter-list [--title] =20 List all of the available network filters. =20 +If *--title* is specified, then the short network filter description +(title) is printed in an extra column. + =20 nwfilter-dumpxml ---------------- diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c index 801a52746e..ca803865bf 100644 --- a/tools/virsh-nwfilter.c +++ b/tools/virsh-nwfilter.c @@ -407,6 +407,10 @@ static const vshCmdInfo info_nwfilter_list[] =3D { }; =20 static const vshCmdOptDef opts_nwfilter_list[] =3D { + {.name =3D "title", + .type =3D VSH_OT_BOOL, + .help =3D N_("show network filter title") + }, {.name =3D NULL} }; =20 @@ -416,13 +420,18 @@ cmdNWFilterList(vshControl *ctl, const vshCmd *cmd G_= GNUC_UNUSED) size_t i; char uuid[VIR_UUID_STRING_BUFLEN]; bool ret =3D false; + bool optTitle =3D vshCommandOptBool(cmd, "title"); struct virshNWFilterList *list =3D NULL; g_autoptr(vshTable) table =3D NULL; =20 if (!(list =3D virshNWFilterListCollect(ctl, 0))) return false; =20 - table =3D vshTableNew(_("UUID"), _("Name"), NULL); + if (optTitle) + table =3D vshTableNew(_("UUID"), _("Name"), _("Title"), NULL); + else + table =3D vshTableNew(_("UUID"), _("Name"), NULL); + if (!table) goto cleanup; =20 @@ -430,11 +439,26 @@ cmdNWFilterList(vshControl *ctl, const vshCmd *cmd G_= GNUC_UNUSED) virNWFilterPtr nwfilter =3D list->filters[i]; =20 virNWFilterGetUUIDString(nwfilter, uuid); - if (vshTableRowAppend(table, - uuid, - virNWFilterGetName(nwfilter), - NULL) < 0) - goto cleanup; + + if (optTitle) { + g_autofree char *title =3D NULL; + if (!(title =3D virshGetNWFilterDescription(ctl, nwfilter, tru= e, 0, 0))) + goto cleanup; + + if (vshTableRowAppend(table, + uuid, + virNWFilterGetName(nwfilter), + title, + NULL) < 0) + goto cleanup; + + } else { + if (vshTableRowAppend(table, + uuid, + virNWFilterGetName(nwfilter), + NULL) < 0) + goto cleanup; + } } =20 vshTablePrintToStdout(table, ctl); --=20 2.42.0