Commit 6e9814a1 authored by Andrea Spadaccini's avatar Andrea Spadaccini
Browse files

Add DRBD8 static resync speed disk parameter


Signed-off-by: default avatarAndrea Spadaccini <spadaccio@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 5e99141b
......@@ -1373,8 +1373,7 @@ class DRBD8(BaseDRBD):
if result.failed:
_ThrowError("drbd%d: can't attach local disk: %s", minor, result.output)
@classmethod
def _AssembleNet(cls, minor, net_info, protocol,
def _AssembleNet(self, minor, net_info, protocol,
dual_pri=False, hmac=None, secret=None):
"""Configure the network part of the device.
......@@ -1383,7 +1382,7 @@ class DRBD8(BaseDRBD):
if None in net_info:
# we don't want network connection and actually want to make
# sure its shutdown
cls._ShutdownNet(minor)
self._ShutdownNet(minor)
return
# Workaround for a race condition. When DRBD is doing its dance to
......@@ -1392,7 +1391,8 @@ class DRBD8(BaseDRBD):
# sync speed only after setting up both sides can race with DRBD
# connecting, hence we set it here before telling DRBD anything
# about its peer.
cls._SetMinorSyncSpeed(minor, constants.SYNC_SPEED)
sync_speed = self.params.get(constants.RESYNC_RATE)
self._SetMinorSyncSpeed(minor, sync_speed)
if netutils.IP6Address.IsValid(lhost):
if not netutils.IP6Address.IsValid(rhost):
......@@ -1407,7 +1407,7 @@ class DRBD8(BaseDRBD):
else:
_ThrowError("drbd%d: Invalid ip %s" % (minor, lhost))
args = ["drbdsetup", cls._DevPath(minor), "net",
args = ["drbdsetup", self._DevPath(minor), "net",
"%s:%s:%s" % (family, lhost, lport),
"%s:%s:%s" % (family, rhost, rport), protocol,
"-A", "discard-zero-changes",
......@@ -1424,7 +1424,7 @@ class DRBD8(BaseDRBD):
minor, result.fail_reason, result.output)
def _CheckNetworkConfig():
info = cls._GetDevInfo(cls._GetShowData(minor))
info = self._GetDevInfo(self._GetShowData(minor))
if not "local_addr" in info or not "remote_addr" in info:
raise utils.RetryAgain()
......@@ -1758,7 +1758,8 @@ class DRBD8(BaseDRBD):
# the device
self._SlowAssemble()
self.SetSyncSpeed(constants.SYNC_SPEED)
sync_speed = self.params.get(constants.RESYNC_RATE)
self.SetSyncSpeed(sync_speed)
def _SlowAssemble(self):
"""Assembles the DRBD device from a (partially) configured device.
......
......@@ -8055,10 +8055,19 @@ def _ComputeLDParams(disk_template, disk_params):
raise errors.ProgrammerError("Unknown disk template %s" % disk_template)
result = list()
dt_params = disk_params[disk_template]
if disk_template == constants.DT_DRBD8:
result.append(constants.DISK_LD_DEFAULTS[constants.LD_DRBD8])
params = {
constants.RESYNC_RATE: dt_params[constants.DRBD_RESYNC_RATE]
}
drbd_params = \
objects.FillDict(constants.DISK_LD_DEFAULTS[constants.LD_DRBD8], params)
result.append(drbd_params)
result.append(constants.DISK_LD_DEFAULTS[constants.LD_LV])
result.append(constants.DISK_LD_DEFAULTS[constants.LD_LV])
elif (disk_template == constants.DT_FILE or
disk_template == constants.DT_SHARED_FILE):
result.append(constants.DISK_LD_DEFAULTS[constants.LD_FILE])
......
......@@ -597,7 +597,7 @@ MAX_TAGS_PER_OBJ = 4096
# others
DEFAULT_BRIDGE = "xen-br0"
SYNC_SPEED = 60 * 1024
CLASSIC_DRBD_SYNC_SPEED = 60 * 1024 # 60 MiB, expressed in KiB
IP4_ADDRESS_LOCALHOST = "127.0.0.1"
IP4_ADDRESS_ANY = "0.0.0.0"
IP6_ADDRESS_LOCALHOST = "::1"
......@@ -897,12 +897,16 @@ NDS_PARAMETER_TYPES = {
NDS_PARAMETERS = frozenset(NDS_PARAMETER_TYPES.keys())
# Logical Disks parameters
RESYNC_RATE = "resync-rate"
DISK_LD_TYPES = {
RESYNC_RATE: VTYPE_INT,
}
DISK_LD_PARAMETERS = frozenset(DISK_LD_TYPES.keys())
# Disk template parameters
DRBD_RESYNC_RATE = "resync-rate"
DISK_DT_TYPES = {
DRBD_RESYNC_RATE: VTYPE_INT,
}
DISK_DT_PARAMETERS = frozenset(DISK_DT_TYPES.keys())
......@@ -1671,6 +1675,7 @@ NDC_DEFAULTS = {
DISK_LD_DEFAULTS = {
LD_DRBD8: {
RESYNC_RATE: CLASSIC_DRBD_SYNC_SPEED,
},
LD_LV: {
},
......@@ -1684,6 +1689,7 @@ DISK_DT_DEFAULTS = {
DT_PLAIN: {
},
DT_DRBD8: {
DRBD_RESYNC_RATE: DISK_LD_DEFAULTS[LD_DRBD8][RESYNC_RATE]
},
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