From nobody Sun Feb 8 19:54:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.124 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=1639136405; cv=none; d=zohomail.com; s=zohoarc; b=QDIcBIIExpNr2MiDqyTo+6UWvvUfRhkjNNTDwPQ/GifRdcFuQwA/hbIDV/gKWr4GSGMWsB8OUJc7q9FjFRedKlCYjsgRiyjfnryxhdQs4iU/vLFNvqAdvYvnYeUdWo+BXicFsS/QctHsdheguWpH4f7oKt+Fmy5aKgisEAZCPXE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639136405; h=Content-Type:Content-Transfer-Encoding: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=y01GbPgtUwp2bLtBy2RpzxiF7amKcr4cjtctoBIGFh0=; b=W0XGwEuh2jwwPgNQDKmVXJrJdcS4puJulb8Rwu3oDMaDDx20aQvpYGOPY91sz/eCtnUp0hBOuJQH99x7GST98ttE0oHUYHawIPrGIDt+kalF2oUKEGqIEIV/71cplIyvaICwxeQMGIl1rbdfI0bM8AjgqvC4sXcLxyWlqZ7CjlY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639136405622511.8726600498761; Fri, 10 Dec 2021 03:40:05 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-431-dQyFhC0zMAKbqYVxIELC2A-1; Fri, 10 Dec 2021 06:39:23 -0500 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 D8D04801B2F; Fri, 10 Dec 2021 11:39:17 +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 BEE34709AA; Fri, 10 Dec 2021 11:39:17 +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 950E74A712; Fri, 10 Dec 2021 11:39:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BABcZMD020678 for ; Fri, 10 Dec 2021 06:38:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7F7715BE18; Fri, 10 Dec 2021 11:38:35 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.193.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id A68CC5BE3F; Fri, 10 Dec 2021 11:38:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639136404; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=y01GbPgtUwp2bLtBy2RpzxiF7amKcr4cjtctoBIGFh0=; b=A08S7jnPw6TokbddSAtbm2RUakd7HSewlIpTYep4aoxS5ncBRO1Td7wuu0Z1NUmeR9ypkt hYP6kY7GA+B56zfR6deLkE/j+4b01ffJewF7oxYjrCjploQng2hwxKX49uYhxfPkxnyuTE g3DJ3B8ISbS9Ee/LZSB1M5aWsKK7QwM= X-MC-Unique: dQyFhC0zMAKbqYVxIELC2A-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 06/12] tools: add 'nodesevinfo' virsh command Date: Fri, 10 Dec 2021 11:37:29 +0000 Message-Id: <20211210113735.2857076-7-berrange@redhat.com> In-Reply-To: <20211210113735.2857076-1-berrange@redhat.com> References: <20211210113735.2857076-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639136407638100001 While some SEV info is reported in the domain capabilities, for reasons of size, this excludes the certificates. The nodesevinfo command provides the full set of information. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Krempa --- docs/manpages/virsh.rst | 14 +++++++++++++ tools/virsh-host.c | 45 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 1a74217625..e828f7ef68 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -479,6 +479,20 @@ Returns memory stats of the node. If *cell* is specified, this will print the specified cell statistics only. =20 =20 +nodesevinfo +----------- + +**Syntax:** + +:: + + nodesevinfo + +Reports information about the AMD SEV launch security features for +the node, if any. Some of this information is also reported in the +domain capabilities XML document. + + nodesuspend ----------- =20 diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 5da1346a9c..5ee3834de2 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -888,6 +888,45 @@ cmdNodeMemStats(vshControl *ctl, const vshCmd *cmd) return true; } =20 +/* + * "nodesevinfo" command + */ +static const vshCmdInfo info_nodesevinfo[] =3D { + {.name =3D "help", + .data =3D N_("node SEV information") + }, + {.name =3D "desc", + .data =3D N_("Returns basic SEV information about the node.") + }, + {.name =3D NULL} +}; + +static bool +cmdNodeSEVInfo(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) +{ + virshControl *priv =3D ctl->privData; + size_t i; + int nparams =3D 0; + virTypedParameterPtr params =3D NULL; + bool ret =3D false; + + if (virNodeGetSEVInfo(priv->conn, ¶ms, &nparams, 0) !=3D 0) { + vshError(ctl, "%s", _("Unable to get host SEV information")); + goto cleanup; + } + + for (i =3D 0; i < nparams; i++) { + g_autofree char *str =3D vshGetTypedParamValue(ctl, ¶ms[i]); + vshPrint(ctl, "%-18s: %s\n", params[i].field, str); + } + + ret =3D true; + + cleanup: + virTypedParamsFree(params, nparams); + return ret; +} + /* * "nodesuspend" command */ @@ -1828,6 +1867,12 @@ const vshCmdDef hostAndHypervisorCmds[] =3D { .info =3D info_nodememstats, .flags =3D 0 }, + {.name =3D "nodesevinfo", + .handler =3D cmdNodeSEVInfo, + .opts =3D NULL, + .info =3D info_nodesevinfo, + .flags =3D 0 + }, {.name =3D "nodesuspend", .handler =3D cmdNodeSuspend, .opts =3D opts_node_suspend, --=20 2.33.1