diff --git a/Makefile.am b/Makefile.am index 513d67bda108dd8c4d4f249bca3dd4e43b8dea11..202a14377483fc396e3264b266d4c51c8ef72e90 100644 --- a/Makefile.am +++ b/Makefile.am @@ -445,6 +445,7 @@ lib/_autoconf.py: Makefile stamp-directories echo "TOOLSDIR = '$(toolsdir)'"; \ echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \ echo "PKGLIBDIR = '$(pkglibdir)'"; \ + echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \ } > $@ $(REPLACE_VARS_SED): Makefile diff --git a/configure.ac b/configure.ac index 441bd3a0d7244090295470444999ab8959f765a0..ab3d935778ecc51e05d0a14e7c33158a20c5f237 100644 --- a/configure.ac +++ b/configure.ac @@ -108,7 +108,7 @@ AC_ARG_WITH([kvm-path], [kvm_path="/usr/bin/kvm"]) AC_SUBST(KVM_PATH, $kvm_path) -# ---with-lvm-stripecount=... +# --with-lvm-stripecount=... AC_ARG_WITH([lvm-stripecount], [AS_HELP_STRING([--with-lvm-stripecount=NUM], [the number of stripes to use for LVM volumes] @@ -118,6 +118,19 @@ AC_ARG_WITH([lvm-stripecount], [lvm_stripecount="1"]) AC_SUBST(LVM_STRIPECOUNT, $lvm_stripecount) +# --enable-drbd-barriers +AC_ARG_ENABLE([drbd-barriers], + [AS_HELP_STRING([--enable-drbd-barriers], + [enable the DRBD barrier functionality (>= 8.0.12) (default: enabled)])], + [[if test "$enableval" != no; then + DRBD_BARRIERS=True + else + DRBD_BARRIERS=False + fi + ]], + [DRBD_BARRIERS=True]) +AC_SUBST(DRBD_BARRIERS, $DRBD_BARRIERS) + # Check common programs AC_PROG_INSTALL AC_PROG_LN_S diff --git a/lib/bdev.py b/lib/bdev.py index 722f12cfc1f69ba2b4332bc9df1205d18ee1c30a..d9718a781d78301c6e0e0b8c1d111de5c01a8e5a 100644 --- a/lib/bdev.py +++ b/lib/bdev.py @@ -1215,6 +1215,24 @@ class DRBD8(BaseDRBD): "--create-device"] if size: args.extend(["-d", "%sm" % size]) + if not constants.DRBD_BARRIERS: # disable barriers, if configured so + version = cls._GetVersion() + # various DRBD versions support different disk barrier options; + # what we aim here is to revert back to the 'drain' method of + # disk flushes and to disable metadata barriers, in effect going + # back to pre-8.0.7 behaviour + vmaj = version['k_major'] + vmin = version['k_minor'] + vrel = version['k_point'] + assert vmaj == 8 + if vmin == 0: # 8.0.x + if vrel >= 12: + args.extend(['-i', '-m']) + elif vmin == 2: # 8.2.x + if vrel >= 7: + args.extend(['-i', '-m']) + elif vmaj >= 3: # 8.3.x or newer + args.extend(['-i', '-a', 'm']) result = utils.RunCmd(args) if result.failed: _ThrowError("drbd%d: can't attach local disk: %s", minor, result.output) diff --git a/lib/constants.py b/lib/constants.py index c20e65bde0466be4ee844ea013a5df1d022e4e04..74f330395705dbce1c196e30224116ca6cd09ba4 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -255,6 +255,7 @@ LDS_BLOCK = frozenset([LD_LV, LD_DRBD8]) # drbd constants DRBD_HMAC_ALG = "md5" DRBD_NET_PROTOCOL = "C" +DRBD_BARRIERS = _autoconf.DRBD_BARRIERS # file backend driver FD_LOOP = "loop"