From nobody Mon Sep 16 19:04:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1693756235; cv=none; d=zohomail.com; s=zohoarc; b=i8+2prSRuZLBTnPPEX4d5iSHN/HMcAKXEX+BFJhx+FE2mOtCYqU3vDlZORjSWqu6jz/p7CjxKGpxUhTDf6DEQ6A44ehBKTFuMKHrDMp0XUMxcUYPaBZ9FO9X5X/CTIIbargSmqq9giNQ+42Weyk3XMcx3OavinsNpAf1A3YWtrY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693756235; 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=D88ocPpg7arlMn0qJ3nKHug42yQB9E6UZaWK6h4DJc0=; b=eTVLojF7pS9WtFxfbpbF03FIY4E6sy4iEM9Ys+NBP+j0sPYWxGKClIvfCOzfZllFqXzqseT/M0sQwVU691QEX/d5idglXGm9HyyB5h+bcgQ/BrnLQ8Zkcj50aXhcLhEKq1Ib7JJc4RbVUhCaDWEDcp8DU/zVpmN3CwMWtcRy4A4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1693756235792587.4431265271261; Sun, 3 Sep 2023 08:50:35 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-550-VhUQIBTjOh6pdpFNiepp4w-1; Sun, 03 Sep 2023 11:50:31 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1E63E1C29799; Sun, 3 Sep 2023 15:50:28 +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 C94021460FFA; Sun, 3 Sep 2023 15:50:27 +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 AB8121946597; Sun, 3 Sep 2023 15:50:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2641A1946597 for ; Sun, 3 Sep 2023 15:50:26 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 16263412F2CF; Sun, 3 Sep 2023 15:50:26 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0EA97412F2CE for ; Sun, 3 Sep 2023 15:50:26 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 E840F91C4E4 for ; Sun, 3 Sep 2023 15:50:25 +0000 (UTC) Received: from mx0.riseup.net (mx0.riseup.net [198.252.153.6]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-516-TyQshtjAPKO7WxfKLdRQ_g-1; Sun, 03 Sep 2023 11:50:23 -0400 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 4Rdx724Xkvz9tGn for ; Sun, 3 Sep 2023 15:50:22 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews02-sea.riseup.net (Postfix) with ESMTPSA id 4Rdx713RXyzFpfK; Sun, 3 Sep 2023 15:50:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693756234; 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=D88ocPpg7arlMn0qJ3nKHug42yQB9E6UZaWK6h4DJc0=; b=MNMLLQbb3kJKktYby95Sh6jqY9Z3Nzxkw+GxOA7UzYnkQxnMPtWrFhwV8wr/5OOTnpM8DG OYgwy24blYom0fAB2VoDd0GdihoiSTnp1hm4eQ0gNigjUO1qqXTTTSAGX4+XncaWgkjCnS iwaIurV4C2xrCu4r7ny/AZP7B44fp4U= X-MC-Unique: VhUQIBTjOh6pdpFNiepp4w-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: TyQshtjAPKO7WxfKLdRQ_g-1 X-Riseup-User-ID: 34212439E151A3B9DE6C7DB63C7C2D82A959D9280EFC341E7A32269F5A635FDA From: K Shiva Kiran To: libvir-list@redhat.com Subject: [PATCH 11/16] virsh: Add option --title for nwfilter-list Date: Sun, 3 Sep 2023 21:19:12 +0530 Message-ID: <20230903155034.211476-12-shiva_kr@riseup.net> In-Reply-To: <20230903155034.211476-1-shiva_kr@riseup.net> References: <20230903155034.211476-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.2 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.7 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: 1693756237705100011 Content-Type: text/plain; charset="utf-8"; x-default="true" Signed-off-by: K Shiva Kiran --- tools/virsh-nwfilter.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) 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