Commit ad1dd4c7 authored by Andrea Spadaccini's avatar Andrea Spadaccini
Browse files

Add net-custom and disk-custom DRBD parameters



Those parameters can be used to pass options directly to drbdsetup disk
and drbdsetup net.
Signed-off-by: default avatarAndrea Spadaccini <spadaccio@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 8002e46b
......@@ -24,6 +24,7 @@
import re
import time
import errno
import shlex
import stat
import pyparsing as pyp
import os
......@@ -1372,6 +1373,9 @@ class DRBD8(BaseDRBD):
self.params[constants.LDP_NO_META_FLUSH])
args.extend(barrier_args)
if self.params[constants.LDP_DISK_CUSTOM]:
args.extend(shlex.split(self.params[constants.LDP_DISK_CUSTOM]))
result = utils.RunCmd(args)
if result.failed:
_ThrowError("drbd%d: can't attach local disk: %s", minor, result.output)
......@@ -1495,6 +1499,10 @@ class DRBD8(BaseDRBD):
args.append("-m")
if hmac and secret:
args.extend(["-a", hmac, "-x", secret])
if self.params[constants.LDP_NET_CUSTOM]:
args.extend(shlex.split(self.params[constants.LDP_NET_CUSTOM]))
result = utils.RunCmd(args)
if result.failed:
_ThrowError("drbd%d: can't setup network: %s - %s",
......
......@@ -8173,6 +8173,8 @@ def _ComputeLDParams(disk_template, disk_params):
constants.LDP_BARRIERS: dt_params[constants.DRBD_DISK_BARRIERS],
constants.LDP_NO_META_FLUSH: dt_params[constants.DRBD_META_BARRIERS],
constants.LDP_DEFAULT_METAVG: dt_params[constants.DRBD_DEFAULT_METAVG],
constants.LDP_DISK_CUSTOM: dt_params[constants.DRBD_DISK_CUSTOM],
constants.LDP_NET_CUSTOM: dt_params[constants.DRBD_NET_CUSTOM],
}
drbd_params = \
......
......@@ -936,12 +936,16 @@ LDP_STRIPES = "stripes"
LDP_BARRIERS = "disabled-barriers"
LDP_NO_META_FLUSH = "disable-meta-flush"
LDP_DEFAULT_METAVG = "default-metavg"
LDP_DISK_CUSTOM = "disk-custom"
LDP_NET_CUSTOM = "net-custom"
DISK_LD_TYPES = {
LDP_RESYNC_RATE: VTYPE_INT,
LDP_STRIPES: VTYPE_INT,
LDP_BARRIERS: VTYPE_STRING,
LDP_NO_META_FLUSH: VTYPE_BOOL,
LDP_DEFAULT_METAVG: VTYPE_STRING,
LDP_DISK_CUSTOM: VTYPE_STRING,
LDP_NET_CUSTOM: VTYPE_STRING,
}
DISK_LD_PARAMETERS = frozenset(DISK_LD_TYPES.keys())
......@@ -952,6 +956,8 @@ DRBD_META_STRIPES = "meta-stripes"
DRBD_DISK_BARRIERS = "disk-barriers"
DRBD_META_BARRIERS = "meta-barriers"
DRBD_DEFAULT_METAVG = "metavg"
DRBD_DISK_CUSTOM = "disk-custom"
DRBD_NET_CUSTOM = "net-custom"
LV_STRIPES = "stripes"
DISK_DT_TYPES = {
DRBD_RESYNC_RATE: VTYPE_INT,
......@@ -960,6 +966,8 @@ DISK_DT_TYPES = {
DRBD_DISK_BARRIERS: VTYPE_STRING,
DRBD_META_BARRIERS: VTYPE_BOOL,
DRBD_DEFAULT_METAVG: VTYPE_STRING,
DRBD_DISK_CUSTOM: VTYPE_STRING,
DRBD_NET_CUSTOM: VTYPE_STRING,
LV_STRIPES: VTYPE_INT,
}
......@@ -1734,6 +1742,8 @@ DISK_LD_DEFAULTS = {
LDP_BARRIERS: _autoconf.DRBD_BARRIERS,
LDP_NO_META_FLUSH: _autoconf.DRBD_NO_META_FLUSH,
LDP_DEFAULT_METAVG: DEFAULT_VG,
LDP_DISK_CUSTOM: "",
LDP_NET_CUSTOM: "",
},
LD_LV: {
LDP_STRIPES: _autoconf.LVM_STRIPECOUNT
......@@ -1755,6 +1765,8 @@ DISK_DT_DEFAULTS = {
DRBD_DISK_BARRIERS: DISK_LD_DEFAULTS[LD_DRBD8][LDP_BARRIERS],
DRBD_META_BARRIERS: DISK_LD_DEFAULTS[LD_DRBD8][LDP_NO_META_FLUSH],
DRBD_DEFAULT_METAVG: DISK_LD_DEFAULTS[LD_DRBD8][LDP_DEFAULT_METAVG],
DRBD_DISK_CUSTOM: DISK_LD_DEFAULTS[LD_DRBD8][LDP_DISK_CUSTOM],
DRBD_NET_CUSTOM: DISK_LD_DEFAULTS[LD_DRBD8][LDP_NET_CUSTOM],
},
DT_DISKLESS: {
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment