This is a patch to add XenAPI driver support for libvirt version 0.7.6. XenAPI 
can be used against XenCloud platform and
managed through virsh and virt-manger. This patch supports domain related APIs 
in libvirt. It is possible to get domain information,
list active and inactive domains, get Domain XML configuration and 
Start/stop/pause/shutdown/destroy VMs.
There will be more patches after this review to support more libvirt APIs and 
add remote storage support to XenAPI.
In order to run this patch you would require libxenserver library.
The XenCloud platform can be downloaded from  
http://xen.org/products/cloudxen.html

diff -ur ./libvirt_org/configure.ac ./libvirt/configure.ac
--- ./libvirt_org/configure.ac  2010-02-17 17:39:21.000000000 +0000
+++ ./libvirt/configure.ac      2010-02-18 11:51:29.000000000 +0000
@@ -219,6 +219,8 @@
   AC_HELP_STRING([--with-libssh2=@<:@PFX@:>@], [libssh2 location 
@<:@default=/usr/local/lib@:>@]),[],[with_libssh2=yes])
 AC_ARG_WITH([phyp],
   AC_HELP_STRING([--with-phyp], [add PHYP support 
@<:@default=check@:>@]),[],[with_phyp=check])
+AC_ARG_WITH([xenapi],
+  AC_HELP_STRING([--with-xenapi], [add XenAPI support 
@<:@default=yes@:>@]),[],[with_xenapi=check])
 AC_ARG_WITH([vbox],
   AC_HELP_STRING([--with-vbox], [add VirtualBox support 
@<:@default=yes@:>@]),[],[with_vbox=yes])
 AC_ARG_WITH([lxc],
@@ -307,6 +309,11 @@
 fi
 AM_CONDITIONAL([WITH_VBOX], [test "$with_vbox" = "yes"])

+if test "$with_xenapi" = "yes"; then
+    AC_DEFINE_UNQUOTED([WITH_XENAPI], 1, [whether XenAPI driver is enabled])
+fi
+AM_CONDITIONAL([WITH_XENAPI], [test "$with_xenapi" = "yes"])
+
 if test "$with_libvirtd" = "no" ; then
   with_qemu=no
 fi
@@ -1894,6 +1901,7 @@
 AC_MSG_NOTICE([     UML: $with_uml])
 AC_MSG_NOTICE([  OpenVZ: $with_openvz])
 AC_MSG_NOTICE([    VBox: $with_vbox])
+AC_MSG_NOTICE([  XenAPI: $with_xenapi])
 AC_MSG_NOTICE([     LXC: $with_lxc])
 AC_MSG_NOTICE([    PHYP: $with_phyp])
 AC_MSG_NOTICE([     ONE: $with_one])

diff -ur ./libvirt_org/src/Makefile.am ./libvirt/src/Makefile.am
--- ./libvirt_org/src/Makefile.am       2010-02-17 17:38:13.000000000 +0000
+++ ./libvirt/src/Makefile.am   2010-02-18 16:25:55.000000000 +0000
@@ -3,12 +3,19 @@
 # No libraries with the exception of LIBXML should be listed
 # here. List them against the individual XXX_la_CFLAGS targets
 # that actually use them
+
+XENAPI_CFLAGS = -...@top_srcdir@/../libxenserver/include
+
 INCLUDES =                                                     \
                -I$(top_srcdir)/gnulib/lib                      \
                -I../gnulib/lib                                 \
                -I../include                                    \
+                -I/usr/include                                  \
                -...@top_srcdir@/src/util                         \
+               -...@top_srcdir@/src                              \
+               -...@top_srcdir@/src/xenapi                       \
                -...@top_srcdir@/include                          \
+               $(XENAPI_CFLAGS)                                \
                $(DRIVER_MODULE_CFLAGS)                         \
                $(LIBXML_CFLAGS)                                \
                -DLIBDIR=\""$(libdir)"\"                        \
@@ -42,6 +49,8 @@
 augeastestdir = $(datadir)/augeas/lenses/tests
 augeastest_DATA =

+XENAPI_LIBS = @top_srcdir@/../libxenserver/libxenserver.so
+
 # These files are not related to driver APIs. Simply generic
 # helper APIs for various purposes
 UTIL_SOURCES =                                                 \
@@ -205,6 +214,10 @@
                qemu/qemu_security_dac.h                        \
                qemu/qemu_security_dac.c

+XENAPI_DRIVER_SOURCES =                                         \
+                xenapi/xenapi_driver.c xenapi/xenapi_driver.h   \
+                xenapi/xenapi_utils.c xenapi/xenapi_utils.h
+
 UML_DRIVER_SOURCES =                                           \
                uml/uml_conf.c uml/uml_conf.h                   \
                uml/uml_driver.c uml/uml_driver.h
@@ -466,6 +479,28 @@
 libvirt_driver_vbox_la_SOURCES = $(VBOX_DRIVER_SOURCES)
 endif

+if WITH_XENAPI
+if WITH_DRIVER_MODULES
+mod_LTLIBRARIES += libvirt_driver_xenapi.la
+else
+noinst_LTLIBRARIES += libvirt_driver_xenapi.la
+
+libvirt_la_LIBADD += libvirt_driver_xenapi.la   \
+                     $(XENAPI_LIBS)


+endif
+#libvirt_driver_xenapi_la_LIBADD = $(XENAPI_LIBS)
+libvirt_driver_xenapi_la_CFLAGS = $(XEN_CFLAGS) \
+                                  $(shell xml2-config --cflags) \
+                                  $(shell curl-config --cflags)
+libvirt_driver_xenapi_la_LDFLAGS = -...@top_srcdir@/../libxenserver/ 
-lxenserver -g $(shell xml2-config --libs) \
+                                  $(shell curl-config --libs)
+
+if WITH_DRIVER_MODULES
+libvirt_driver_xenapi_la_LDFLAGS += -module -avoid-version
+endif
+libvirt_driver_xenapi_la_SOURCES = $(XENAPI_DRIVER_SOURCES)
+endif
+
 if WITH_QEMU
 if WITH_DRIVER_MODULES
 mod_LTLIBRARIES += libvirt_driver_qemu.la
@@ -722,6 +757,7 @@
                $(OPENVZ_DRIVER_SOURCES)                        \
                $(PHYP_DRIVER_SOURCES)                          \
                $(VBOX_DRIVER_SOURCES)                          \
+               $(XENAPI_DRIVER_SOURCES)                        \
                $(ESX_DRIVER_SOURCES)                           \
                $(NETWORK_DRIVER_SOURCES)                       \
                $(INTERFACE_DRIVER_SOURCES)                     \

diff -ur ./libvirt_org/tools/Makefile.am ./libvirt/tools/Makefile.am
--- ./libvirt_org/tools/Makefile.am     2010-02-17 17:36:13.000000000 +0000
+++ ./libvirt/tools/Makefile.am 2010-02-18 11:56:30.000000000 +0000
@@ -40,7 +40,8 @@
                $(WARN_CFLAGS)                                  \
                ../src/libvirt.la                               \
                ../gnulib/lib/libgnu.la                         \
-               $(VIRSH_LIBS)
+               $(VIRSH_LIBS)                                   \
+                ../../libxenserver/libxenserver.so
 virsh_CFLAGS =                                                         \
                -I$(top_srcdir)/gnulib/lib -I../gnulib/lib      \
                -I../include -I$(top_srcdir)/include            \

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

Reply via email to