LD_DRBD8 = "drbd8"
LD_FILE = "file"
LD_BLOCKDEV = "blockdev"
+LOGICAL_DISK_TYPES = frozenset([
+ LD_LV,
+ LD_DRBD8,
+ LD_FILE,
+ LD_BLOCKDEV,
+ ])
+
LDS_BLOCK = frozenset([LD_LV, LD_DRBD8, LD_BLOCKDEV])
# drbd constants
DRBD_HMAC_ALG = "md5"
DRBD_NET_PROTOCOL = "C"
-DRBD_BARRIERS = _autoconf.DRBD_BARRIERS
+
+# drbd barrier types
+DRBD_B_NONE = "n"
+DRBD_B_DISK_BARRIERS = "b"
+DRBD_B_DISK_DRAIN = "d"
+DRBD_B_DISK_FLUSH = "f"
+
+# Valid barrier combinations: "n" or any non-null subset of "bfd"
+DRBD_VALID_BARRIER_OPT = frozenset([
+ frozenset([DRBD_B_NONE]),
+ frozenset([DRBD_B_DISK_BARRIERS]),
+ frozenset([DRBD_B_DISK_DRAIN]),
+ frozenset([DRBD_B_DISK_FLUSH]),
+ frozenset([DRBD_B_DISK_DRAIN, DRBD_B_DISK_FLUSH]),
+ frozenset([DRBD_B_DISK_DRAIN, DRBD_B_DISK_FLUSH]),
+ frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_DRAIN]),
+ frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_FLUSH]),
+ frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_FLUSH, DRBD_B_DISK_DRAIN]),
+ ])
# file backend driver
FD_LOOP = "loop"
# 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"
DEFAULT_DRBD_HELPER = "/bin/true"
MIN_VG_SIZE = 20480
DEFAULT_MAC_PREFIX = "aa:00:00"
-LVM_STRIPECOUNT = _autoconf.LVM_STRIPECOUNT
# default maximum instance wait time, in seconds.
DEFAULT_SHUTDOWN_TIMEOUT = 120
NODE_MAX_CLOCK_SKEW = 150
HVST_CPU_TOTAL = "cpu_total"
HVST_CPU_NODE = "cpu_node"
+HVST_DEFAULTS = {
+ HVST_MEMORY_TOTAL: 0,
+ HVST_MEMORY_NODE: 0,
+ HVST_MEMORY_HV: 0,
+ HVST_CPU_TOTAL: 1,
+ HVST_CPU_NODE: 1,
+ }
+
HVSTS_PARAMETER_TYPES = {
HVST_MEMORY_TOTAL: VTYPE_INT,
HVST_MEMORY_NODE: VTYPE_INT,
DS_DISK_RESERVED = "disk_reserved"
DS_DISK_OVERHEAD = "disk_overhead"
+DS_DEFAULTS = {
+ DS_DISK_TOTAL: 0,
+ DS_DISK_RESERVED: 0,
+ DS_DISK_OVERHEAD: 0,
+ }
+
DSS_PARAMETER_TYPES = {
DS_DISK_TOTAL: VTYPE_INT,
DS_DISK_RESERVED: VTYPE_INT,
}
DSS_PARAMETERS = frozenset(DSS_PARAMETER_TYPES.keys())
+DS_VALID_TYPES = frozenset([LD_LV])
# Backend parameter names
BE_MEMORY = "memory" # deprecated and replaced by max and min mem
BE_MINMEM = "minmem"
BE_VCPUS = "vcpus"
BE_AUTO_BALANCE = "auto_balance"
+BE_ALWAYS_FAILOVER = "always_failover"
BES_PARAMETER_TYPES = {
BE_MAXMEM: VTYPE_SIZE,
BE_MINMEM: VTYPE_SIZE,
BE_VCPUS: VTYPE_INT,
BE_AUTO_BALANCE: VTYPE_BOOL,
+ BE_ALWAYS_FAILOVER: VTYPE_BOOL,
}
BES_PARAMETER_COMPAT = {
BES_PARAMETERS = frozenset(BES_PARAMETER_TYPES.keys())
+# instance specs
+MEM_SIZE_SPEC = "memory-size"
+CPU_COUNT_SPEC = "cpu-count"
+DISK_COUNT_SPEC = "disk-count"
+DISK_SIZE_SPEC = "disk-size"
+NIC_COUNT_SPEC = "nic-count"
+
+ISPECS_PARAMETER_TYPES = {
+ MEM_SIZE_SPEC: VTYPE_INT,
+ CPU_COUNT_SPEC: VTYPE_INT,
+ DISK_COUNT_SPEC: VTYPE_INT,
+ DISK_SIZE_SPEC: VTYPE_INT,
+ NIC_COUNT_SPEC: VTYPE_INT,
+ }
+
+ISPECS_PARAMETERS = frozenset(ISPECS_PARAMETER_TYPES.keys())
+
+MIN_ISPECS = "min"
+MAX_ISPECS = "max"
+STD_ISPECS = "std"
+
+IPOLICY_PARAMETERS = frozenset([
+ MIN_ISPECS,
+ MAX_ISPECS,
+ STD_ISPECS
+ ])
+
# Node parameter names
ND_OOB_PROGRAM = "oob_program"
NDS_PARAMETERS = frozenset(NDS_PARAMETER_TYPES.keys())
+# Logical Disks parameters
+LDP_RESYNC_RATE = "resync-rate"
+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())
+
+# Disk template parameters
+DRBD_RESYNC_RATE = "resync-rate"
+DRBD_DATA_STRIPES = "data-stripes"
+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,
+ DRBD_DATA_STRIPES: VTYPE_INT,
+ DRBD_META_STRIPES: VTYPE_INT,
+ 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,
+ }
+
+DISK_DT_PARAMETERS = frozenset(DISK_DT_TYPES.keys())
+
# OOB supported commands
OOB_POWER_ON = "power-on"
OOB_POWER_OFF = "power-off"
IALLOCATOR_NEVAC_ALL,
])
+# Node evacuation
+NODE_EVAC_PRI = "primary-only"
+NODE_EVAC_SEC = "secondary-only"
+NODE_EVAC_ALL = "all"
+NODE_EVAC_MODES = frozenset([
+ NODE_EVAC_PRI,
+ NODE_EVAC_SEC,
+ NODE_EVAC_ALL,
+ ])
+
# Job queue
JOB_QUEUE_VERSION = 1
JOB_QUEUE_LOCK_FILE = QUEUE_DIR + "/lock"
BE_MAXMEM: 128,
BE_VCPUS: 1,
BE_AUTO_BALANCE: True,
+ BE_ALWAYS_FAILOVER: False,
}
NDC_DEFAULTS = {
ND_OOB_PROGRAM: None,
}
+DISK_LD_DEFAULTS = {
+ LD_DRBD8: {
+ LDP_RESYNC_RATE: CLASSIC_DRBD_SYNC_SPEED,
+ 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
+ },
+ LD_FILE: {
+ },
+ LD_BLOCKDEV: {
+ },
+ }
+
+DISK_DT_DEFAULTS = {
+ DT_PLAIN: {
+ LV_STRIPES: DISK_LD_DEFAULTS[LD_LV][LDP_STRIPES],
+ },
+ DT_DRBD8: {
+ 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],
+ 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: {
+ },
+ DT_FILE: {
+ },
+ DT_SHARED_FILE: {
+ },
+ DT_BLOCK: {
+ },
+ }
+
NICC_DEFAULTS = {
NIC_MODE: NIC_MODE_BRIDGED,
NIC_LINK: DEFAULT_BRIDGE,
}
+IPOLICY_DEFAULTS = {
+ MIN_ISPECS: {
+ MEM_SIZE_SPEC: 128,
+ CPU_COUNT_SPEC: 1,
+ DISK_COUNT_SPEC: 1,
+ DISK_SIZE_SPEC: 1024,
+ NIC_COUNT_SPEC: 1,
+ },
+ MAX_ISPECS: {
+ MEM_SIZE_SPEC: 128,
+ CPU_COUNT_SPEC: 1,
+ DISK_COUNT_SPEC: 1,
+ DISK_SIZE_SPEC: 1024,
+ NIC_COUNT_SPEC: 1,
+ },
+ STD_ISPECS: {
+ MEM_SIZE_SPEC: 128,
+ CPU_COUNT_SPEC: 1,
+ DISK_COUNT_SPEC: 1,
+ DISK_SIZE_SPEC: 1024,
+ NIC_COUNT_SPEC: 1,
+ }
+ }
+
MASTER_POOL_SIZE_DEFAULT = 10
CONFD_PROTOCOL_VERSION = 1