Package not found: devel:languages:python/python-pydle

File 6c136b81-add-virNodeGetSEVInfo.patch of Package python-libvirt-python

commit 6c136b8150e1487efdbb10bfd32a5d8a0f84df16
Author: Erik Skultety <eskultet@redhat.com>
Date:   Tue Jun 12 16:17:58 2018 +0200

    Add support for virNodeGetSEVInfo
    
    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@redhat.com>
    Reviewed-by: Ján Tomko <jtomko@redhat.com>

Index: libvirt-python-4.0.0/generator.py
===================================================================
--- libvirt-python-4.0.0.orig/generator.py
+++ libvirt-python-4.0.0/generator.py
@@ -489,6 +489,7 @@ skip_impl = (
     'virDomainSetPerfEvents',
     'virDomainGetGuestVcpus',
     'virDomainGetLaunchSecurityInfo',
+    'virNodeGetSEVInfo',
 )
 
 lxc_skip_impl = (
Index: libvirt-python-4.0.0/libvirt-override-api.xml
===================================================================
--- libvirt-python-4.0.0.orig/libvirt-override-api.xml
+++ libvirt-python-4.0.0/libvirt-override-api.xml
@@ -723,5 +723,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>
Index: libvirt-python-4.0.0/libvirt-override.c
===================================================================
--- libvirt-python-4.0.0.orig/libvirt-override.c
+++ libvirt-python-4.0.0/libvirt-override.c
@@ -9673,6 +9673,40 @@ libvirt_virDomainGetLaunchSecurityInfo(P
     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, 0, 0) */
 
 
@@ -9911,6 +9945,7 @@ static PyMethodDef libvirtMethods[] = {
 #endif /* LIBVIR_CHECK_VERSION(3, 4, 0) */
 #if LIBVIR_CHECK_VERSION(4, 0, 0)
     {(char *) "virDomainGetLaunchSecurityInfo", libvirt_virDomainGetLaunchSecurityInfo, METH_VARARGS, NULL},
+    {(char *) "virNodeGetSEVInfo", libvirt_virNodeGetSEVInfo, METH_VARARGS, NULL},
 #endif /* LIBVIR_CHECK_VERSION(4, 0, 0) */
     {NULL, NULL, 0, NULL}
 };
openSUSE Build Service is sponsored by