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

Move LD parameters constants to the LDP_ namespace



Add the LDP_ prefix to the LD parameters-related constants, in order to
avoid pollution in the global constants namespace.
Signed-off-by: default avatarAndrea Spadaccini <spadaccio@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 23805716
......@@ -415,7 +415,7 @@ class LogicalVolume(BlockDev):
" in lvm.conf using either 'filter' or 'preferred_names'")
free_size = sum([pv[0] for pv in pvs_info])
current_pvs = len(pvlist)
desired_stripes = params[constants.STRIPES]
desired_stripes = params[constants.LDP_STRIPES]
stripes = min(current_pvs, desired_stripes)
if stripes < desired_stripes:
logging.warning("Could not use %d stripes for VG %s, as only %d PVs are"
......@@ -1368,8 +1368,8 @@ class DRBD8(BaseDRBD):
barrier_args = \
self._ComputeDiskBarrierArgs(vmaj, vmin, vrel,
self.params[constants.BARRIERS],
self.params[constants.NO_META_FLUSH])
self.params[constants.LDP_BARRIERS],
self.params[constants.LDP_NO_META_FLUSH])
args.extend(barrier_args)
result = utils.RunCmd(args)
......@@ -1468,7 +1468,7 @@ 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.
sync_speed = self.params.get(constants.RESYNC_RATE)
sync_speed = self.params.get(constants.LDP_RESYNC_RATE)
self._SetMinorSyncSpeed(minor, sync_speed)
if netutils.IP6Address.IsValid(lhost):
......@@ -1835,7 +1835,7 @@ class DRBD8(BaseDRBD):
# the device
self._SlowAssemble()
sync_speed = self.params.get(constants.RESYNC_RATE)
sync_speed = self.params.get(constants.LDP_RESYNC_RATE)
self.SetSyncSpeed(sync_speed)
def _SlowAssemble(self):
......
......@@ -8169,9 +8169,9 @@ def _ComputeLDParams(disk_template, disk_params):
dt_params = disk_params[disk_template]
if disk_template == constants.DT_DRBD8:
drbd_params = {
constants.RESYNC_RATE: dt_params[constants.DRBD_RESYNC_RATE],
constants.BARRIERS: dt_params[constants.DRBD_DISK_BARRIERS],
constants.NO_META_FLUSH: dt_params[constants.DRBD_META_BARRIERS],
constants.LDP_RESYNC_RATE: dt_params[constants.DRBD_RESYNC_RATE],
constants.LDP_BARRIERS: dt_params[constants.DRBD_DISK_BARRIERS],
constants.LDP_NO_META_FLUSH: dt_params[constants.DRBD_META_BARRIERS],
}
drbd_params = \
......@@ -8182,7 +8182,7 @@ def _ComputeLDParams(disk_template, disk_params):
# data LV
data_params = {
constants.STRIPES: dt_params[constants.DRBD_DATA_STRIPES],
constants.LDP_STRIPES: dt_params[constants.DRBD_DATA_STRIPES],
}
data_params = \
objects.FillDict(constants.DISK_LD_DEFAULTS[constants.LD_LV],
......@@ -8191,7 +8191,7 @@ def _ComputeLDParams(disk_template, disk_params):
# metadata LV
meta_params = {
constants.STRIPES: dt_params[constants.DRBD_META_STRIPES],
constants.LDP_STRIPES: dt_params[constants.DRBD_META_STRIPES],
}
meta_params = \
objects.FillDict(constants.DISK_LD_DEFAULTS[constants.LD_LV],
......@@ -8204,7 +8204,7 @@ def _ComputeLDParams(disk_template, disk_params):
elif disk_template == constants.DT_PLAIN:
params = {
constants.STRIPES: dt_params[constants.LV_STRIPES],
constants.LDP_STRIPES: dt_params[constants.LV_STRIPES],
}
params = \
objects.FillDict(constants.DISK_LD_DEFAULTS[constants.LD_LV],
......
......@@ -931,15 +931,15 @@ NDS_PARAMETER_TYPES = {
NDS_PARAMETERS = frozenset(NDS_PARAMETER_TYPES.keys())
# Logical Disks parameters
RESYNC_RATE = "resync-rate"
STRIPES = "stripes"
BARRIERS = "disabled-barriers"
NO_META_FLUSH = "disable-meta-flush"
LDP_RESYNC_RATE = "resync-rate"
LDP_STRIPES = "stripes"
LDP_BARRIERS = "disabled-barriers"
LDP_NO_META_FLUSH = "disable-meta-flush"
DISK_LD_TYPES = {
RESYNC_RATE: VTYPE_INT,
STRIPES: VTYPE_INT,
BARRIERS: VTYPE_STRING,
NO_META_FLUSH: VTYPE_BOOL,
LDP_RESYNC_RATE: VTYPE_INT,
LDP_STRIPES: VTYPE_INT,
LDP_BARRIERS: VTYPE_STRING,
LDP_NO_META_FLUSH: VTYPE_BOOL,
}
DISK_LD_PARAMETERS = frozenset(DISK_LD_TYPES.keys())
......@@ -1726,12 +1726,12 @@ NDC_DEFAULTS = {
DISK_LD_DEFAULTS = {
LD_DRBD8: {
RESYNC_RATE: CLASSIC_DRBD_SYNC_SPEED,
BARRIERS: _autoconf.DRBD_BARRIERS,
NO_META_FLUSH: _autoconf.DRBD_NO_META_FLUSH,
LDP_RESYNC_RATE: CLASSIC_DRBD_SYNC_SPEED,
LDP_BARRIERS: _autoconf.DRBD_BARRIERS,
LDP_NO_META_FLUSH: _autoconf.DRBD_NO_META_FLUSH,
},
LD_LV: {
STRIPES: _autoconf.LVM_STRIPECOUNT
LDP_STRIPES: _autoconf.LVM_STRIPECOUNT
},
LD_FILE: {
},
......@@ -1741,14 +1741,14 @@ DISK_LD_DEFAULTS = {
DISK_DT_DEFAULTS = {
DT_PLAIN: {
LV_STRIPES: DISK_LD_DEFAULTS[LD_LV][STRIPES],
LV_STRIPES: DISK_LD_DEFAULTS[LD_LV][LDP_STRIPES],
},
DT_DRBD8: {
DRBD_RESYNC_RATE: DISK_LD_DEFAULTS[LD_DRBD8][RESYNC_RATE],
DRBD_DATA_STRIPES: DISK_LD_DEFAULTS[LD_LV][STRIPES],
DRBD_META_STRIPES: DISK_LD_DEFAULTS[LD_LV][STRIPES],
DRBD_DISK_BARRIERS: DISK_LD_DEFAULTS[LD_DRBD8][BARRIERS],
DRBD_META_BARRIERS: DISK_LD_DEFAULTS[LD_DRBD8][NO_META_FLUSH],
DRBD_RESYNC_RATE: DISK_LD_DEFAULTS[LD_DRBD8][LDP_RESYNC_RATE],
DRBD_DATA_STRIPES: DISK_LD_DEFAULTS[LD_LV][LDP_STRIPES],
DRBD_META_STRIPES: DISK_LD_DEFAULTS[LD_LV][LDP_STRIPES],
DRBD_DISK_BARRIERS: DISK_LD_DEFAULTS[LD_DRBD8][LDP_BARRIERS],
DRBD_META_BARRIERS: DISK_LD_DEFAULTS[LD_DRBD8][LDP_NO_META_FLUSH],
},
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