NODED_USER = _autoconf.NODED_USER
NODED_GROUP = _autoconf.NODED_GROUP
+# cpu pinning separators and constants
+CPU_PINNING_SEP = ":"
+CPU_PINNING_ALL = "all"
+# internal representation of "all"
+CPU_PINNING_ALL_VAL = -1
+# one "all" entry in a CPU list means CPU pinning is off
+CPU_PINNING_OFF = [CPU_PINNING_ALL_VAL]
+
+# A Xen-specific implementation detail - there is no way to actually say
+# "use any cpu for pinning" in a Xen configuration file, as opposed to the
+# command line, where you can say "xm vcpu-pin <domain> <vcpu> all".
+# The workaround used in Xen is "0-63" (see source code function
+# xm_vcpu_pin in <xen-source>/tools/python/xen/xm/main.py).
+# To support future changes, the following constant is treated as a
+# blackbox string that simply means use-any-cpu-for-pinning-under-xen.
+CPU_PINNING_ALL_XEN = "0-63"
+
+# A KVM-specific implementation detail - the following value is used
+# to set CPU affinity to all processors (#0 through #31), per taskset
+# man page.
+CPU_PINNING_ALL_KVM = 0xFFFFFFFF
# Wipe
DD_CMD = "dd"
-WIPE_BLOCK_SIZE = 1024**2
+WIPE_BLOCK_SIZE = 1024 ** 2
MAX_WIPE_CHUNK = 1024 # 1GB
MIN_WIPE_CHUNK_PERCENT = 10
ADOPTABLE_BLOCKDEV_ROOT = "/dev/disk/"
# keep RUN_GANETI_DIR first here, to make sure all get created when the node
# daemon is started (this takes care of RUN_DIR being tmpfs)
-SUB_RUN_DIRS = [ RUN_GANETI_DIR, BDEV_CACHE_DIR, DISK_LINKS_DIR ]
+SUB_RUN_DIRS = [
+ RUN_GANETI_DIR,
+ BDEV_CACHE_DIR,
+ DISK_LINKS_DIR,
+ ]
LOCK_DIR = _autoconf.LOCALSTATEDIR + "/lock"
SSCONF_LOCK_FILE = LOCK_DIR + "/ganeti-ssconf.lock"
# User-id pool lock directory
NODED_CERT_FILE = DATA_DIR + "/server.pem"
RAPI_CERT_FILE = DATA_DIR + "/rapi.pem"
CONFD_HMAC_KEY = DATA_DIR + "/hmac.key"
+SPICE_CERT_FILE = DATA_DIR + "/spice.pem"
+SPICE_CACERT_FILE = DATA_DIR + "/spice-ca.pem"
CLUSTER_DOMAIN_SECRET_FILE = DATA_DIR + "/cluster-domain-secret"
-WATCHER_STATEFILE = DATA_DIR + "/watcher.data"
-WATCHER_PAUSEFILE = DATA_DIR + "/watcher.pause"
INSTANCE_STATUS_FILE = RUN_GANETI_DIR + "/instance-status"
SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts"
RAPI_USERS_FILE = DATA_DIR + "/rapi/users"
SYSCONFDIR = _autoconf.SYSCONFDIR
TOOLSDIR = _autoconf.TOOLSDIR
CONF_DIR = SYSCONFDIR + "/ganeti"
+USER_SCRIPTS_DIR = CONF_DIR + "/scripts"
+ENABLE_CONFD = _autoconf.ENABLE_CONFD
+
+#: Lock file for watcher, locked in shared mode by watcher; lock in exclusive
+# mode to block watcher (see L{cli._RunWhileClusterStoppedHelper.Call}
+WATCHER_LOCK_FILE = LOCK_DIR + "/ganeti-watcher.lock"
-ALL_CERT_FILES = frozenset([NODED_CERT_FILE, RAPI_CERT_FILE])
+#: Status file for per-group watcher, locked in exclusive mode by watcher
+WATCHER_GROUP_STATE_FILE = DATA_DIR + "/watcher.%s.data"
+
+#: File for per-group instance status, merged into L{INSTANCE_STATUS_FILE} by
+#: per-group processes
+WATCHER_GROUP_INSTANCE_STATUS_FILE = DATA_DIR + "/watcher.%s.instance-status"
+
+#: File containing Unix timestamp until which watcher should be paused
+WATCHER_PAUSEFILE = DATA_DIR + "/watcher.pause"
+
+# Master IP address setup scripts paths (default and user-provided)
+DEFAULT_MASTER_SETUP_SCRIPT = TOOLSDIR + "/master-ip-setup"
+EXTERNAL_MASTER_SETUP_SCRIPT = USER_SCRIPTS_DIR + "/master-ip-setup"
+
+ALL_CERT_FILES = frozenset([
+ NODED_CERT_FILE,
+ RAPI_CERT_FILE,
+ SPICE_CERT_FILE,
+ SPICE_CACERT_FILE,
+ ])
MASTER_SOCKET = SOCKET_DIR + "/ganeti-master"
XEN_BOOTLOADER = _autoconf.XEN_BOOTLOADER
XEN_KERNEL = _autoconf.XEN_KERNEL
XEN_INITRD = _autoconf.XEN_INITRD
+XEN_CMD = "xm"
KVM_PATH = _autoconf.KVM_PATH
SOCAT_PATH = _autoconf.SOCAT_PATH
#: Console as VNC server
CONS_VNC = "vnc"
+#: Console as SPICE server
+CONS_SPICE = "spice"
+
#: Display a message for console access
CONS_MESSAGE = "msg"
#: All console types
-CONS_ALL = frozenset([CONS_SSH, CONS_VNC, CONS_MESSAGE])
+CONS_ALL = frozenset([CONS_SSH, CONS_VNC, CONS_SPICE, CONS_MESSAGE])
# For RSA keys more bits are better, but they also make operations more
# expensive. NIST SP 800-131 recommends a minimum of 2048 bits from the year
HOOKS_NAME_CFGUPDATE = "config-update"
HOOKS_NAME_WATCHER = "watcher"
HOOKS_VERSION = 2
+HOOKS_PATH = "/sbin:/bin:/usr/sbin:/usr/bin"
# hooks subject type (what object type does the LU deal with)
HTYPE_CLUSTER = "CLUSTER"
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"
IP6_ADDRESS_ANY = "::"
IP4_VERSION = 4
IP6_VERSION = 6
+VALID_IP_VERSIONS = frozenset([IP4_VERSION, IP6_VERSION])
TCP_PING_TIMEOUT = 10
GANETI_RUNAS = "root"
DEFAULT_VG = "xenvg"
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
DISK_TRANSFER_CONNECT_TIMEOUT = 60
# Disk index separator
DISK_SEPARATOR = _autoconf.DISK_SEPARATOR
+IP_COMMAND_PATH = _autoconf.IP_PATH
#: Key for job IDs in opcode result
JOB_IDS_KEY = "jobs"
VTYPE_INT,
])
+# Constant representing that the user does not specify any IP version
+IFACE_NO_IP_VERSION_SPECIFIED = 0
+
# HV parameter names (global namespace)
HV_BOOT_ORDER = "boot_order"
HV_CDROM_IMAGE_PATH = "cdrom_image_path"
HV_VNC_TLS = "vnc_tls"
HV_VNC_X509 = "vnc_x509_path"
HV_VNC_X509_VERIFY = "vnc_x509_verify"
+HV_KVM_SPICE_BIND = "spice_bind"
+HV_KVM_SPICE_IP_VERSION = "spice_ip_version"
+HV_KVM_SPICE_PASSWORD_FILE = "spice_password_file"
+HV_KVM_SPICE_LOSSLESS_IMG_COMPR = "spice_image_compression"
+HV_KVM_SPICE_JPEG_IMG_COMPR = "spice_jpeg_wan_compression"
+HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR = "spice_zlib_glz_wan_compression"
+HV_KVM_SPICE_STREAMING_VIDEO_DETECTION = "spice_streaming_video"
+HV_KVM_SPICE_AUDIO_COMPR = "spice_playback_compression"
+HV_KVM_SPICE_USE_TLS = "spice_use_tls"
+HV_KVM_SPICE_TLS_CIPHERS = "spice_tls_ciphers"
+HV_KVM_SPICE_USE_VDAGENT = "spice_use_vdagent"
HV_ACPI = "acpi"
HV_PAE = "pae"
HV_USE_BOOTLOADER = "use_bootloader"
HV_VNC_TLS: VTYPE_BOOL,
HV_VNC_X509: VTYPE_STRING,
HV_VNC_X509_VERIFY: VTYPE_BOOL,
+ HV_KVM_SPICE_BIND: VTYPE_STRING,
+ HV_KVM_SPICE_IP_VERSION: VTYPE_INT,
+ HV_KVM_SPICE_PASSWORD_FILE: VTYPE_STRING,
+ HV_KVM_SPICE_LOSSLESS_IMG_COMPR: VTYPE_STRING,
+ HV_KVM_SPICE_JPEG_IMG_COMPR: VTYPE_STRING,
+ HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR: VTYPE_STRING,
+ HV_KVM_SPICE_STREAMING_VIDEO_DETECTION: VTYPE_STRING,
+ HV_KVM_SPICE_AUDIO_COMPR: VTYPE_BOOL,
+ HV_KVM_SPICE_USE_TLS: VTYPE_BOOL,
+ HV_KVM_SPICE_TLS_CIPHERS: VTYPE_STRING,
+ HV_KVM_SPICE_USE_VDAGENT: VTYPE_BOOL,
HV_ACPI: VTYPE_BOOL,
HV_PAE: VTYPE_BOOL,
HV_USE_BOOTLOADER: VTYPE_BOOL,
HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
+# Migration statuses
+HV_MIGRATION_COMPLETED = "completed"
+HV_MIGRATION_ACTIVE = "active"
+HV_MIGRATION_FAILED = "failed"
+HV_MIGRATION_CANCELLED = "cancelled"
+
+HV_MIGRATION_VALID_STATUSES = frozenset([
+ HV_MIGRATION_COMPLETED,
+ HV_MIGRATION_ACTIVE,
+ HV_MIGRATION_FAILED,
+ HV_MIGRATION_CANCELLED,
+ ])
+
+HV_MIGRATION_FAILED_STATUSES = frozenset([
+ HV_MIGRATION_FAILED,
+ HV_MIGRATION_CANCELLED,
+ ])
+
+# KVM-specific statuses
+HV_KVM_MIGRATION_VALID_STATUSES = HV_MIGRATION_VALID_STATUSES
+
+# Node info keys
+HV_NODEINFO_KEY_VERSION = "hv_version"
+
+# Hypervisor state
+HVST_MEMORY_TOTAL = "mem_total"
+HVST_MEMORY_NODE = "mem_node"
+HVST_MEMORY_HV = "mem_hv"
+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,
+ HVST_MEMORY_HV: VTYPE_INT,
+ HVST_CPU_TOTAL: VTYPE_INT,
+ HVST_CPU_NODE: VTYPE_INT,
+ }
+
+HVSTS_PARAMETERS = frozenset(HVSTS_PARAMETER_TYPES.keys())
+
+# Disk state
+DS_DISK_TOTAL = "disk_total"
+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,
+ DS_DISK_OVERHEAD: VTYPE_INT,
+ }
+
+DSS_PARAMETERS = frozenset(DSS_PARAMETER_TYPES.keys())
+DS_VALID_TYPES = frozenset([LD_LV])
+
# Backend parameter names
-BE_MEMORY = "memory"
+BE_MEMORY = "memory" # deprecated and replaced by max and min mem
+BE_MAXMEM = "maxmem"
+BE_MINMEM = "minmem"
BE_VCPUS = "vcpus"
BE_AUTO_BALANCE = "auto_balance"
+BE_ALWAYS_FAILOVER = "always_failover"
BES_PARAMETER_TYPES = {
- BE_MEMORY: VTYPE_SIZE,
- BE_VCPUS: VTYPE_INT,
- BE_AUTO_BALANCE: VTYPE_BOOL,
- }
+ 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 = {
+ BE_MEMORY: VTYPE_SIZE,
+ }
+BES_PARAMETER_COMPAT.update(BES_PARAMETER_TYPES)
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_PARAMETER_TYPES = {
- ND_OOB_PROGRAM: VTYPE_MAYBE_STRING,
- }
+ ND_OOB_PROGRAM: VTYPE_MAYBE_STRING,
+ }
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"
NIC_VALID_MODES = frozenset([NIC_MODE_BRIDGED, NIC_MODE_ROUTED])
NICS_PARAMETER_TYPES = {
- NIC_MODE: VTYPE_STRING,
- NIC_LINK: VTYPE_STRING,
- }
+ NIC_MODE: VTYPE_STRING,
+ NIC_LINK: VTYPE_STRING,
+ }
NICS_PARAMETERS = frozenset(NICS_PARAMETER_TYPES.keys())
HT_BO_NETWORK
])
+# SPICE lossless image compression options
+HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_GLZ = "auto_glz"
+HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_LZ = "auto_lz"
+HT_KVM_SPICE_LOSSLESS_IMG_COMPR_QUIC = "quic"
+HT_KVM_SPICE_LOSSLESS_IMG_COMPR_GLZ = "glz"
+HT_KVM_SPICE_LOSSLESS_IMG_COMPR_LZ = "lz"
+HT_KVM_SPICE_LOSSLESS_IMG_COMPR_OFF = "off"
+
+HT_KVM_SPICE_VALID_LOSSLESS_IMG_COMPR_OPTIONS = frozenset([
+ HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_GLZ,
+ HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_LZ,
+ HT_KVM_SPICE_LOSSLESS_IMG_COMPR_QUIC,
+ HT_KVM_SPICE_LOSSLESS_IMG_COMPR_GLZ,
+ HT_KVM_SPICE_LOSSLESS_IMG_COMPR_LZ,
+ HT_KVM_SPICE_LOSSLESS_IMG_COMPR_OFF,
+ ])
+
+# SPICE lossy image compression options (valid for both jpeg and zlib-glz)
+HT_KVM_SPICE_LOSSY_IMG_COMPR_AUTO = "auto"
+HT_KVM_SPICE_LOSSY_IMG_COMPR_NEVER = "never"
+HT_KVM_SPICE_LOSSY_IMG_COMPR_ALWAYS = "always"
+
+HT_KVM_SPICE_VALID_LOSSY_IMG_COMPR_OPTIONS = frozenset([
+ HT_KVM_SPICE_LOSSY_IMG_COMPR_AUTO,
+ HT_KVM_SPICE_LOSSY_IMG_COMPR_NEVER,
+ HT_KVM_SPICE_LOSSY_IMG_COMPR_ALWAYS,
+ ])
+
+# SPICE video stream detection
+HT_KVM_SPICE_VIDEO_STREAM_DETECTION_OFF = "off"
+HT_KVM_SPICE_VIDEO_STREAM_DETECTION_ALL = "all"
+HT_KVM_SPICE_VIDEO_STREAM_DETECTION_FILTER = "filter"
+
+HT_KVM_SPICE_VALID_VIDEO_STREAM_DETECTION_OPTIONS = frozenset([
+ HT_KVM_SPICE_VIDEO_STREAM_DETECTION_OFF,
+ HT_KVM_SPICE_VIDEO_STREAM_DETECTION_ALL,
+ HT_KVM_SPICE_VIDEO_STREAM_DETECTION_FILTER,
+ ])
+
# Security models
HT_SM_NONE = "none"
HT_SM_USER = "user"
VERIFY_NPLUSONE_MEM = "nplusone_mem"
VERIFY_OPTIONAL_CHECKS = frozenset([VERIFY_NPLUSONE_MEM])
+# Cluster Verify error classes
+CV_TCLUSTER = "cluster"
+CV_TNODE = "node"
+CV_TINSTANCE = "instance"
+
+# Cluster Verify error codes and documentation
+CV_ECLUSTERCFG = \
+ (CV_TCLUSTER, "ECLUSTERCFG", "Cluster configuration verification failure")
+CV_ECLUSTERCERT = \
+ (CV_TCLUSTER, "ECLUSTERCERT",
+ "Cluster certificate files verification failure")
+CV_ECLUSTERFILECHECK = \
+ (CV_TCLUSTER, "ECLUSTERFILECHECK",
+ "Cluster configuration verification failure")
+CV_ECLUSTERDANGLINGNODES = \
+ (CV_TNODE, "ECLUSTERDANGLINGNODES",
+ "Some nodes belong to non-existing groups")
+CV_ECLUSTERDANGLINGINST = \
+ (CV_TNODE, "ECLUSTERDANGLINGINST",
+ "Some instances have a non-existing primary node")
+CV_EINSTANCEBADNODE = \
+ (CV_TINSTANCE, "EINSTANCEBADNODE",
+ "Instance marked as running lives on an offline node")
+CV_EINSTANCEDOWN = \
+ (CV_TINSTANCE, "EINSTANCEDOWN", "Instance not running on its primary node")
+CV_EINSTANCELAYOUT = \
+ (CV_TINSTANCE, "EINSTANCELAYOUT", "Instance has multiple secondary nodes")
+CV_EINSTANCEMISSINGDISK = \
+ (CV_TINSTANCE, "EINSTANCEMISSINGDISK", "Missing volume on an instance")
+CV_EINSTANCEFAULTYDISK = \
+ (CV_TINSTANCE, "EINSTANCEFAULTYDISK",
+ "Impossible to retrieve status for a disk")
+CV_EINSTANCEWRONGNODE = \
+ (CV_TINSTANCE, "EINSTANCEWRONGNODE", "Instance running on the wrong node")
+CV_EINSTANCESPLITGROUPS = \
+ (CV_TINSTANCE, "EINSTANCESPLITGROUPS",
+ "Instance with primary and secondary nodes in different groups")
+CV_ENODEDRBD = \
+ (CV_TNODE, "ENODEDRBD", "Error parsing the DRBD status file")
+CV_ENODEDRBDHELPER = \
+ (CV_TNODE, "ENODEDRBDHELPER", "Error caused by the DRBD helper")
+CV_ENODEFILECHECK = \
+ (CV_TNODE, "ENODEFILECHECK",
+ "Error retrieving the checksum of the node files")
+CV_ENODEHOOKS = \
+ (CV_TNODE, "ENODEHOOKS", "Communication failure in hooks execution")
+CV_ENODEHV = \
+ (CV_TNODE, "ENODEHV", "Hypervisor parameters verification failure")
+CV_ENODELVM = \
+ (CV_TNODE, "ENODELVM", "LVM-related node error")
+CV_ENODEN1 = \
+ (CV_TNODE, "ENODEN1", "Not enough memory to accommodate instance failovers")
+CV_ENODENET = \
+ (CV_TNODE, "ENODENET", "Network-related node error")
+CV_ENODEOS = \
+ (CV_TNODE, "ENODEOS", "OS-related node error")
+CV_ENODEORPHANINSTANCE = \
+ (CV_TNODE, "ENODEORPHANINSTANCE", "Unknown intance running on a node")
+CV_ENODEORPHANLV = \
+ (CV_TNODE, "ENODEORPHANLV", "Unknown LVM logical volume")
+CV_ENODERPC = \
+ (CV_TNODE, "ENODERPC",
+ "Error during connection to the primary node of an instance")
+CV_ENODESSH = \
+ (CV_TNODE, "ENODESSH", "SSH-related node error")
+CV_ENODEVERSION = \
+ (CV_TNODE, "ENODEVERSION",
+ "Protocol version mismatch or Ganeti version mismatch")
+CV_ENODESETUP = \
+ (CV_TNODE, "ENODESETUP", "Node setup error")
+CV_ENODETIME = \
+ (CV_TNODE, "ENODETIME", "Node returned invalid time")
+CV_ENODEOOBPATH = \
+ (CV_TNODE, "ENODEOOBPATH", "Invalid Out Of Band path")
+CV_ENODEUSERSCRIPTS = \
+ (CV_TNODE, "ENODEUSERSCRIPTS", "User scripts not present or not executable")
+
+CV_ALL_ECODES = frozenset([
+ CV_ECLUSTERCFG,
+ CV_ECLUSTERCERT,
+ CV_ECLUSTERFILECHECK,
+ CV_ECLUSTERDANGLINGNODES,
+ CV_ECLUSTERDANGLINGINST,
+ CV_EINSTANCEBADNODE,
+ CV_EINSTANCEDOWN,
+ CV_EINSTANCELAYOUT,
+ CV_EINSTANCEMISSINGDISK,
+ CV_EINSTANCEFAULTYDISK,
+ CV_EINSTANCEWRONGNODE,
+ CV_EINSTANCESPLITGROUPS,
+ CV_ENODEDRBD,
+ CV_ENODEDRBDHELPER,
+ CV_ENODEFILECHECK,
+ CV_ENODEHOOKS,
+ CV_ENODEHV,
+ CV_ENODELVM,
+ CV_ENODEN1,
+ CV_ENODENET,
+ CV_ENODEOS,
+ CV_ENODEORPHANINSTANCE,
+ CV_ENODEORPHANLV,
+ CV_ENODERPC,
+ CV_ENODESSH,
+ CV_ENODEVERSION,
+ CV_ENODESETUP,
+ CV_ENODETIME,
+ CV_ENODEOOBPATH,
+ CV_ENODEUSERSCRIPTS,
+ ])
+
+CV_ALL_ECODES_STRINGS = frozenset(estr for (_, estr, _) in CV_ALL_ECODES)
+
# Node verify constants
NV_DRBDHELPER = "drbd-helper"
NV_DRBDLIST = "drbd-list"
NV_VMNODES = "vmnodes"
NV_OOB_PATHS = "oob-paths"
NV_BRIDGES = "bridges"
+NV_USERSCRIPTS = "user-scripts"
# Instance status
INSTST_RUNNING = "running"
INSTST_ADMINDOWN = "ADMIN_down"
+INSTST_ADMINOFFLINE = "ADMIN_offline"
INSTST_NODEOFFLINE = "ERROR_nodeoffline"
INSTST_NODEDOWN = "ERROR_nodedown"
INSTST_WRONGNODE = "ERROR_wrongnode"
INSTST_ALL = frozenset([
INSTST_RUNNING,
INSTST_ADMINDOWN,
+ INSTST_ADMINOFFLINE,
INSTST_NODEOFFLINE,
INSTST_NODEDOWN,
INSTST_WRONGNODE,
INSTST_ERRORDOWN,
])
+# Admin states
+ADMINST_UP = "up"
+ADMINST_DOWN = "down"
+ADMINST_OFFLINE = "offline"
+ADMINST_ALL = frozenset([
+ ADMINST_UP,
+ ADMINST_DOWN,
+ ADMINST_OFFLINE,
+ ])
+
# Node roles
NR_REGULAR = "R"
NR_MASTER = "M"
])
IALLOCATOR_MODE_ALLOC = "allocate"
IALLOCATOR_MODE_RELOC = "relocate"
-IALLOCATOR_MODE_MEVAC = "multi-evacuate"
IALLOCATOR_MODE_CHG_GROUP = "change-group"
IALLOCATOR_MODE_NODE_EVAC = "node-evacuate"
VALID_IALLOCATOR_MODES = frozenset([
IALLOCATOR_MODE_ALLOC,
IALLOCATOR_MODE_RELOC,
- IALLOCATOR_MODE_MEVAC,
IALLOCATOR_MODE_CHG_GROUP,
IALLOCATOR_MODE_NODE_EVAC,
])
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"
JOB_QUEUE_DIRS_MODE = SECURE_DIR_MODE
JOB_ID_TEMPLATE = r"\d+"
+JOB_FILE_RE = re.compile(r"^job-(%s)$" % JOB_ID_TEMPLATE)
# unchanged job return
JOB_NOTCHANGED = "nochange"
#: Dictionary with special field cases and their verbose/terse formatting
RSS_DESCRIPTION = {
RS_UNKNOWN: ("(unknown)", "??"),
- RS_NODATA: ("(nodata)", "?"),
+ RS_NODATA: ("(nodata)", "?"),
RS_OFFLINE: ("(offline)", "*"),
RS_UNAVAIL: ("(unavail)", "-"),
}
SS_MASTER_CANDIDATES_IPS = "master_candidates_ips"
SS_MASTER_IP = "master_ip"
SS_MASTER_NETDEV = "master_netdev"
+SS_MASTER_NETMASK = "master_netmask"
SS_MASTER_NODE = "master_node"
SS_NODE_LIST = "node_list"
SS_NODE_PRIMARY_IPS = "node_primary_ips"
SS_UID_POOL = "uid_pool"
SS_NODEGROUPS = "nodegroups"
+SS_FILE_PERMS = 0444
+
# cluster wide default parameters
DEFAULT_ENABLED_HYPERVISOR = HT_XEN_PVM
HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
HV_BLOCKDEV_PREFIX: "sd",
HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
+ HV_CPU_MASK: CPU_PINNING_ALL,
},
HT_XEN_HVM: {
HV_BOOT_ORDER: "cd",
HV_USE_LOCALTIME: False,
HV_BLOCKDEV_PREFIX: "hd",
HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
+ HV_CPU_MASK: CPU_PINNING_ALL,
},
HT_KVM: {
HV_KERNEL_PATH: "/boot/vmlinuz-2.6-kvmU",
HV_VNC_X509: "",
HV_VNC_X509_VERIFY: False,
HV_VNC_PASSWORD_FILE: "",
+ HV_KVM_SPICE_BIND: "",
+ HV_KVM_SPICE_IP_VERSION: IFACE_NO_IP_VERSION_SPECIFIED,
+ HV_KVM_SPICE_PASSWORD_FILE: "",
+ HV_KVM_SPICE_LOSSLESS_IMG_COMPR: "",
+ HV_KVM_SPICE_JPEG_IMG_COMPR: "",
+ HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR: "",
+ HV_KVM_SPICE_STREAMING_VIDEO_DETECTION: "",
+ HV_KVM_SPICE_AUDIO_COMPR: True,
+ HV_KVM_SPICE_USE_TLS: False,
+ HV_KVM_SPICE_TLS_CIPHERS: OPENSSL_CIPHERS,
+ HV_KVM_SPICE_USE_VDAGENT: True,
HV_KVM_FLOPPY_IMAGE_PATH: "",
HV_CDROM_IMAGE_PATH: "",
HV_KVM_CDROM2_IMAGE_PATH: "",
HV_KVM_USE_CHROOT: False,
HV_MEM_PATH: "",
HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
+ HV_CPU_MASK: CPU_PINNING_ALL,
},
HT_FAKE: {
},
])
BEC_DEFAULTS = {
- BE_MEMORY: 128,
+ BE_MINMEM: 128,
+ 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
# User-id pool minimum/maximum acceptable user-ids.
UIDPOOL_UID_MIN = 0
-UIDPOOL_UID_MAX = 2**32-1 # Assuming 32 bit user-ids
+UIDPOOL_UID_MAX = 2 ** 32 - 1 # Assuming 32 bit user-ids
# Name or path of the pgrep command
PGREP = "pgrep"
# Temporary external/shared storage parameters
BLOCKDEV_DRIVER_MANUAL = "manual"
+# qemu-img path, required for ovfconverter
+QEMUIMG_PATH = _autoconf.QEMUIMG_PATH
+
# Whether htools was enabled at compilation time
HTOOLS = _autoconf.HTOOLS
# The hail iallocator
IALLOC_HAIL = "hail"
+
+# Fake opcodes for functions that have hooks attached to them via
+# backend.RunLocalHooks
+FAKE_OP_MASTER_TURNUP = "OP_CLUSTER_IP_TURNUP"
+FAKE_OP_MASTER_TURNDOWN = "OP_CLUSTER_IP_TURNDOWN"
+
+# Do not re-export imported modules
+del re, _vcsversion, _autoconf