From nobody Mon Apr 29 08:31:53 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1528886931040892.1602857659896; Wed, 13 Jun 2018 03:48:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2A88D796E0; Wed, 13 Jun 2018 10:48:49 +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 BCA4D600C8; Wed, 13 Jun 2018 10:48:48 +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 49C184CA82; Wed, 13 Jun 2018 10:48:48 +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 w5DAmjN3010631 for ; Wed, 13 Jun 2018 06:48:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 920D52017D0F; Wed, 13 Jun 2018 10:48:45 +0000 (UTC) Received: from beluga.usersys.redhat.com (unknown [10.43.2.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 18EC72026987; Wed, 13 Jun 2018 10:48:44 +0000 (UTC) From: Erik Skultety To: libvir-list@redhat.com Date: Wed, 13 Jun 2018 12:48:36 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [libvirt-python PATCH v2 1/2] Add support for virDomainGetLaunchSecurityInfo 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: , MIME-Version: 1.0 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 13 Jun 2018 10:48:50 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Libvirt recently introduced support for getting launch security parameters, most notably AMD SEV VM memory measurement. This API can't be generated as it's using typed parameters which we need to allocate. Signed-off-by: Erik Skultety Reviewed-by: J=EF=BF=BDn Tomko --- generator.py | 1 + libvirt-override-api.xml | 6 ++++++ libvirt-override.c | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/generator.py b/generator.py index b7d96a1..643d1b4 100755 --- a/generator.py +++ b/generator.py @@ -489,6 +489,7 @@ skip_impl =3D ( 'virDomainSetPerfEvents', 'virDomainGetGuestVcpus', 'virConnectBaselineHypervisorCPU', + 'virDomainGetLaunchSecurityInfo', ) =20 lxc_skip_impl =3D ( diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml index 36d3577..2f23c51 100644 --- a/libvirt-override-api.xml +++ b/libvirt-override-api.xml @@ -728,5 +728,11 @@ + + Get launch security info for a domain + + + + diff --git a/libvirt-override.c b/libvirt-override.c index 2f2c4ff..23dd678 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -9763,6 +9763,42 @@ libvirt_virConnectBaselineHypervisorCPU(PyObject *se= lf ATTRIBUTE_UNUSED, #endif /* LIBVIR_CHECK_VERSION(4, 4, 0) */ =20 =20 +#if LIBVIR_CHECK_VERSION(4, 5, 0) +static PyObject * +libvirt_virDomainGetLaunchSecurityInfo(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + PyObject *pyobj_dom =3D NULL; + PyObject *ret =3D NULL; + + virDomainPtr dom =3D NULL; + virTypedParameterPtr params =3D NULL; + int nparams =3D 0; + unsigned int flags =3D 0; + int i_retval; + + if (!PyArg_ParseTuple(args, (char *)"OI:virDomainGetLaunchSecurityInfo= ", + &pyobj_dom, &flags)) + return NULL; + dom =3D (virDomainPtr) PyvirDomain_Get(pyobj_dom); + + LIBVIRT_BEGIN_ALLOW_THREADS; + i_retval =3D virDomainGetLaunchSecurityInfo(dom, ¶ms, &nparams, fl= ags); + LIBVIRT_END_ALLOW_THREADS; + + if (i_retval < 0) { + ret =3D VIR_PY_NONE; + goto cleanup; + } + + ret =3D getPyVirTypedParameter(params, nparams); + cleanup: + virTypedParamsFree(params, nparams); + return ret; +} +#endif /* LIBVIR_CHECK_VERSION(4, 5, 0) */ + + /************************************************************************ * * * The registration stuff * @@ -9999,6 +10035,9 @@ static PyMethodDef libvirtMethods[] =3D { #if LIBVIR_CHECK_VERSION(4, 4, 0) {(char *) "virConnectBaselineHypervisorCPU", libvirt_virConnectBaselin= eHypervisorCPU, METH_VARARGS, NULL}, #endif /* LIBVIR_CHECK_VERSION(4, 4, 0) */ +#if LIBVIR_CHECK_VERSION(4, 5, 0) + {(char *) "virDomainGetLaunchSecurityInfo", libvirt_virDomainGetLaunch= SecurityInfo, METH_VARARGS, NULL}, +#endif /* LIBVIR_CHECK_VERSION(4, 5, 0) */ {NULL, NULL, 0, NULL} }; =20 --=20 2.14.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 08:31:53 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1528886935165988.4150180115411; Wed, 13 Jun 2018 03:48:55 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8B586308403F; Wed, 13 Jun 2018 10:48:53 +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 507F6309128B; Wed, 13 Jun 2018 10:48:53 +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 F41084CA85; Wed, 13 Jun 2018 10:48:52 +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 w5DAmkug010641 for ; Wed, 13 Jun 2018 06:48:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6EAB520244E1; Wed, 13 Jun 2018 10:48:46 +0000 (UTC) Received: from beluga.usersys.redhat.com (unknown [10.43.2.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD24020244E0; Wed, 13 Jun 2018 10:48:45 +0000 (UTC) From: Erik Skultety To: libvir-list@redhat.com Date: Wed, 13 Jun 2018 12:48:37 +0200 Message-Id: <0619516e93aab8b62bc654447fcb9f24ef859b2d.1528886735.git.eskultet@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [libvirt-python PATCH v2 2/2] Add support for virNodeGetSEVInfo 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 13 Jun 2018 10:48:54 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This binding allows to query the AMD's SEV firmware for various platform specific things, like a PDH certificate and a certificate chain to establish a trusted connection with the firmware. Because the API uses typed params, it's exempted from generation. Signed-off-by: Erik Skultety Reviewed-by: J=EF=BF=BDn Tomko --- generator.py | 1 + libvirt-override-api.xml | 6 ++++++ libvirt-override.c | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/generator.py b/generator.py index 643d1b4..353adab 100755 --- a/generator.py +++ b/generator.py @@ -490,6 +490,7 @@ skip_impl =3D ( 'virDomainGetGuestVcpus', 'virConnectBaselineHypervisorCPU', 'virDomainGetLaunchSecurityInfo', + 'virNodeGetSEVInfo', ) =20 lxc_skip_impl =3D ( diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml index 2f23c51..ecbdac2 100644 --- a/libvirt-override-api.xml +++ b/libvirt-override-api.xml @@ -734,5 +734,11 @@ + + Get platform specific information from the SEV firmware + + + + diff --git a/libvirt-override.c b/libvirt-override.c index 23dd678..012de3f 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -9796,6 +9796,40 @@ libvirt_virDomainGetLaunchSecurityInfo(PyObject *sel= f ATTRIBUTE_UNUSED, virTypedParamsFree(params, nparams); return ret; } + + +static PyObject * +libvirt_virNodeGetSEVInfo(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + PyObject *pyobj_conn =3D NULL; + PyObject *ret =3D NULL; + + virConnectPtr conn =3D NULL; + virTypedParameterPtr params =3D NULL; + int nparams =3D 0; + unsigned int flags =3D 0; + int i_retval; + + if (!PyArg_ParseTuple(args, (char *)"OI:virNodeGetSEVInfo", + &pyobj_conn, &flags)) + return NULL; + conn =3D (virConnectPtr) PyvirConnect_Get(pyobj_conn); + + LIBVIRT_BEGIN_ALLOW_THREADS; + i_retval =3D virNodeGetSEVInfo(conn, ¶ms, &nparams, flags); + LIBVIRT_END_ALLOW_THREADS; + + if (i_retval < 0) { + ret =3D VIR_PY_NONE; + goto cleanup; + } + + ret =3D getPyVirTypedParameter(params, nparams); + cleanup: + virTypedParamsFree(params, nparams); + return ret; +} #endif /* LIBVIR_CHECK_VERSION(4, 5, 0) */ =20 =20 @@ -10037,6 +10071,7 @@ static PyMethodDef libvirtMethods[] =3D { #endif /* LIBVIR_CHECK_VERSION(4, 4, 0) */ #if LIBVIR_CHECK_VERSION(4, 5, 0) {(char *) "virDomainGetLaunchSecurityInfo", libvirt_virDomainGetLaunch= SecurityInfo, METH_VARARGS, NULL}, + {(char *) "virNodeGetSEVInfo", libvirt_virNodeGetSEVInfo, METH_VARARGS= , NULL}, #endif /* LIBVIR_CHECK_VERSION(4, 5, 0) */ {NULL, NULL, 0, NULL} }; --=20 2.14.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list