#
#
-# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Google Inc.
+# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
DT_FILE = "file"
DT_SHARED_FILE = "sharedfile"
DT_BLOCK = "blockdev"
+DT_RBD = "rbd"
# the set of network-mirrored disk templates
DTS_INT_MIRROR = frozenset([DT_DRBD8])
# the set of externally-mirrored disk templates (e.g. SAN, NAS)
-DTS_EXT_MIRROR = frozenset([DT_SHARED_FILE, DT_BLOCK])
+DTS_EXT_MIRROR = frozenset([DT_SHARED_FILE, DT_BLOCK, DT_RBD])
# the set of non-lvm-based disk templates
-DTS_NOT_LVM = frozenset([DT_DISKLESS, DT_FILE, DT_SHARED_FILE, DT_BLOCK])
+DTS_NOT_LVM = frozenset([DT_DISKLESS, DT_FILE, DT_SHARED_FILE,
+ DT_BLOCK, DT_RBD])
# the set of disk templates which can be grown
-DTS_GROWABLE = frozenset([DT_PLAIN, DT_DRBD8, DT_FILE, DT_SHARED_FILE])
+DTS_GROWABLE = frozenset([DT_PLAIN, DT_DRBD8, DT_FILE, DT_SHARED_FILE, DT_RBD])
# the set of disk templates that allow adoption
DTS_MAY_ADOPT = frozenset([DT_PLAIN, DT_BLOCK])
LD_DRBD8 = "drbd8"
LD_FILE = "file"
LD_BLOCKDEV = "blockdev"
+LD_RBD = "rbd"
LOGICAL_DISK_TYPES = frozenset([
LD_LV,
LD_DRBD8,
LD_FILE,
LD_BLOCKDEV,
+ LD_RBD,
])
-LDS_BLOCK = frozenset([LD_LV, LD_DRBD8, LD_BLOCKDEV])
+LDS_BLOCK = frozenset([LD_LV, LD_DRBD8, LD_BLOCKDEV, LD_RBD])
# drbd constants
DRBD_HMAC_ALG = "md5"
frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_FLUSH, DRBD_B_DISK_DRAIN]),
])
+# rbd tool command
+RBD_CMD = "rbd"
+
# file backend driver
FD_LOOP = "loop"
FD_BLKTAP = "blktap"
DT_DRBD8,
DT_FILE,
DT_SHARED_FILE,
- DT_BLOCK
+ DT_BLOCK,
+ DT_RBD
])
FILE_DRIVER = frozenset([FD_LOOP, FD_BLKTAP])
# dynamic device modification
DDM_ADD = "add"
+DDM_MODIFY = "modify"
DDM_REMOVE = "remove"
DDMS_VALUES = frozenset([DDM_ADD, DDM_REMOVE])
+DDMS_VALUES_WITH_MODIFY = (DDMS_VALUES | frozenset([
+ DDM_MODIFY,
+ ]))
+# TODO: DDM_SWAP, DDM_MOVE?
# common exit codes
EXIT_SUCCESS = 0
ISPECS_MIN = "min"
ISPECS_MAX = "max"
ISPECS_STD = "std"
+IPOLICY_DTS = "disk-templates"
+IPOLICY_VCPU_RATIO = "vcpu-ratio"
+IPOLICY_SPINDLE_RATIO = "spindle-ratio"
-IPOLICY_PARAMETERS = frozenset([
+IPOLICY_ISPECS = frozenset([
ISPECS_MIN,
ISPECS_MAX,
ISPECS_STD,
])
+IPOLICY_PARAMETERS = frozenset([
+ IPOLICY_VCPU_RATIO,
+ IPOLICY_SPINDLE_RATIO,
+ ])
+
+IPOLICY_ALL_KEYS = (IPOLICY_ISPECS |
+ IPOLICY_PARAMETERS |
+ frozenset([IPOLICY_DTS]))
+
# Node parameter names
ND_OOB_PROGRAM = "oob_program"
+ND_SPINDLE_COUNT = "spindle_count"
NDS_PARAMETER_TYPES = {
ND_OOB_PROGRAM: VTYPE_MAYBE_STRING,
+ ND_SPINDLE_COUNT: VTYPE_INT,
}
NDS_PARAMETERS = frozenset(NDS_PARAMETER_TYPES.keys())
LDP_DELAY_TARGET = "c-delay-target"
LDP_MAX_RATE = "c-max-rate"
LDP_MIN_RATE = "c-min-rate"
+LDP_POOL = "pool"
DISK_LD_TYPES = {
LDP_RESYNC_RATE: VTYPE_INT,
LDP_STRIPES: VTYPE_INT,
LDP_DELAY_TARGET: VTYPE_INT,
LDP_MAX_RATE: VTYPE_INT,
LDP_MIN_RATE: VTYPE_INT,
+ LDP_POOL: VTYPE_STRING,
}
DISK_LD_PARAMETERS = frozenset(DISK_LD_TYPES.keys())
DRBD_MAX_RATE = "c-max-rate"
DRBD_MIN_RATE = "c-min-rate"
LV_STRIPES = "stripes"
+RBD_POOL = "pool"
DISK_DT_TYPES = {
DRBD_RESYNC_RATE: VTYPE_INT,
DRBD_DATA_STRIPES: VTYPE_INT,
DRBD_MAX_RATE: VTYPE_INT,
DRBD_MIN_RATE: VTYPE_INT,
LV_STRIPES: VTYPE_INT,
+ RBD_POOL: VTYPE_STRING,
}
DISK_DT_PARAMETERS = frozenset(DISK_DT_TYPES.keys())
NDC_DEFAULTS = {
ND_OOB_PROGRAM: None,
+ ND_SPINDLE_COUNT: 1,
}
DISK_LD_DEFAULTS = {
},
LD_BLOCKDEV: {
},
+ LD_RBD: {
+ LDP_POOL: "rbd"
+ },
}
# readability shortcuts
},
DT_BLOCK: {
},
+ DT_RBD: {
+ RBD_POOL: DISK_LD_DEFAULTS[LD_RBD][LDP_POOL]
+ },
}
# we don't want to export the shortcuts
NIC_LINK: DEFAULT_BRIDGE,
}
+# All of the following values are quite arbitrarily - there are no
+# "good" defaults, these must be customised per-site
IPOLICY_DEFAULTS = {
ISPECS_MIN: {
ISPEC_MEM_SIZE: 128,
ISPEC_NIC_COUNT: 1,
},
ISPECS_MAX: {
- ISPEC_MEM_SIZE: 128,
- ISPEC_CPU_COUNT: 1,
- ISPEC_DISK_COUNT: 1,
- ISPEC_DISK_SIZE: 1024,
- ISPEC_NIC_COUNT: 1,
+ ISPEC_MEM_SIZE: 32768,
+ ISPEC_CPU_COUNT: 8,
+ ISPEC_DISK_COUNT: MAX_DISKS,
+ ISPEC_DISK_SIZE: 1024 * 1024,
+ ISPEC_NIC_COUNT: MAX_NICS,
},
ISPECS_STD: {
ISPEC_MEM_SIZE: 128,
ISPEC_DISK_COUNT: 1,
ISPEC_DISK_SIZE: 1024,
ISPEC_NIC_COUNT: 1,
- }
+ },
+ IPOLICY_DTS: DISK_TEMPLATES,
+ IPOLICY_VCPU_RATIO: 4.0,
+ IPOLICY_SPINDLE_RATIO: 32.0,
}
MASTER_POOL_SIZE_DEFAULT = 10