[libvirt] [PATCH 0/3] Basic libxenlight driver

Hi, I started working on a libxenlight driver for libvirt a few weeks ago. By that time I didn't knew Jim Fehlig was also working on a driver for that api: http://article.gmane.org/gmane.comp.emulators.libvirt/33024 Because I already did some work and there is no driver from Jim yet, I am posting my current version of the driver here. It is a driver for the libxl (libxenlight) interface from the upcoming xen 4.1. This driver is divided into 3 patches, the first adds the driver without changing anything in libvirt, the second one integrates it into the build system of libvirt. The last one is self explanatory. However there are a few caveats. 1. The driver offers only basic functionality like: suspend, resume, pinvcpu, etc. create, restore, definexml and others are not yet implemented. 2. The driver supports libvirtxml <-> xen-xm conversion, thanks to the unified xen driver which already offered this functionality. But since this driver is not part of xen unified, I had to copy this functionality, rather than reusing it. 3. To compile libvirt with this driver, there is a new flag --with-xenlight. To fix some linker errors, libvirt has to link against several additional libraries now which are used in xen's libxenlight. These libraries are not directly used within libvirt, but I believe that some of them are GPL licensed, so that could be an issue. 4. To compile the driver you may need to copy the libxl_utils.h from tools/libxl of your xen-source directory to an include dir in your PATH. Right now this file is not copied when installing xen, but I will talk with the xen developers about that. Please let me know what you think about it. Thanks, Markus Markus Groß (3): Add basic libxenlight driver Integrate libxenlight driver into libvirt Add myself to AUTHORS AUTHORS | 1 + configure.ac | 35 +- include/libvirt/virterror.h | 1 + po/POTFILES.in | 2 + src/Makefile.am | 25 + src/driver.h | 3 +- src/libvirt.c | 13 + src/util/virterror.c | 3 + src/xenlight/xl_driver.c | 948 ++++++++++++++++++ src/xenlight/xl_driver.h | 46 + src/xenlight/xl_driver_private.h | 52 + src/xenlight/xl_utils.c | 1969 ++++++++++++++++++++++++++++++++++++++ src/xenlight/xl_utils.h | 90 ++ tools/virsh.c | 3 + 14 files changed, 3188 insertions(+), 3 deletions(-) create mode 100644 src/xenlight/xl_driver.c create mode 100644 src/xenlight/xl_driver.h create mode 100644 src/xenlight/xl_driver_private.h create mode 100644 src/xenlight/xl_utils.c create mode 100644 src/xenlight/xl_utils.h -- 1.7.4

--- src/xenlight/xl_driver.c | 948 ++++++++++++++++++ src/xenlight/xl_driver.h | 46 + src/xenlight/xl_driver_private.h | 52 + src/xenlight/xl_utils.c | 1969 ++++++++++++++++++++++++++++++++++++++ src/xenlight/xl_utils.h | 90 ++ 5 files changed, 3105 insertions(+), 0 deletions(-) create mode 100644 src/xenlight/xl_driver.c create mode 100644 src/xenlight/xl_driver.h create mode 100644 src/xenlight/xl_driver_private.h create mode 100644 src/xenlight/xl_utils.c create mode 100644 src/xenlight/xl_utils.h

--- configure.ac | 35 +++++++++++++++++++++++++++++++++-- include/libvirt/virterror.h | 1 + po/POTFILES.in | 2 ++ src/Makefile.am | 25 +++++++++++++++++++++++++ src/driver.h | 3 ++- src/libvirt.c | 13 +++++++++++++ src/util/virterror.c | 3 +++ tools/virsh.c | 3 +++ 8 files changed, 82 insertions(+), 3 deletions(-)

--- AUTHORS | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)

