[libvirt-python PATCH v2 2/2] Add support for virNodeGetSEVInfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <eskultet@xxxxxxxxxx>
---
 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 = (
     'virDomainGetGuestVcpus',
     'virConnectBaselineHypervisorCPU',
     'virDomainGetLaunchSecurityInfo',
+    'virNodeGetSEVInfo',
 )
 
 lxc_skip_impl = (
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 @@
       <arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
       <arg name='flags' type='int' info='unused, always pass 0'/>
     </function>
+    <function name='virNodeGetSEVInfo' file='python'>
+      <info>Get platform specific information from the SEV firmware</info>
+      <return type='char *' info='None in case of error, returns a dictionary of params'/>
+      <arg name='conn' type='virConnectPtr' info='pointer to hypervisor connection'/>
+      <arg name='flags' type='int' info='unused, always pass 0'/>
+    </function>
   </symbols>
 </api>
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 *self ATTRIBUTE_UNUSED,
     virTypedParamsFree(params, nparams);
     return ret;
 }
+
+
+static PyObject *
+libvirt_virNodeGetSEVInfo(PyObject *self ATTRIBUTE_UNUSED,
+                          PyObject *args)
+{
+    PyObject *pyobj_conn = NULL;
+    PyObject *ret = NULL;
+
+    virConnectPtr conn = NULL;
+    virTypedParameterPtr params = NULL;
+    int nparams = 0;
+    unsigned int flags = 0;
+    int i_retval;
+
+    if (!PyArg_ParseTuple(args, (char *)"OI:virNodeGetSEVInfo",
+                          &pyobj_conn, &flags))
+        return NULL;
+    conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
+
+    LIBVIRT_BEGIN_ALLOW_THREADS;
+    i_retval = virNodeGetSEVInfo(conn, &params, &nparams, flags);
+    LIBVIRT_END_ALLOW_THREADS;
+
+    if (i_retval < 0) {
+        ret = VIR_PY_NONE;
+        goto cleanup;
+    }
+
+    ret = getPyVirTypedParameter(params, nparams);
+ cleanup:
+    virTypedParamsFree(params, nparams);
+    return ret;
+}
 #endif /* LIBVIR_CHECK_VERSION(4, 5, 0) */
 
 
@@ -10037,6 +10071,7 @@ static PyMethodDef libvirtMethods[] = {
 #endif /* LIBVIR_CHECK_VERSION(4, 4, 0) */
 #if LIBVIR_CHECK_VERSION(4, 5, 0)
     {(char *) "virDomainGetLaunchSecurityInfo", libvirt_virDomainGetLaunchSecurityInfo, METH_VARARGS, NULL},
+    {(char *) "virNodeGetSEVInfo", libvirt_virNodeGetSEVInfo, METH_VARARGS, NULL},
 #endif /* LIBVIR_CHECK_VERSION(4, 5, 0) */
     {NULL, NULL, 0, NULL}
 };
-- 
2.14.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux