From nobody Tue Feb 10 23:01:43 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com 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 1634292512707950.2486550239345; Fri, 15 Oct 2021 03:08:32 -0700 (PDT) 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-137-yUfc7hIDN8S5Neyj8VLkSw-1; Fri, 15 Oct 2021 06:08:24 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8FA0010A8E00; Fri, 15 Oct 2021 10:08:19 +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 493501002D67; Fri, 15 Oct 2021 10:08:19 +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 182961806D03; Fri, 15 Oct 2021 10:08:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19FA87Jj003627 for ; Fri, 15 Oct 2021 06:08:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 74F3A40CFD11; Fri, 15 Oct 2021 10:08:07 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6FF7440CFD0D for ; Fri, 15 Oct 2021 10:08:07 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 58C3B80231F for ; Fri, 15 Oct 2021 10:08:07 +0000 (UTC) Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-535-GxsbveneNi6Kmbx8tNm2hw-1; Fri, 15 Oct 2021 06:08:05 -0400 Received: by mail-pl1-f176.google.com with SMTP id v20so6079294plo.7 for ; Fri, 15 Oct 2021 03:08:05 -0700 (PDT) Received: from zhanglei-dev.zelin.local ([2a09:bac0:23::815:bc4]) by smtp.gmail.com with ESMTPSA id c25sm4613388pfn.159.2021.10.15.03.08.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 03:08:04 -0700 (PDT) X-MC-Unique: yUfc7hIDN8S5Neyj8VLkSw-1 X-MC-Unique: GxsbveneNi6Kmbx8tNm2hw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oA9puj7Lj4MmlIdR1LZCQGkfr9o0/8pu3bONbtuKCXQ=; b=kYF56wjfl/8xw/NeiOvJ95wvP7+nMgMLGfQj3esyLCH7cgrdR6WcvQ++s0vmmF4vRC EhkTdw4jqSRDRLTfj7La/lKiT28kXyi/bh6/SSy9h6fE1CsSeOSqVR5p8HPfdEM99IVq AAflrLTMBI8EgBWPV87/J5m/g2FJMLGCHdGxsb+yKqe0H310rz2USK95zb4heQ/UC6NG jaRkbrlqbRkfRWbwuYXDw7YpILKiZDN5imH8QoWeEbofEzBacW8MikMzjAPfh77xRqxG kegBC/du6stnIsLf+OrCGIyZ8eLUnRXXSfxDMtQf0EpcTqd50pvzCqjsqXT4vg1P92Y5 mNsg== X-Gm-Message-State: AOAM532q4Q4DNrfNFKxi23fVJuhObSgLUu8QUwn+9U4qL8eRrjjdQJ/o cSDHmBBYhDhebbQXN/eub8XgYmCBqytZE+txKzCeqg== X-Google-Smtp-Source: ABdhPJyJwTbisVj99Q6wdDn/k09RAHP9fCLnH+3wqaeu8BifjilUxvVLLfhGdRcCrTrlU0EBm5XKPg== X-Received: by 2002:a17:903:22c9:b0:13e:ed56:70e2 with SMTP id y9-20020a17090322c900b0013eed5670e2mr10206889plg.19.1634292484520; Fri, 15 Oct 2021 03:08:04 -0700 (PDT) From: zhanglei To: zhanglei@smartx.com, libvir-list@redhat.com Subject: [libvirt PATCH v4 2/5] virsh: add interface information to guestinfo command Date: Fri, 15 Oct 2021 18:07:48 +0800 Message-Id: <20211015100751.1492806-3-zhanglei@smartx.com> In-Reply-To: <20211015100751.1492806-1-zhanglei@smartx.com> References: <20211015100751.1492806-1-zhanglei@smartx.com> 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 2.84 on 10.11.54.1 X-loop: libvir-list@redhat.com 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.84 on 10.5.11.22 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-ZM-MESSAGEID: 1634292513715100002 Content-Type: text/plain; charset="utf-8" The new parameter group returns information about network interfaces Signed-off-by: zhanglei --- docs/manpages/virsh.rst | 12 ++++++++++-- src/libvirt-domain.c | 2 +- tools/virsh-domain.c | 6 ++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 4c5341d00d..1c60eae607 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -2700,7 +2700,7 @@ guestinfo :: =20 guestinfo domain [--user] [--os] [--timezone] [--hostname] [--filesyste= m] - [--disk] + [--disk] [--interface] =20 Print information about the guest from the point of view of the guest agen= t. Note that this command requires a guest agent to be configured and running= in @@ -2711,7 +2711,7 @@ are supported by the guest agent. You can limit the t= ypes of information that are returned by specifying one or more flags. If a requested information type is not supported, the processes will provide an exit code of 1. Available information types flags are *--user*, *--os*, -*--timezone*, *--hostname*, *--filesystem* and *--disk*. +*--timezone*, *--hostname*, *--filesystem*, *--disk* and *--interface*. =20 Note that depending on the hypervisor type and the version of the guest ag= ent running within the domain, not all of the following information may be @@ -2779,6 +2779,14 @@ returned: * ``disk..alias`` - the device alias of the disk (e.g. sda) * ``disk..guest_alias`` - optional alias assigned to the disk =20 +*--interface* returns: +* ``if.count`` - the number of interfaces defined on this domain +* ``if..name`` - name in the guest (e.g. ``eth0``) for interface +* ``if..hwaddr`` - hardware address in the guest for interface +* ``if..addr.count`` - the number of IP addresses of interface +* ``if..addr..type`` - the IP address type of addr (e.g.= ipv4) +* ``if..addr..addr`` - the IP address of addr +* ``if..addr..prefix`` - the prefix of IP address of addr =20 guestvcpus ---------- diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index fdc0780ae0..ce7cafde36 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -12580,7 +12580,7 @@ virDomainSetVcpu(virDomainPtr domain, * "hostname" - the hostname of the domain * * VIR_DOMAIN_GUEST_INFO_INTERFACES: - * Returns information about the interfaces within the domain. the typed + * Returns information about the interfaces within the domain. The typed * parameter keys are in this format: * * "if.count" - the number of interfaces defined on this domain diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index dbddefb4a5..bce03b3de5 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -13999,6 +13999,10 @@ static const vshCmdOptDef opts_guestinfo[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("report disk information"), }, + {.name =3D "interface", + .type =3D VSH_OT_BOOL, + .help =3D N_("report interface information"), + }, {.name =3D NULL} }; =20 @@ -14024,6 +14028,8 @@ cmdGuestInfo(vshControl *ctl, const vshCmd *cmd) types |=3D VIR_DOMAIN_GUEST_INFO_FILESYSTEM; if (vshCommandOptBool(cmd, "disk")) types |=3D VIR_DOMAIN_GUEST_INFO_DISKS; + if (vshCommandOptBool(cmd, "interface")) + types |=3D VIR_DOMAIN_GUEST_INFO_INTERFACES; =20 if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) return false; --=20 2.31.1