COLO: only build when libnl is available
v2 cover COLO: only build when libnl is available
COLO depends on netlink which is only available on Linux. This series cleans up COLO code and make it only build when libnl is available. This should fix FreeBSD build.
Tested building on Linux with and without libnl-3-dev and libnl3-route-dev.
git rebase -i HEAD~4 --exec \
'./configure --disable-stubdom && \
CCACHE_DISABLE=1 make -C tools/libxl clean && \
CCACHE_DISABLE=1 make -C tools/libxl -j8'
Both build tests on every single commit passed.
Wei.
Wei Liu (4):
libxl: colo: rearrange things in header files
libxl: colo: move netlink related stuff to libxl_colo_proxy.c
build: rename CONFIG_REMUS_NETBUF to CONFIG_LIBNL
libxl: colo: make it depend on availability of libnl
config/Tools.mk.in | 2 +- tools/configure | 10 +++---- tools/configure.ac | 6 ++-- tools/hotplug/Linux/Makefile | 2 +- tools/libxl/Makefile | 11 ++++++-- tools/libxl/libxl_colo.h | 52 +++++++++++++++++------------------ tools/libxl/libxl_colo_proxy.c | 13 +++++++++ tools/libxl/libxl_internal.h | 36 ++++++++---------------- tools/libxl/libxl_no_colo.c | 62 ++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 130 insertions(+), 64 deletions(-) create mode 100644 tools/libxl/libxl_no_colo.c
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v2 1/4 libxl: colo: rearrange things in header files
We need to separate COLO code from common code as clean as possible. With this patch, all COLO structures are now in libxl_colo.h.
It does the following:
1. Move two typedefs for libxl__domain_create_state{,cb} back to libxl_internal.h.
2. Move libxl__colo_save_state to libxl_colo.h.
3. Include libxl_internal.h in libxl_colo.h.
4. Move a bunch of colo typedefs to the top of libxl_internal.h.
5. Move the inclusion of libxl_colo.h to the right place in libxl_internal.h.
--- tools/libxl/libxl_colo.h | 40 +++++++++++++++++++++++++--------------- tools/libxl/libxl_internal.h | 36 ++++++++++++------------------------ 2 files changed, 37 insertions(+), 39 deletions(-)
tools/libxl/libxl_colo.h +25 -15
@@ -16,13 +16,9 @@#ifndef LIBXL_COLO_H #define LIBXL_COLO_H +#include "libxl_internal.h" #include <linux/netlink.h> -struct libxl__ao ; -struct libxl__egc ; -struct libxl__colo_save_state ; -struct libxl__checkpoint_devices_state ; -/* Consistent with the new COLO netlink channel in kernel side */ #define NETLINK_COLO 28
@@ -65,16 +61,15 @@ enum colo_netlink_op { COLO_PROXY_RESET, /* UNUSED, will be used for continuous FT */ }; -typedef struct libxl__colo_device_nic { +struct libxl__colo_device_nic {int devid;const char *vif; -}libxl__colo_device_nic ; +}; -typedef struct libxl__colo_qdisk { +struct libxl__colo_qdisk {bool setuped; -}libxl__colo_qdisk ; +}; -typedef struct libxl__colo_proxy_state libxl__colo_proxy_state ;struct libxl__colo_proxy_state {/* set by caller of colo_proxy_setup */ struct libxl__ao *ao;
@@ -83,12 +78,27 @@ struct libxl__colo_proxy_state {int index; }; -typedef struct libxl__domain_create_state libxl__domain_create_state ; -typedef void libxl__domain_create_cb (struct libxl__egc *egc, -libxl__domain_create_state *dcs, -int rc,uint32_t domid); +struct libxl__colo_save_state { +int send_fd; +int recv_fd; +char *colo_proxy_script; + +/* private */ +libxl__stream_read_state srs; +void (*callback)(libxl__egc *,libxl__colo_save_state *,int ); +bool svm_running; +bool paused; + +/* private, used by qdisk block replication */ +bool qdisk_used; +bool qdisk_setuped; + +/* private, used by colo-proxy */ +libxl__colo_proxy_state cps; +libxl__ev_child child; +}; + -typedef struct libxl__colo_restore_state libxl__colo_restore_state ;typedef void libxl__colo_callback (struct libxl__egc *egc,libxl__colo_restore_state *crs,int rc);
tools/libxl/libxl_internal.h +12 -24
@@ -87,8 +87,6 @@#include "_libxl_types_internal.h" #include "_libxl_types_internal_json.h" -#include "libxl_colo.h" -#define LIBXL_INIT_TIMEOUT 10#define LIBXL_DESTROY_TIMEOUT 10#define LIBXL_HOTPLUG_TIMEOUT 40
@@ -184,6 +182,17 @@ typedef struct libxl__aop_occurred libxl__aop_occurred;typedef struct libxl__osevent_hook_nexus libxl__osevent_hook_nexus ;typedef struct libxl__osevent_hook_nexi libxl__osevent_hook_nexi ; +typedef struct libxl__domain_create_state libxl__domain_create_state ; +typedef void libxl__domain_create_cb (struct libxl__egc *egc, +libxl__domain_create_state *dcs, +int rc,uint32_t domid); + +typedef struct libxl__colo_device_nic libxl__colo_device_nic ; +typedef struct libxl__colo_qdisk libxl__colo_qdisk ; +typedef struct libxl__colo_proxy_state libxl__colo_proxy_state ; +typedef struct libxl__colo_save_state libxl__colo_save_state ; +typedef struct libxl__colo_restore_state libxl__colo_restore_state ; + _hidden void libxl__alloc_failed(libxl_ctx *, const char *func,size_t nmemb,size_t size) __attribute__((noreturn));/* func, size and nmemb are used only in the log message.
@@ -3134,6 +3143,7 @@ libxl__stream_read_inuse(const libxl__stream_read_state *stream)return stream->running; } +#include "libxl_colo.h" /*----- Domain suspend (save) state structure -----*/ /*
@@ -3210,28 +3220,6 @@ libxl__stream_write_inuse(const libxl__stream_write_state *stream)return stream->running; } -/*----- colo related state structure -----*/ -typedef struct libxl__colo_save_state libxl__colo_save_state ; -struct libxl__colo_save_state { -int send_fd; -int recv_fd; -char *colo_proxy_script; - -/* private */ -libxl__stream_read_state srs; -void (*callback)(libxl__egc *,libxl__colo_save_state *,int ); -bool svm_running; -bool paused; - -/* private, used by qdisk block replication */ -bool qdisk_used; -bool qdisk_setuped; - -/* private, used by colo-proxy */ -libxl__colo_proxy_state cps; -libxl__ev_child child; -}; - typedef struct libxl__logdirty_switch { /* Set by caller of libxl__domain_common_switch_qemu_logdirty */ libxl__ao *ao;
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v2 2/4 libxl: colo: move netlink related stuff to libxl_colo_proxy.c
In reply to Wei LiuThey are only used there, no need to expose them to other parts of libxl.
This is necessary to make libxl build on FreeBSD again because FreeBSD doesn't have netlink.
--- tools/libxl/libxl_colo.h | 12 ------------ tools/libxl/libxl_colo_proxy.c | 13 +++++++++++++ 2 files changed, 13 insertions(+), 12 deletions(-)
tools/libxl/libxl_colo.h +0 -12
@@ -17,10 +17,6 @@#define LIBXL_COLO_H #include "libxl_internal.h" -#include <linux/netlink.h> - -/* Consistent with the new COLO netlink channel in kernel side */ -#define NETLINK_COLO 28/* Maximum time(5s) to wait for colo proxy checkpoit */ #define COLO_PROXY_CHECKPOINT_TIMEOUT 5000000
@@ -53,14 +49,6 @@ enum { LIBXL_COLO_RESUMED, }; -enum colo_netlink_op { -COLO_QUERY_CHECKPOINT = (NLMSG_MIN_TYPE +1 ), -COLO_CHECKPOINT , -COLO_FAILOVER , -COLO_PROXY_INIT , -COLO_PROXY_RESET ,/* UNUSED, will be used for continuous FT */ -}; -struct libxl__colo_device_nic {int devid;const char *vif;
tools/libxl/libxl_colo_proxy.c +13 -0
@@ -17,6 +17,19 @@#include "libxl_internal.h" +#include <linux/netlink.h> + +/* Consistent with the new COLO netlink channel in kernel side */ +#define NETLINK_COLO 28 + +enum colo_netlink_op { +COLO_QUERY_CHECKPOINT = (NLMSG_MIN_TYPE +1 ), +COLO_CHECKPOINT , +COLO_FAILOVER , +COLO_PROXY_INIT , +COLO_PROXY_RESET ,/* UNUSED, will be used for continuous FT */ +}; +/* ========= colo-proxy: helper functions ========== */ static int colo_proxy_send(libxl__colo_proxy_state *cps, uint8_t *buff,
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v2 3/4 build: rename CONFIG_REMUS_NETBUF to CONFIG_LIBNL
In reply to Wei LiuCOLO and Remus net buffer support both depend on the availability of libnl. Use a generic name.
No functional changes.
---
I committed configure changes as well. Feel free to rerun autogen.sh.
--- config/Tools.mk.in | 2 +- tools/configure | 10 +++++----- tools/configure.ac | 6 +++--- tools/hotplug/Linux/Makefile | 2 +- tools/libxl/Makefile | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-)
config/Tools.mk.in +1 -1
@@ -58,7 +58,7 @@ CONFIG_QEMU_TRAD := @qemu_traditional@ CONFIG_QEMU_XEN := @qemu_xen@ CONFIG_BLKTAP2 := @blktap2@ CONFIG_QEMUU_EXTRA_ARGS:= @EXTRA_QEMUU_CONFIGURE_ARGS@ -CONFIG_REMUS_NETBUF := @remus_netbuf@ +CONFIG_LIBNL := @libnl@ CONFIG_SYSTEMD := @systemd@ SYSTEMD_CFLAGS := @SYSTEMD_CFLAGS@
tools/configure +5 -5
@@ -629,7 +629,7 @@ SYSTEMD_CFLAGS SYSTEMD_MODULES_LOAD SYSTEMD_DIR systemd -remus_netbuf +libnl LIBNL3_LIBS LIBNL3_CFLAGS argp_ldflags
@@ -9068,18 +9068,18 @@ fi if test "x$libnl3_lib" = "xn" ; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disabling support for Remus network buffering. + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disabling support for Remus network buffering and COLO. Please install libnl3 libraries, command line tools and devel headers - version 3.2.8 or higher" >&5 -$as_echo "$as_me: WARNING: Disabling support for Remus network buffering. +$as_echo "$as_me: WARNING: Disabling support for Remus network buffering and COLO. Please install libnl3 libraries, command line tools and devel headers - version 3.2.8 or higher" >&2;} - remus_netbuf=n + libnl=n else - remus_netbuf=y + libnl=y fi
tools/configure.ac +3 -3
@@ -410,12 +410,12 @@ PKG_CHECK_MODULES(LIBNL3, [libnl-3.0 >= 3.2.8 libnl-route-3.0 >= 3.2.8], [libnl3_lib="y"], [libnl3_lib="n"]) AS_IF([test "x$libnl3_lib" = "xn" ], [ - AC_MSG_WARN([Disabling support for Remus network buffering. + AC_MSG_WARN([Disabling support for Remus network buffering and COLO. Please install libnl3 libraries, command line tools and devel headers - version 3.2.8 or higher]) - AC_SUBST(remus_netbuf, [n]) + AC_SUBST(libnl, [n]) ],[ - AC_SUBST(remus_netbuf, [y]) + AC_SUBST(libnl, [y]) ]) AC_SUBST(LIBNL3_LIBS)
tools/hotplug/Linux/Makefile +1 -1
@@ -18,7 +18,7 @@ XEN_SCRIPTS += vif-nat XEN_SCRIPTS += vif-openvswitch XEN_SCRIPTS += vif2 XEN_SCRIPTS += vif-setup -XEN_SCRIPTS-$(CONFIG_REMUS_NETBUF) += remus-netbuf-setup +XEN_SCRIPTS-$(CONFIG_LIBNL) += remus-netbuf-setup XEN_SCRIPTS += block XEN_SCRIPTS += block-enbd block-nbd XEN_SCRIPTS += xen-hotplug-cleanup
tools/libxl/Makefile +3 -3
@@ -21,7 +21,7 @@ endif LIBXL_LIBS = LIBXL_LIBS = $(LDLIBS_libxentoollog) $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libblktapctl) $(PTYFUNCS_LIBS) $(LIBUUID_LIBS) -ifeq ($(CONFIG_REMUS_NETBUF),y) +ifeq ($(CONFIG_LIBNL),y) LIBXL_LIBS += $(LIBNL3_LIBS) endif
@@ -31,7 +31,7 @@ CFLAGS_LIBXL += $(CFLAGS_libxenctrl) CFLAGS_LIBXL += $(CFLAGS_libxenguest) CFLAGS_LIBXL += $(CFLAGS_libxenstore) CFLAGS_LIBXL += $(CFLAGS_libblktapctl) -ifeq ($(CONFIG_REMUS_NETBUF),y) +ifeq ($(CONFIG_LIBNL),y) CFLAGS_LIBXL += $(LIBNL3_CFLAGS) endif CFLAGS_LIBXL += -Wshadow
@@ -52,7 +52,7 @@ else LIBXL_OBJS-y += libxl_noblktap2.o endif -ifeq ($(CONFIG_REMUS_NETBUF),y) +ifeq ($(CONFIG_LIBNL),y) LIBXL_OBJS-y += libxl_netbuffer.o else LIBXL_OBJS-y += libxl_nonetbuffer.o
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH v2 3/4] build: rename CONFIG_REMUS_NETBUF to CONFIG_LIBNL
tools/configure.ac PKG_CHECK_MODULES(LIBNL3, [libnl-3.0 >= 3.2.8 libnl-route-3.0 >= 3.2.8], · line 415
Quoted 12 lines · Wei Liu
tools/configure.ac +1
-1@@ -410,12 +410,12 @@ PKG_CHECK_MODULES(LIBNL3, [libnl-3.0 >= 3.2.8 libnl-route-3.0 >= 3.2.8], [libnl3_lib="y"], [libnl3_lib="n"]) AS_IF([test "x$libnl3_lib" = "xn" ], [ - AC_MSG_WARN([Disabling support for Remus network buffering. + AC_MSG_WARN([Disabling support for Remus network buffering and COLO. Please install libnl3 libraries, command line tools and devel headers - version 3.2.8 or higher])
While playing in this area, could the text be expanded to something like:
"Please install libnl3 libraries (including libnl-route)"
I spent a rather long time trying to work out I couldn't enable netbuf on a fresh install, as they are separate packages.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/4] build: rename CONFIG_REMUS_NETBUF to CONFIG_LIBNL
Quoted 16 lines · Andrew Cooper
tools/configure.ac PKG_CHECK_MODULES(LIBNL3, [libnl-3.0 >= 3.2.8 libnl-route-3.0 >= 3.2.8], · line 415
Quoted 12 lines · Wei Liu
tools/configure.ac +1
-1@@ -410,12 +410,12 @@ PKG_CHECK_MODULES(LIBNL3, [libnl-3.0 >= 3.2.8 libnl-route-3.0 >= 3.2.8], [libnl3_lib="y"], [libnl3_lib="n"]) AS_IF([test "x$libnl3_lib" = "xn" ], [ - AC_MSG_WARN([Disabling support for Remus network buffering. + AC_MSG_WARN([Disabling support for Remus network buffering and COLO. Please install libnl3 libraries, command line tools and devel headers - version 3.2.8 or higher])While playing in this area, could the text be expanded to something like:
Quoted 5 lines
"Please install libnl3 libraries (including libnl-route)"
I spent a rather long time trying to work out I couldn't enable netbuf on a fresh install, as they are separate packages.
Oh sure. :-)
Wei.
Quoted 1 line
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/4] build: rename CONFIG_REMUS_NETBUF to CONFIG_LIBNL
In reply to Wei LiuWei Liu writes ("[PATCH v2 3/4] build: rename CONFIG_REMUS_NETBUF to CONFIG_LIBNL"):
Quoted 8 lines
COLO and Remus net buffer support both depend on the availability of libnl. Use a generic name.
No functional changes.
Signed-off-by Wei Liu <[email protected]>---
I committed configure changes as well. Feel free to rerunautogen.sh.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v2 4/4 libxl: colo: make it depend on availability of libnl
In reply to Wei LiuNetlink is required when initialising COLO, so make sure only to compile COLO when netlink is available. Change the inclusion of linux/netlink.h to netlink/netlink.h.
Provide necessary stub functions in case COLO is disabled. This should fix build on FreeBSD because there is no netlink there. It would also make libxl build properly when netlink is not present on a Linux system.
--- tools/libxl/Makefile | 5 ++++ tools/libxl/libxl_colo_proxy.c | 2 +- tools/libxl/libxl_no_colo.c | 62 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 tools/libxl/libxl_no_colo.c
tools/libxl/Makefile +5 -0
@@ -65,10 +65,15 @@ LIBXL_OBJS-y += libxl_no_convert_callout.o endif LIBXL_OBJS-y += libxl_remus.o libxl_checkpoint_device.o libxl_remus_disk_drbd.o + +ifeq ($(CONFIG_LIBNL),y) LIBXL_OBJS-y += libxl_colo_restore.o libxl_colo_save.o LIBXL_OBJS-y += libxl_colo_qdisk.o LIBXL_OBJS-y += libxl_colo_proxy.o LIBXL_OBJS-y += libxl_colo_nic.o +else +LIBXL_OBJS-y += libxl_no_colo.o +endif LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o libxl_psr.o LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_arm.o libxl_libfdt_compat.o
tools/libxl/libxl_colo_proxy.c +1 -1
@@ -17,7 +17,7 @@#include "libxl_internal.h" -#include <linux/netlink.h> +#include <netlink/netlink.h> /* Consistent with the new COLO netlink channel in kernel side */ #define NETLINK_COLO 28
tools/libxl/libxl_no_colo.c new file +62 -0
62 lines not on this page · raw message
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH v2 4/4] libxl: colo: make it depend on availability of libnl
Wei Liu writes ("[PATCH v2 4/4] libxl: colo: make it depend on availability of libnl"):
Quoted 8 lines
Netlink is required when initialising COLO, so make sure only to compile COLO when netlink is available. Change the inclusion of
linux/netlink.htonetlink/netlink.h.Provide necessary stub functions in case COLO is disabled. This should fix build on FreeBSD because there is no netlink there. It would also make libxl build properly when netlink is not present on a Linux system.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 4 lines · Wei Liu
COLO depends on netlink which is only available on Linux. This series cleans up COLO code and make it only build when libnl is available. This should fix FreeBSD build.
Quoted 9 lines
Tested building on Linux with and without libnl-3-dev and libnl3-route-dev.
git rebase -i HEAD~4 --exec \
'./configure --disable-stubdom && \
CCACHE_DISABLE=1 make -Ctools/libxlclean && \
CCACHE_DISABLE=1 make -Ctools/libxl-j8'Both build tests on every single commit passed.
This series can be found at:
git://xenbits.xen.org/people/liuw/xen.git wip.colo-freebsd-fix-v2
The head of that branch builds OK on FreeBSD now -- but not every single commit though because the build is fixed in the final commit.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 12 lines · Wei Liu
Quoted 11 lines · Wei Liu
COLO depends on netlink which is only available on Linux. This series cleans up COLO code and make it only build when libnl is available. This should fix FreeBSD build.
Tested building on Linux with and without libnl-3-dev and libnl3-route-dev.
git rebase -i HEAD~4 --exec \
'./configure --disable-stubdom && \
CCACHE_DISABLE=1 make -Ctools/libxlclean && \
CCACHE_DISABLE=1 make -Ctools/libxl-j8'
Quoted 6 lines
Quoted 2 lines
Both build tests on every single commit passed.
This series can be found at:
git://xenbits.xen.org/people/liuw/xen.gitwip.colo-freebsd-fix-v2
I've made change per Andrew's request and folded in all the acks.
Please pull from
git://xenbits.xen.org/people/liuw/xen.git wip.colo-freebsd-fix-v3
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Wei Liu writes ("Re: [PATCH v2 0/4] COLO: only build when libnl is available"):
Quoted 1 line
I've made change per Andrew's request and folded in all the acks.
Thank you.
Quoted 3 lines
Please pull from
git://xenbits.xen.org/people/liuw/xen.gitwip.colo-freebsd-fix-v3
Queued.
Thanks,
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel