From nobody Mon Feb 9 19:31:35 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 1631607331064159.1426305465917; Tue, 14 Sep 2021 01:15:31 -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-423-pkUKCT9aNG-Tafj7X-E4KA-1; Tue, 14 Sep 2021 04:15:28 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9D2EA1800D41; Tue, 14 Sep 2021 08:15:23 +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 2D02A19739; Tue, 14 Sep 2021 08:15:23 +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 30DBF1803B30; Tue, 14 Sep 2021 08:15:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 18E7vaIu010049 for ; Tue, 14 Sep 2021 03:57:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id E35EC2151500; Tue, 14 Sep 2021 07:57:35 +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 DC87F2151504 for ; Tue, 14 Sep 2021 07:57:33 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 3F89B8934E5 for ; Tue, 14 Sep 2021 07:57:33 +0000 (UTC) Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-366-NyLu2rVYNAmhL8rLNIzqZg-1; Tue, 14 Sep 2021 03:57:30 -0400 Received: by mail-pj1-f51.google.com with SMTP id k23-20020a17090a591700b001976d2db364so2098809pji.2 for ; Tue, 14 Sep 2021 00:57:30 -0700 (PDT) Received: from fedora.zelin.local (61-221-155-12.hinet-ip.hinet.net. [61.221.155.12]) by smtp.gmail.com with ESMTPSA id p9sm11390650pgn.36.2021.09.14.00.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 00:57:29 -0700 (PDT) X-MC-Unique: pkUKCT9aNG-Tafj7X-E4KA-1 X-MC-Unique: NyLu2rVYNAmhL8rLNIzqZg-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=kpoqA8ZDSoPHfW7hxiX9hCVZC9QdOPxsELLjemEe6m0=; b=0w/5bqJQkB3llIo7tB9E3J6FrjloArHkgJcFCaVyb+aXS7M1pDE1BpAgdLv33tLnOg 9490PrbgEtsLCrTcCNsQpePaqR+L2p8I9RpIuPLyAa3ieMvrPmG/VfFfyJO88goPd7wS N2C4L2vGlnB1jJtS13GtFaetKZfa8QyK4dCPBJoODY/jiPmCxnCsoCc7x5FGXmbu460+ Ly+XNalV3KFhN2j987fsJYS3RX5uRoGgKiB6heVpNlxhTsSzJtK5z6RpPqNZ5yg2Cd0I LP+xnW/SvE/uu+RPCy4eec0c+G6k57EygB7JU0NvP26fXppDhMICE/BPUxL0zc0GYJ56 aRzQ== X-Gm-Message-State: AOAM530ir5Oiy+oWk2TcmfIdXn+ot4Ox+JMSrGtSlaBehOr6qTw4JekI VHJs0lqliKN3iJByjzTiPHuowbDQuXSDV8jILy4= X-Google-Smtp-Source: ABdhPJwBUWc9ts/um+0xxGaKLGELjg0Ln9BLfPizSqaKkANsI9k7iea3zKSI7zvqbT2r14ooM5YsgQ== X-Received: by 2002:a17:902:ab16:b0:13a:356c:6a03 with SMTP id ik22-20020a170902ab1600b0013a356c6a03mr13849487plb.38.1631606249549; Tue, 14 Sep 2021 00:57:29 -0700 (PDT) From: zhanglei To: zhanglei@smartx.com, libvir-list@redhat.com Subject: [libvirt PATCH v2 2/4] virsh: add interface information to guestinfo command Date: Tue, 14 Sep 2021 15:56:43 +0800 Message-Id: <20210914075645.166703-3-zhanglei@smartx.com> In-Reply-To: <20210914075645.166703-1-zhanglei@smartx.com> References: <20210914075645.166703-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-Mimecast-Spam-Signature: yes X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Tue, 14 Sep 2021 04:15:19 -0400 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.23 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: 1631607332656100004 Content-Type: text/plain; charset="utf-8" Signed-off-by: zhanglei --- docs/manpages/virsh.rst | 12 ++++++++++-- tools/virsh-domain.c | 6 ++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 9561b3f59d..dd186ab14d 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 type of IP address (e.g. ipv4) +* ``if..addr..addr`` - the address of IP address +* ``if..addr..prefix`` - the prefix of IP address =20 guestvcpus ---------- diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index e5bd1fdd75..5ba5bd6b8c 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -13829,6 +13829,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 @@ -13854,6 +13858,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