COLO: only build on Linux
cover COLO: only build on Linux
COLO depends on netlink which is only available on Linux. This series cleans up COLO code and make it only build on Linux. This should fix FreeBSD build.
Congyang and Changlong, please review this series as soon as possible. I also have a question why COLO doesn't use libnl? It is using Linux header directly.
Roger, can you run functional tests on FreeBSD? I don't have FreeBSD Dom0.
Wei.
Wei Liu (3):
libxl: colo: rearrange things in header files
libxl: colo: move netlink related stuff to libxl_colo_proxy.c
libxl: colo: only build COLO on Linux
tools/libxl/Makefile | 5 ++++ 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 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+), 51 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 1/3 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
Re: [PATCH 1/3] libxl: colo: rearrange things in header files
Wei Liu writes ("[PATCH 1/3] libxl: colo: rearrange things in header files"):
Quoted 12 lines
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 tolibxl_internal.h.
2. Movelibxl__colo_save_statetolibxl_colo.h.
3. Includelibxl_internal.hinlibxl_colo.h.
4. Move a bunch of colo typedefs to the top oflibxl_internal.h.
5. Move the inclusion oflibxl_colo.hto the right place inlibxl_internal.h.
Quoted 1 line
Signed-off-by Wei Liu <[email protected]>
On the basis that I believe you that this is just code motion.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH 2/3 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
Re: [PATCH 2/3] libxl: colo: move netlink related stuff to libxl_colo_proxy.c
Wei Liu writes ("[PATCH 2/3] libxl: colo: move netlink related stuff to libxl_colo_proxy.c"):
Quoted 7 lines
They 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.
Signed-off-by Wei Liu <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH 3/3 libxl: colo: only build COLO on Linux
In reply to Wei LiuLinux's netlink is required when initialising COLO, so make sure only to compile COLO on Linux.
Provide necessary stub functions in case COLO is disabled. This should fix libxl build on FreeBSD.
--- tools/libxl/Makefile | 5 ++++ tools/libxl/libxl_no_colo.c | 62 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) 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_Linux),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_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 3/3] libxl: colo: only build COLO on Linux
Quoted 18 lines · Wei Liu
Linux's netlink is required when initialising COLO, so make sure only to compile COLO on Linux.
Provide necessary stub functions in case COLO is disabled. This should fix libxl build on FreeBSD.
Signed-off-by Wei Liu <[email protected]>--- tools/libxl/Makefile | 5 ++++ tools/libxl/libxl_no_colo.c | 62 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 tools/libxl/libxl_no_colo.ctools/libxl/Makefile +0
-0
tools/libxl/Makefile LIBXL_OBJS-y += libxl_no_convert_callout.o · line 69
Quoted 5 lines
tools/libxl/Makefile +2
-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_Linux),y)
I think about this a bit more, this is not necessary right.
The header file (linux/netlink.h) may be in a dedicated package. On Debian it is in linux-libc-dev. I should explicitly check the availability of that header file instead.
...
Just after I finished the above paragraph, Congyang confirmed that COLO should depend on libnl, so whatever I wrote above is moot. I post it for the public record anyway.
Wei.
Quoted 81 lines
tools/libxl/Makefile +3
-0LIBXL_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.otools/libxl/libxl_no_colo.c new file +62
-0@@ -0,0 +1,62 @@ +/* +* Copyright (C) 2016 +* Author Wei Liu <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation; version 2.1 only. with the special +* exception on linking described in file LICENSE. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +*/ + +#include "libxl_osdeps.h" /* must come before any other headers */ + +#include "libxl_internal.h" + +void libxl__colo_restore_setup (libxl__egc *egc, +libxl__colo_restore_state *crs) +{ +STATE_AO_GC (crs->ao); + +LOG (ERROR ,"COLO is not supported" ); + + crs->callback (egc, crs,ERROR_FAIL ); +} + +void libxl__colo_restore_teardown (libxl__egc *egc,void *dcs_void, +int ret,int retval,int errnoval) +{ +/* Shouldn't be here because setup already failed */ +abort (); +} + +void libxl__colo_save_setup (libxl__egc *egc,libxl__colo_save_state *css) +{ +libxl__domain_save_state *dss =CONTAINER_OF (css, *dss, css); +STATE_AO_GC (dss->ao); + +LOG (ERROR ,"COLO is not supported" ); + + dss->callback (egc, dss,ERROR_FAIL ); +} + +void libxl__colo_save_teardown (libxl__egc *egc, +libxl__colo_save_state *css, +int rc) +{ +/* Shouldn't be here because setup already failed */ +abort (); +} + + +/* +* Local variables: +* mode: C +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/ Signature · 1 line
2.1.4
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 5 lines · Wei Liu
COLO depends on netlink which is only available on Linux. This series cleans up COLO code and make it only build on Linux. This should fix FreeBSD build.
Congyang and Changlong, please review this series as soon as possible. I also have a question why COLO doesn't use libnl? It is using Linux header directly.
It is implemented by Yang one year ago. I don't know the reason. We will investigate how to use libnl.
Thanks
Wen Congyang
Quoted 10 lines
Roger, can you run functional tests on FreeBSD? I don't have FreeBSD Dom0.
Wei.
Wei Liu (3):
libxl: colo: rearrange things in header files
libxl: colo: move netlink related stuff tolibxl_colo_proxy.c
libxl: colo: only build COLO on Linux
Quoted 8 lines
tools/libxl/Makefile | 5 ++++ 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 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+), 51 deletions(-) create mode 100644 tools/libxl/libxl_no_colo.c
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 10 lines · Wen Congyang
Quoted 5 lines · Wei Liu
COLO depends on netlink which is only available on Linux. This series cleans up COLO code and make it only build on Linux. This should fix FreeBSD build.
Congyang and Changlong, please review this series as soon as possible. I also have a question why COLO doesn't use libnl? It is using Linux header directly.
It is implemented by Yang one year ago. I don't know the reason. We will investigate how to use libnl.
It's easy -- change inclusion of linux/netlink.h to netlink/netlink.h. I already have a series to do that -- this series is actually my second attempt to fix COLO.
If you can confirm COLO should depend on libnl, I will post my patches.
Wei.
Quoted 24 lines
Thanks
Wen CongyangQuoted 18 lines
Roger, can you run functional tests on FreeBSD? I don't have FreeBSD Dom0.
Wei.
Wei Liu (3):
libxl: colo: rearrange things in header files
libxl: colo: move netlink related stuff tolibxl_colo_proxy.c
libxl: colo: only build COLO on Linuxtools/libxl/Makefile | 5 ++++ 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 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+), 51 deletions(-) create mode 100644 tools/libxl/libxl_no_colo.c
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 12 lines · Wei Liu
Quoted 10 lines · Wen Congyang
Quoted 5 lines · Wei Liu
COLO depends on netlink which is only available on Linux. This series cleans up COLO code and make it only build on Linux. This should fix FreeBSD build.
Congyang and Changlong, please review this series as soon as possible. I also have a question why COLO doesn't use libnl? It is using Linux header directly.
It is implemented by Yang one year ago. I don't know the reason. We will investigate how to use libnl.
Quoted 5 lines
It's easy -- change inclusion of
linux/netlink.htonetlink/netlink.h. I already have a series to do that -- this series is actually my second attempt to fix COLO.If you can confirm COLO should depend on libnl, I will post my patches.
I think COLO should depend on libnl.
Thanks
Wen Congyang
Quoted 29 lines
Wei.
Quoted 24 lines
Thanks
Wen CongyangQuoted 18 lines
Roger, can you run functional tests on FreeBSD? I don't have FreeBSD Dom0.
Wei.
Wei Liu (3):
libxl: colo: rearrange things in header files
libxl: colo: move netlink related stuff tolibxl_colo_proxy.c
libxl: colo: only build COLO on Linuxtools/libxl/Makefile | 5 ++++ 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 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+), 51 deletions(-) create mode 100644 tools/libxl/libxl_no_colo.c
Quoted 2 lines
.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 13 lines · Wen Congyang
Quoted 12 lines · Wei Liu
Quoted 10 lines · Wen Congyang
Quoted 5 lines · Wei Liu
COLO depends on netlink which is only available on Linux. This series cleans up COLO code and make it only build on Linux. This should fix FreeBSD build.
Congyang and Changlong, please review this series as soon as possible. I also have a question why COLO doesn't use libnl? It is using Linux header directly.
It is implemented by Yang one year ago. I don't know the reason. We will investigate how to use libnl.
Quoted 8 lines
Quoted 5 lines
It's easy -- change inclusion of
linux/netlink.htonetlink/netlink.h. I already have a series to do that -- this series is actually my second attempt to fix COLO.If you can confirm COLO should depend on libnl, I will post my patches.
I think COLO should depend on libnl.
NP, patch series incoming.
Wei.
Quoted 37 lines
Thanks
Wen CongyangQuoted 31 lines
Wei.
Quoted 24 lines
Thanks
Wen CongyangQuoted 18 lines
Roger, can you run functional tests on FreeBSD? I don't have FreeBSD Dom0.
Wei.
Wei Liu (3):
libxl: colo: rearrange things in header files
libxl: colo: move netlink related stuff tolibxl_colo_proxy.c
libxl: colo: only build COLO on Linuxtools/libxl/Makefile | 5 ++++ 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 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+), 51 deletions(-) create mode 100644 tools/libxl/libxl_no_colo.c.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
I've test on my side, and works ok for me.
Thanks
-Xie
Quoted 15 lines · Wei Liu
COLO depends on netlink which is only available on Linux. This series cleans up COLO code and make it only build on Linux. This should fix FreeBSD build.
Congyang and Changlong, please review this series as soon as possible. I also have a question why COLO doesn't use libnl? It is using Linux header directly.
Roger, can you run functional tests on FreeBSD? I don't have FreeBSD Dom0.
Wei.
Wei Liu (3):
libxl: colo: rearrange things in header files
libxl: colo: move netlink related stuff tolibxl_colo_proxy.c
libxl: colo: only build COLO on Linux
Quoted 8 lines
tools/libxl/Makefile | 5 ++++ 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 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+), 51 deletions(-)create mode 100644
tools/libxl/libxl_no_colo.c
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel