From nobody Sat Apr 27 16:53:16 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 1528813445965921.5913478409522; Tue, 12 Jun 2018 07:24:05 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8BEF0804E3; Tue, 12 Jun 2018 14:24:04 +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 54F082010D59; Tue, 12 Jun 2018 14:24:04 +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 A90A01800533; Tue, 12 Jun 2018 14:24:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5CENp6w020295 for ; Tue, 12 Jun 2018 10:23:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id B5E29111C4AA; Tue, 12 Jun 2018 14:23:51 +0000 (UTC) Received: from beluga.usersys.redhat.com (unknown [10.43.2.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A27A111C4A2; Tue, 12 Jun 2018 14:23:51 +0000 (UTC) From: Erik Skultety To: libvir-list@redhat.com Date: Tue, 12 Jun 2018 16:23:37 +0200 Message-Id: <875e193506d096f163ed22fc83a05c20c9e5efd1.1528813212.git.eskultet@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [libvirt-python PATCH 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 12 Jun 2018 14:24:05 +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 --- 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', ) lxc_skip_impl =3D ( diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml index 36d3577..7137237 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..5de8693 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) */ +#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, params, nparams, flag= s); + 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} }; -- 2.14.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 16:53:16 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 1528813438537625.4350292153338; Tue, 12 Jun 2018 07:23:58 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1827E5D675; Tue, 12 Jun 2018 14:23:57 +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 D0F459588C; Tue, 12 Jun 2018 14:23:56 +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 6A1761800531; Tue, 12 Jun 2018 14:23:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5CENquS020305 for ; Tue, 12 Jun 2018 10:23:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 75F1E111C4A9; Tue, 12 Jun 2018 14:23:52 +0000 (UTC) Received: from beluga.usersys.redhat.com (unknown [10.43.2.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id EFB0C111C4A2; Tue, 12 Jun 2018 14:23:51 +0000 (UTC) From: Erik Skultety To: libvir-list@redhat.com Date: Tue, 12 Jun 2018 16:23:38 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [libvirt-python PATCH 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.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 12 Jun 2018 14:23:57 +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 --- generator.py | 1 + libvirt-override-api.xml | 6 ++++++ libvirt-override.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 41 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', ) lxc_skip_impl =3D ( diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml index 7137237..7f7ae58 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 5de8693..a0584a7 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, params, 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) */ -- 2.14.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list