* Python Bindings Status
@ 2015-03-12 11:02 James Dingwall
2015-03-12 16:10 ` Ian Campbell
0 siblings, 1 reply; 2+ messages in thread
From: James Dingwall @ 2015-03-12 11:02 UTC (permalink / raw)
To: xen-devel
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',
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: Python Bindings Status
2015-03-12 11:02 Python Bindings Status James Dingwall
@ 2015-03-12 16:10 ` Ian Campbell
0 siblings, 0 replies; 2+ messages in thread
From: Ian Campbell @ 2015-03-12 16:10 UTC (permalink / raw)
To: James Dingwall; +Cc: xen-devel
On Thu, 2015-03-12 at 11:02 +0000, James Dingwall wrote:
> 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?
IMHO they are architecturally broken and should be redone from scratch.
In particular the "live update of the backing C struct" aspect is broken
in various respects IIRC and difficult to fix (the original author is
also long gone).
I expect this brokenness relates to why things appear to return 0 for
you.
IMHO a much more sensible approach would be to follow what the ocaml
bindings do and do on demand translation between Python<->C as you call
the libxl functions.
> What level of experience/effort would be required to address this?
Not much Xen experience, mostly Python bindings experience (the
generator itself is in Python too as it happens).
I think it would be a fair effort though.
Ian.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-12 16:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-12 11:02 Python Bindings Status James Dingwall
2015-03-12 16:10 ` Ian Campbell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.