From nobody Tue Feb 10 04:13:52 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1564666654; cv=none; d=zoho.com; s=zohoarc; b=fOyAtsVKh5dJwS2lTm53TK/utDFkpwTY9KuOFFVL1hLxpG6pkQbwgLbGrZHnLpMZKeNUhNkSvnJPd4sYEEtd5ONxCW3K2JGt9NnkCkwNPixc2OMp+E+Htefsicr5HZBbZ86WpRDNpzCBh+6rtswXdhtgoIWb1jCYxpHVk0a3pkU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564666654; 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:ARC-Authentication-Results; bh=MV9mwzpuvctLCOOppBrC/OGVPxpZHPtD0f2pjGgfJAM=; b=YoueRoByk3m9We0uaYeqo5yqjHlU4zl0kB55M5jg7MGQeLO1GXO1m17re49MHl0ogrQLXB0bhLyd+kWcXTwCZauoScZpB3yqd0cvHLHOSg6IOrIjoGZV1GUQFI26O6UifqIpMk+MRzGyzok7dkz3essN2r8f3WrpRw6bdIIICSE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1564666654723497.4845600924152; Thu, 1 Aug 2019 06:37:34 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 6950D7FDCA; Thu, 1 Aug 2019 13:37:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3980A60625; Thu, 1 Aug 2019 13:37:33 +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 EF5F819734; Thu, 1 Aug 2019 13:37:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x71DbIUc016323 for ; Thu, 1 Aug 2019 09:37:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 457AC600F8; Thu, 1 Aug 2019 13:37:18 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-117-216.phx2.redhat.com [10.3.117.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0283D600C4; Thu, 1 Aug 2019 13:37:17 +0000 (UTC) From: Jonathon Jongsma To: libvir-list@redhat.com Date: Thu, 1 Aug 2019 08:37:10 -0500 Message-Id: <20190801133710.19096-8-jjongsma@redhat.com> In-Reply-To: <20190801133710.19096-1-jjongsma@redhat.com> References: <20190801133710.19096-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: tgolembi@redhat.com Subject: [libvirt] [PATCH 7/7] virsh: add 'guestinfo' command 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 01 Aug 2019 13:37:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The 'guestinfo' command uses the new virDomainGetGuestInfo() API to query information about the specified domain and print it out for the user. The output is modeled roughly on the 'domstats' command. Signed-off-by: Jonathon Jongsma --- tools/virsh-domain.c | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index e79dc75342..83249768ad 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -14038,6 +14038,53 @@ cmdDomFSInfo(vshControl *ctl, const vshCmd *cmd) return ret; } =20 +/* + * "guestinfo" command + */ +static const vshCmdInfo info_guestinfo[] =3D { + {.name =3D "help", + .data =3D N_("query information about the guest (via agent)") + }, + {.name =3D "desc", + .data =3D N_("Use the guest agent to query various information from g= uest's " + "point of view") + }, + {.name =3D NULL} +}; + +static const vshCmdOptDef opts_guestinfo[] =3D { + VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), + {.name =3D NULL} +}; + +static bool +cmdGuestInfo(vshControl *ctl, const vshCmd *cmd) +{ + virDomainPtr dom; + bool ret =3D false; + virTypedParameterPtr params =3D NULL; + int nparams =3D 0; + int i; + + if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) + return false; + + if (virDomainGetGuestInfo(dom, 0, ¶ms, &nparams, 0) < 0) + goto cleanup; + + for (i =3D 0; i < nparams; i++) { + char *str =3D vshGetTypedParamValue(ctl, ¶ms[i]); + vshPrint(ctl, "%-20s: %s\n", params[i].field, str); + VIR_FREE(str); + } + + ret =3D true; + +cleanup: + virshDomainFree(dom); + return ret; +} + const vshCmdDef domManagementCmds[] =3D { {.name =3D "attach-device", .handler =3D cmdAttachDevice, @@ -14653,5 +14700,11 @@ const vshCmdDef domManagementCmds[] =3D { .info =3D info_domblkthreshold, .flags =3D 0 }, + {.name =3D "guestinfo", + .handler =3D cmdGuestInfo, + .opts =3D opts_guestinfo, + .info =3D info_guestinfo, + .flags =3D 0 + }, {.name =3D NULL} }; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list