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

[Xen-devel] Python Bindings Status


  • To: xen-devel@xxxxxxxxxxxxx
  • From: James Dingwall <james@xxxxxxxxxxxxxx>
  • Date: Thu, 12 Mar 2015 11:02:47 +0000
  • Delivery-date: Thu, 12 Mar 2015 11:04:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

Hi,

I am trying to use the libxl python bindings but having mixed levels of 
success.  I assume that the current 
status of this is unsupported as the build of the xl.so is disabled by default 
but perhaps completing the 
missing parts could be quite trivial?  I have managed to enabled the build with 
the patch the follow below.

I can for example:

from __future__ import print_function
from xen.lowlevel import xl
xlctx = xl.ctx()
for domu in xlctx.list_domains():
    print(xlctx.domid_to_name(domu.domid))

However other parts such as xl.version_info() do not seem to work.  Looking at 
the wrapper code which is 
generated in the build it seems that the object which would store the version 
information is allocated and 
initialised but never populated:

xen-4.5.0/tools/python/xen/lowlevel/xl/_pyxl_types.c:
static int Pyversion_info_init(Py_version_info *self, PyObject *args, PyObject 
*kwds)
{
    memset(&self->obj, 0, sizeof(self->obj));
    return genwrap__obj_init((PyObject *)self, args, kwds);
}

static PyObject *Pyversion_info_new(PyTypeObject *type, PyObject *args, 
PyObject *kwds)
{
    Py_version_info *self = (Py_version_info *)type->tp_alloc(type, 0);
    if (self == NULL)
        return NULL;
    memset(&self->obj, 0, sizeof(self->obj));
    return (PyObject *)self;
}

I can see that the version_info libxl function takes a ctx argument but passing 
in xl.ctx() to xl.version_info() 
does not change anything, i.e. print(xl.version_info().xen_version_major) 
always shows 0.

What level of experience/effort would be required to address this?

Thanks,
James

diff --git a/tools/python/setup.py b/tools/python/setup.py
index 439c429..029869e 100644
--- a/tools/python/setup.py
+++ b/tools/python/setup.py
@@ -31,13 +31,13 @@ xl = Extension("xl",
                extra_compile_args = extra_compile_args,
                include_dirs       = [ PATH_XEN, PATH_LIBXL, PATH_LIBXC + 
"/include", "xen/lowlevel/xl" ],
                library_dirs       = [ PATH_LIBXL ],
-               libraries          = [ "xenlight" ],
-               depends            = [ PATH_LIBXL + "/libxenlight.so" ],
+               libraries          = [ "xenlight", "xlutil" ],
+               depends            = [ PATH_LIBXL + "/libxenlight.so", 
PATH_LIBXL + "/libxlutil.so" ],
                sources            = [ "xen/lowlevel/xl/xl.c", 
"xen/lowlevel/xl/_pyxl_types.c" ])

 plat = os.uname()[0]
 modules = [ xc, xs ]
-#modules.extend([ xl ])
+modules.extend([ xl ])

 setup(name            = 'xen',
       version         = '3.0',


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.