Remus/Libxl: Remus network buffering and drbd disk
v20 cover Remus/Libxl: Remus network buffering and drbd disk
This patch series adds support for network buffering and drbd disk in the Remus codebase in libxl.
the code is also hosted on github:
url: https://github.com/macrosheep/xen/tree/remus-v20
Changes in v20:
Rebased.
Changes in v19:
Use defbool for cmdline switch.
Restruct of subkind init and cleanup operation. Use libxl__device_kind instead of libxl__remus_device_kind Fix a layer violation issue pointed out by IanJ. Other minor fixes.
Rebased to the latest staging tree.
Changes in v18:
Merge match() and setup() api.
Reuse libxl__multidev and libxl__ao_device.
Commit messages and code comments improved. Thanks to Shriram. Rebased.
Changes in v17:
Make remus device abstract layer more generic.
Addressed Ian J's comments.
Changes in v16:
Merge libxl__remus_state and libxl__remus_device_state.
Pass the ops to device abstract layer instead of defined it in the layer. Optimized subkind ops APIs.
Addressed Ian J's comments.
Rebased.
Changes in v15:
The first patch in v14 has been taken, so remove it from the patchset. Add a patch to Update maintained files of REMUS.
Rebased.
Changes in v14:
Addressed IanJ's comments.
Rebased.
Changes in v13:
Addressed Konrad's comments.
Rebased.
Changes in v12:
Add disk buffering cmdline switch.
Changes in v11:
Addressed comments from Ian J and Shriram.
Add drbd disk implement into this patch series.
Changes in V10:
Restructured the whole patch series.
Introduce the remus device abstract layer.
Make remus checkpoint asynchronous.
Changes in V9:
Use async exec script api to exec scripts.
Changes in V8:
Applied some comments(by IanJ).
Merge some struct definitions to it's implementation. (2/3/5 in V7 => 3 in V8)
Changes in V7:
Applied missing comments(by IanJ).
Applied Shriram comments.
merge netbufering tangled setup/teardown code into one patch. (2/6/8 in V6 => 5 in V7. 9/10 in V6 => 7 in V7)
Changes in V6:
Applied Ian Jackson's comments of V5 series. the [PATCH 2/4 V5] is split by small functionalities.
[PATCH 4/4 V5] --> [PATCH 13/13] netbuffer is default enabled.
Changes in V5:
Merge hotplug script patch (2/5) and hotplug script setup/teardown patch (3/5) into a single patch.
Changes in V4:
[1/5] Remove check for libnl command line utils in autoconf checks
[2/5] minor nits
[3/5] define LIBXL_HAVE_REMUS_NETBUF in libxl.h
[4/5] clean ups. Make the usleep in checkpoint callback asynchronous
[5/5] minor nits
Changes in V3:
[1/5] Fix redundant checks in configure scripts
(based on Ian Campbell's suggestions)
[2/5] Introduce locking in the script, during IFB setup.
Add xenstore paths used by netbuf scripts to xenstore-paths.markdown
[3/5] Hotplug scripts setup/teardown invocations are now asynchronous
following IanJ's feedback. However, the invocations are still sequential.
[5/5] Allow per-domain specification of netbuffer scripts in xl remus
commmand.
And minor nits throughout the series based on feedback from the last version
Changes in V2:
[1/5] Configure script will automatically enable/disable network
buffer support depending on the availability of the appropriate libnl3 version. [If libnl3 is unavailable, a warning message will be printed to let the user know that the feature has been disabled.]
use macros from pkg.m4 instead of pkg-config commands removed redundant checks for libnl3 libraries.
[3,4/5] - Minor nits.
Version 1:
[1/5] Changes to autoconf scripts to check for libnl3. Add linker flags
to libxl Makefile.
[2/5] External script to setup/teardown network buffering using libnl3's
CLI. This script will be invoked by libxl before starting Remus. The script's main job is to bring up an IFB device with plug qdisc attached to it. It then re-routes egress traffic from the guest's vif to the IFB device.
[3/5] Libxl code to invoke the external setup script, followed by netlink
related setup to obtain a handle on the output buffers attached to each vif.
[4/5] Libxl interaction with network buffer module in the kernel via
libnl3 API.
[5/5] xl cmdline switch to explicitly enable network buffering when
starting remus.
Few things to note(by shriram):
a) Based on previous email discussions, the setup/teardown task has been moved to a hotplug style shell script which can be customized as desired, instead of implementing it as C code inside libxl.
b) Libnl3 is not available on NetBSD. Nor is it available on CentOS
(Linux). So I have made network buffering support an optional feature so that it can be disabled if desired.
c) NetBSD does not have libnl3. So I have put the setup script under tools/hotplug/Linux folder.
thanks,
Yang.
Legend:
A - acked
D - previous acked, but new change introduced so acked-by dropped M - Modified
S - the same version as last round
No marker - new patch
Yang Hongyang (12):
A libxl: introduce libxl__multidev_prepare_with_aodev
A libxl: Extend libxl__ao_device with a libxl__ev_child member A autoconf: add libnl3 dependency for Remus network buffering support S libxl/remus: introduce an abstract Remus device layer
A libxl/remus: setup and control network output buffering A libxl/remus: setup and control disk replication for DRBD backends S xl/remus: change bool to defbool
S xl/remus: cmdline switch to explicitly enable unsafe configurations A xl/remus: cmdline switches and config vars to control network
buffering
A xl/remus: add a cmdline switch to disable disk replication A libxl/remus: add LIBXL_HAVE_REMUS to indicate Remus support in libxl S MAINTAINERS: update maintained files of Remus
MAINTAINERS | 7 + README | 4 + config/Tools.mk.in | 4 + docs/README.remus | 16 + docs/man/xl.conf.pod.5 | 6 + docs/man/xl.pod.1 | 30 +- docs/misc/xenstore-paths.markdown | 4 + tools/configure.ac | 16 + tools/hotplug/Linux/Makefile | 2 + tools/hotplug/Linux/block-drbd-probe | 87 ++++++ tools/hotplug/Linux/remus-netbuf-setup | 230 +++++++++++++++ tools/libxl/Makefile | 15 + tools/libxl/libxl.c | 75 ++++- tools/libxl/libxl.h | 6 + tools/libxl/libxl_device.c | 14 +- tools/libxl/libxl_dom.c | 170 ++++++++++- tools/libxl/libxl_internal.h | 195 ++++++++++++- tools/libxl/libxl_netbuffer.c | 517 +++++++++++++++++++++++++++++++++ tools/libxl/libxl_nonetbuffer.c | 54 ++++ tools/libxl/libxl_remus_device.c | 296 +++++++++++++++++++ tools/libxl/libxl_remus_disk_drbd.c | 257 ++++++++++++++++ tools/libxl/libxl_types.idl | 10 +- tools/libxl/libxl_types_internal.idl | 2 + tools/libxl/xl.c | 4 + tools/libxl/xl.h | 1 + tools/libxl/xl_cmdimpl.c | 42 ++- tools/libxl/xl_cmdtable.c | 11 +- 27 files changed, 2030 insertions(+), 45 deletions(-) create mode 100755 tools/hotplug/Linux/block-drbd-probe create mode 100644 tools/hotplug/Linux/remus-netbuf-setup create mode 100644 tools/libxl/libxl_netbuffer.c create mode 100644 tools/libxl/libxl_nonetbuffer.c create mode 100644 tools/libxl/libxl_remus_device.c create mode 100644 tools/libxl/libxl_remus_disk_drbd.c
Signature · 1 line
1.9.1
PATCH v20 1/12 libxl: introduce libxl__multidev_prepare_with_aodev
libxl__multidev_prepare_with_aodev is similar to libxl__multidev_prepare, but takes a libxl__ao_device as an extra argument. libxl__multidev_prepare is now a wrapper around libxl__multidev_prepare_with_aodev.
This new internal API will be used by the Remus device abstract layer for handling various Remus devices.
--- tools/libxl/libxl_device.c | 13 ++++++++++--- tools/libxl/libxl_internal.h | 14 +++++++++++--- 2 files changed, 21 insertions(+), 6 deletions(-)
tools/libxl/libxl_device.c +10 -3
@@ -481,11 +481,10 @@ void libxl__multidev_begin(libxl__ao *ao, libxl__multidev *multidev)static void multidev_one_callback (libxl__egc *egc,libxl__ao_device *aodev); -libxl__ao_device *libxl__multidev_prepare (libxl__multidev *multidev) { +void libxl__multidev_prepare_with_aodev (libxl__multidev *multidev, +libxl__ao_device *aodev) {STATE_AO_GC (multidev->ao); -libxl__ao_device *aodev; -GCNEW (aodev); aodev->multidev = multidev; aodev->callback = multidev_one_callback;libxl__prepare_ao_device (ao, aodev);
@@ -495,6 +494,14 @@ libxl__ao_device *libxl__multidev_prepare(libxl__multidev *multidev) {GCREALLOC_ARRAY (multidev->array, multidev->allocd); } multidev->array[multidev->used++] = aodev; +} + +libxl__ao_device *libxl__multidev_prepare (libxl__multidev *multidev) { +STATE_AO_GC (multidev->ao); +libxl__ao_device *aodev; + +GCNEW (aodev); +libxl__multidev_prepare_with_aodev (multidev, aodev);return aodev; }
tools/libxl/libxl_internal.h +11 -3
@@ -2170,9 +2170,17 @@ struct libxl__ao_device {/* Starts preparing to add/remove a bunch of devices. */ _hidden void libxl__multidev_begin(libxl__ao *ao, libxl__multidev*); -/* Prepares to add/remove one of many devices. Returns a libxl__ao_device -* which has had libxl__prepare_ao_device called, and which has also -* had ->callback set. The user should not mess with aodev->callback. */ +/* Prepares to add/remove one of many devices. +* Calls libxl__prepare_ao_device on libxl__ao_device argument provided and +* also sets the ->callback. The user should not mess with aodev->callback. +*/ +_hidden void libxl__multidev_prepare_with_aodev(libxl__multidev*, +libxl__ao_device *); + +/* A wrapper function around libxl__multidev_prepare_with_aodev. +* Allocates a libxl__ao_device and prepares it for addition/removal. +* Returns the newly allocated libxl__ao_dev. +*/ _hidden libxl__ao_device *libxl__multidev_prepare(libxl__multidev*);/* Notifies the multidev machinery that we have now finished preparing
Signature · 1 line
1.9.1
PATCH v20 2/12 libxl: Extend libxl__ao_device with a libxl__ev_child member
In reply to Yang HongyangThis can be used to fork children to allow the asynchronous execution of system calls which only come in a synchronous variant. This will be useful for Remus, in the following patches.
--- tools/libxl/libxl_device.c | 1 + tools/libxl/libxl_internal.h | 2 ++ 2 files changed, 3 insertions(+)
tools/libxl/libxl_device.c +1 -0
@@ -453,6 +453,7 @@ void libxl__prepare_ao_device(libxl__ao *ao, libxl__ao_device *aodev)/* We init this here because we might call device_hotplug_done * without actually calling any hotplug script */ libxl__async_exec_init (&aodev->aes); +libxl__ev_child_init (&aodev->child); }/* multidev */
tools/libxl/libxl_internal.h +2 -0
@@ -2150,6 +2150,8 @@ struct libxl__ao_device {libxl__async_exec_state aes;/* If we need to update JSON config */ bool update_json; +/* for asynchronous execution of synchronous-only syscalls etc. */ +libxl__ev_child child; };/*
Signature · 1 line
1.9.1
PATCH v20 3/12 autoconf: add libnl3 dependency for Remus network buffering support
In reply to Yang HongyangLibnl3 is required for controlling Remus network buffering. This patch adds dependency on libnl3 (>= 3.2.8) to autoconf scripts. It also provides the ability to configure tools without libnl3 support i.e., without network buffering support.
When there is no network buffering support, libxl__netbuffer_enabled() returns 0, otherwise returns 1. The callers of this api will be introduced in the rest of the series.
NOTE: This patch changes tools/configure.ac, please rerun
autogen.sh while applying the patch.
--- README | 4 ++++ config/Tools.mk.in | 4 ++++ docs/README.remus | 6 ++++++ tools/configure.ac | 16 ++++++++++++++++ tools/libxl/Makefile | 13 +++++++++++++ tools/libxl/libxl_internal.h | 1 + tools/libxl/libxl_netbuffer.c | 31 +++++++++++++++++++++++++++++++ tools/libxl/libxl_nonetbuffer.c | 31 +++++++++++++++++++++++++++++++ 8 files changed, 106 insertions(+) create mode 100644 tools/libxl/libxl_netbuffer.c create mode 100644 tools/libxl/libxl_nonetbuffer.c
README +4 -0
@@ -73,6 +73,10 @@ disabled at compile time: * markdown * figlet (for generating the traditional Xen start of day banner) * systemd daemon development files + * Development install of libnl3 (e.g., libnl-3-200, + libnl-3-dev, etc). Required if network buffering is desired + when using Remus with libxl. See tools/remus/README for detailed + information. Second, you need to acquire a suitable kernel for use in domain 0. If possible you should use a kernel provided by your OS distributor. If
config/Tools.mk.in +4 -0
@@ -43,6 +43,9 @@ PTHREAD_LIBS := @PTHREAD_LIBS@ PTYFUNCS_LIBS := @PTYFUNCS_LIBS@ +LIBNL3_LIBS := @LIBNL3_LIBS@ +LIBNL3_CFLAGS := @LIBNL3_CFLAGS@ + # Download GIT repositories via HTTP or GIT's own protocol? # GIT's protocol is faster and more robust, when it works at all (firewalls # may block it). We make it the default, but if your GIT repository downloads
@@ -62,6 +65,7 @@ CONFIG_BLKTAP1 := @blktap1@ CONFIG_BLKTAP2 := @blktap2@ CONFIG_VTPM := @vtpm@ CONFIG_QEMUU_EXTRA_ARGS:= @EXTRA_QEMUU_CONFIGURE_ARGS@ +CONFIG_REMUS_NETBUF := @remus_netbuf@ CONFIG_SYSTEMD := @systemd@ SYSTEMD_CFLAGS := @SYSTEMD_CFLAGS@
docs/README.remus +6 -0
@@ -2,3 +2,9 @@ Remus provides fault tolerance for virtual machines by sending continuous checkpoints to a backup, which will activate if the target VM fails. See the website at http://wiki.xen.org/wiki/Remus for details. + +Using Remus with libxl on Xen 4.5 and higher: + To enable network buffering, you need libnl 3.2.8 + or higher along with the development headers and command line utilities. + If your distro does not have the appropriate libnl3 version, you can find + the latest source tarball of libnl3 at http://www.carisma.slowglass.com/~tgr/libnl/
tools/configure.ac +16 -0
@@ -320,6 +320,22 @@ esac # Checks for header files. AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h valgrind/memcheck.h utmp.h]) +# Check for libnl3 >=3.2.8. If present enable remus network buffering. +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. + Please install libnl3 libraries, command line tools and devel + headers - version 3.2.8 or higher]) + AC_SUBST(remus_netbuf, [n]) + ],[ + AC_SUBST(remus_netbuf, [y]) +]) + +AC_SUBST(LIBNL3_LIBS) +AC_SUBST(LIBNL3_CFLAGS) + fi # ! $rump AX_AVAILABLE_SYSTEMD()
tools/libxl/Makefile +13 -0
@@ -21,11 +21,17 @@ endif LIBXL_LIBS = LIBXL_LIBS = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libblktapctl) $(PTYFUNCS_LIBS) $(LIBUUID_LIBS) +ifeq ($(CONFIG_REMUS_NETBUF),y) +LIBXL_LIBS += $(LIBNL3_LIBS) +endif CFLAGS_LIBXL += $(CFLAGS_libxenctrl) CFLAGS_LIBXL += $(CFLAGS_libxenguest) CFLAGS_LIBXL += $(CFLAGS_libxenstore) CFLAGS_LIBXL += $(CFLAGS_libblktapctl) +ifeq ($(CONFIG_REMUS_NETBUF),y) +CFLAGS_LIBXL += $(LIBNL3_CFLAGS) +endif CFLAGS_LIBXL += -Wshadow LIBXL_LIBS-$(CONFIG_ARM) += -lfdt
@@ -43,6 +49,13 @@ LIBXL_OBJS-y += libxl_blktap2.o else LIBXL_OBJS-y += libxl_noblktap2.o endif + +ifeq ($(CONFIG_REMUS_NETBUF),y) +LIBXL_OBJS-y += libxl_netbuffer.o +else +LIBXL_OBJS-y += libxl_nonetbuffer.o +endif + LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_arm.o
tools/libxl/libxl_internal.h +1 -0
@@ -2573,6 +2573,7 @@ typedef struct libxl__save_helper_state {* marshalling and xc callback functions */ } libxl__save_helper_state; +_hidden int libxl__netbuffer_enabled(libxl__gc *gc);/*----- Domain suspend (save) state structure -----*/
tools/libxl/libxl_netbuffer.c new file +31 -0
@@ -0,0 +1,31 @@ +/* +* Copyright (C) 2014 +* Author Shriram Rajagopalan <[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" + +int libxl__netbuffer_enabled (libxl__gc *gc) +{ +return 1 ; +} + +/* +* Local variables: +* mode: C +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
tools/libxl/libxl_nonetbuffer.c new file +31 -0
@@ -0,0 +1,31 @@ +/* +* Copyright (C) 2014 +* Author Shriram Rajagopalan <[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" + +int libxl__netbuffer_enabled (libxl__gc *gc) +{ +return 0 ; +} + +/* +* Local variables: +* mode: C +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
Signature · 1 line
1.9.1
PATCH v20 4/12 libxl/remus: introduce an abstract Remus device layer
In reply to Yang HongyangIntroduce an abstract device layer that allows the Remus logic in libxl to control a guest's devices in a device-agnostic manner. The device layer also exposes a set of internal interfaces that a device type must implement, if it wishes to support Remus.
The following API are exposed to libxl:
One-time configuration operations:
*libxl__remus_devices_setup
Quoted 1 line
Enable output buffering for NICs, setup disk replication, etc.
*libxl__remus_devices_teardown
Quoted 1 line
Disable network output buffering and disk replication;
teardown any associated external setups like qdiscs for NICs.
Operations executed every checkpoint (in order of invocation):
*libxl__remus_devices_postsuspend *libxl__remus_devices_preresume *libxl__remus_devices_commit
Each device type needs to implement the interfaces specified in the libxl__remus_device_instance_ops if it wishes to support Remus.
The high-level control flow through the Remus device layer is shown below:
xl remus
|-> libxl_domain_remus_start
|-> libxl__remus_devices_setup
|-> Per-checkpoint libxl__remus_devices_[postsuspend,preresume,commit]
...
|-> On backup failure/network error/other errors
libxl__remus_devices_teardownFor comments:
--- tools/libxl/Makefile | 2 + tools/libxl/libxl.c | 47 +++++- tools/libxl/libxl_dom.c | 168 +++++++++++++++++++-- tools/libxl/libxl_internal.h | 163 +++++++++++++++++++++ tools/libxl/libxl_remus_device.c | 273 +++++++++++++++++++++++++++++++++++ tools/libxl/libxl_types.idl | 2 + tools/libxl/libxl_types_internal.idl | 2 + 7 files changed, 640 insertions(+), 17 deletions(-) create mode 100644 tools/libxl/libxl_remus_device.c
tools/libxl/Makefile +2 -0
@@ -56,6 +56,8 @@ else LIBXL_OBJS-y += libxl_nonetbuffer.o endif +LIBXL_OBJS-y += libxl_remus_device.o + LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_arm.o
tools/libxl/libxl.c +41 -6
73 lines not on this page · raw message
tools/libxl/libxl_dom.c +157 -11
225 lines not on this page · raw message
tools/libxl/libxl_internal.h +163 -0
175 lines not on this page · raw message
tools/libxl/libxl_remus_device.c new file +273 -0
273 lines not on this page · raw message
tools/libxl/libxl_types.idl +2 -0
@@ -61,6 +61,8 @@ libxl_error = Enumeration("error", [ (-15, "LOCK_FAIL"), (-16, "JSON_CONFIG_EMPTY"), (-17, "DEVICE_EXISTS"), + (-18, "REMUS_DEVOPS_DOES_NOT_MATCH"), + (-19, "REMUS_DEVICE_NOT_SUPPORTED"), ], value_namespace = "") libxl_domain_type = Enumeration("domain_type", [
tools/libxl/libxl_types_internal.idl +2 -0
@@ -22,6 +22,8 @@ libxl__device_kind = Enumeration("device_kind", [ (6, "VKBD"), (7, "CONSOLE"), (8, "VTPM"), + (9, "REMUS_NIC"), + (10, "REMUS_DISK"), ]) libxl__console_backend = Enumeration("console_backend", [
Signature · 1 line
1.9.1
PATCH v20 5/12 libxl/remus: setup and control network output buffering
In reply to Yang HongyangThis patch adds the machinery required for protecting a guest's network device state. This patch comprises of two parts:
1. Hotplug scripts: The remus-netbuf-setup script is responsible for setting up and tearing down the necessary infrastructure required for network output buffering. This script should be invoked by libxl for each of the guest's network interfaces, when starting or stopping Remus.
Apart from returning success/failure indication via the usual hotplug entries in xenstore, this script also writes to xenstore, the name of the REMUS_IFB device to be used to control the vif's network output.
The script relies on libnl3 command line utilities to perform various setup/teardown functions. The script is confined to Linux platforms only since NetBSD does not seem to have libnl3.
2. Remus network device: Implements the interfaces required by the remus abstract device layer. A note about the implementation:
a) init_subkind_nic() & cleanup_subkind_nic() are called once per Remus invocation. They establish and free netlink related state respectively.
b) setup() and teardown are called for each vif attached to the guest.
During setup():
i) The hotplug script is called to setup a network buffer on a given vif. The script chooses an available IFB device from the system, redirects vif egress traffic to the IFB device and sets up the plug qdisc (output buffer) on the IFB device. The name of the IFB device is communicated via xenstore to libxl.
ii) Libxl obtains a handle to the plug qdisc using the libnl3 API
and subsequently controls output buffering using this handle in the checkpoint callbacks.
During teardown(), the hotplug scripts are called again to remove the vif->ifb traffic redirection, release the ifb and the plug qdisc associated with it.
c) The checkpoint callbacks [postsuspend(), preresume() and commit()] are implemented as synchronous ops as the netlink calls associated with the qdisc subsystem are very fast.
--- docs/misc/xenstore-paths.markdown | 4 + tools/hotplug/Linux/Makefile | 1 + tools/hotplug/Linux/remus-netbuf-setup | 230 ++++++++++++++++ tools/libxl/libxl.c | 7 + tools/libxl/libxl_internal.h | 10 + tools/libxl/libxl_netbuffer.c | 481 +++++++++++++++++++++++++++++++++ tools/libxl/libxl_nonetbuffer.c | 23 ++ tools/libxl/libxl_remus_device.c | 18 +- 8 files changed, 773 insertions(+), 1 deletion(-) create mode 100644 tools/hotplug/Linux/remus-netbuf-setup
docs/misc/xenstore-paths.markdown +4 -0
@@ -393,6 +393,10 @@ The guest's virtual time offset from UTC in seconds. The device model version for a domain. +#### /libxl/$DOMID/remus/netbuf/$DEVID/ifb = STRING [n,INTERNAL] + +ifb device used by Remus to buffer network output from the associated vif. + [BLKIF]: http://xenbits.xen.org/docs/unstable/hypercall/include,public,io,blkif.h.html [FBIF]: http://xenbits.xen.org/docs/unstable/hypercall/include,public,io,fbif.h.html [HVMPARAMS]: http://xenbits.xen.org/docs/unstable/hypercall/include,public,hvm,params.h.html
tools/hotplug/Linux/Makefile +1 -0
@@ -16,6 +16,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 += block XEN_SCRIPTS += block-enbd block-nbd XEN_SCRIPTS-$(CONFIG_BLKTAP1) += blktap
tools/hotplug/Linux/remus-netbuf-setup new file +230 -0
230 lines not on this page · raw message
tools/libxl/libxl.c +7 -0
@@ -819,6 +819,13 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info,/* Convenience aliases */ libxl__remus_devices_state *const rds = &dss->rds; + +if (!libxl__netbuffer_enabled (gc)) { +LOG (ERROR ,"Remus: No support for network buffering" ); + goto out; + } + rds->device_kind_flags |= (1 <<LIBXL__DEVICE_KIND_REMUS_NIC ); + rds->ao = ao; rds->egc = egc; rds->domid = domid;
tools/libxl/libxl_internal.h +10 -0
@@ -2652,6 +2652,9 @@ struct libxl__remus_device_instance_ops {void (*teardown)(libxl__remus_device *dev); }; +int init_subkind_nic (libxl__remus_devices_state *rds); +void cleanup_subkind_nic (libxl__remus_devices_state *rds); +typedef void libxl__remus_callback (libxl__egc *,libxl__remus_devices_state *,int rc);
@@ -2687,6 +2690,13 @@ struct libxl__remus_devices_state {int num_disks;libxl__multidev multidev; + +/*----- private for concrete (device-specific) layer only -----*/ + +/* private for nic device subkind ops */ +char *netbufscript; +struct nl_sock *nlsock; +struct nl_cache *qdisc_cache; };/*
tools/libxl/libxl_netbuffer.c +481 -0
492 lines not on this page · raw message
tools/libxl/libxl_nonetbuffer.c +23 -0
@@ -22,6 +22,29 @@ int libxl__netbuffer_enabled(libxl__gc *gc)return 0 ; } +int init_subkind_nic (libxl__remus_devices_state *rds) +{ +return 0 ; +} + +void cleanup_subkind_nic (libxl__remus_devices_state *rds) +{ +return ; +} + +static void nic_setup (libxl__remus_device *dev) +{ +STATE_AO_GC (dev->rds->ao); + + dev->aodev.rc =ERROR_FAIL ; + dev->aodev.callback (dev->rds->egc, &dev->aodev); +} + +const libxl__remus_device_instance_ops remus_device_nic = { + .kind =LIBXL__DEVICE_KIND_REMUS_NIC , + .setup = nic_setup, +}; +/* * Local variables: * mode: C
tools/libxl/libxl_remus_device.c +17 -1
@@ -17,7 +17,9 @@#include "libxl_internal.h" +extern const libxl__remus_device_instance_ops remus_device_nic;static const libxl__remus_device_instance_ops *remus_ops[] = { + &remus_device_nic,NULL , };
@@ -26,12 +28,26 @@ static const libxl__remus_device_instance_ops *remus_ops[] = {static int init_device_subkind (libxl__remus_devices_state *rds) {/* init device subkind-specific state in the libxl ctx */ -return 0 ; +int rc; +STATE_AO_GC (rds->ao); + +if (libxl__netbuffer_enabled (gc)) { + rc =init_subkind_nic (rds); +if (rc) goto out; + } + + rc =0 ; +out: +return rc; }static void cleanup_device_subkind (libxl__remus_devices_state *rds) {/* cleanup device subkind-specific state in the libxl ctx */ +STATE_AO_GC (rds->ao); + +if (libxl__netbuffer_enabled (gc)) +cleanup_subkind_nic (rds); }/*----- setup() and teardown() -----*/
Signature · 1 line
1.9.1
PATCH v20 6/12 libxl/remus: setup and control disk replication for DRBD backends
In reply to Yang HongyangThis patch adds the machinery required for protecting a guest's disk state, when the guest disk uses a DRBD disk backend. This patch comprises of two parts:
1. Hotplug scripts: The block-drbd-probe script is responsible for performing sanity checks on the state of the DRBD disk before the checkpointing process begins. This script should be invoked by libxl for each of the guest's disk devices, when starting Remus.
2. Remus drbd disk device: Implements the interfaces required by the remus abstract device layer. A note about the implementation:
a) setup() is called for each disk attached to the guest. During setup():
i) The hotplug script is called to perform the sanity check.
ii) Libxl obtains a handle to the DRBD device (/dev/drbd*) and
and subsequently controls disk checkpoint replication using this handle in the checkpoint callbacks.
c) The preresume() checkpoint callback is executed asynchronously using libxl__ev_child_fork(), as it may potentially block for more than few seconds in case of backup failure.
Edits to commit message:
--- docs/README.remus | 10 ++ tools/hotplug/Linux/Makefile | 1 + tools/hotplug/Linux/block-drbd-probe | 87 ++++++++++++ tools/libxl/Makefile | 2 +- tools/libxl/libxl.c | 1 + tools/libxl/libxl_internal.h | 5 + tools/libxl/libxl_remus_device.c | 7 + tools/libxl/libxl_remus_disk_drbd.c | 257 +++++++++++++++++++++++++++++++++++ 8 files changed, 369 insertions(+), 1 deletion(-) create mode 100755 tools/hotplug/Linux/block-drbd-probe create mode 100644 tools/libxl/libxl_remus_disk_drbd.c
docs/README.remus +10 -0
@@ -8,3 +8,13 @@ Using Remus with libxl on Xen 4.5 and higher: or higher along with the development headers and command line utilities. If your distro does not have the appropriate libnl3 version, you can find the latest source tarball of libnl3 at http://www.carisma.slowglass.com/~tgr/libnl/ + +Disk replication: + VMs protected by Remus need to use DRBD based disk backends. Specifically, you + need a compile and install a custom version of DRBD, that is available publicly + at https://github.com/rshriram/remus-drbd + This code is based on DRBD 8.3.11 and uses a new replication protocol (named + protocol D) for asynchronous disk checkpoint replication. A protected VM's DRBD + disks on the primary and backup hosts need to be configured to use protocol D + as the replication protocol. An example resource configuration file can be found + in the aforementioned github repository.
tools/hotplug/Linux/Makefile +1 -0
@@ -24,6 +24,7 @@ XEN_SCRIPTS += xen-hotplug-cleanup XEN_SCRIPTS += external-device-migrate XEN_SCRIPTS += vscsi XEN_SCRIPTS += block-iscsi +XEN_SCRIPTS += block-drbd-probe XEN_SCRIPTS += $(XEN_SCRIPTS-y) SUBDIRS-$(CONFIG_SYSTEMD) += systemd
tools/hotplug/Linux/block-drbd-probe new file +87 -0
87 lines not on this page · raw message
tools/libxl/Makefile +1 -1
@@ -56,7 +56,7 @@ else LIBXL_OBJS-y += libxl_nonetbuffer.o endif -LIBXL_OBJS-y += libxl_remus_device.o +LIBXL_OBJS-y += libxl_remus_device.o libxl_remus_disk_drbd.o LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_arm.o
tools/libxl/libxl.c +1 -0
@@ -825,6 +825,7 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, goto out; } rds->device_kind_flags |= (1 <<LIBXL__DEVICE_KIND_REMUS_NIC ); + rds->device_kind_flags |= (1 <<LIBXL__DEVICE_KIND_REMUS_DISK ); rds->ao = ao; rds->egc = egc;
tools/libxl/libxl_internal.h +5 -0
@@ -2654,6 +2654,8 @@ struct libxl__remus_device_instance_ops {int init_subkind_nic (libxl__remus_devices_state *rds);void cleanup_subkind_nic (libxl__remus_devices_state *rds); +int init_subkind_drbd_disk (libxl__remus_devices_state *rds); +void cleanup_subkind_drbd_disk (libxl__remus_devices_state *rds);typedef void libxl__remus_callback (libxl__egc *,libxl__remus_devices_state *,int rc);
@@ -2697,6 +2699,9 @@ struct libxl__remus_devices_state {char *netbufscript;struct nl_sock *nlsock;struct nl_cache *qdisc_cache; + +/* private for drbd disk subkind ops */ +char *drbd_probe_script; };/*
tools/libxl/libxl_remus_device.c +7 -0
@@ -18,8 +18,10 @@#include "libxl_internal.h" extern const libxl__remus_device_instance_ops remus_device_nic; +extern const libxl__remus_device_instance_ops remus_device_drbd_disk;static const libxl__remus_device_instance_ops *remus_ops[] = { &remus_device_nic, + &remus_device_drbd_disk,NULL , };
@@ -36,6 +38,9 @@ static int init_device_subkind(libxl__remus_devices_state *rds)if (rc) goto out; } + rc =init_subkind_drbd_disk (rds); +if (rc) goto out; + rc =0 ; out:return rc;
@@ -48,6 +53,8 @@ static void cleanup_device_subkind(libxl__remus_devices_state *rds)if (libxl__netbuffer_enabled (gc))cleanup_subkind_nic (rds); + +cleanup_subkind_drbd_disk (rds); }/*----- setup() and teardown() -----*/
tools/libxl/libxl_remus_disk_drbd.c new file +257 -0
257 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v20 7/12 xl/remus: change bool to defbool
In reply to Yang HongyangUse defbool instead of bool for boolean flags in remus_info struct.
--- tools/libxl/libxl.c | 3 +++ tools/libxl/libxl_dom.c | 2 +- tools/libxl/libxl_types.idl | 4 ++-- tools/libxl/xl_cmdimpl.c | 9 ++++----- 4 files changed, 10 insertions(+), 8 deletions(-)
tools/libxl/libxl.c +3 -0
@@ -804,6 +804,9 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, goto out; } +libxl_defbool_setdefault (&info->blackhole, false); +libxl_defbool_setdefault (&info->compression, true); +GCNEW (dss); dss->ao = ao; dss->callback = remus_failover_cb;
tools/libxl/libxl_dom.c +1 -1
@@ -1809,7 +1809,7 @@ void libxl__domain_suspend(libxl__egc *egc, libxl__domain_suspend_state *dss)if (r_info !=NULL ) { dss->interval = r_info->interval; -if (r_info->compression) +if (libxl_defbool_val (r_info->compression)) dss->xcflags |=XCFLAGS_CHECKPOINT_COMPRESS ; }
tools/libxl/libxl_types.idl +2 -2
@@ -611,8 +611,8 @@ libxl_sched_credit_params = Struct("sched_credit_params", [ libxl_domain_remus_info = Struct("domain_remus_info",[ ("interval", integer), - ("blackhole", bool), - ("compression", bool), + ("blackhole", libxl_defbool), + ("compression", libxl_defbool), ]) libxl_event_type = Enumeration("event_type", [
tools/libxl/xl_cmdimpl.c +4 -5
@@ -7495,18 +7495,17 @@ int main_remus(int argc, char **argv)memset (&r_info,0 ,sizeof (libxl_domain_remus_info));/* Defaults */ r_info.interval =200 ; - r_info.blackhole =0 ; - r_info.compression =1 ; +libxl_defbool_setdefault (&r_info.blackhole, false); SWITCH_FOREACH_OPT(opt, "bui:s:e", NULL, "remus", 2) {case 'i' : r_info.interval =atoi (optarg);break ;case 'b' : - r_info.blackhole =1 ; +libxl_defbool_set (&r_info.blackhole, true);break ;case 'u' : - r_info.compression =0 ; +libxl_defbool_set (&r_info.compression, false);break ;case 's' : ssh_command = optarg;
@@ -7519,7 +7518,7 @@ int main_remus(int argc, char **argv) domid =find_domain (argv[optind]); host = argv[optind +1 ]; -if (r_info.blackhole) { +if (libxl_defbool_val (r_info.blackhole)) { send_fd =open ("/dev/null" ,O_RDWR ,0644 );if (send_fd <0 ) {perror ("failed to open /dev/null" );
Signature · 1 line
1.9.1
Re: [PATCH for-4.5 v20 07/12] xl/remus: change bool to defbool
Quoted 1 line · Yang Hongyang
Use defbool instead of bool for boolean flags in
remus_infostruct.
While that change by itself looks OK, the change in 'libxl_types.idl' break the ABI.
Could you say a bit of why that is OK? As in, would there had been in the past any users of this ABI that now would have issues with this?
Also, how important is this patch? Does it have to go in or can it be dropped from the patchset?
Quoted 94 lines
Signed-off-by Yang Hongyang <[email protected]>--- tools/libxl/libxl.c | 3 +++ tools/libxl/libxl_dom.c | 2 +- tools/libxl/libxl_types.idl | 4 ++-- tools/libxl/xl_cmdimpl.c | 9 ++++----- 4 files changed, 10 insertions(+), 8 deletions(-)tools/libxl/libxl.c +3
-0@@ -804,6 +804,9 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, goto out; } +libxl_defbool_setdefault (&info->blackhole, false); +libxl_defbool_setdefault (&info->compression, true); +GCNEW (dss); dss->ao = ao; dss->callback = remus_failover_cb;tools/libxl/libxl_dom.c +1
-1@@ -1809,7 +1809,7 @@ void libxl__domain_suspend(libxl__egc *egc, libxl__domain_suspend_state *dss)if (r_info !=NULL ) { dss->interval = r_info->interval; -if (r_info->compression) +if (libxl_defbool_val (r_info->compression)) dss->xcflags |=XCFLAGS_CHECKPOINT_COMPRESS ; }tools/libxl/libxl_types.idl +2
-2@@ -611,8 +611,8 @@ libxl_sched_credit_params = Struct("sched_credit_params", [ libxl_domain_remus_info = Struct("domain_remus_info",[ ("interval", integer), - ("blackhole", bool), - ("compression", bool), + ("blackhole", libxl_defbool), + ("compression", libxl_defbool), ]) libxl_event_type = Enumeration("event_type", [tools/libxl/xl_cmdimpl.c +4
-5@@ -7495,18 +7495,17 @@ int main_remus(int argc, char **argv)memset (&r_info,0 ,sizeof (libxl_domain_remus_info));/* Defaults */ r_info.interval =200 ; - r_info.blackhole =0 ; - r_info.compression =1 ; +libxl_defbool_setdefault (&r_info.blackhole, false); SWITCH_FOREACH_OPT(opt, "bui:s:e", NULL, "remus", 2) {case 'i' : r_info.interval =atoi (optarg);break ;case 'b' : - r_info.blackhole =1 ; +libxl_defbool_set (&r_info.blackhole, true);break ;case 'u' : - r_info.compression =0 ; +libxl_defbool_set (&r_info.compression, false);break ;case 's' : ssh_command = optarg;@@ -7519,7 +7518,7 @@ int main_remus(int argc, char **argv) domid =find_domain (argv[optind]); host = argv[optind +1 ]; -if (r_info.blackhole) { +if (libxl_defbool_val (r_info.blackhole)) { send_fd =open ("/dev/null" ,O_RDWR ,0644 );if (send_fd <0 ) {perror ("failed to open /dev/null" );Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH for-4.5 v20 07/12] xl/remus: change bool to defbool
Quoted 9 lines · Konrad Rzeszutek Wilk
Quoted 1 line · Yang Hongyang
Use defbool instead of bool for boolean flags in
remus_infostruct.While that change by itself looks OK, the change in 'libxl_types.idl' break the ABI.
Could you say a bit of why that is OK? As in, would there had been in the past any users of this ABI that now would have issues with
this?
Quoted 1 line
There were no users of the libxl Remus api in the past. Certainly not an API level user like libvirt.
Quoted 3 lines
Also, how important is this patch? Does it have to go in or can it be dropped from the patchset?
Well, this defbool thing came up as part of the feedback. Dropping this may be of little consequence but there are new additions to the libxl Remus struct (enable or disable net/disk buffer), that will break compatibility. But we can't drop these patches.
Quoted 1 line
Quoted 1 line
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH for-4.5 v20 07/12] xl/remus: change bool to defbool
Shriram Rajagopalan writes ("Re: [Xen-devel] [PATCH for-4.5 v20 07/12] xl/remus: change bool to defbool"):
Quoted 7 lines
Quoted 5 lines · Konrad Rzeszutek Wilk
Quoted 1 line · Yang Hongyang
Use defbool instead of bool for boolean flags in
remus_infostruct.While that change by itself looks OK, the change in 'libxl_types.idl' break the ABI.
(We don't provide ABI stability in libxl (across Xen releases), only API stability. However, this change does break the API too:)
Quoted 5 lines
Quoted 2 lines
Could you say a bit of why that is OK? As in, would there had been in the past any users of this ABI that now would have issues with this?
There were no users of the libxl Remus api in the past. Certainly not an API level user like libvirt.
This is IMO a good answer. As I said earlier, the libxl Remus API in previous version does not really work properly so it seems unlikely that this change will break any uses.
Quoted 4 lines
Quoted 2 lines
Also, how important is this patch? Does it have to go in or can it be dropped from the patchset?
Well, this defbool thing came up as part of the feedback.
Ian C and I think that this variable should be a defbool. That it wasn't, beforehand, was a mistake. We have an opportinity to fix that now, but we won't after 4.5 if we release working libxl Remus support in 4.5 (as we intend.)
Thanks,
Ian.
Re: [PATCH for-4.5 v20 07/12] xl/remus: change bool to defbool
Quoted 25 lines · Ian Jackson
Shriram Rajagopalan writes ("Re: [Xen-devel] [PATCH for-4.5 v20 07/12] xl/remus: change bool to defbool"):
Quoted 7 lines
Quoted 5 lines · Konrad Rzeszutek Wilk
Quoted 1 line · Yang Hongyang
Use defbool instead of bool for boolean flags in
remus_infostruct.While that change by itself looks OK, the change in 'libxl_types.idl' break the ABI.
(We don't provide ABI stability in libxl (across Xen releases), only API stability. However, this change does break the API too:)
Quoted 5 lines
Quoted 2 lines
Could you say a bit of why that is OK? As in, would there had been in the past any users of this ABI that now would have issues with this?
There were no users of the libxl Remus api in the past. Certainly not an API level user like libvirt.
This is IMO a good answer. As I said earlier, the libxl Remus API in previous version does not really work properly so it seems unlikely that this change will break any uses.
Quoted 3 lines
Quoted 2 lines
Also, how important is this patch? Does it have to go in or can it be dropped from the patchset?
Quoted 6 lines
Quoted 1 line
Well, this defbool thing came up as part of the feedback.
Ian C and I think that this variable should be a defbool. That it wasn't, beforehand, was a mistake. We have an opportinity to fix that now, but we won't after 4.5 if we release working libxl Remus support in 4.5 (as we intend.)
OK, defbool it is. Thank you for clearing that up.
PATCH v20 8/12 xl/remus: cmdline switch to explicitly enable unsafe configurations
In reply to Yang HongyangBy default, network buffering and disk replication are enabled; checkpoints are replicated to another standby VM.
This patch allows the user to disable any of these features by explicitly specifying a 'run in unsafe mode' switch when invoking the 'xl remus' command. While running Remus in an unsafe mode makes little sense under normal circumstances, it is useful to be able to disable one or more features mentioned above for testing/debugging/profiling purposes.
Unless this option is enabled, it will not be possible to replicate memory checkpoints to /dev/null (blackhole replication), disable network buffering or disk replication.
As a starter, the use of blackhole replication now requires that the unsafe mode be enabled. Subsequent patches will add support for disabling network buffering and disk replication in a similar manner.
--- docs/man/xl.pod.1 | 15 ++++++++++----- tools/libxl/libxl.c | 7 +++++++ tools/libxl/libxl_types.idl | 1 + tools/libxl/xl_cmdimpl.c | 5 ++++- tools/libxl/xl_cmdtable.c | 7 +++++-- 5 files changed, 27 insertions(+), 8 deletions(-)
docs/man/xl.pod.1 +10 -5
@@ -446,11 +446,6 @@ B<OPTIONS> Checkpoint domain memory every MS milliseconds (default 200ms). -=item B<-b> - -Replicate memory checkpoints to /dev/null (blackhole). -Generally useful for debugging. - =item B<-u> Disable memory checkpoint compression.
@@ -465,6 +460,16 @@ If empty, run <host> instead of ssh <host> xl migrate-receive -r [-e]. On the new host, do not wait in the background (on <host>) for the death of the domain. See the corresponding option of the I<create> subcommand. +=item B<-F> + +Run Remus in unsafe mode. Use this option with caution as failover may +not work as intended. + +=item B<-b> + +Replicate memory checkpoints to /dev/null (blackhole). +Generally useful for debugging. Requires enabling unsafe mode. + =back =item B<pause> I<domain-id>
tools/libxl/libxl.c +7 -0
@@ -804,9 +804,16 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, goto out; } +libxl_defbool_setdefault (&info->unsafe, false);libxl_defbool_setdefault (&info->blackhole, false);libxl_defbool_setdefault (&info->compression, true); +if (!libxl_defbool_val (info->unsafe) && +libxl_defbool_val (info->blackhole)) { +LOG (ERROR ,"Unsafe mode must be enabled to replicate to /dev/null" ); + goto out; + } +GCNEW (dss); dss->ao = ao; dss->callback = remus_failover_cb;
tools/libxl/libxl_types.idl +1 -0
@@ -611,6 +611,7 @@ libxl_sched_credit_params = Struct("sched_credit_params", [ libxl_domain_remus_info = Struct("domain_remus_info",[ ("interval", integer), + ("unsafe", libxl_defbool), ("blackhole", libxl_defbool), ("compression", libxl_defbool), ])
tools/libxl/xl_cmdimpl.c +4 -1
@@ -7497,10 +7497,13 @@ int main_remus(int argc, char **argv) r_info.interval =200 ;libxl_defbool_setdefault (&r_info.blackhole, false); - SWITCH_FOREACH_OPT(opt, "bui:s:e", NULL, "remus", 2) { + SWITCH_FOREACH_OPT(opt, "Fbui:s:e", NULL, "remus", 2) {case 'i' : r_info.interval =atoi (optarg);break ; +case 'F' : +libxl_defbool_set (&r_info.unsafe, true); +break ;case 'b' :libxl_defbool_set (&r_info.blackhole, true);break ;
tools/libxl/xl_cmdtable.c +5 -2
@@ -495,13 +495,16 @@ struct cmd_spec cmd_table[] = { "Enable Remus HA for domain", "[options] <Domain> [<host>]", "-i MS Checkpoint domain memory every MS milliseconds (def. 200ms).\n" - "-b Replicate memory checkpoints to /dev/null (blackhole)\n" "-u Disable memory checkpoint compression.\n" "-s <sshcommand> Use <sshcommand> instead of ssh. String will be passed\n" " to sh. If empty, run <host> instead of \n" " ssh <host> xl migrate-receive -r [-e]\n" "-e Do not wait in the background (on <host>) for the death\n" - " of the domain." + " of the domain.\n" + "-F Enable unsafe configurations [-b flags]. Use this option\n" + " with caution as failover may not work as intended.\n" + "-b Replicate memory checkpoints to /dev/null (blackhole).\n" + " Works only in unsafe mode." }, #endif { "devd",
Signature · 1 line
1.9.1
Re: [PATCH for-4.5 v20 08/12] xl/remus: cmdline switch to explicitly enable unsafe configurations
Quoted 14 lines · Yang Hongyang
By default, network buffering and disk replication are enabled; checkpoints are replicated to another standby VM.
This patch allows the user to disable any of these features by explicitly specifying a 'run in unsafe mode' switch when invoking the 'xl remus' command. While running Remus in an unsafe mode makes little sense under normal circumstances, it is useful to be able to disable one or more features mentioned above for testing/debugging/profiling purposes.
Unless this option is enabled, it will not be possible to replicate memory checkpoints to
/dev/null(blackhole replication), disable network buffering or disk replication.
Quoted 7 lines
As a starter, the use of blackhole replication now requires that the unsafe mode be enabled. Subsequent patches will add support for disabling network buffering and disk replication in a similar manner.
Signed-off-by Yang Hongyang <[email protected]>Signed-off-by Shriram Rajagopalan <[email protected]>
Quoted 124 lines
--- docs/man/xl.pod.1 | 15 ++++++++++----- tools/libxl/libxl.c | 7 +++++++ tools/libxl/libxl_types.idl | 1 + tools/libxl/xl_cmdimpl.c | 5 ++++- tools/libxl/xl_cmdtable.c | 7 +++++-- 5 files changed, 27 insertions(+), 8 deletions(-)docs/man/xl.pod.1 +10
-5@@ -446,11 +446,6 @@ B<OPTIONS> Checkpoint domain memory every MS milliseconds (default 200ms). -=item B<-b> - -Replicate memory checkpoints to /dev/null (blackhole). -Generally useful for debugging. - =item B<-u> Disable memory checkpoint compression.@@ -465,6 +460,16 @@ If empty, run <host> instead of ssh <host> xl migrate-receive -r [-e]. On the new host, do not wait in the background (on <host>) for the death of the domain. See the corresponding option of the I<create> subcommand. +=item B<-F> + +Run Remus in unsafe mode. Use this option with caution as failover may +not work as intended. + +=item B<-b> + +Replicate memory checkpoints to /dev/null (blackhole). +Generally useful for debugging. Requires enabling unsafe mode. + =back =item B<pause> I<domain-id>tools/libxl/libxl.c +7
-0@@ -804,9 +804,16 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, goto out; } +libxl_defbool_setdefault (&info->unsafe, false);libxl_defbool_setdefault (&info->blackhole, false);libxl_defbool_setdefault (&info->compression, true); +if (!libxl_defbool_val (info->unsafe) && +libxl_defbool_val (info->blackhole)) { +LOG (ERROR ,"Unsafe mode must be enabled to replicate to /dev/null" ); + goto out; + } +GCNEW (dss); dss->ao = ao; dss->callback = remus_failover_cb;tools/libxl/libxl_types.idl +1
-0@@ -611,6 +611,7 @@ libxl_sched_credit_params = Struct("sched_credit_params", [ libxl_domain_remus_info = Struct("domain_remus_info",[ ("interval", integer), + ("unsafe", libxl_defbool), ("blackhole", libxl_defbool), ("compression", libxl_defbool), ])tools/libxl/xl_cmdimpl.c +4
-1@@ -7497,10 +7497,13 @@ int main_remus(int argc, char **argv) r_info.interval =200 ;libxl_defbool_setdefault (&r_info.blackhole, false); - SWITCH_FOREACH_OPT(opt, "bui:s:e", NULL, "remus", 2) { + SWITCH_FOREACH_OPT(opt, "Fbui:s:e", NULL, "remus", 2) {case 'i' : r_info.interval =atoi (optarg);break ; +case 'F' : +libxl_defbool_set (&r_info.unsafe, true); +break ;case 'b' :libxl_defbool_set (&r_info.blackhole, true);break ;tools/libxl/xl_cmdtable.c +5
-2@@ -495,13 +495,16 @@ struct cmd_spec cmd_table[] = { "Enable Remus HA for domain", "[options] <Domain> [<host>]", "-i MS Checkpoint domain memory every MS milliseconds (def. 200ms).\n" - "-b Replicate memory checkpoints to /dev/null (blackhole)\n" "-u Disable memory checkpoint compression.\n" "-s <sshcommand> Use <sshcommand> instead of ssh. String will be passed\n" " to sh. If empty, run <host> instead of \n" " ssh <host> xl migrate-receive -r [-e]\n" "-e Do not wait in the background (on <host>) for the death\n" - " of the domain." + " of the domain.\n" + "-F Enable unsafe configurations [-b flags]. Use this option\n" + " with caution as failover may not work as intended.\n" + "-b Replicate memory checkpoints to /dev/null (blackhole).\n" + " Works only in unsafe mode." }, #endif { "devd",Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v20 9/12 xl/remus: cmdline switches and config vars to control network buffering
In reply to Yang HongyangAdd two members in libxl_domain_remus_info:
netbuf: whether netbuf is enabled
netbufscript: the path of the script which will be run to setup
and tear down the guest's interface.
Add cmdline switches to 'xl remus' command to enable or disable network buffering and a domain-specific hotplug script to setup network buffering.
Add a new config var 'remus.default.netbufscript' to xl.conf, that allows the user to override the default global script used to setup network buffering.
Note: Network buffering is enabled by default. Disabling network buffering requires enabling unsafe mode.
--- docs/man/xl.conf.pod.5 | 6 ++++++ docs/man/xl.pod.1 | 11 ++++++++++- tools/libxl/libxl.c | 18 ++++++++++++------ tools/libxl/libxl_netbuffer.c | 9 +++++++-- tools/libxl/libxl_types.idl | 2 ++ tools/libxl/xl.c | 4 ++++ tools/libxl/xl.h | 1 + tools/libxl/xl_cmdimpl.c | 27 +++++++++++++++++++++------ tools/libxl/xl_cmdtable.c | 7 +++++-- 9 files changed, 68 insertions(+), 17 deletions(-)
docs/man/xl.conf.pod.5 +6 -0
@@ -105,6 +105,12 @@ Configures the default gateway device to set for virtual network devices. Default: C<None> +=item B<remus.default.netbufscript="PATH"> + +Configures the default script used by Remus to setup network buffering. + +Default: C</etc/xen/scripts/remus-netbuf-setup> + =item B<output_format="json|sxp"> Configures the default output format used by xl when printing "machine
docs/man/xl.pod.1 +10 -1
@@ -436,7 +436,7 @@ Enable Remus HA for domain. By default B<xl> relies on ssh as a transport mechanism between the two hosts. N.B: Remus support in xl is still in experimental (proof-of-concept) phase. - There is no support for network or disk buffering at the moment. + There is no support for disk buffering at the moment. B<OPTIONS>
@@ -460,6 +460,11 @@ If empty, run <host> instead of ssh <host> xl migrate-receive -r [-e]. On the new host, do not wait in the background (on <host>) for the death of the domain. See the corresponding option of the I<create> subcommand. +=item B<-N> I<netbufscript> + +Use <netbufscript> to setup network buffering instead of the +default script (/etc/xen/scripts/remus-netbuf-setup). + =item B<-F> Run Remus in unsafe mode. Use this option with caution as failover may
@@ -470,6 +475,10 @@ not work as intended. Replicate memory checkpoints to /dev/null (blackhole). Generally useful for debugging. Requires enabling unsafe mode. +=item B<-n> + +Disable network output buffering. Requires enabling unsafe mode. + =back =item B<pause> I<domain-id>
tools/libxl/libxl.c +12 -6
@@ -807,13 +807,17 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info,libxl_defbool_setdefault (&info->unsafe, false);libxl_defbool_setdefault (&info->blackhole, false);libxl_defbool_setdefault (&info->compression, true); +libxl_defbool_setdefault (&info->netbuf, true);if (!libxl_defbool_val (info->unsafe) && -libxl_defbool_val (info->blackhole)) { -LOG (ERROR ,"Unsafe mode must be enabled to replicate to /dev/null" ); + (libxl_defbool_val (info->blackhole) || + !libxl_defbool_val (info->netbuf))) { +LOG (ERROR ,"Unsafe mode must be enabled to replicate to /dev/null and " +"disable network buffering" ); goto out; } +GCNEW (dss); dss->ao = ao; dss->callback = remus_failover_cb;
@@ -830,11 +834,13 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info,/* Convenience aliases */ libxl__remus_devices_state *const rds = &dss->rds; -if (!libxl__netbuffer_enabled (gc)) { -LOG (ERROR ,"Remus: No support for network buffering" ); - goto out; +if (libxl_defbool_val (info->netbuf)) { +if (!libxl__netbuffer_enabled (gc)) { +LOG (ERROR ,"Remus: No support for network buffering" ); + goto out; + } + rds->device_kind_flags |= (1 <<LIBXL__DEVICE_KIND_REMUS_NIC ); } - rds->device_kind_flags |= (1 <<LIBXL__DEVICE_KIND_REMUS_NIC ); rds->device_kind_flags |= (1 <<LIBXL__DEVICE_KIND_REMUS_DISK ); rds->ao = ao;
tools/libxl/libxl_netbuffer.c +7 -2
@@ -41,6 +41,7 @@ int libxl__netbuffer_enabled(libxl__gc *gc)int init_subkind_nic (libxl__remus_devices_state *rds) {int rc, ret; +libxl__domain_suspend_state *dss =CONTAINER_OF (rds, *dss, rds);STATE_AO_GC (rds->ao);
@@ -68,8 +69,12 @@ int init_subkind_nic(libxl__remus_devices_state *rds) goto out; } - rds->netbufscript =GCSPRINTF ("%s/remus-netbuf-setup" , -libxl__xen_script_dir_path ()); +if (dss->remus->netbufscript) { + rds->netbufscript =libxl__strdup (gc, dss->remus->netbufscript); + }else { + rds->netbufscript =GCSPRINTF ("%s/remus-netbuf-setup" , +libxl__xen_script_dir_path ()); + } rc =0 ;
tools/libxl/libxl_types.idl +2 -0
@@ -614,6 +614,8 @@ libxl_domain_remus_info = Struct("domain_remus_info",[ ("unsafe", libxl_defbool), ("blackhole", libxl_defbool), ("compression", libxl_defbool), + ("netbuf", libxl_defbool), + ("netbufscript", string), ]) libxl_event_type = Enumeration("event_type", [
tools/libxl/xl.c +4 -0
@@ -44,6 +44,7 @@ char *default_vifscript = NULL;char *default_bridge =NULL ;char *default_gatewaydev =NULL ;char *default_vifbackend =NULL ; +char *default_remus_netbufscript =NULL ;enum output_format default_output_format =OUTPUT_FORMAT_JSON ;int claim_mode =1 ;bool progress_use_cr =0 ;
@@ -176,6 +177,9 @@ static void parse_global_config(const char *configfile,if (!xlu_cfg_get_long (config,"claim_mode" , &l,0 )) claim_mode = l; +xlu_cfg_replace_string (config,"remus.default.netbufscript" , + &default_remus_netbufscript,0 ); +xlu_cfg_destroy (config); }
tools/libxl/xl.h +1 -0
@@ -171,6 +171,7 @@ extern char *default_vifscript;extern char *default_bridge;extern char *default_gatewaydev;extern char *default_vifbackend; +extern char *default_remus_netbufscript;extern char *blkdev_start;enum output_format {
tools/libxl/xl_cmdimpl.c +21 -6
@@ -7497,7 +7497,7 @@ int main_remus(int argc, char **argv) r_info.interval =200 ;libxl_defbool_setdefault (&r_info.blackhole, false); - SWITCH_FOREACH_OPT(opt, "Fbui:s:e", NULL, "remus", 2) { + SWITCH_FOREACH_OPT(opt, "Fbuni:s:N:e", NULL, "remus", 2) {case 'i' : r_info.interval =atoi (optarg);break ;
@@ -7510,6 +7510,12 @@ int main_remus(int argc, char **argv)case 'u' :libxl_defbool_set (&r_info.compression, false);break ; +case 'n' : +libxl_defbool_set (&r_info.netbuf, false); +break ; +case 'N' : + r_info.netbufscript = optarg; +break ;case 's' : ssh_command = optarg;break ;
@@ -7521,6 +7527,9 @@ int main_remus(int argc, char **argv) domid =find_domain (argv[optind]); host = argv[optind +1 ]; +if (!r_info.netbufscript) + r_info.netbufscript = default_remus_netbufscript; +if (libxl_defbool_val (r_info.blackhole)) { send_fd =open ("/dev/null" ,O_RDWR ,0644 );if (send_fd <0 ) {
@@ -7558,13 +7567,19 @@ int main_remus(int argc, char **argv)/* Point of no return */ rc =libxl_domain_remus_start (ctx, &r_info, domid, send_fd, recv_fd,0 ); -/* If we are here, it means backup has failed/domain suspend failed. -* Try to resume the domain and exit gracefully. -* TODO: Split-Brain check. +/* check if the domain exists. User may have xl destroyed the +* domain to force failover */ -fprintf (stderr,"remus sender: libxl_domain_suspend failed" -" (rc=%d)\n" , rc); +if (libxl_domain_info (ctx,0 , domid)) { +fprintf (stderr,"Remus: Primary domain has been destroyed.\n" ); +close (send_fd); +return 0 ; + } +/* If we are here, it means remus setup/domain suspend/backup has +* failed. Try to resume the domain and exit gracefully. +* TODO: Split-Brain check. +*/ if (rc ==ERROR_GUEST_TIMEDOUT )fprintf (stderr,"Failed to suspend domain at primary.\n" );else {
tools/libxl/xl_cmdtable.c +5 -2
@@ -501,10 +501,13 @@ struct cmd_spec cmd_table[] = { " ssh <host> xl migrate-receive -r [-e]\n" "-e Do not wait in the background (on <host>) for the death\n" " of the domain.\n" - "-F Enable unsafe configurations [-b flags]. Use this option\n" + "-N <netbufscript> Use netbufscript to setup network buffering instead of the\n" + " default script (/etc/xen/scripts/remus-netbuf-setup).\n" + "-F Enable unsafe configurations [-b|-n flags]. Use this option\n" " with caution as failover may not work as intended.\n" "-b Replicate memory checkpoints to /dev/null (blackhole).\n" - " Works only in unsafe mode." + " Works only in unsafe mode.\n" + "-n Disable network output buffering. Works only in unsafe mode." }, #endif { "devd",
Signature · 1 line
1.9.1
PATCH v20 10/12 xl/remus: add a cmdline switch to disable disk replication
In reply to Yang HongyangDisk replication is enabled by default. This patch adds a cmdline switch to 'xl remus' command to explicitly disable disk replication. A new boolean field 'diskbuf' is added to the libxl_domain_remus_info structure to represent this configuration option inside libxl.
Note: Disabling disk replication requires enabling unsafe mode.
--- docs/man/xl.pod.1 | 6 +++++- tools/libxl/libxl.c | 12 ++++++++---- tools/libxl/libxl_types.idl | 1 + tools/libxl/xl_cmdimpl.c | 5 ++++- tools/libxl/xl_cmdtable.c | 5 +++-- 5 files changed, 21 insertions(+), 8 deletions(-)
docs/man/xl.pod.1 +5 -1
@@ -436,7 +436,7 @@ Enable Remus HA for domain. By default B<xl> relies on ssh as a transport mechanism between the two hosts. N.B: Remus support in xl is still in experimental (proof-of-concept) phase. - There is no support for disk buffering at the moment. + Disk replication support is limited to DRBD disks. B<OPTIONS>
@@ -479,6 +479,10 @@ Generally useful for debugging. Requires enabling unsafe mode. Disable network output buffering. Requires enabling unsafe mode. +=item B<-d> + +Disable disk replication. Requires enabling unsafe mode. + =back =item B<pause> I<domain-id>
tools/libxl/libxl.c +8 -4
@@ -808,12 +808,14 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info,libxl_defbool_setdefault (&info->blackhole, false);libxl_defbool_setdefault (&info->compression, true);libxl_defbool_setdefault (&info->netbuf, true); +libxl_defbool_setdefault (&info->diskbuf, true);if (!libxl_defbool_val (info->unsafe) && (libxl_defbool_val (info->blackhole) || - !libxl_defbool_val (info->netbuf))) { -LOG (ERROR ,"Unsafe mode must be enabled to replicate to /dev/null and " -"disable network buffering" ); + !libxl_defbool_val (info->netbuf) || + !libxl_defbool_val (info->diskbuf))) { +LOG (ERROR ,"Unsafe mode must be enabled to replicate to /dev/null," +"disable network buffering and disk replication" ); goto out; }
@@ -841,7 +843,9 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, } rds->device_kind_flags |= (1 <<LIBXL__DEVICE_KIND_REMUS_NIC ); } - rds->device_kind_flags |= (1 <<LIBXL__DEVICE_KIND_REMUS_DISK ); + +if (libxl_defbool_val (info->diskbuf)) + rds->device_kind_flags |= (1 <<LIBXL__DEVICE_KIND_REMUS_DISK ); rds->ao = ao; rds->egc = egc;
tools/libxl/libxl_types.idl +1 -0
@@ -616,6 +616,7 @@ libxl_domain_remus_info = Struct("domain_remus_info",[ ("compression", libxl_defbool), ("netbuf", libxl_defbool), ("netbufscript", string), + ("diskbuf", libxl_defbool), ]) libxl_event_type = Enumeration("event_type", [
tools/libxl/xl_cmdimpl.c +4 -1
@@ -7497,7 +7497,7 @@ int main_remus(int argc, char **argv) r_info.interval =200 ;libxl_defbool_setdefault (&r_info.blackhole, false); - SWITCH_FOREACH_OPT(opt, "Fbuni:s:N:e", NULL, "remus", 2) { + SWITCH_FOREACH_OPT(opt, "Fbundi:s:N:e", NULL, "remus", 2) {case 'i' : r_info.interval =atoi (optarg);break ;
@@ -7516,6 +7516,9 @@ int main_remus(int argc, char **argv)case 'N' : r_info.netbufscript = optarg;break ; +case 'd' : +libxl_defbool_set (&r_info.diskbuf, false); +break ;case 's' : ssh_command = optarg;break ;
tools/libxl/xl_cmdtable.c +3 -2
@@ -503,11 +503,12 @@ struct cmd_spec cmd_table[] = { " of the domain.\n" "-N <netbufscript> Use netbufscript to setup network buffering instead of the\n" " default script (/etc/xen/scripts/remus-netbuf-setup).\n" - "-F Enable unsafe configurations [-b|-n flags]. Use this option\n" + "-F Enable unsafe configurations [-b|-n|-d flags]. Use this option\n" " with caution as failover may not work as intended.\n" "-b Replicate memory checkpoints to /dev/null (blackhole).\n" " Works only in unsafe mode.\n" - "-n Disable network output buffering. Works only in unsafe mode." + "-n Disable network output buffering. Works only in unsafe mode.\n" + "-d Disable disk replication. Works only in unsafe mode." }, #endif { "devd",
Signature · 1 line
1.9.1
PATCH v20 11/12 libxl/remus: add LIBXL_HAVE_REMUS to indicate Remus support in libxl
In reply to Yang HongyangAdd LIBXL_HAVE_REMUS to indicate Remus support in libxl
--- tools/libxl/libxl.h | 6 ++++++ 1 file changed, 6 insertions(+)
tools/libxl/libxl.h +6 -0
@@ -647,6 +647,12 @@ typedef struct libxl__ctx libxl_ctx;*/ #define LIBXL_HAVE_BUILDINFO_SERIAL_LIST 1 +/* +* LIBXL_HAVE_REMUS +* If this is defined, then libxl supports remus. +*/ +#define LIBXL_HAVE_REMUS 1 +typedef uint8_t libxl_mac [6 ];#define LIBXL_MAC_FMT "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"#define LIBXL_MAC_FMTLEN ((2*6)+5)/* 6 hex bytes plus 5 colons */
Signature · 1 line
1.9.1
PATCH v20 12/12 MAINTAINERS: update maintained files of Remus
In reply to Yang HongyangAdd Remus specific hotplug scripts and libxl files to the list of maintained files.
--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
@@ -260,8 +260,15 @@ M: Shriram Rajagopalan <[email protected]> M: Yang Hongyang <[email protected]> S: Maintained F: docs/README.remus +F: tools/libxc/xc_domain_save.c +F: tools/libxc/xc_domain_restore.c F: tools/blktap2/drivers/block-remus.c F: tools/blktap2/drivers/hashtable* +F: tools/libxl/libxl_remus_* +F: tools/libxl/libxl_netbuffer.c +F: tools/libxl/libxl_nonetbuffer.c +F: tools/hotplug/Linux/remus-netbuf-setup +F: tools/hotplug/Linux/block-drbd-probe SCHEDULING M: George Dunlap <[email protected]>
Signature · 1 line
1.9.1
Re: [PATCH for-4.5 v20 12/12] MAINTAINERS: update maintained files of Remus
Quoted 4 lines · Yang Hongyang
Add Remus specific hotplug scripts and libxl files to the list of maintained files.
Signed-off-by Yang Hongyang <[email protected]>
Quoted 32 lines
--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)MAINTAINERS +7
-0@@ -260,8 +260,15 @@ M: Shriram Rajagopalan <[email protected]> M: Yang Hongyang <[email protected]> S: Maintained F: docs/README.remus +F: tools/libxc/xc_domain_save.c +F: tools/libxc/xc_domain_restore.c F: tools/blktap2/drivers/block-remus.c F: tools/blktap2/drivers/hashtable* +F: tools/libxl/libxl_remus_* +F: tools/libxl/libxl_netbuffer.c +F: tools/libxl/libxl_nonetbuffer.c +F: tools/hotplug/Linux/remus-netbuf-setup +F: tools/hotplug/Linux/block-drbd-probe SCHEDULING M: George Dunlap <[email protected]>Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 5 lines · Yang Hongyang
This patch series adds support for network buffering and drbd disk in the Remus codebase in libxl.
the code is also hosted on github:
url: https://github.com/macrosheep/xen/tree/remus-v20
I only had one question in regards to patch:
[PATCH for-4.5 v20 07/12] xl/remus: change bool to defbool
Otherwise all the other patches that did not have an Review from me look good (and as such I have replied with 'Reviewed-by' on them).
All of those that had Ian's Ack on them, looked OK to me. I didn't respond 'Acked-by' on them as I figured I would do it here.
Regardless of the #7 question I believe the patches can
go in 4.5 and can have 'Acked-by: Konrad Rzeszutek Wilk <[email protected]>' on them.
Thank you!
Quoted 224 lines
Changes in v20:
Rebased.Changes in v19:
Use defbool for cmdline switch.
Restruct of subkind init and cleanup operation. Uselibxl__device_kindinstead oflibxl__remus_device_kindFix a layer violation issue pointed out by IanJ. Other minor fixes.
Rebased to the latest staging tree.Changes in v18:
Mergematch()andsetup()api.
Reuselibxl__multidevandlibxl__ao_device.
Commit messages and code comments improved. Thanks to Shriram. Rebased.Changes in v17:
Make remus device abstract layer more generic.
Addressed Ian J's comments.Changes in v16:
Mergelibxl__remus_stateandlibxl__remus_device_state.
Pass the ops to device abstract layer instead of defined it in the layer. Optimized subkind ops APIs.
Addressed Ian J's comments.
Rebased.Changes in v15:
The first patch in v14 has been taken, so remove it from the patchset. Add a patch to Update maintained files of REMUS.
Rebased.Changes in v14:
Addressed IanJ's comments.
Rebased.Changes in v13:
Addressed Konrad's comments.
Rebased.Changes in v12:
Add disk buffering cmdline switch.Changes in v11:
Addressed comments from Ian J and Shriram.
Add drbd disk implement into this patch series.Changes in V10:
Restructured the whole patch series.
Introduce the remus device abstract layer.
Make remus checkpoint asynchronous.Changes in V9:
Use async exec script api to exec scripts.Changes in V8:
Applied some comments(by IanJ).
Merge some struct definitions to it's implementation. (2/3/5 in V7 => 3 in V8)Changes in V7:
Applied missing comments(by IanJ).
Applied Shriram comments.merge netbufering tangled setup/teardown code into one patch. (2/6/8 in V6 => 5 in V7. 9/10 in V6 => 7 in V7)
Changes in V6:
Applied Ian Jackson's comments of V5 series. the [PATCH 2/4 V5] is split by small functionalities.[PATCH 4/4 V5] --> [PATCH 13/13] netbuffer is default enabled.
Changes in V5:
Merge hotplug script patch (2/5) and hotplug script setup/teardown patch (3/5) into a single patch.
Changes in V4:
[1/5] Remove check for libnl command line utils in autoconf checks
[2/5] minor nits
[3/5] define
LIBXL_HAVE_REMUS_NETBUFinlibxl.h[4/5] clean ups. Make the usleep in checkpoint callback asynchronous
[5/5] minor nits
Changes in V3:
[1/5] Fix redundant checks in configure scripts
(based on Ian Campbell's suggestions)[2/5] Introduce locking in the script, during IFB setup.
Add xenstore paths used by netbuf scripts to xenstore-paths.markdown[3/5] Hotplug scripts setup/teardown invocations are now asynchronous
following IanJ's feedback. However, the invocations are still sequential.[5/5] Allow per-domain specification of netbuffer scripts in xl remus
commmand.And minor nits throughout the series based on feedback from the last version
Changes in V2:
[1/5] Configure script will automatically enable/disable network
buffer support depending on the availability of the appropriate libnl3 version. [If libnl3 is unavailable, a warning message will be printed to let the user know that the feature has been disabled.]use macros from pkg.m4 instead of pkg-config commands removed redundant checks for libnl3 libraries.
[3,4/5] - Minor nits.
Version 1:
[1/5] Changes to autoconf scripts to check for libnl3. Add linker flags
to libxlMakefile.[2/5] External script to setup/teardown network buffering using libnl3's
CLI. This script will be invoked by libxl before starting Remus. The script's main job is to bring up an IFB device with plug qdisc attached to it. It then re-routes egress traffic from the guest's vif to the IFB device.[3/5] Libxl code to invoke the external setup script, followed by netlink
related setup to obtain a handle on the output buffers attached to each vif.[4/5] Libxl interaction with network buffer module in the kernel via
libnl3 API.[5/5] xl cmdline switch to explicitly enable network buffering when
starting remus.Few things to note(by shriram):
a) Based on previous email discussions, the setup/teardown task has been moved to a hotplug style shell script which can be customized as desired, instead of implementing it as C code inside libxl.
b) Libnl3 is not available on NetBSD. Nor is it available on CentOS
(Linux). So I have made network buffering support an optional feature so that it can be disabled if desired.c) NetBSD does not have libnl3. So I have put the setup script under
tools/hotplug/Linuxfolder.thanks,
Yang.Legend:
A - acked
D - previous acked, but new change introduced so acked-by dropped M - Modified
S - the same version as last round
No marker - new patchYang Hongyang (12):
A libxl: introducelibxl__multidev_prepare_with_aodev
A libxl: Extendlibxl__ao_devicewith alibxl__ev_childmember A autoconf: add libnl3 dependency for Remus network buffering support S libxl/remus: introduce an abstract Remus device layer
A libxl/remus: setup and control network output buffering A libxl/remus: setup and control disk replication for DRBD backends S xl/remus: change bool to defbool
S xl/remus: cmdline switch to explicitly enable unsafe configurations A xl/remus: cmdline switches and config vars to control network
buffering
A xl/remus: add a cmdline switch to disable disk replication A libxl/remus: addLIBXL_HAVE_REMUSto indicate Remus support in libxl SMAINTAINERS: update maintained files of RemusMAINTAINERS | 7 + README | 4 + config/Tools.mk.in | 4 + docs/README.remus | 16 + docs/man/xl.conf.pod.5 | 6 + docs/man/xl.pod.1 | 30 +- docs/misc/xenstore-paths.markdown | 4 + tools/configure.ac | 16 + tools/hotplug/Linux/Makefile | 2 + tools/hotplug/Linux/block-drbd-probe | 87 ++++++ tools/hotplug/Linux/remus-netbuf-setup | 230 +++++++++++++++ tools/libxl/Makefile | 15 + tools/libxl/libxl.c | 75 ++++- tools/libxl/libxl.h | 6 + tools/libxl/libxl_device.c | 14 +- tools/libxl/libxl_dom.c | 170 ++++++++++- tools/libxl/libxl_internal.h | 195 ++++++++++++- tools/libxl/libxl_netbuffer.c | 517 +++++++++++++++++++++++++++++++++ tools/libxl/libxl_nonetbuffer.c | 54 ++++ tools/libxl/libxl_remus_device.c | 296 +++++++++++++++++++ tools/libxl/libxl_remus_disk_drbd.c | 257 ++++++++++++++++ tools/libxl/libxl_types.idl | 10 +- tools/libxl/libxl_types_internal.idl | 2 + tools/libxl/xl.c | 4 + tools/libxl/xl.h | 1 + tools/libxl/xl_cmdimpl.c | 42 ++- tools/libxl/xl_cmdtable.c | 11 +- 27 files changed, 2030 insertions(+), 45 deletions(-) create mode 100755 tools/hotplug/Linux/block-drbd-probe create mode 100644 tools/hotplug/Linux/remus-netbuf-setup create mode 100644 tools/libxl/libxl_netbuffer.c create mode 100644 tools/libxl/libxl_nonetbuffer.c create mode 100644 tools/libxl/libxl_remus_device.c create mode 100644 tools/libxl/libxl_remus_disk_drbd.cSignature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 14 lines · Konrad Rzeszutek Wilk
Quoted 5 lines · Yang Hongyang
This patch series adds support for network buffering and drbd disk in the Remus codebase in libxl.
the code is also hosted on github:
url: https://github.com/macrosheep/xen/tree/remus-v20I only had one question in regards to patch:
[PATCH for-4.5 v20 07/12] xl/remus: change bool to defboolOtherwise all the other patches that did not have an Review from me look good (and as such I have replied with 'Reviewed-by' on them).
Quoted 7 lines
All of those that had Ian's Ack on them, looked OK to me. I didn't respond 'Acked-by' on them as I figured I would do it here.
Regardless of the #7 question I believe the patches can
go in 4.5 and can have 'Acked-by: Konrad Rzeszutek Wilk <[email protected]>' on them.
Thank you! I have add all your Ack together witn Ian's Ack
Quoted 228 lines
Thank you!
Quoted 216 lines
Changes in v20:
Rebased.Changes in v19:
Use defbool for cmdline switch.
Restruct of subkind init and cleanup operation. Uselibxl__device_kindinstead oflibxl__remus_device_kindFix a layer violation issue pointed out by IanJ. Other minor fixes.
Rebased to the latest staging tree.Changes in v18:
Mergematch()andsetup()api.
Reuselibxl__multidevandlibxl__ao_device.
Commit messages and code comments improved. Thanks to Shriram. Rebased.Changes in v17:
Make remus device abstract layer more generic.
Addressed Ian J's comments.Changes in v16:
Mergelibxl__remus_stateandlibxl__remus_device_state.
Pass the ops to device abstract layer instead of defined it in the layer. Optimized subkind ops APIs.
Addressed Ian J's comments.
Rebased.Changes in v15:
The first patch in v14 has been taken, so remove it from the patchset. Add a patch to Update maintained files of REMUS.
Rebased.Changes in v14:
Addressed IanJ's comments.
Rebased.Changes in v13:
Addressed Konrad's comments.
Rebased.Changes in v12:
Add disk buffering cmdline switch.Changes in v11:
Addressed comments from Ian J and Shriram. Add drbd disk implement into this patch series.Changes in V10:
Restructured the whole patch series.
Introduce the remus device abstract layer.
Make remus checkpoint asynchronous.Changes in V9:
Use async exec script api to exec scripts.Changes in V8:
Applied some comments(by IanJ).
Merge some struct definitions to it's implementation. (2/3/5 in V7 => 3 in V8)Changes in V7:
Applied missing comments(by IanJ).
Applied Shriram comments.merge netbufering tangled setup/teardown code into one patch. (2/6/8 in V6 => 5 in V7. 9/10 in V6 => 7 in V7)
Changes in V6:
Applied Ian Jackson's comments of V5 series. the [PATCH 2/4 V5] is split by small functionalities.[PATCH 4/4 V5] --> [PATCH 13/13] netbuffer is default enabled.Changes in V5:
Merge hotplug script patch (2/5) and hotplug script setup/teardown patch (3/5) into a single patch.
Changes in V4:
[1/5] Remove check for libnl command line utils in autoconf checks
[2/5] minor nits
[3/5] define
LIBXL_HAVE_REMUS_NETBUFinlibxl.h[4/5] clean ups. Make the usleep in checkpoint callback asynchronous
[5/5] minor nits
Changes in V3:
[1/5] Fix redundant checks in configure scripts
(based on Ian Campbell's suggestions)[2/5] Introduce locking in the script, during IFB setup.
Add xenstore paths used by netbuf scripts to xenstore-paths.markdown[3/5] Hotplug scripts setup/teardown invocations are now asynchronous
following IanJ's feedback. However, the invocations are still sequential.[5/5] Allow per-domain specification of netbuffer scripts in xl remus
commmand.And minor nits throughout the series based on feedback from the last version
Changes in V2:
[1/5] Configure script will automatically enable/disable network
buffer support depending on the availability of the appropriate libnl3 version. [If libnl3 is unavailable, a warning message will be printed to let the user know that the feature has been disabled.]use macros from pkg.m4 instead of pkg-config commands removed redundant checks for libnl3 libraries.
[3,4/5] - Minor nits.
Version 1:
[1/5] Changes to autoconf scripts to check for libnl3. Add linker flags
to libxlMakefile.[2/5] External script to setup/teardown network buffering using libnl3's
CLI. This script will be invoked by libxl before starting Remus. The script's main job is to bring up an IFB device with plug qdisc attached to it. It then re-routes egress traffic from the guest's vif to the IFB device.[3/5] Libxl code to invoke the external setup script, followed by netlink
related setup to obtain a handle on the output buffers attached to each vif.[4/5] Libxl interaction with network buffer module in the kernel via
libnl3 API.[5/5] xl cmdline switch to explicitly enable network buffering when
starting remus.Few things to note(by shriram):
a) Based on previous email discussions, the setup/teardown task has been moved to a hotplug style shell script which can be customized as desired, instead of implementing it as C code inside libxl.
b) Libnl3 is not available on NetBSD. Nor is it available on CentOS
(Linux). So I have made network buffering support an optional feature so that it can be disabled if desired.c) NetBSD does not have libnl3. So I have put the setup script under
tools/hotplug/Linuxfolder.thanks,
Yang.Legend:
A - acked
D - previous acked, but new change introduced so acked-by dropped M - Modified
S - the same version as last round
No marker - new patchYang Hongyang (12):
A libxl: introducelibxl__multidev_prepare_with_aodev
A libxl: Extendlibxl__ao_devicewith alibxl__ev_childmember A autoconf: add libnl3 dependency for Remus network buffering support S libxl/remus: introduce an abstract Remus device layer
A libxl/remus: setup and control network output buffering A libxl/remus: setup and control disk replication for DRBD backends S xl/remus: change bool to defbool
S xl/remus: cmdline switch to explicitly enable unsafe configurations A xl/remus: cmdline switches and config vars to control network
buffering
A xl/remus: add a cmdline switch to disable disk replication A libxl/remus: addLIBXL_HAVE_REMUSto indicate Remus support in libxl SMAINTAINERS: update maintained files of RemusMAINTAINERS | 7 + README | 4 + config/Tools.mk.in | 4 + docs/README.remus | 16 + docs/man/xl.conf.pod.5 | 6 + docs/man/xl.pod.1 | 30 +- docs/misc/xenstore-paths.markdown | 4 + tools/configure.ac | 16 + tools/hotplug/Linux/Makefile | 2 + tools/hotplug/Linux/block-drbd-probe | 87 ++++++ tools/hotplug/Linux/remus-netbuf-setup | 230 +++++++++++++++ tools/libxl/Makefile | 15 + tools/libxl/libxl.c | 75 ++++- tools/libxl/libxl.h | 6 + tools/libxl/libxl_device.c | 14 +- tools/libxl/libxl_dom.c | 170 ++++++++++- tools/libxl/libxl_internal.h | 195 ++++++++++++- tools/libxl/libxl_netbuffer.c | 517 +++++++++++++++++++++++++++++++++ tools/libxl/libxl_nonetbuffer.c | 54 ++++ tools/libxl/libxl_remus_device.c | 296 +++++++++++++++++++ tools/libxl/libxl_remus_disk_drbd.c | 257 ++++++++++++++++ tools/libxl/libxl_types.idl | 10 +- tools/libxl/libxl_types_internal.idl | 2 + tools/libxl/xl.c | 4 + tools/libxl/xl.h | 1 + tools/libxl/xl_cmdimpl.c | 42 ++- tools/libxl/xl_cmdtable.c | 11 +- 27 files changed, 2030 insertions(+), 45 deletions(-)create mode 100755
tools/hotplug/Linux/block-drbd-probecreate mode 100644tools/hotplug/Linux/remus-netbuf-setupcreate mode 100644tools/libxl/libxl_netbuffer.ccreate mode 100644tools/libxl/libxl_nonetbuffer.ccreate mode 100644tools/libxl/libxl_remus_device.ccreate mode 100644tools/libxl/libxl_remus_disk_drbd.cQuoted 8 lines
--
1.9.1_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel.
Signature · 7 lines
Thanks, Yang. _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel