>From d6802cee0c50e9d9d58345ecf94a3f3e2933d190 Mon Sep 17 00:00:00 2001 From: Jim Fehlig Date: Thu, 10 Feb 2011 15:42:34 -0700 Subject: [PATCH] Add libxenlight driver Add a new xen driver based on libxenlight [1], which is the primary toolstack starting with Xen 4.1.0. The driver is stateful, runs privileged only, and is accessed with libxl:/// URI. [1] http://lists.xensource.com/archives/html/xen-devel/2009-11/msg00436.html --- cfg.mk | 1 + configure.ac | 48 ++ daemon/Makefile.am | 4 + daemon/libvirtd.c | 6 + docs/drivers.html.in | 3 +- docs/drvxen.html.in | 6 +- docs/drvxenlight.html.in | 53 ++ docs/sitemap.html.in | 6 +- include/libvirt/virterror.h | 1 + po/POTFILES.in | 2 + src/Makefile.am | 32 ++ src/driver.h | 3 +- src/libvirt.c | 4 + src/libxl/libxl_conf.c | 783 ++++++++++++++++++++++++++ src/libxl/libxl_conf.h | 85 +++ src/libxl/libxl_driver.c | 1280 +++++++++++++++++++++++++++++++++++++++++++ src/libxl/libxl_driver.h | 27 + src/util/virterror.c | 3 + 18 files changed, 2343 insertions(+), 4 deletions(-) diff --git a/cfg.mk b/cfg.mk index 4bbeb96..6ec11b4 100644 --- a/cfg.mk +++ b/cfg.mk @@ -400,6 +400,7 @@ msg_gen_function += virXenStoreError msg_gen_function += virXendError msg_gen_function += vmwareError msg_gen_function += xenapiSessionErrorHandler +msg_gen_function += libxlError msg_gen_function += xenUnifiedError msg_gen_function += xenXMError msg_gen_function += VIR_ERROR diff --git a/configure.ac b/configure.ac index 3cd824a..d4edd40 100644 --- a/configure.ac +++ b/configure.ac @@ -258,6 +258,8 @@ 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=check@:>@]),[],[with_xenapi=check]) +AC_ARG_WITH([libxl], + AC_HELP_STRING([--with-libxl], [add libxenlight support @<:@default=check@:>@]),[],[with_libxl=check]) AC_ARG_WITH([vbox], AC_HELP_STRING([--with-vbox=@<:@PFX@:>@], [VirtualBox XPCOMC location @<:@default=yes@:>@]),[], @@ -492,6 +494,46 @@ fi AC_SUBST([LIBXENSERVER_CFLAGS]) AC_SUBST([LIBXENSERVER_LIBS]) +old_LIBS="$LIBS" +old_CFLAGS="$CFLAGS" +LIBXL_LIBS="" +LIBXL_CFLAGS="" +dnl search for libxl, aka libxenlight +fail=0 +if test "$with_libxl" != "no" ; then + if test "$with_libxl" != "yes" && test "$with_libxl" != "check" ; then + LIBXL_CFLAGS="-I$with_libxl/include" + LIBXL_LIBS="-L$with_libxl" + fi + CFLAGS="$CFLAGS $LIBXL_CFLAGS" + LIBS="$LIBS $LIBXL_LIBS" + AC_CHECK_LIB([xenlight], [libxl_ctx_init], [ + with_libxl=yes + LIBXL_LIBS="$LIBXL_LIBS -lxenlight -lxenstore -lxenctrl -lxenguest -luuid -lutil -lblktapctl" + ],[ + if test "$with_libxl" = "yes"; then + fail=1 + fi + with_libxl=no + ],[ + -lxenstore -lxenctrl -lxenguest -luuid -lutil -lblktapctl + ]) +fi + +LIBS="$old_LIBS" +CFLAGS="$old_CFLAGS" + +if test $fail = 1; then + AC_MSG_ERROR([You must install the libxl Library to compile libxenlight driver with -lxl]) +fi + +if test "$with_libxl" = "yes"; then + AC_DEFINE_UNQUOTED([WITH_LIBXL], 1, [whether libxenlight driver is enabled]) +fi +AM_CONDITIONAL([WITH_LIBXL], [test "$with_libxl" = "yes"]) + +AC_SUBST([LIBXL_CFLAGS]) +AC_SUBST([LIBXL_LIBS]) old_LIBS="$LIBS" old_CFLAGS="$CFLAGS" @@ -2352,6 +2394,7 @@ AC_MSG_NOTICE([ OpenVZ: $with_openvz]) AC_MSG_NOTICE([ VMware: $with_vmware]) AC_MSG_NOTICE([ VBox: $with_vbox]) AC_MSG_NOTICE([ XenAPI: $with_xenapi]) +AC_MSG_NOTICE([libxenlight: $with_libxl]) AC_MSG_NOTICE([ LXC: $with_lxc]) AC_MSG_NOTICE([ PHYP: $with_phyp]) AC_MSG_NOTICE([ ONE: $with_one]) @@ -2461,6 +2504,11 @@ AC_MSG_NOTICE([ xenapi: $LIBXENSERVER_CFLAGS $LIBXENSERVER_LIBS]) else AC_MSG_NOTICE([ xenapi: no]) fi +if test "$with_libxl" = "yes" ; then +AC_MSG_NOTICE([ libxenlight: $LIBXL_CFLAGS $LIBXL_LIBS]) +else +AC_MSG_NOTICE([ libxenlight: no]) +fi if test "$with_hal" = "yes" ; then AC_MSG_NOTICE([ hal: $HAL_CFLAGS $HAL_LIBS]) else diff --git a/daemon/Makefile.am b/daemon/Makefile.am index cdf0f75..c732827 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -111,6 +111,10 @@ if WITH_LXC libvirtd_LDADD += ../src/libvirt_driver_lxc.la endif +if WITH_LIBXL + libvirtd_LDADD += ../src/libvirt_driver_libxl.la +endif + if WITH_UML libvirtd_LDADD += ../src/libvirt_driver_uml.la endif diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index f4b3327..962f1fa 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -80,6 +80,9 @@ # ifdef WITH_LXC # include "lxc/lxc_driver.h" # endif +# ifdef WITH_LIBXL +# include "libxl/libxl_driver.h" +# endif # ifdef WITH_UML # include "uml/uml_driver.h" # endif @@ -928,6 +931,9 @@ static struct qemud_server *qemudInitialize(void) { # ifdef WITH_LXC lxcRegister(); # endif +# ifdef WITH_LIBXL + libxlRegister(); +# endif # ifdef WITH_UML umlRegister(); # endif diff --git a/docs/drivers.html.in b/docs/drivers.html.in index ecad03a..368664e 100644 --- a/docs/drivers.html.in +++ b/docs/drivers.html.in @@ -28,7 +28,8 @@
  • VirtualBox
  • VMware ESX
  • VMware Workstation/Player
  • -
  • Xen
  • +
  • Xen 3.0.1 - 4.0.x
  • +
  • Xen 4.1.0 onwards
  • Storage drivers

    diff --git a/docs/drvxen.html.in b/docs/drvxen.html.in index 4e35afa..4b88a7d 100644 --- a/docs/drvxen.html.in +++ b/docs/drvxen.html.in @@ -6,7 +6,11 @@

    The libvirt Xen driver provides the ability to manage virtual machines - on any Xen release from 3.0.1 onwards. + on any Xen release from 3.0.1 to 4.0.x. Starting with Xen 4.1.0, + the traditional xm/xend toolstack is replaced with a new toolstack + based on libxenlight. Consult the + libxenlight driver if your Xen host is + configured to use the new toolstack.

    Deployment pre-requisites

    diff --git a/docs/drvxenlight.html.in b/docs/drvxenlight.html.in new file mode 100644 index 0000000..fe60786 --- /dev/null +++ b/docs/drvxenlight.html.in @@ -0,0 +1,53 @@ + + +

    libxenlight hypervisor driver

    + + + +

    + The libvirt libxenlight driver provides the ability to manage virtual + machines on any Xen release from 4.1.0 onwards. +

    + +

    Deployment pre-requisites

    + +

    + This driver uses Xen's libxenlight toolstack, which is the default + toolstack configuration starting with Xen 4.1.0. The traditional + xm/xend toolstack is still provided, but it is no longer maintained + and may be removed in a future Xen release. +

    + +

    + The libxenlight toolstack uses xenstored and blktap2. Ensure + xenstored is running, or use the xencommons init script provided. + Ensure your kernel supports the blktap2 module and it is loaded. +

    + +

    Connections to libxenlight driver

    + +

    + The libvirt libxenlight driver is a stateful, privileged driver, + with a driver name of 'libxl'. Some example conection URIs for + the libxenlight driver are: +

    + +
    +libxl:///                      (local access, direct)
    +libxl://example.com/           (remote access, TLS/x509)
    +libxl+tcp://example.com/       (remote access, SASl/Kerberos)
    +libxl+ssh://root@example.com/  (remote access, SSH tunnelled)
    +
    + +

    Example domain XML config

    + +

    + The libxenlight toolstack attempts to be compatible with the + legacy xm/xend toolstack, supporting the traditional python + configuration files (xen-xm). Fortunately, the libvirt XML + syntax is unchanged with the libxenlight driver. Consult + the Xen driver examples. +

    + + + diff --git a/docs/sitemap.html.in b/docs/sitemap.html.in index ac0af71..538f227 100644 --- a/docs/sitemap.html.in +++ b/docs/sitemap.html.in @@ -156,7 +156,11 @@