Markus Groß wrote:
Hi,
I started working on a libxenlight driver for libvirt a few weeks ago. By that time I didn't knew Jim Fehlig was also working on a driver for that api: http://article.gmane.org/gmane.comp.emulators.libvirt/33024
Because I already did some work and there is no driver from Jim yet, I am posting my current version of the driver here.
I was hoping to get an initial submission this week but have been quite ill.
It is a driver for the libxl (libxenlight) interface from the upcoming xen 4.1.
This driver is divided into 3 patches, the first adds the driver without changing anything in libvirt, the second one integrates it into the build system of libvirt. The last one is self explanatory.
However there are a few caveats.
1. The driver offers only basic functionality like: suspend, resume, pinvcpu, etc. create, restore, definexml and others are not yet implemented.
I took the approach of getting define, create, reboot, capabilities, getinfo, and dumpxml implemented.
2. The driver supports libvirtxml <-> xen-xm conversion, thanks to the unified xen driver which already offered this functionality. But since this driver is not part of xen unified, I had to copy this functionality, rather than reusing it.
Yep, same with some of the capabilities code. But I haven't done much in the way of libvirtXML <-> xen-xm conversion since I'm not convinced the libvirt libxenlight driver should even manage vms it has not created (similar to qemu driver). If a vm is started with xl tool, it has a daemon spawned to listen for domain death, CD eject, etc. events. I'm not sure of libvirt libxenlight driver should get involved with that. Hmm, I should just post my current driver so you can take a look. Thanks. Jim
3. To compile libvirt with this driver, there is a new flag --with-xenlight. To fix some linker errors, libvirt has to link against several additional libraries now which are used in xen's libxenlight. These libraries are not directly used within libvirt, but I believe that some of them are GPL licensed, so that could be an issue.
4. To compile the driver you may need to copy the libxl_utils.h from tools/libxl of your xen-source directory to an include dir in your PATH. Right now this file is not copied when installing xen, but I will talk with the xen developers about that.
Please let me know what you think about it.
Thanks, Markus
Markus Groß (3): Add basic libxenlight driver Integrate libxenlight driver into libvirt Add myself to AUTHORS
AUTHORS | 1 + configure.ac | 35 +- include/libvirt/virterror.h | 1 + po/POTFILES.in | 2 + src/Makefile.am | 25 + src/driver.h | 3 +- src/libvirt.c | 13 + src/util/virterror.c | 3 + src/xenlight/xl_driver.c | 948 ++++++++++++++++++ src/xenlight/xl_driver.h | 46 + src/xenlight/xl_driver_private.h | 52 + src/xenlight/xl_utils.c | 1969 ++++++++++++++++++++++++++++++++++++++ src/xenlight/xl_utils.h | 90 ++ tools/virsh.c | 3 + 14 files changed, 3188 insertions(+), 3 deletions(-) create mode 100644 src/xenlight/xl_driver.c create mode 100644 src/xenlight/xl_driver.h create mode 100644 src/xenlight/xl_driver_private.h create mode 100644 src/xenlight/xl_utils.c create mode 100644 src/xenlight/xl_utils.h
------------------------------------------------------------------------
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

Jim Fehlig wrote:
Markus Groß wrote:
2. The driver supports libvirtxml <-> xen-xm conversion, thanks to the unified xen driver which already offered this functionality. But since this driver is not part of xen unified, I had to copy this functionality, rather than reusing it.
Yep, same with some of the capabilities code. But I haven't done much in the way of libvirtXML <-> xen-xm conversion since I'm not convinced the libvirt libxenlight driver should even manage vms it has not created (similar to qemu driver). If a vm is started with xl tool, it has a daemon spawned to listen for domain death, CD eject, etc. events. I'm not sure of libvirt libxenlight driver should get involved with that.
Just to clarify, we do need to convert xl/libxl config syntax (which is same as legacy xen python config files except that arbitrary embedded python is not supported) to libvirtXML. At a minimum, it will be needed to support virConnectDomain{From,To}Native(). My point above is that this functionality, and the other missing driver table functions, can be added incrementally. But we do need to solve the code duplication with existing xen driver, at which point we have the conversion anyhow. Speaking of code duplication, I think we can solve it as Matthias did for esx and vmware/player drivers - see src/vmx. What do you think? Thanks, Jim

Jim Fehlig wrote:
Jim Fehlig wrote:
Markus Groß wrote:
2. The driver supports libvirtxml <-> xen-xm conversion, thanks to the unified xen driver which already offered this functionality. But since this driver is not part of xen unified, I had to copy this functionality, rather than reusing it.
Yep, same with some of the capabilities code. But I haven't done much in the way of libvirtXML <-> xen-xm conversion since I'm not convinced the libvirt libxenlight driver should even manage vms it has not created (similar to qemu driver). If a vm is started with xl tool, it has a daemon spawned to listen for domain death, CD eject, etc. events. I'm not sure of libvirt libxenlight driver should get involved with that.
Just to clarify, we do need to convert xl/libxl config syntax (which is same as legacy xen python config files except that arbitrary embedded python is not supported) to libvirtXML. At a minimum, it will be needed to support virConnectDomain{From,To}Native(). My point above is that this functionality, and the other missing driver table functions, can be added incrementally. But we do need to solve the code duplication with existing xen driver, at which point we have the conversion anyhow. Speaking of code duplication, I think we can solve it as Matthias did for esx and vmware/player drivers - see src/vmx. What do you think?
That sounds like a good idea. The necessary functions could be split into new source files and moved to src/xen-xm or src/xm. Cheers, Markus

Markus Groß wrote:
Hi,
I started working on a libxenlight driver for libvirt a few weeks ago. By that time I didn't knew Jim Fehlig was also working on a driver for that api: http://article.gmane.org/gmane.comp.emulators.libvirt/33024
Hi Markus, Attached is my current driver. It supports defining, undefining, and starting managed domains; creating unmanaged domains; list, getinfo, and dumpxml; listening for domain destroy events on domains it has started/created; capabilities. It also passes make syntax-check and has been through an initial valgrind run, but there has been some code movement and I'm sure some leaks remain. The items I wanted to finish before an initial post (and before getting so ill this week): documentation for the new driver, resolve capabilities code duplication with existing xen driver, add some minimal tests, do some testing with other libvirt clients such as virt-manager. We need to get an initial, minimal driver accepted, making it easier to independently submit new driver functionality. Regards, Jim
participants (3)
-
Jim Fehlig
-
Markus Gross
-
Markus Groß