From nobody Tue Feb 10 06:04:33 2026 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; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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 [170.10.133.124]) by mx.zohomail.com with SMTPS id 1631620177606198.4112664549607; Tue, 14 Sep 2021 04:49:37 -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-596-X3YDs_ZdMBCYTXNngStfDQ-1; Tue, 14 Sep 2021 07:49:34 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1F6D18BAF49; Tue, 14 Sep 2021 11:48:45 +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 F41267A5CE; Tue, 14 Sep 2021 11:48:44 +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 A11921805989; Tue, 14 Sep 2021 11:48:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 18EBmZjI032288 for ; Tue, 14 Sep 2021 07:48:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id C67FD202F348; Tue, 14 Sep 2021 11:48:35 +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 C1C71203B7B0 for ; Tue, 14 Sep 2021 11:48:30 +0000 (UTC) Received: from us-smtp-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 9396D800883 for ; Tue, 14 Sep 2021 11:48:30 +0000 (UTC) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-481-LDqzJxCLNU6G9ogBwoL1Wg-1; Tue, 14 Sep 2021 07:48:29 -0400 Received: by mail-pj1-f52.google.com with SMTP id v19so5989000pjh.2 for ; Tue, 14 Sep 2021 04:48:28 -0700 (PDT) Received: from fedora.zelin.local ([106.161.68.221]) by smtp.gmail.com with ESMTPSA id k22sm10330883pfi.149.2021.09.14.04.48.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 04:48:27 -0700 (PDT) X-MC-Unique: X3YDs_ZdMBCYTXNngStfDQ-1 X-MC-Unique: LDqzJxCLNU6G9ogBwoL1Wg-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=5R3hECBKQJiek5Sokq4yl9VHZlFCUP+l73PwRoWeweI=; b=uyOXecei4LF8cxHJnMjfb3/OUCTcSaQwOligXZBGoVlssd0tvVJQjCOsI8zfa1XH1k h9TOSxPMAxk+qnYG83TexyHrbsDljGz3xwDdILuehzcGDXnHo9PawG5u0TIM1cp1Ib5B IE6VpKDj6HGTHwXEqfssZpsuj5/0G2//ZIzZY9qdfVBdgHlr4VbrucurbFSssr0aknXe fBJYuGnPBOvnAw1SVlHpBODXet5JwS3ZnooENV7WRulqXBPlk+VB1DqBnPXb96vUf94a PUROc1veKTb6B81TVTsFq9D2eQQAHutWtRJwDg8fQiqO4tKXUo65o9vBQcDZy5POics5 7JXQ== X-Gm-Message-State: AOAM530bHjod8HgTNJslfl3rinl3qxilUKCxT5uR6WAj90m8QIN2HmwO JfC9MO/kL6oiRdnRX7S0FIML8lZ3kbSZGblQcO5xVRSz X-Google-Smtp-Source: ABdhPJyT8FCZ84xp/bn0hzlPmYq/3cXEH/oKzOj07iqmG30vJLB7SgRf6lCJeFR3dLrr3c75Lqtd3w== X-Received: by 2002:a17:90a:cb14:: with SMTP id z20mr1645857pjt.230.1631620107763; Tue, 14 Sep 2021 04:48:27 -0700 (PDT) From: zhanglei To: libvir-list@redhat.com, zhanglei@smartx.com Subject: [libvirt PATCH v3 2/5] virsh: add interface information to guestinfo command Date: Tue, 14 Sep 2021 19:47:07 +0800 Message-Id: <20210914114710.270816-3-zhanglei@smartx.com> In-Reply-To: <20210914114710.270816-1-zhanglei@smartx.com> References: <20210914114710.270816-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.78 on 10.11.54.4 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.79 on 10.5.11.13 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: 1631620177930100001 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 9561b3f59d..5310baab10 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 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