import re
import socket
-from ganeti import _autoconf
+from ganeti import _constants
from ganeti import _vcsversion
from ganeti import compat
from ganeti import pathutils
# various versions
-RELEASE_VERSION = _autoconf.PACKAGE_VERSION
-OS_API_V10 = 10
-OS_API_V15 = 15
-OS_API_V20 = 20
-OS_API_VERSIONS = compat.UniqueFrozenset([
- OS_API_V10,
- OS_API_V15,
- OS_API_V20,
- ])
+RELEASE_VERSION = _constants.RELEASE_VERSION
+OS_API_V10 = _constants.OS_API_V10
+OS_API_V15 = _constants.OS_API_V15
+OS_API_V20 = _constants.OS_API_V20
+OS_API_VERSIONS = _constants.OS_API_VERSIONS
VCS_VERSION = _vcsversion.VCS_VERSION
-EXPORT_VERSION = 0
-RAPI_VERSION = 2
-
-
-# Format for CONFIG_VERSION:
-# 01 03 0123 = 01030123
-# ^^ ^^ ^^^^
-# | | + Configuration version/revision
-# | + Minor version
-# + Major version
-#
-# It is stored as an integer. Make sure not to write an octal number.
+EXPORT_VERSION = _constants.EXPORT_VERSION
+RAPI_VERSION = _constants.RAPI_VERSION
-# BuildVersion and SplitVersion must be in here because we can't import other
-# modules. The cfgupgrade tool must be able to read and write version numbers
-# and thus requires these functions. To avoid code duplication, they're kept in
-# here.
+VERSION_MAJOR = _constants.VERSION_MAJOR
+VERSION_MINOR = _constants.VERSION_MINOR
+VERSION_REVISION = _constants.VERSION_REVISION
-def BuildVersion(major, minor, revision):
- """Calculates int version number from major, minor and revision numbers.
+DIR_VERSION = _constants.DIR_VERSION
- Returns: int representing version number
+CONFIG_MAJOR = _constants.CONFIG_MAJOR
+CONFIG_MINOR = _constants.CONFIG_MINOR
+CONFIG_REVISION = _constants.CONFIG_REVISION
+CONFIG_VERSION = _constants.CONFIG_VERSION
- """
- assert isinstance(major, int)
- assert isinstance(minor, int)
- assert isinstance(revision, int)
- return (1000000 * major +
- 10000 * minor +
- 1 * revision)
-
-
-def SplitVersion(version):
- """Splits version number stored in an int.
+#: RPC protocol version
+PROTOCOL_VERSION = _constants.PROTOCOL_VERSION
- Returns: tuple; (major, minor, revision)
+# user separation
+DAEMONS_GROUP = _constants.DAEMONS_GROUP
+ADMIN_GROUP = _constants.ADMIN_GROUP
+MASTERD_USER = _constants.MASTERD_USER
+MASTERD_GROUP = _constants.MASTERD_GROUP
+RAPI_USER = _constants.RAPI_USER
+RAPI_GROUP = _constants.RAPI_GROUP
+CONFD_USER = _constants.CONFD_USER
+CONFD_GROUP = _constants.CONFD_GROUP
+LUXID_USER = _constants.LUXID_USER
+LUXID_GROUP = _constants.LUXID_GROUP
+NODED_USER = _constants.NODED_USER
+NODED_GROUP = _constants.NODED_GROUP
+MOND_USER = _constants.MOND_USER
+MOND_GROUP = _constants.MOND_GROUP
+SSH_LOGIN_USER = _constants.SSH_LOGIN_USER
+SSH_CONSOLE_USER = _constants.SSH_CONSOLE_USER
+
+CPU_PINNING_SEP = _constants.CPU_PINNING_SEP
+CPU_PINNING_ALL = _constants.CPU_PINNING_ALL
+CPU_PINNING_ALL_VAL = _constants.CPU_PINNING_ALL_VAL
+CPU_PINNING_OFF = _constants.CPU_PINNING_OFF
+
+CPU_PINNING_ALL_XEN = _constants.CPU_PINNING_ALL_XEN
+
+CPU_PINNING_ALL_KVM = _constants.CPU_PINNING_ALL_KVM
+
+DD_CMD = _constants.DD_CMD
+MAX_WIPE_CHUNK = _constants.MAX_WIPE_CHUNK
+MIN_WIPE_CHUNK_PERCENT = _constants.MIN_WIPE_CHUNK_PERCENT
+
+RUN_DIRS_MODE = _constants.RUN_DIRS_MODE
+SECURE_DIR_MODE = _constants.SECURE_DIR_MODE
+SECURE_FILE_MODE = _constants.SECURE_FILE_MODE
+ADOPTABLE_BLOCKDEV_ROOT = _constants.ADOPTABLE_BLOCKDEV_ROOT
+ENABLE_CONFD = _constants.ENABLE_CONFD
+ENABLE_MOND = _constants.ENABLE_MOND
+ENABLE_SPLIT_QUERY = _constants.ENABLE_SPLIT_QUERY
+ENABLE_RESTRICTED_COMMANDS = _constants.ENABLE_RESTRICTED_COMMANDS
- """
- assert isinstance(version, int)
+# SSH constants
+SSH = _constants.SSH
+SCP = _constants.SCP
- (major, remainder) = divmod(version, 1000000)
- (minor, revision) = divmod(remainder, 10000)
+NODED = _constants.NODED
+CONFD = _constants.CONFD
+LUXID = _constants.LUXID
+RAPI = _constants.RAPI
+MASTERD = _constants.MASTERD
+MOND = _constants.MOND
- return (major, minor, revision)
+DAEMONS = _constants.DAEMONS
+DAEMONS_PORTS = _constants.DAEMONS_PORTS
-CONFIG_MAJOR = int(_autoconf.VERSION_MAJOR)
-CONFIG_MINOR = int(_autoconf.VERSION_MINOR)
-CONFIG_REVISION = 0
-CONFIG_VERSION = BuildVersion(CONFIG_MAJOR, CONFIG_MINOR, CONFIG_REVISION)
+DEFAULT_NODED_PORT = _constants.DEFAULT_NODED_PORT
+DEFAULT_CONFD_PORT = _constants.DEFAULT_CONFD_PORT
+DEFAULT_MOND_PORT = _constants.DEFAULT_MOND_PORT
+DEFAULT_RAPI_PORT = _constants.DEFAULT_RAPI_PORT
-#: RPC protocol version
-PROTOCOL_VERSION = BuildVersion(CONFIG_MAJOR, CONFIG_MINOR, 0)
+FIRST_DRBD_PORT = _constants.FIRST_DRBD_PORT
+LAST_DRBD_PORT = _constants.LAST_DRBD_PORT
-# user separation
-DAEMONS_GROUP = _autoconf.DAEMONS_GROUP
-ADMIN_GROUP = _autoconf.ADMIN_GROUP
-MASTERD_USER = _autoconf.MASTERD_USER
-MASTERD_GROUP = _autoconf.MASTERD_GROUP
-RAPI_USER = _autoconf.RAPI_USER
-RAPI_GROUP = _autoconf.RAPI_GROUP
-CONFD_USER = _autoconf.CONFD_USER
-CONFD_GROUP = _autoconf.CONFD_GROUP
-LUXID_USER = _autoconf.LUXID_USER
-LUXID_GROUP = _autoconf.LUXID_GROUP
-NODED_USER = _autoconf.NODED_USER
-NODED_GROUP = _autoconf.NODED_GROUP
-MOND_USER = _autoconf.MOND_USER
-MOND_GROUP = _autoconf.MOND_GROUP
-SSH_LOGIN_USER = _autoconf.SSH_LOGIN_USER
-SSH_CONSOLE_USER = _autoconf.SSH_CONSOLE_USER
-
-# 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.
-# FIXME: This only works for machines with up to 32 CPU cores
-CPU_PINNING_ALL_KVM = 0xFFFFFFFF
-
-# Wipe
-DD_CMD = "dd"
-MAX_WIPE_CHUNK = 1024 # 1GB
-MIN_WIPE_CHUNK_PERCENT = 10
-
-RUN_DIRS_MODE = 0775
-SECURE_DIR_MODE = 0700
-SECURE_FILE_MODE = 0600
-ADOPTABLE_BLOCKDEV_ROOT = "/dev/disk/"
-ENABLE_SHARED_FILE_STORAGE = _autoconf.ENABLE_SHARED_FILE_STORAGE
-ENABLE_CONFD = _autoconf.ENABLE_CONFD
-ENABLE_MOND = _autoconf.ENABLE_MOND
-ENABLE_SPLIT_QUERY = _autoconf.ENABLE_SPLIT_QUERY
-ENABLE_RESTRICTED_COMMANDS = _autoconf.ENABLE_RESTRICTED_COMMANDS
-
-# SSH constants
-SSH = "ssh"
-SCP = "scp"
-
-NODED = "ganeti-noded"
-CONFD = "ganeti-confd"
-LUXID = "ganeti-luxid"
-RAPI = "ganeti-rapi"
-MASTERD = "ganeti-masterd"
-MOND = "ganeti-mond"
-
-DAEMONS = compat.UniqueFrozenset([
- NODED,
- CONFD,
- LUXID,
- RAPI,
- MASTERD,
- MOND,
- ])
-
-DAEMONS_PORTS = {
- # daemon-name: ("proto", "default-port")
- NODED: ("tcp", 1811),
- CONFD: ("udp", 1814),
- MOND: ("tcp", 1815),
- RAPI: ("tcp", 5080),
- SSH: ("tcp", 22),
-}
-
-DEFAULT_NODED_PORT = DAEMONS_PORTS[NODED][1]
-DEFAULT_CONFD_PORT = DAEMONS_PORTS[CONFD][1]
-DEFAULT_MOND_PORT = DAEMONS_PORTS[MOND][1]
-DEFAULT_RAPI_PORT = DAEMONS_PORTS[RAPI][1]
-
-FIRST_DRBD_PORT = 11000
-LAST_DRBD_PORT = 14999
-
-DAEMONS_LOGBASE = {
- NODED: "node-daemon",
- CONFD: "conf-daemon",
- LUXID: "luxi-daemon",
- RAPI: "rapi-daemon",
- MASTERD: "master-daemon",
- MOND: "monitoring-daemon",
- }
+DAEMONS_LOGBASE = _constants.DAEMONS_LOGBASE
DAEMONS_LOGFILES = \
dict((daemon, pathutils.GetLogFilename(DAEMONS_LOGBASE[daemon]))
# These are the extra logfiles, grouped by daemon
DAEMONS_EXTRA_LOGBASE = {
MOND: {
- EXTRA_LOGREASON_ACCESS: "monitoring-daemon-access",
- EXTRA_LOGREASON_ERROR: "monitoring-daemon-error",
+ EXTRA_LOGREASON_ACCESS: _constants.EXTRA_LOGREASON_ACCESS,
+ EXTRA_LOGREASON_ERROR: _constants.EXTRA_LOGREASON_ERROR,
}
}
for extra in DAEMONS_EXTRA_LOGBASE[daemon]))
for daemon in DAEMONS_EXTRA_LOGBASE)
-DEV_CONSOLE = "/dev/console"
+DEV_CONSOLE = _constants.DEV_CONSOLE
-PROC_MOUNTS = "/proc/mounts"
-
-# Local UniX Interface related constants
-LUXI_EOM = "\3"
-LUXI_VERSION = CONFIG_VERSION
-#: Environment variable for the luxi override socket
-LUXI_OVERRIDE = "FORCE_LUXI_SOCKET"
-LUXI_OVERRIDE_MASTER = "master"
-LUXI_OVERRIDE_QUERY = "query"
+PROC_MOUNTS = _constants.PROC_MOUNTS
+LUXI_EOM = _constants.LUXI_EOM
+LUXI_VERSION = _constants.LUXI_VERSION
+LUXI_OVERRIDE = _constants.LUXI_OVERRIDE
+LUXI_OVERRIDE_MASTER = _constants.LUXI_OVERRIDE_MASTER
+LUXI_OVERRIDE_QUERY = _constants.LUXI_OVERRIDE_QUERY
# one of "no", "yes", "only"
-SYSLOG_USAGE = _autoconf.SYSLOG_USAGE
-SYSLOG_NO = "no"
-SYSLOG_YES = "yes"
-SYSLOG_ONLY = "only"
-SYSLOG_SOCKET = "/dev/log"
-
-EXPORT_CONF_FILE = "config.ini"
-
-XEN_BOOTLOADER = _autoconf.XEN_BOOTLOADER
-XEN_KERNEL = _autoconf.XEN_KERNEL
-XEN_INITRD = _autoconf.XEN_INITRD
-XEN_CMD_XM = "xm"
-XEN_CMD_XL = "xl"
-
-KNOWN_XEN_COMMANDS = compat.UniqueFrozenset([
- XEN_CMD_XM,
- XEN_CMD_XL,
- ])
+SYSLOG_USAGE = _constants.SYSLOG_USAGE
+SYSLOG_NO = _constants.SYSLOG_NO
+SYSLOG_YES = _constants.SYSLOG_YES
+SYSLOG_ONLY = _constants.SYSLOG_ONLY
+SYSLOG_SOCKET = _constants.SYSLOG_SOCKET
+
+EXPORT_CONF_FILE = _constants.EXPORT_CONF_FILE
+
+XEN_BOOTLOADER = _constants.XEN_BOOTLOADER
+XEN_KERNEL = _constants.XEN_KERNEL
+XEN_INITRD = _constants.XEN_INITRD
+XEN_CMD_XM = _constants.XEN_CMD_XM
+XEN_CMD_XL = _constants.XEN_CMD_XL
+KNOWN_XEN_COMMANDS = _constants.KNOWN_XEN_COMMANDS
# When the Xen toolstack used is "xl", live migration requires the source host
# to connect to the target host via ssh (xl runs this command). We need to pass
" -oHostKeyAlias=%%s") % (SSH_LOGIN_USER,
pathutils.SSH_KNOWN_HOSTS_FILE)
-KVM_PATH = _autoconf.KVM_PATH
-KVM_KERNEL = _autoconf.KVM_KERNEL
-SOCAT_PATH = _autoconf.SOCAT_PATH
-SOCAT_USE_ESCAPE = _autoconf.SOCAT_USE_ESCAPE
-SOCAT_USE_COMPRESS = _autoconf.SOCAT_USE_COMPRESS
-SOCAT_ESCAPE_CODE = "0x1d"
-
-#: Console as SSH command
-CONS_SSH = "ssh"
-
-#: Console as VNC server
-CONS_VNC = "vnc"
+KVM_PATH = _constants.KVM_PATH
+KVM_KERNEL = _constants.KVM_KERNEL
+SOCAT_PATH = _constants.SOCAT_PATH
+SOCAT_USE_ESCAPE = _constants.SOCAT_USE_ESCAPE
+SOCAT_USE_COMPRESS = _constants.SOCAT_USE_COMPRESS
+SOCAT_ESCAPE_CODE = _constants.SOCAT_ESCAPE_CODE
-#: Console as SPICE server
-CONS_SPICE = "spice"
-
-#: Display a message for console access
-CONS_MESSAGE = "msg"
-
-#: All console types
-CONS_ALL = compat.UniqueFrozenset([
- 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
-# 2010 on.
-RSA_KEY_BITS = 2048
+CONS_SSH = _constants.CONS_SSH
+CONS_VNC = _constants.CONS_VNC
+CONS_SPICE = _constants.CONS_SPICE
+CONS_MESSAGE = _constants.CONS_MESSAGE
+CONS_ALL = _constants.CONS_ALL
-# Ciphers allowed for SSL connections. For the format, see ciphers(1). A better
-# way to disable ciphers would be to use the exclamation mark (!), but socat
-# versions below 1.5 can't parse exclamation marks in options properly. When
-# modifying the ciphers, ensure not to accidentially add something after it's
-# been removed. Use the "openssl" utility to check the allowed ciphers, e.g.
-# "openssl ciphers -v HIGH:-DES".
-OPENSSL_CIPHERS = "HIGH:-DES:-3DES:-EXPORT:-ADH"
+RSA_KEY_BITS = _constants.RSA_KEY_BITS
+OPENSSL_CIPHERS = _constants.OPENSSL_CIPHERS
-# Digest used to sign certificates ("openssl x509" uses SHA1 by default)
-X509_CERT_SIGN_DIGEST = "SHA1"
-
-# Default validity of certificates in days
-X509_CERT_DEFAULT_VALIDITY = 365 * 5
-
-# commonName (CN) used in certificates
-X509_CERT_CN = "ganeti.example.com"
-
-X509_CERT_SIGNATURE_HEADER = "X-Ganeti-Signature"
+X509_CERT_SIGN_DIGEST = _constants.X509_CERT_SIGN_DIGEST
+X509_CERT_DEFAULT_VALIDITY = _constants.X509_CERT_DEFAULT_VALIDITY
+X509_CERT_CN = _constants.X509_CERT_CN
+X509_CERT_SIGNATURE_HEADER = _constants.X509_CERT_SIGNATURE_HEADER
# Import/export daemon mode
-IEM_IMPORT = "import"
-IEM_EXPORT = "export"
+IEM_IMPORT = _constants.IEM_IMPORT
+IEM_EXPORT = _constants.IEM_EXPORT
# Import/export transport compression
-IEC_NONE = "none"
-IEC_GZIP = "gzip"
-IEC_ALL = compat.UniqueFrozenset([
- IEC_NONE,
- IEC_GZIP,
- ])
+IEC_NONE = _constants.IEC_NONE
+IEC_GZIP = _constants.IEC_GZIP
+IEC_ALL = _constants.IEC_ALL
-IE_CUSTOM_SIZE = "fd"
+IE_CUSTOM_SIZE = _constants.IE_CUSTOM_SIZE
IE_MAGIC_RE = re.compile(r"^[-_.a-zA-Z0-9]{5,100}$")
-# Import/export I/O
-# Direct file I/O, equivalent to a shell's I/O redirection using '<' or '>'
-IEIO_FILE = "file"
-# Raw block device I/O using "dd"
-IEIO_RAW_DISK = "raw"
-# OS definition import/export script
-IEIO_SCRIPT = "script"
+IEIO_FILE = _constants.IEIO_FILE
+IEIO_RAW_DISK = _constants.IEIO_RAW_DISK
+IEIO_SCRIPT = _constants.IEIO_SCRIPT
VALUE_DEFAULT = "default"
VALUE_AUTO = "auto"
# External script validation mask
EXT_PLUGIN_MASK = re.compile("^[a-zA-Z0-9_-]+$")
-# hooks-related constants
-HOOKS_PHASE_PRE = "pre"
-HOOKS_PHASE_POST = "post"
-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"
-HTYPE_NODE = "NODE"
-HTYPE_GROUP = "GROUP"
-HTYPE_INSTANCE = "INSTANCE"
-HTYPE_NETWORK = "NETWORK"
-
-HKR_SKIP = 0
-HKR_FAIL = 1
-HKR_SUCCESS = 2
+HOOKS_PHASE_PRE = _constants.HOOKS_PHASE_PRE
+HOOKS_PHASE_POST = _constants.HOOKS_PHASE_POST
+HOOKS_NAME_CFGUPDATE = _constants.HOOKS_NAME_CFGUPDATE
+HOOKS_NAME_WATCHER = _constants.HOOKS_NAME_WATCHER
+HOOKS_VERSION = _constants.HOOKS_VERSION
+HOOKS_PATH = _constants.HOOKS_PATH
-# Storage types
-ST_BLOCK = "blockdev"
-ST_DISKLESS = "diskless"
-ST_EXT = "ext"
-ST_FILE = "file"
-ST_LVM_PV = "lvm-pv"
-ST_LVM_VG = "lvm-vg"
-ST_RADOS = "rados"
-
-STORAGE_TYPES = compat.UniqueFrozenset([
- ST_BLOCK,
- ST_DISKLESS,
- ST_EXT,
- ST_FILE,
- ST_LVM_PV,
- ST_LVM_VG,
- ST_RADOS,
- ])
+HTYPE_CLUSTER = _constants.HTYPE_CLUSTER
+HTYPE_NODE = _constants.HTYPE_NODE
+HTYPE_GROUP = _constants.HTYPE_GROUP
+HTYPE_INSTANCE = _constants.HTYPE_INSTANCE
+HTYPE_NETWORK = _constants.HTYPE_NETWORK
-# the set of storage types for which storage reporting is available
-# FIXME: Remove this, once storage reporting is available for all types.
-STS_REPORT = compat.UniqueFrozenset([ST_FILE, ST_LVM_PV, ST_LVM_VG])
+HKR_SKIP = _constants.HKR_SKIP
+HKR_FAIL = _constants.HKR_FAIL
+HKR_SUCCESS = _constants.HKR_SUCCESS
+
+# Storage types
+ST_BLOCK = _constants.ST_BLOCK
+ST_DISKLESS = _constants.ST_DISKLESS
+ST_EXT = _constants.ST_EXT
+ST_FILE = _constants.ST_FILE
+ST_LVM_PV = _constants.ST_LVM_PV
+ST_LVM_VG = _constants.ST_LVM_VG
+ST_RADOS = _constants.ST_RADOS
+STORAGE_TYPES = _constants.STORAGE_TYPES
+STS_REPORT = _constants.STS_REPORT
# Storage fields
# first two are valid in LU context only, not passed to backend
-SF_NODE = "node"
-SF_TYPE = "type"
+SF_NODE = _constants.SF_NODE
+SF_TYPE = _constants.SF_TYPE
# and the rest are valid in backend
-SF_NAME = "name"
-SF_SIZE = "size"
-SF_FREE = "free"
-SF_USED = "used"
-SF_ALLOCATABLE = "allocatable"
-
-# Storage operations
-SO_FIX_CONSISTENCY = "fix-consistency"
-
-# Available fields per storage type
-VALID_STORAGE_FIELDS = compat.UniqueFrozenset([
- SF_NAME,
- SF_TYPE,
- SF_SIZE,
- SF_USED,
- SF_FREE,
- SF_ALLOCATABLE,
- ])
-
-MODIFIABLE_STORAGE_FIELDS = {
- ST_LVM_PV: frozenset([SF_ALLOCATABLE]),
- }
-
-VALID_STORAGE_OPERATIONS = {
- ST_LVM_VG: frozenset([SO_FIX_CONSISTENCY]),
- }
-
-# Local disk status
-# Note: Code depends on LDS_OKAY < LDS_UNKNOWN < LDS_FAULTY
-(LDS_OKAY,
- LDS_UNKNOWN,
- LDS_FAULTY) = range(1, 4)
-
-LDS_NAMES = {
- LDS_OKAY: "ok",
- LDS_UNKNOWN: "unknown",
- LDS_FAULTY: "faulty",
-}
+SF_NAME = _constants.SF_NAME
+SF_SIZE = _constants.SF_SIZE
+SF_FREE = _constants.SF_FREE
+SF_USED = _constants.SF_USED
+SF_ALLOCATABLE = _constants.SF_ALLOCATABLE
+VALID_STORAGE_FIELDS = _constants.VALID_STORAGE_FIELDS
+MODIFIABLE_STORAGE_FIELDS = _constants.MODIFIABLE_STORAGE_FIELDS
+
+SO_FIX_CONSISTENCY = _constants.SO_FIX_CONSISTENCY
+VALID_STORAGE_OPERATIONS = _constants.VALID_STORAGE_OPERATIONS
+
+VF_DEV = _constants.VF_DEV
+VF_INSTANCE = _constants.VF_INSTANCE
+VF_NAME = _constants.VF_NAME
+VF_NODE = _constants.VF_NODE
+VF_PHYS = _constants.VF_PHYS
+VF_SIZE = _constants.VF_SIZE
+VF_VG = _constants.VF_VG
+
+LDS_OKAY = _constants.LDS_OKAY
+LDS_UNKNOWN = _constants.LDS_UNKNOWN
+LDS_FAULTY = _constants.LDS_FAULTY
+LDS_NAMES = _constants.LDS_NAMES
# disk template types
-DT_BLOCK = "blockdev"
-DT_DISKLESS = "diskless"
-DT_DRBD8 = "drbd"
-DT_EXT = "ext"
-DT_FILE = "file"
-DT_PLAIN = "plain"
-DT_RBD = "rbd"
-DT_SHARED_FILE = "sharedfile"
-
-# This is used to order determine the default disk template when the list
-# of enabled disk templates is inferred from the current state of the cluster.
-# This only happens on an upgrade from a version of Ganeti that did not
-# support the 'enabled_disk_templates' so far.
-DISK_TEMPLATE_PREFERENCE = [
- DT_BLOCK,
- DT_DISKLESS,
- DT_DRBD8,
- DT_EXT,
- DT_FILE,
- DT_PLAIN,
- DT_RBD,
- DT_SHARED_FILE,
- ]
-
-DISK_TEMPLATES = compat.UniqueFrozenset([
- DT_DISKLESS,
- DT_PLAIN,
- DT_DRBD8,
- DT_FILE,
- DT_SHARED_FILE,
- DT_BLOCK,
- DT_RBD,
- DT_EXT
- ])
-
-# disk templates that are enabled by default
-DEFAULT_ENABLED_DISK_TEMPLATES = [
- DT_DRBD8,
- DT_PLAIN,
- ]
-
-# mapping of disk templates to storage types
-MAP_DISK_TEMPLATE_STORAGE_TYPE = {
- DT_BLOCK: ST_BLOCK,
- DT_DISKLESS: ST_DISKLESS,
- DT_DRBD8: ST_LVM_VG,
- DT_EXT: ST_EXT,
- DT_FILE: ST_FILE,
- DT_PLAIN: ST_LVM_VG,
- DT_RBD: ST_RADOS,
- DT_SHARED_FILE: ST_FILE,
- }
-
-# the set of network-mirrored disk templates
-DTS_INT_MIRROR = compat.UniqueFrozenset([DT_DRBD8])
-
-# the set of externally-mirrored disk templates (e.g. SAN, NAS)
-DTS_EXT_MIRROR = compat.UniqueFrozenset([
- DT_DISKLESS, # 'trivially' externally mirrored
- DT_SHARED_FILE,
- DT_BLOCK,
- DT_RBD,
- DT_EXT,
- ])
-
-# the set of non-lvm-based disk templates
-DTS_NOT_LVM = compat.UniqueFrozenset([
- DT_DISKLESS,
- DT_FILE,
- DT_SHARED_FILE,
- DT_BLOCK,
- DT_RBD,
- DT_EXT,
- ])
-
-# the set of disk templates which can be grown
-DTS_GROWABLE = compat.UniqueFrozenset([
- DT_PLAIN,
- DT_DRBD8,
- DT_FILE,
- DT_SHARED_FILE,
- DT_RBD,
- DT_EXT,
- ])
-
-# the set of disk templates that allow adoption
-DTS_MAY_ADOPT = compat.UniqueFrozenset([
- DT_PLAIN,
- DT_BLOCK,
- ])
-
-# the set of disk templates that *must* use adoption
-DTS_MUST_ADOPT = compat.UniqueFrozenset([DT_BLOCK])
-
-# the set of disk templates that allow migrations
-DTS_MIRRORED = frozenset.union(DTS_INT_MIRROR, DTS_EXT_MIRROR)
-
-# the set of file based disk templates
-DTS_FILEBASED = compat.UniqueFrozenset([
- DT_FILE,
- DT_SHARED_FILE,
- ])
-
-# the set of disk templates that can be moved by copying
-# Note: a requirement is that they're not accessed externally or shared between
-# nodes; in particular, sharedfile is not suitable.
-DTS_COPYABLE = compat.UniqueFrozenset([
- DT_FILE,
- DT_PLAIN,
- ])
-
-# the set of disk templates that are supported by exclusive_storage
-DTS_EXCL_STORAGE = compat.UniqueFrozenset([DT_PLAIN])
-
-# templates for which we don't perform checks on free space
-DTS_NO_FREE_SPACE_CHECK = compat.UniqueFrozenset([
- DT_FILE,
- DT_SHARED_FILE,
- DT_RBD,
- DT_EXT,
- ])
-
-# logical disk types
-LD_LV = "lvm"
-LD_DRBD8 = "drbd8"
-LD_FILE = "file"
-LD_BLOCKDEV = "blockdev"
-LD_RBD = "rbd"
-LD_EXT = "ext"
-LOGICAL_DISK_TYPES = compat.UniqueFrozenset([
- LD_LV,
- LD_DRBD8,
- LD_FILE,
- LD_BLOCKDEV,
- LD_RBD,
- LD_EXT,
- ])
-
-LDS_BLOCK = compat.UniqueFrozenset([
- LD_LV,
- LD_DRBD8,
- LD_BLOCKDEV,
- LD_RBD,
- LD_EXT,
- ])
-
-# drbd constants
-DRBD_HMAC_ALG = "md5"
-DRBD_DEFAULT_NET_PROTOCOL = "C"
-DRBD_MIGRATION_NET_PROTOCOL = "C"
-DRBD_STATUS_FILE = "/proc/drbd"
-
-#: Size of DRBD meta block device
-DRBD_META_SIZE = 128
-
-# drbd barrier types
-DRBD_B_NONE = "n"
-DRBD_B_DISK_BARRIERS = "b"
-DRBD_B_DISK_DRAIN = "d"
-DRBD_B_DISK_FLUSH = "f"
+DT_BLOCK = _constants.DT_BLOCK
+DT_DISKLESS = _constants.DT_DISKLESS
+DT_DRBD8 = _constants.DT_DRBD8
+DT_EXT = _constants.DT_EXT
+DT_FILE = _constants.DT_FILE
+DT_PLAIN = _constants.DT_PLAIN
+DT_RBD = _constants.DT_RBD
+DT_SHARED_FILE = _constants.DT_SHARED_FILE
+DISK_TEMPLATE_PREFERENCE = _constants.DISK_TEMPLATE_PREFERENCE
+DISK_TEMPLATES = _constants.DISK_TEMPLATES
+DEFAULT_ENABLED_DISK_TEMPLATES = _constants.DEFAULT_ENABLED_DISK_TEMPLATES
+
+MAP_DISK_TEMPLATE_STORAGE_TYPE = _constants.MAP_DISK_TEMPLATE_STORAGE_TYPE
+
+DTS_INT_MIRROR = _constants.DTS_INT_MIRROR
+DTS_EXT_MIRROR = _constants.DTS_EXT_MIRROR
+DTS_NOT_LVM = _constants.DTS_NOT_LVM
+DTS_GROWABLE = _constants.DTS_GROWABLE
+DTS_MAY_ADOPT = _constants.DTS_MAY_ADOPT
+DTS_MUST_ADOPT = _constants.DTS_MUST_ADOPT
+DTS_MIRRORED = _constants.DTS_MIRRORED
+DTS_FILEBASED = _constants.DTS_FILEBASED
+DTS_COPYABLE = _constants.DTS_COPYABLE
+DTS_EXCL_STORAGE = _constants.DTS_EXCL_STORAGE
+DTS_NO_FREE_SPACE_CHECK = _constants.DTS_NO_FREE_SPACE_CHECK
+DTS_BLOCK = _constants.DTS_BLOCK
+
+DRBD_HMAC_ALG = _constants.DRBD_HMAC_ALG
+DRBD_DEFAULT_NET_PROTOCOL = _constants.DRBD_DEFAULT_NET_PROTOCOL
+DRBD_MIGRATION_NET_PROTOCOL = _constants.DRBD_MIGRATION_NET_PROTOCOL
+DRBD_STATUS_FILE = _constants.DRBD_STATUS_FILE
+DRBD_META_SIZE = _constants.DRBD_META_SIZE
+
+DRBD_B_NONE = _constants.DRBD_B_NONE
+DRBD_B_DISK_BARRIERS = _constants.DRBD_B_DISK_BARRIERS
+DRBD_B_DISK_DRAIN = _constants.DRBD_B_DISK_DRAIN
+DRBD_B_DISK_FLUSH = _constants.DRBD_B_DISK_FLUSH
# Valid barrier combinations: "n" or any non-null subset of "bfd"
DRBD_VALID_BARRIER_OPT = compat.UniqueFrozenset([
frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_FLUSH, DRBD_B_DISK_DRAIN]),
])
-# rbd tool command
-RBD_CMD = "rbd"
+RBD_CMD = _constants.RBD_CMD
-# file backend driver
-FD_LOOP = "loop"
-FD_BLKTAP = "blktap"
+FD_BLKTAP = _constants.FD_BLKTAP
+FD_LOOP = _constants.FD_LOOP
+FILE_DRIVER = _constants.FILE_DRIVER
-# the set of drbd-like disk types
-LDS_DRBD = compat.UniqueFrozenset([LD_DRBD8])
+LDS_DRBD = _constants.LDS_DRBD
# disk access mode
-DISK_RDONLY = "ro"
-DISK_RDWR = "rw"
-DISK_ACCESS_SET = compat.UniqueFrozenset([DISK_RDONLY, DISK_RDWR])
-
-# disk replacement mode
-REPLACE_DISK_PRI = "replace_on_primary" # replace disks on primary
-REPLACE_DISK_SEC = "replace_on_secondary" # replace disks on secondary
-REPLACE_DISK_CHG = "replace_new_secondary" # change secondary node
-REPLACE_DISK_AUTO = "replace_auto"
-REPLACE_MODES = compat.UniqueFrozenset([
- REPLACE_DISK_PRI,
- REPLACE_DISK_SEC,
- REPLACE_DISK_CHG,
- REPLACE_DISK_AUTO,
- ])
+DISK_RDONLY = _constants.DISK_RDONLY
+DISK_RDWR = _constants.DISK_RDWR
+DISK_ACCESS_SET = _constants.DISK_ACCESS_SET
+DISK_USERSPACE = _constants.DISK_USERSPACE
+DISK_KERNELSPACE = _constants.DISK_KERNELSPACE
+DISK_VALID_ACCESS_MODES = _constants.DISK_VALID_ACCESS_MODES
+
+REPLACE_DISK_PRI = _constants.REPLACE_DISK_PRI
+REPLACE_DISK_SEC = _constants.REPLACE_DISK_SEC
+REPLACE_DISK_CHG = _constants.REPLACE_DISK_CHG
+REPLACE_DISK_AUTO = _constants.REPLACE_DISK_AUTO
+REPLACE_MODES = _constants.REPLACE_MODES
# Instance export mode
-EXPORT_MODE_LOCAL = "local"
-EXPORT_MODE_REMOTE = "remote"
-EXPORT_MODES = compat.UniqueFrozenset([
- EXPORT_MODE_LOCAL,
- EXPORT_MODE_REMOTE,
- ])
+EXPORT_MODE_LOCAL = _constants.EXPORT_MODE_LOCAL
+EXPORT_MODE_REMOTE = _constants.EXPORT_MODE_REMOTE
+EXPORT_MODES = _constants.EXPORT_MODES
# instance creation modes
-INSTANCE_CREATE = "create"
-INSTANCE_IMPORT = "import"
-INSTANCE_REMOTE_IMPORT = "remote-import"
-INSTANCE_CREATE_MODES = compat.UniqueFrozenset([
- INSTANCE_CREATE,
- INSTANCE_IMPORT,
- INSTANCE_REMOTE_IMPORT,
- ])
-
-# Remote import/export handshake message and version
-RIE_VERSION = 0
-RIE_HANDSHAKE = "Hi, I'm Ganeti"
-
-# Remote import/export certificate validity in seconds
-RIE_CERT_VALIDITY = 24 * 60 * 60
-
-# Overall timeout for establishing connection
-RIE_CONNECT_TIMEOUT = 180
-
-# Export only: how long to wait per connection attempt (seconds)
-RIE_CONNECT_ATTEMPT_TIMEOUT = 20
-
-# Export only: number of attempts to connect
-RIE_CONNECT_RETRIES = 10
-
-#: Give child process up to 5 seconds to exit after sending a signal
-CHILD_LINGER_TIMEOUT = 5.0
-
-FILE_DRIVER = compat.UniqueFrozenset([FD_LOOP, FD_BLKTAP])
-
-# import/export config options
-INISECT_EXP = "export"
-INISECT_INS = "instance"
-INISECT_HYP = "hypervisor"
-INISECT_BEP = "backend"
-INISECT_OSP = "os"
+INSTANCE_CREATE = _constants.INSTANCE_CREATE
+INSTANCE_IMPORT = _constants.INSTANCE_IMPORT
+INSTANCE_REMOTE_IMPORT = _constants.INSTANCE_REMOTE_IMPORT
+INSTANCE_CREATE_MODES = _constants.INSTANCE_CREATE_MODES
+
+RIE_VERSION = _constants.RIE_VERSION
+RIE_HANDSHAKE = _constants.RIE_HANDSHAKE
+RIE_CERT_VALIDITY = _constants.RIE_CERT_VALIDITY
+RIE_CONNECT_TIMEOUT = _constants.RIE_CONNECT_TIMEOUT
+RIE_CONNECT_ATTEMPT_TIMEOUT = _constants.RIE_CONNECT_ATTEMPT_TIMEOUT
+RIE_CONNECT_RETRIES = _constants.RIE_CONNECT_RETRIES
+CHILD_LINGER_TIMEOUT = _constants.CHILD_LINGER_TIMEOUT
+
+INISECT_EXP = _constants.INISECT_EXP
+INISECT_INS = _constants.INISECT_INS
+INISECT_HYP = _constants.INISECT_HYP
+INISECT_BEP = _constants.INISECT_BEP
+INISECT_OSP = _constants.INISECT_OSP
# dynamic device modification
-DDM_ADD = "add"
-DDM_MODIFY = "modify"
-DDM_REMOVE = "remove"
-DDMS_VALUES = compat.UniqueFrozenset([DDM_ADD, DDM_REMOVE])
-DDMS_VALUES_WITH_MODIFY = (DDMS_VALUES | frozenset([
- DDM_MODIFY,
- ]))
+DDM_ADD = _constants.DDM_ADD
+DDM_MODIFY = _constants.DDM_MODIFY
+DDM_REMOVE = _constants.DDM_REMOVE
+DDMS_VALUES = _constants.DDMS_VALUES
+DDMS_VALUES_WITH_MODIFY = _constants.DDMS_VALUES_WITH_MODIFY
# TODO: DDM_SWAP, DDM_MOVE?
# common exit codes
-EXIT_SUCCESS = 0
-EXIT_FAILURE = 1
-EXIT_NOTCLUSTER = 5
-EXIT_NOTMASTER = 11
-EXIT_NODESETUP_ERROR = 12
-EXIT_CONFIRMATION = 13 # need user confirmation
-
-#: Exit code for query operations with unknown fields
-EXIT_UNKNOWN_FIELD = 14
+EXIT_SUCCESS = _constants.EXIT_SUCCESS
+EXIT_FAILURE = _constants.EXIT_FAILURE
+EXIT_NOTCLUSTER = _constants.EXIT_NOTCLUSTER
+EXIT_NOTMASTER = _constants.EXIT_NOTMASTER
+EXIT_NODESETUP_ERROR = _constants.EXIT_NODESETUP_ERROR
+EXIT_CONFIRMATION = _constants.EXIT_CONFIRMATION
+EXIT_UNKNOWN_FIELD = _constants.EXIT_UNKNOWN_FIELD
# tags
-TAG_CLUSTER = "cluster"
-TAG_NODEGROUP = "nodegroup"
-TAG_NODE = "node"
-TAG_INSTANCE = "instance"
-TAG_NETWORK = "network"
-VALID_TAG_TYPES = compat.UniqueFrozenset([
- TAG_CLUSTER,
- TAG_NODEGROUP,
- TAG_NODE,
- TAG_INSTANCE,
- TAG_NETWORK,
- ])
-MAX_TAG_LEN = 128
-MAX_TAGS_PER_OBJ = 4096
+TAG_CLUSTER = _constants.TAG_CLUSTER
+TAG_NODEGROUP = _constants.TAG_NODEGROUP
+TAG_NODE = _constants.TAG_NODE
+TAG_INSTANCE = _constants.TAG_INSTANCE
+TAG_NETWORK = _constants.TAG_NETWORK
+VALID_TAG_TYPES = _constants.VALID_TAG_TYPES
+
+MAX_TAG_LEN = _constants.MAX_TAG_LEN
+MAX_TAGS_PER_OBJ = _constants.MAX_TAGS_PER_OBJ
# others
-DEFAULT_BRIDGE = "xen-br0"
-DEFAULT_OVS = "switch1"
-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 = compat.UniqueFrozenset([IP4_VERSION, IP6_VERSION])
+DEFAULT_BRIDGE = _constants.DEFAULT_BRIDGE
+DEFAULT_OVS = _constants.DEFAULT_OVS
+CLASSIC_DRBD_SYNC_SPEED = _constants.CLASSIC_DRBD_SYNC_SPEED
+IP4_ADDRESS_LOCALHOST = _constants.IP4_ADDRESS_LOCALHOST
+IP4_ADDRESS_ANY = _constants.IP4_ADDRESS_ANY
+IP6_ADDRESS_LOCALHOST = _constants.IP6_ADDRESS_LOCALHOST
+IP6_ADDRESS_ANY = _constants.IP6_ADDRESS_ANY
+IP4_VERSION = _constants.IP4_VERSION
+IP6_VERSION = _constants.IP6_VERSION
+VALID_IP_VERSIONS = _constants.VALID_IP_VERSIONS
# for export to htools
IP4_FAMILY = socket.AF_INET
IP6_FAMILY = socket.AF_INET6
-TCP_PING_TIMEOUT = 10
-DEFAULT_VG = "xenvg"
-DEFAULT_DRBD_HELPER = "/bin/true"
-MIN_VG_SIZE = 20480
-DEFAULT_MAC_PREFIX = "aa:00:00"
-# default maximum instance wait time, in seconds.
-DEFAULT_SHUTDOWN_TIMEOUT = 120
-NODE_MAX_CLOCK_SKEW = 150
-# Time for an intra-cluster disk transfer to wait for a connection
-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"
-
-# runparts results
-(RUNPARTS_SKIP,
- RUNPARTS_RUN,
- RUNPARTS_ERR) = range(3)
-
-RUNPARTS_STATUS = compat.UniqueFrozenset([
- RUNPARTS_SKIP,
- RUNPARTS_RUN,
- RUNPARTS_ERR,
- ])
-
-# RPC constants
-(RPC_ENCODING_NONE,
- RPC_ENCODING_ZLIB_BASE64) = range(2)
-
-# Various time constants for the timeout table
-RPC_TMO_URGENT = 60 # one minute
-RPC_TMO_FAST = 5 * 60 # five minutes
-RPC_TMO_NORMAL = 15 * 60 # 15 minutes
-RPC_TMO_SLOW = 3600 # one hour
-RPC_TMO_4HRS = 4 * 3600
-RPC_TMO_1DAY = 86400
-
-# Timeout for connecting to nodes (seconds)
-RPC_CONNECT_TIMEOUT = 5
-
-# os related constants
-OS_SCRIPT_CREATE = "create"
-OS_SCRIPT_IMPORT = "import"
-OS_SCRIPT_EXPORT = "export"
-OS_SCRIPT_RENAME = "rename"
-OS_SCRIPT_VERIFY = "verify"
-OS_SCRIPTS = compat.UniqueFrozenset([
- OS_SCRIPT_CREATE,
- OS_SCRIPT_IMPORT,
- OS_SCRIPT_EXPORT,
- OS_SCRIPT_RENAME,
- OS_SCRIPT_VERIFY,
- ])
-
-OS_API_FILE = "ganeti_api_version"
-OS_VARIANTS_FILE = "variants.list"
-OS_PARAMETERS_FILE = "parameters.list"
-
-OS_VALIDATE_PARAMETERS = "parameters"
-OS_VALIDATE_CALLS = compat.UniqueFrozenset([OS_VALIDATE_PARAMETERS])
-
-# External Storage (ES) related constants
-ES_ACTION_CREATE = "create"
-ES_ACTION_REMOVE = "remove"
-ES_ACTION_GROW = "grow"
-ES_ACTION_ATTACH = "attach"
-ES_ACTION_DETACH = "detach"
-ES_ACTION_SETINFO = "setinfo"
-ES_ACTION_VERIFY = "verify"
-
-ES_SCRIPT_CREATE = ES_ACTION_CREATE
-ES_SCRIPT_REMOVE = ES_ACTION_REMOVE
-ES_SCRIPT_GROW = ES_ACTION_GROW
-ES_SCRIPT_ATTACH = ES_ACTION_ATTACH
-ES_SCRIPT_DETACH = ES_ACTION_DETACH
-ES_SCRIPT_SETINFO = ES_ACTION_SETINFO
-ES_SCRIPT_VERIFY = ES_ACTION_VERIFY
-ES_SCRIPTS = frozenset([
- ES_SCRIPT_CREATE,
- ES_SCRIPT_REMOVE,
- ES_SCRIPT_GROW,
- ES_SCRIPT_ATTACH,
- ES_SCRIPT_DETACH,
- ES_SCRIPT_SETINFO,
- ES_SCRIPT_VERIFY
- ])
-
-ES_PARAMETERS_FILE = "parameters.list"
+TCP_PING_TIMEOUT = _constants.TCP_PING_TIMEOUT
+DEFAULT_VG = _constants.DEFAULT_VG
+DEFAULT_DRBD_HELPER = _constants.DEFAULT_DRBD_HELPER
+MIN_VG_SIZE = _constants.MIN_VG_SIZE
+DEFAULT_MAC_PREFIX = _constants.DEFAULT_MAC_PREFIX
+DEFAULT_SHUTDOWN_TIMEOUT = _constants.DEFAULT_SHUTDOWN_TIMEOUT
+NODE_MAX_CLOCK_SKEW = _constants.NODE_MAX_CLOCK_SKEW
+DISK_TRANSFER_CONNECT_TIMEOUT = _constants.DISK_TRANSFER_CONNECT_TIMEOUT
+DISK_SEPARATOR = _constants.DISK_SEPARATOR
+IP_COMMAND_PATH = _constants.IP_COMMAND_PATH
+JOB_IDS_KEY = _constants.JOB_IDS_KEY
+
+RUNPARTS_SKIP = _constants.RUNPARTS_SKIP
+RUNPARTS_RUN = _constants.RUNPARTS_RUN
+RUNPARTS_ERR = _constants.RUNPARTS_ERR
+RUNPARTS_STATUS = _constants.RUNPARTS_STATUS
+
+RPC_ENCODING_NONE = _constants.RPC_ENCODING_NONE
+RPC_ENCODING_ZLIB_BASE64 = _constants.RPC_ENCODING_ZLIB_BASE64
+
+RPC_TMO_URGENT = _constants.RPC_TMO_URGENT
+RPC_TMO_FAST = _constants.RPC_TMO_FAST
+RPC_TMO_NORMAL = _constants.RPC_TMO_NORMAL
+RPC_TMO_SLOW = _constants.RPC_TMO_SLOW
+RPC_TMO_4HRS = _constants.RPC_TMO_4HRS
+RPC_TMO_1DAY = _constants.RPC_TMO_1DAY
+RPC_CONNECT_TIMEOUT = _constants.RPC_CONNECT_TIMEOUT
+
+OS_SCRIPT_CREATE = _constants.OS_SCRIPT_CREATE
+OS_SCRIPT_IMPORT = _constants.OS_SCRIPT_IMPORT
+OS_SCRIPT_EXPORT = _constants.OS_SCRIPT_EXPORT
+OS_SCRIPT_RENAME = _constants.OS_SCRIPT_RENAME
+OS_SCRIPT_VERIFY = _constants.OS_SCRIPT_VERIFY
+OS_SCRIPTS = _constants.OS_SCRIPTS
+
+OS_API_FILE = _constants.OS_API_FILE
+OS_VARIANTS_FILE = _constants.OS_VARIANTS_FILE
+OS_PARAMETERS_FILE = _constants.OS_PARAMETERS_FILE
+
+OS_VALIDATE_PARAMETERS = _constants.OS_VALIDATE_PARAMETERS
+OS_VALIDATE_CALLS = _constants.OS_VALIDATE_CALLS
+
+ES_ACTION_CREATE = _constants.ES_ACTION_CREATE
+ES_ACTION_REMOVE = _constants.ES_ACTION_REMOVE
+ES_ACTION_GROW = _constants.ES_ACTION_GROW
+ES_ACTION_ATTACH = _constants.ES_ACTION_ATTACH
+ES_ACTION_DETACH = _constants.ES_ACTION_DETACH
+ES_ACTION_SETINFO = _constants.ES_ACTION_SETINFO
+ES_ACTION_VERIFY = _constants.ES_ACTION_VERIFY
+
+ES_SCRIPT_CREATE = _constants.ES_SCRIPT_CREATE
+ES_SCRIPT_REMOVE = _constants.ES_SCRIPT_REMOVE
+ES_SCRIPT_GROW = _constants.ES_SCRIPT_GROW
+ES_SCRIPT_ATTACH = _constants.ES_SCRIPT_ATTACH
+ES_SCRIPT_DETACH = _constants.ES_SCRIPT_DETACH
+ES_SCRIPT_SETINFO = _constants.ES_SCRIPT_SETINFO
+ES_SCRIPT_VERIFY = _constants.ES_SCRIPT_VERIFY
+ES_SCRIPTS = _constants.ES_SCRIPTS
+
+ES_PARAMETERS_FILE = _constants.ES_PARAMETERS_FILE
# reboot types
-INSTANCE_REBOOT_SOFT = "soft"
-INSTANCE_REBOOT_HARD = "hard"
-INSTANCE_REBOOT_FULL = "full"
-
-REBOOT_TYPES = compat.UniqueFrozenset([
- INSTANCE_REBOOT_SOFT,
- INSTANCE_REBOOT_HARD,
- INSTANCE_REBOOT_FULL,
- ])
-
-# instance reboot behaviors
-INSTANCE_REBOOT_ALLOWED = "reboot"
-INSTANCE_REBOOT_EXIT = "exit"
-
-REBOOT_BEHAVIORS = compat.UniqueFrozenset([
- INSTANCE_REBOOT_ALLOWED,
- INSTANCE_REBOOT_EXIT,
- ])
-
-VTYPE_STRING = "string"
-VTYPE_MAYBE_STRING = "maybe-string"
-VTYPE_BOOL = "bool"
-VTYPE_SIZE = "size" # size, in MiBs
-VTYPE_INT = "int"
-ENFORCEABLE_TYPES = compat.UniqueFrozenset([
- VTYPE_STRING,
- VTYPE_MAYBE_STRING,
- VTYPE_BOOL,
- VTYPE_SIZE,
- VTYPE_INT,
- ])
-
-# Constant representing that the user does not specify any IP version
-IFACE_NO_IP_VERSION_SPECIFIED = 0
-
-VALID_SERIAL_SPEEDS = compat.UniqueFrozenset([
- 75,
- 110,
- 300,
- 600,
- 1200,
- 1800,
- 2400,
- 4800,
- 9600,
- 14400,
- 19200,
- 28800,
- 38400,
- 57600,
- 115200,
- 230400,
- 345600,
- 460800,
- ])
-
-# HV parameter names (global namespace)
-HV_BOOT_ORDER = "boot_order"
-HV_CDROM_IMAGE_PATH = "cdrom_image_path"
-HV_KVM_CDROM2_IMAGE_PATH = "cdrom2_image_path"
-HV_KVM_FLOPPY_IMAGE_PATH = "floppy_image_path"
-HV_NIC_TYPE = "nic_type"
-HV_DISK_TYPE = "disk_type"
-HV_KVM_CDROM_DISK_TYPE = "cdrom_disk_type"
-HV_VNC_BIND_ADDRESS = "vnc_bind_address"
-HV_VNC_PASSWORD_FILE = "vnc_password_file"
-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_BOOTLOADER_ARGS = "bootloader_args"
-HV_BOOTLOADER_PATH = "bootloader_path"
-HV_KERNEL_ARGS = "kernel_args"
-HV_KERNEL_PATH = "kernel_path"
-HV_INITRD_PATH = "initrd_path"
-HV_ROOT_PATH = "root_path"
-HV_SERIAL_CONSOLE = "serial_console"
-HV_SERIAL_SPEED = "serial_speed"
-HV_USB_MOUSE = "usb_mouse"
-HV_KEYMAP = "keymap"
-HV_DEVICE_MODEL = "device_model"
-HV_INIT_SCRIPT = "init_script"
-HV_MIGRATION_PORT = "migration_port"
-HV_MIGRATION_BANDWIDTH = "migration_bandwidth"
-HV_MIGRATION_DOWNTIME = "migration_downtime"
-HV_MIGRATION_MODE = "migration_mode"
-HV_USE_LOCALTIME = "use_localtime"
-HV_DISK_CACHE = "disk_cache"
-HV_SECURITY_MODEL = "security_model"
-HV_SECURITY_DOMAIN = "security_domain"
-HV_KVM_FLAG = "kvm_flag"
-HV_VHOST_NET = "vhost_net"
-HV_KVM_USE_CHROOT = "use_chroot"
-HV_CPU_MASK = "cpu_mask"
-HV_MEM_PATH = "mem_path"
-HV_PASSTHROUGH = "pci_pass"
-HV_BLOCKDEV_PREFIX = "blockdev_prefix"
-HV_REBOOT_BEHAVIOR = "reboot_behavior"
-HV_CPU_TYPE = "cpu_type"
-HV_CPU_CAP = "cpu_cap"
-HV_CPU_WEIGHT = "cpu_weight"
-HV_CPU_CORES = "cpu_cores"
-HV_CPU_THREADS = "cpu_threads"
-HV_CPU_SOCKETS = "cpu_sockets"
-HV_SOUNDHW = "soundhw"
-HV_USB_DEVICES = "usb_devices"
-HV_VGA = "vga"
-HV_KVM_EXTRA = "kvm_extra"
-HV_KVM_MACHINE_VERSION = "machine_version"
-HV_KVM_PATH = "kvm_path"
-HV_VIF_TYPE = "vif_type"
-HV_VIF_SCRIPT = "vif_script"
-HV_XEN_CMD = "xen_cmd"
-HV_VNET_HDR = "vnet_hdr"
-
+INSTANCE_REBOOT_SOFT = _constants.INSTANCE_REBOOT_SOFT
+INSTANCE_REBOOT_HARD = _constants.INSTANCE_REBOOT_HARD
+INSTANCE_REBOOT_FULL = _constants.INSTANCE_REBOOT_FULL
+REBOOT_TYPES = _constants.REBOOT_TYPES
+
+INSTANCE_REBOOT_ALLOWED = _constants.INSTANCE_REBOOT_ALLOWED
+INSTANCE_REBOOT_EXIT = _constants.INSTANCE_REBOOT_EXIT
+REBOOT_BEHAVIORS = _constants.REBOOT_BEHAVIORS
+
+VTYPE_STRING = _constants.VTYPE_STRING
+VTYPE_MAYBE_STRING = _constants.VTYPE_MAYBE_STRING
+VTYPE_BOOL = _constants.VTYPE_BOOL
+VTYPE_SIZE = _constants.VTYPE_SIZE
+VTYPE_INT = _constants.VTYPE_INT
+ENFORCEABLE_TYPES = _constants.ENFORCEABLE_TYPES
+
+IFACE_NO_IP_VERSION_SPECIFIED = _constants.IFACE_NO_IP_VERSION_SPECIFIED
+
+VALID_SERIAL_SPEEDS = _constants.VALID_SERIAL_SPEEDS
+
+HV_BOOT_ORDER = _constants.HV_BOOT_ORDER
+HV_CDROM_IMAGE_PATH = _constants.HV_CDROM_IMAGE_PATH
+HV_KVM_CDROM2_IMAGE_PATH = _constants.HV_KVM_CDROM2_IMAGE_PATH
+HV_KVM_FLOPPY_IMAGE_PATH = _constants.HV_KVM_FLOPPY_IMAGE_PATH
+HV_NIC_TYPE = _constants.HV_NIC_TYPE
+HV_DISK_TYPE = _constants.HV_DISK_TYPE
+HV_KVM_CDROM_DISK_TYPE = _constants.HV_KVM_CDROM_DISK_TYPE
+HV_VNC_BIND_ADDRESS = _constants.HV_VNC_BIND_ADDRESS
+HV_VNC_PASSWORD_FILE = _constants.HV_VNC_PASSWORD_FILE
+HV_VNC_TLS = _constants.HV_VNC_TLS
+HV_VNC_X509 = _constants.HV_VNC_X509
+HV_VNC_X509_VERIFY = _constants.HV_VNC_X509_VERIFY
+HV_KVM_SPICE_BIND = _constants.HV_KVM_SPICE_BIND
+HV_KVM_SPICE_IP_VERSION = _constants.HV_KVM_SPICE_IP_VERSION
+HV_KVM_SPICE_PASSWORD_FILE = _constants.HV_KVM_SPICE_PASSWORD_FILE
+HV_KVM_SPICE_LOSSLESS_IMG_COMPR = _constants.HV_KVM_SPICE_LOSSLESS_IMG_COMPR
+HV_KVM_SPICE_JPEG_IMG_COMPR = _constants.HV_KVM_SPICE_JPEG_IMG_COMPR
+HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR = _constants.HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR
+HV_KVM_SPICE_STREAMING_VIDEO_DETECTION = \
+ _constants.HV_KVM_SPICE_STREAMING_VIDEO_DETECTION
+HV_KVM_SPICE_AUDIO_COMPR = _constants.HV_KVM_SPICE_AUDIO_COMPR
+HV_KVM_SPICE_USE_TLS = _constants.HV_KVM_SPICE_USE_TLS
+HV_KVM_SPICE_TLS_CIPHERS = _constants.HV_KVM_SPICE_TLS_CIPHERS
+HV_KVM_SPICE_USE_VDAGENT = _constants.HV_KVM_SPICE_USE_VDAGENT
+HV_ACPI = _constants.HV_ACPI
+HV_PAE = _constants.HV_PAE
+HV_USE_BOOTLOADER = _constants.HV_USE_BOOTLOADER
+HV_BOOTLOADER_ARGS = _constants.HV_BOOTLOADER_ARGS
+HV_BOOTLOADER_PATH = _constants.HV_BOOTLOADER_PATH
+HV_KERNEL_ARGS = _constants.HV_KERNEL_ARGS
+HV_KERNEL_PATH = _constants.HV_KERNEL_PATH
+HV_INITRD_PATH = _constants.HV_INITRD_PATH
+HV_ROOT_PATH = _constants.HV_ROOT_PATH
+HV_SERIAL_CONSOLE = _constants.HV_SERIAL_CONSOLE
+HV_SERIAL_SPEED = _constants.HV_SERIAL_SPEED
+HV_USB_MOUSE = _constants.HV_USB_MOUSE
+HV_KEYMAP = _constants.HV_KEYMAP
+HV_DEVICE_MODEL = _constants.HV_DEVICE_MODEL
+HV_INIT_SCRIPT = _constants.HV_INIT_SCRIPT
+HV_MIGRATION_PORT = _constants.HV_MIGRATION_PORT
+HV_MIGRATION_BANDWIDTH = _constants.HV_MIGRATION_BANDWIDTH
+HV_MIGRATION_DOWNTIME = _constants.HV_MIGRATION_DOWNTIME
+HV_MIGRATION_MODE = _constants.HV_MIGRATION_MODE
+HV_USE_LOCALTIME = _constants.HV_USE_LOCALTIME
+HV_DISK_CACHE = _constants.HV_DISK_CACHE
+HV_SECURITY_MODEL = _constants.HV_SECURITY_MODEL
+HV_SECURITY_DOMAIN = _constants.HV_SECURITY_DOMAIN
+HV_KVM_FLAG = _constants.HV_KVM_FLAG
+HV_VHOST_NET = _constants.HV_VHOST_NET
+HV_KVM_USE_CHROOT = _constants.HV_KVM_USE_CHROOT
+HV_CPU_MASK = _constants.HV_CPU_MASK
+HV_MEM_PATH = _constants.HV_MEM_PATH
+HV_PASSTHROUGH = _constants.HV_PASSTHROUGH
+HV_BLOCKDEV_PREFIX = _constants.HV_BLOCKDEV_PREFIX
+HV_REBOOT_BEHAVIOR = _constants.HV_REBOOT_BEHAVIOR
+HV_CPU_TYPE = _constants.HV_CPU_TYPE
+HV_CPU_CAP = _constants.HV_CPU_CAP
+HV_CPU_WEIGHT = _constants.HV_CPU_WEIGHT
+HV_CPU_CORES = _constants.HV_CPU_CORES
+HV_CPU_THREADS = _constants.HV_CPU_THREADS
+HV_CPU_SOCKETS = _constants.HV_CPU_SOCKETS
+HV_SOUNDHW = _constants.HV_SOUNDHW
+HV_USB_DEVICES = _constants.HV_USB_DEVICES
+HV_VGA = _constants.HV_VGA
+HV_KVM_EXTRA = _constants.HV_KVM_EXTRA
+HV_KVM_MACHINE_VERSION = _constants.HV_KVM_MACHINE_VERSION
+HV_KVM_PATH = _constants.HV_KVM_PATH
+HV_VIF_TYPE = _constants.HV_VIF_TYPE
+HV_VIF_SCRIPT = _constants.HV_VIF_SCRIPT
+HV_XEN_CMD = _constants.HV_XEN_CMD
+HV_XEN_CPUID = _constants.HV_XEN_CPUID
+HV_VNET_HDR = _constants.HV_VNET_HDR
+HV_VIRIDIAN = _constants.HV_VIRIDIAN
HVS_PARAMETER_TYPES = {
HV_KVM_PATH: VTYPE_STRING,
HV_VIF_TYPE: VTYPE_STRING,
HV_VIF_SCRIPT: VTYPE_STRING,
HV_XEN_CMD: VTYPE_STRING,
+ HV_XEN_CPUID: VTYPE_STRING,
HV_VNET_HDR: VTYPE_BOOL,
+ HV_VIRIDIAN: VTYPE_BOOL,
}
HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
-HVS_PARAMETER_TITLES = {
- HV_ACPI: "ACPI",
- HV_BOOT_ORDER: "Boot_order",
- HV_CDROM_IMAGE_PATH: "CDROM_image_path",
- HV_DISK_TYPE: "Disk_type",
- HV_INITRD_PATH: "Initrd_path",
- HV_KERNEL_PATH: "Kernel_path",
- HV_NIC_TYPE: "NIC_type",
- HV_PAE: "PAE",
- HV_VNC_BIND_ADDRESS: "VNC_bind_address",
- HV_PASSTHROUGH: "pci_pass",
- HV_CPU_TYPE: "cpu_type",
- }
-
-# Migration statuses
-HV_MIGRATION_COMPLETED = "completed"
-HV_MIGRATION_ACTIVE = "active"
-HV_MIGRATION_FAILED = "failed"
-HV_MIGRATION_CANCELLED = "cancelled"
-
-HV_MIGRATION_VALID_STATUSES = compat.UniqueFrozenset([
- HV_MIGRATION_COMPLETED,
- HV_MIGRATION_ACTIVE,
- HV_MIGRATION_FAILED,
- HV_MIGRATION_CANCELLED,
- ])
-
-HV_MIGRATION_FAILED_STATUSES = compat.UniqueFrozenset([
- 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 = compat.UniqueFrozenset([LD_LV])
-
-# Backend parameter names
-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"
-BE_SPINDLE_USE = "spindle_use"
-
-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,
- BE_SPINDLE_USE: VTYPE_INT,
- }
-
-BES_PARAMETER_TITLES = {
- BE_AUTO_BALANCE: "Auto_balance",
- BE_MAXMEM: "ConfigMaxMem",
- BE_MINMEM: "ConfigMinMem",
- BE_VCPUS: "ConfigVCPUs",
- }
-
-BES_PARAMETER_COMPAT = {
- BE_MEMORY: VTYPE_SIZE,
- }
-BES_PARAMETER_COMPAT.update(BES_PARAMETER_TYPES)
-
-BES_PARAMETERS = frozenset(BES_PARAMETER_TYPES.keys())
-
-# instance specs
-ISPEC_MEM_SIZE = "memory-size"
-ISPEC_CPU_COUNT = "cpu-count"
-ISPEC_DISK_COUNT = "disk-count"
-ISPEC_DISK_SIZE = "disk-size"
-ISPEC_NIC_COUNT = "nic-count"
-ISPEC_SPINDLE_USE = "spindle-use"
-
-ISPECS_PARAMETER_TYPES = {
- ISPEC_MEM_SIZE: VTYPE_INT,
- ISPEC_CPU_COUNT: VTYPE_INT,
- ISPEC_DISK_COUNT: VTYPE_INT,
- ISPEC_DISK_SIZE: VTYPE_INT,
- ISPEC_NIC_COUNT: VTYPE_INT,
- ISPEC_SPINDLE_USE: VTYPE_INT,
- }
-
-ISPECS_PARAMETERS = frozenset(ISPECS_PARAMETER_TYPES.keys())
-
-ISPECS_MINMAX = "minmax"
-ISPECS_MIN = "min"
-ISPECS_MAX = "max"
-ISPECS_STD = "std"
-IPOLICY_DTS = "disk-templates"
-IPOLICY_VCPU_RATIO = "vcpu-ratio"
-IPOLICY_SPINDLE_RATIO = "spindle-ratio"
-
-ISPECS_MINMAX_KEYS = compat.UniqueFrozenset([
- ISPECS_MIN,
- ISPECS_MAX,
- ])
-
-IPOLICY_PARAMETERS = compat.UniqueFrozenset([
- IPOLICY_VCPU_RATIO,
- IPOLICY_SPINDLE_RATIO,
- ])
-
-IPOLICY_ALL_KEYS = (IPOLICY_PARAMETERS |
- frozenset([ISPECS_MINMAX, ISPECS_STD, IPOLICY_DTS]))
-
-# Node parameter names
-ND_OOB_PROGRAM = "oob_program"
-ND_SPINDLE_COUNT = "spindle_count"
-ND_EXCLUSIVE_STORAGE = "exclusive_storage"
-
-NDS_PARAMETER_TYPES = {
- ND_OOB_PROGRAM: VTYPE_STRING,
- ND_SPINDLE_COUNT: VTYPE_INT,
- ND_EXCLUSIVE_STORAGE: VTYPE_BOOL,
- }
-
-NDS_PARAMETERS = frozenset(NDS_PARAMETER_TYPES.keys())
-
-NDS_PARAMETER_TITLES = {
- ND_OOB_PROGRAM: "OutOfBandProgram",
- ND_SPINDLE_COUNT: "SpindleCount",
- ND_EXCLUSIVE_STORAGE: "ExclusiveStorage",
- }
-
-# 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"
-LDP_PROTOCOL = "protocol"
-LDP_DYNAMIC_RESYNC = "dynamic-resync"
-LDP_PLAN_AHEAD = "c-plan-ahead"
-LDP_FILL_TARGET = "c-fill-target"
-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_BARRIERS: VTYPE_STRING,
- LDP_NO_META_FLUSH: VTYPE_BOOL,
- LDP_DEFAULT_METAVG: VTYPE_STRING,
- LDP_DISK_CUSTOM: VTYPE_STRING,
- LDP_NET_CUSTOM: VTYPE_STRING,
- LDP_PROTOCOL: VTYPE_STRING,
- LDP_DYNAMIC_RESYNC: VTYPE_BOOL,
- LDP_PLAN_AHEAD: VTYPE_INT,
- LDP_FILL_TARGET: 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())
-
-# Disk template parameters (can be set/changed by the user via gnt-cluster and
-# gnt-group)
-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"
-DRBD_PROTOCOL = "protocol"
-DRBD_DYNAMIC_RESYNC = "dynamic-resync"
-DRBD_PLAN_AHEAD = "c-plan-ahead"
-DRBD_FILL_TARGET = "c-fill-target"
-DRBD_DELAY_TARGET = "c-delay-target"
-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_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,
- DRBD_PROTOCOL: VTYPE_STRING,
- DRBD_DYNAMIC_RESYNC: VTYPE_BOOL,
- DRBD_PLAN_AHEAD: VTYPE_INT,
- DRBD_FILL_TARGET: VTYPE_INT,
- DRBD_DELAY_TARGET: 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())
+HVS_PARAMETER_TITLES = _constants.HVS_PARAMETER_TITLES
+
+HV_MIGRATION_COMPLETED = _constants.HV_MIGRATION_COMPLETED
+HV_MIGRATION_ACTIVE = _constants.HV_MIGRATION_ACTIVE
+HV_MIGRATION_FAILED = _constants.HV_MIGRATION_FAILED
+HV_MIGRATION_CANCELLED = _constants.HV_MIGRATION_CANCELLED
+HV_MIGRATION_VALID_STATUSES = _constants.HV_MIGRATION_VALID_STATUSES
+HV_MIGRATION_FAILED_STATUSES = _constants.HV_MIGRATION_FAILED_STATUSES
+HV_KVM_MIGRATION_VALID_STATUSES = _constants.HV_KVM_MIGRATION_VALID_STATUSES
+
+HV_NODEINFO_KEY_VERSION = _constants.HV_NODEINFO_KEY_VERSION
+
+HVST_MEMORY_TOTAL = _constants.HVST_MEMORY_TOTAL
+HVST_MEMORY_NODE = _constants.HVST_MEMORY_NODE
+HVST_MEMORY_HV = _constants.HVST_MEMORY_HV
+HVST_CPU_TOTAL = _constants.HVST_CPU_TOTAL
+HVST_CPU_NODE = _constants.HVST_CPU_NODE
+HVSTS_PARAMETERS = _constants.HVSTS_PARAMETERS
+HVST_DEFAULTS = _constants.HVST_DEFAULTS
+HVSTS_PARAMETER_TYPES = _constants.HVSTS_PARAMETER_TYPES
+
+DS_DISK_TOTAL = _constants.DS_DISK_TOTAL
+DS_DISK_RESERVED = _constants.DS_DISK_RESERVED
+DS_DISK_OVERHEAD = _constants.DS_DISK_OVERHEAD
+DS_DEFAULTS = _constants.DS_DEFAULTS
+DSS_PARAMETER_TYPES = _constants.DSS_PARAMETER_TYPES
+DSS_PARAMETERS = _constants.DSS_PARAMETERS
+DS_VALID_TYPES = _constants.DS_VALID_TYPES
+
+BE_MEMORY = _constants.BE_MEMORY
+BE_MAXMEM = _constants.BE_MAXMEM
+BE_MINMEM = _constants.BE_MINMEM
+BE_VCPUS = _constants.BE_VCPUS
+BE_AUTO_BALANCE = _constants.BE_AUTO_BALANCE
+BE_ALWAYS_FAILOVER = _constants.BE_ALWAYS_FAILOVER
+BE_SPINDLE_USE = _constants.BE_SPINDLE_USE
+BES_PARAMETER_TYPES = _constants.BES_PARAMETER_TYPES
+BES_PARAMETER_TITLES = _constants.BES_PARAMETER_TITLES
+BES_PARAMETER_COMPAT = _constants.BES_PARAMETER_COMPAT
+BES_PARAMETERS = _constants.BES_PARAMETERS
+
+ISPEC_MEM_SIZE = _constants.ISPEC_MEM_SIZE
+ISPEC_CPU_COUNT = _constants.ISPEC_CPU_COUNT
+ISPEC_DISK_COUNT = _constants.ISPEC_DISK_COUNT
+ISPEC_DISK_SIZE = _constants.ISPEC_DISK_SIZE
+ISPEC_NIC_COUNT = _constants.ISPEC_NIC_COUNT
+ISPEC_SPINDLE_USE = _constants.ISPEC_SPINDLE_USE
+ISPECS_PARAMETER_TYPES = _constants.ISPECS_PARAMETER_TYPES
+ISPECS_PARAMETERS = _constants.ISPECS_PARAMETERS
+
+ISPECS_MINMAX = _constants.ISPECS_MINMAX
+ISPECS_MIN = _constants.ISPECS_MIN
+ISPECS_MAX = _constants.ISPECS_MAX
+ISPECS_STD = _constants.ISPECS_STD
+IPOLICY_DTS = _constants.IPOLICY_DTS
+IPOLICY_VCPU_RATIO = _constants.IPOLICY_VCPU_RATIO
+IPOLICY_SPINDLE_RATIO = _constants.IPOLICY_SPINDLE_RATIO
+ISPECS_MINMAX_KEYS = _constants.ISPECS_MINMAX_KEYS
+IPOLICY_PARAMETERS = _constants.IPOLICY_PARAMETERS
+IPOLICY_ALL_KEYS = _constants.IPOLICY_ALL_KEYS
+
+ND_OOB_PROGRAM = _constants.ND_OOB_PROGRAM
+ND_SPINDLE_COUNT = _constants.ND_SPINDLE_COUNT
+ND_EXCLUSIVE_STORAGE = _constants.ND_EXCLUSIVE_STORAGE
+ND_OVS = _constants.ND_OVS
+ND_OVS_NAME = _constants.ND_OVS_NAME
+ND_OVS_LINK = _constants.ND_OVS_LINK
+
+NDS_PARAMETER_TYPES = _constants.NDS_PARAMETER_TYPES
+NDS_PARAMETERS = _constants.NDS_PARAMETERS
+NDS_PARAMETER_TITLES = _constants.NDS_PARAMETER_TITLES
+
+LDP_RESYNC_RATE = _constants.LDP_RESYNC_RATE
+LDP_STRIPES = _constants.LDP_STRIPES
+LDP_BARRIERS = _constants.LDP_BARRIERS
+LDP_NO_META_FLUSH = _constants.LDP_NO_META_FLUSH
+LDP_DEFAULT_METAVG = _constants.LDP_DEFAULT_METAVG
+LDP_DISK_CUSTOM = _constants.LDP_DISK_CUSTOM
+LDP_NET_CUSTOM = _constants.LDP_NET_CUSTOM
+LDP_PROTOCOL = _constants.LDP_PROTOCOL
+LDP_DYNAMIC_RESYNC = _constants.LDP_DYNAMIC_RESYNC
+LDP_PLAN_AHEAD = _constants.LDP_PLAN_AHEAD
+LDP_FILL_TARGET = _constants.LDP_FILL_TARGET
+LDP_DELAY_TARGET = _constants.LDP_DELAY_TARGET
+LDP_MAX_RATE = _constants.LDP_MAX_RATE
+LDP_MIN_RATE = _constants.LDP_MIN_RATE
+LDP_POOL = _constants.LDP_POOL
+LDP_ACCESS = _constants.LDP_ACCESS
+DISK_LD_TYPES = _constants.DISK_LD_TYPES
+DISK_LD_PARAMETERS = _constants.DISK_LD_PARAMETERS
+
+DRBD_RESYNC_RATE = _constants.DRBD_RESYNC_RATE
+DRBD_DATA_STRIPES = _constants.DRBD_DATA_STRIPES
+DRBD_META_STRIPES = _constants.DRBD_META_STRIPES
+DRBD_DISK_BARRIERS = _constants.DRBD_DISK_BARRIERS
+DRBD_META_BARRIERS = _constants.DRBD_META_BARRIERS
+DRBD_DEFAULT_METAVG = _constants.DRBD_DEFAULT_METAVG
+DRBD_DISK_CUSTOM = _constants.DRBD_DISK_CUSTOM
+DRBD_NET_CUSTOM = _constants.DRBD_NET_CUSTOM
+DRBD_PROTOCOL = _constants.DRBD_PROTOCOL
+DRBD_DYNAMIC_RESYNC = _constants.DRBD_DYNAMIC_RESYNC
+DRBD_PLAN_AHEAD = _constants.DRBD_PLAN_AHEAD
+DRBD_FILL_TARGET = _constants.DRBD_FILL_TARGET
+DRBD_DELAY_TARGET = _constants.DRBD_DELAY_TARGET
+DRBD_MAX_RATE = _constants.DRBD_MAX_RATE
+DRBD_MIN_RATE = _constants.DRBD_MIN_RATE
+LV_STRIPES = _constants.LV_STRIPES
+RBD_ACCESS = _constants.RBD_ACCESS
+RBD_POOL = _constants.RBD_POOL
+DISK_DT_TYPES = _constants.DISK_DT_TYPES
+DISK_DT_PARAMETERS = _constants.DISK_DT_PARAMETERS
+
+DDP_LOCAL_IP = _constants.DDP_LOCAL_IP
+DDP_REMOTE_IP = _constants.DDP_REMOTE_IP
+DDP_PORT = _constants.DDP_PORT
+DDP_LOCAL_MINOR = _constants.DDP_LOCAL_MINOR
+DDP_REMOTE_MINOR = _constants.DDP_REMOTE_MINOR
# OOB supported commands
-OOB_POWER_ON = "power-on"
-OOB_POWER_OFF = "power-off"
-OOB_POWER_CYCLE = "power-cycle"
-OOB_POWER_STATUS = "power-status"
-OOB_HEALTH = "health"
-
-OOB_COMMANDS = compat.UniqueFrozenset([
- OOB_POWER_ON,
- OOB_POWER_OFF,
- OOB_POWER_CYCLE,
- OOB_POWER_STATUS,
- OOB_HEALTH,
- ])
-
-OOB_POWER_STATUS_POWERED = "powered"
-
-OOB_TIMEOUT = 60 # 60 seconds
-OOB_POWER_DELAY = 2.0 # 2 seconds
-
-OOB_STATUS_OK = "OK"
-OOB_STATUS_WARNING = "WARNING"
-OOB_STATUS_CRITICAL = "CRITICAL"
-OOB_STATUS_UNKNOWN = "UNKNOWN"
-
-OOB_STATUSES = compat.UniqueFrozenset([
- OOB_STATUS_OK,
- OOB_STATUS_WARNING,
- OOB_STATUS_CRITICAL,
- OOB_STATUS_UNKNOWN,
- ])
-
-# Instance Parameters Profile
-PP_DEFAULT = "default"
-
-# NIC_* constants are used inside the ganeti config
-NIC_MODE = "mode"
-NIC_LINK = "link"
-NIC_VLAN = "vlan"
-
-NIC_MODE_BRIDGED = "bridged"
-NIC_MODE_ROUTED = "routed"
-NIC_MODE_OVS = "openvswitch"
-NIC_IP_POOL = "pool"
-
-NIC_VALID_MODES = compat.UniqueFrozenset([
- NIC_MODE_BRIDGED,
- NIC_MODE_ROUTED,
- NIC_MODE_OVS,
- ])
-
-RESERVE_ACTION = "reserve"
-RELEASE_ACTION = "release"
-
-NICS_PARAMETER_TYPES = {
- NIC_MODE: VTYPE_STRING,
- NIC_LINK: VTYPE_STRING,
- NIC_VLAN: VTYPE_MAYBE_STRING,
- }
-
-NICS_PARAMETERS = frozenset(NICS_PARAMETER_TYPES.keys())
-
-# IDISK_* constants are used in opcodes, to create/change disks
-IDISK_SIZE = "size"
-IDISK_SPINDLES = "spindles"
-IDISK_MODE = "mode"
-IDISK_ADOPT = "adopt"
-IDISK_VG = "vg"
-IDISK_METAVG = "metavg"
-IDISK_PROVIDER = "provider"
-IDISK_NAME = "name"
-IDISK_PARAMS_TYPES = {
- IDISK_SIZE: VTYPE_SIZE,
- IDISK_SPINDLES: VTYPE_INT,
- IDISK_MODE: VTYPE_STRING,
- IDISK_ADOPT: VTYPE_STRING,
- IDISK_VG: VTYPE_STRING,
- IDISK_METAVG: VTYPE_STRING,
- IDISK_PROVIDER: VTYPE_STRING,
- IDISK_NAME: VTYPE_MAYBE_STRING,
- }
-IDISK_PARAMS = frozenset(IDISK_PARAMS_TYPES.keys())
-
-# INIC_* constants are used in opcodes, to create/change nics
-INIC_MAC = "mac"
-INIC_IP = "ip"
-INIC_MODE = "mode"
-INIC_LINK = "link"
-INIC_NETWORK = "network"
-INIC_NAME = "name"
-INIC_VLAN = "vlan"
-INIC_PARAMS_TYPES = {
- INIC_IP: VTYPE_MAYBE_STRING,
- INIC_LINK: VTYPE_STRING,
- INIC_MAC: VTYPE_STRING,
- INIC_MODE: VTYPE_STRING,
- INIC_NETWORK: VTYPE_MAYBE_STRING,
- INIC_NAME: VTYPE_MAYBE_STRING,
- INIC_VLAN: VTYPE_MAYBE_STRING,
- }
-INIC_PARAMS = frozenset(INIC_PARAMS_TYPES.keys())
+OOB_POWER_ON = _constants.OOB_POWER_ON
+OOB_POWER_OFF = _constants.OOB_POWER_OFF
+OOB_POWER_CYCLE = _constants.OOB_POWER_CYCLE
+OOB_POWER_STATUS = _constants.OOB_POWER_STATUS
+OOB_HEALTH = _constants.OOB_HEALTH
+OOB_COMMANDS = _constants.OOB_COMMANDS
+
+OOB_POWER_STATUS_POWERED = _constants.OOB_POWER_STATUS_POWERED
+
+OOB_TIMEOUT = _constants.OOB_TIMEOUT
+OOB_POWER_DELAY = _constants.OOB_POWER_DELAY
+
+OOB_STATUS_OK = _constants.OOB_STATUS_OK
+OOB_STATUS_WARNING = _constants.OOB_STATUS_WARNING
+OOB_STATUS_CRITICAL = _constants.OOB_STATUS_CRITICAL
+OOB_STATUS_UNKNOWN = _constants.OOB_STATUS_UNKNOWN
+OOB_STATUSES = _constants.OOB_STATUSES
+
+PP_DEFAULT = _constants.PP_DEFAULT
+
+NIC_MODE = _constants.NIC_MODE
+NIC_LINK = _constants.NIC_LINK
+NIC_VLAN = _constants.NIC_VLAN
+NICS_PARAMETER_TYPES = _constants.NICS_PARAMETER_TYPES
+NICS_PARAMETERS = _constants.NICS_PARAMETERS
+
+NIC_MODE_BRIDGED = _constants.NIC_MODE_BRIDGED
+NIC_MODE_ROUTED = _constants.NIC_MODE_ROUTED
+NIC_MODE_OVS = _constants.NIC_MODE_OVS
+NIC_IP_POOL = _constants.NIC_IP_POOL
+NIC_VALID_MODES = _constants.NIC_VALID_MODES
+
+RESERVE_ACTION = _constants.RESERVE_ACTION
+RELEASE_ACTION = _constants.RELEASE_ACTION
+
+IDISK_SIZE = _constants.IDISK_SIZE
+IDISK_SPINDLES = _constants.IDISK_SPINDLES
+IDISK_MODE = _constants.IDISK_MODE
+IDISK_ADOPT = _constants.IDISK_ADOPT
+IDISK_VG = _constants.IDISK_VG
+IDISK_METAVG = _constants.IDISK_METAVG
+IDISK_PROVIDER = _constants.IDISK_PROVIDER
+IDISK_NAME = _constants.IDISK_NAME
+IDISK_PARAMS_TYPES = _constants.IDISK_PARAMS_TYPES
+IDISK_PARAMS = _constants.IDISK_PARAMS
+
+INIC_MAC = _constants.INIC_MAC
+INIC_IP = _constants.INIC_IP
+INIC_MODE = _constants.INIC_MODE
+INIC_LINK = _constants.INIC_LINK
+INIC_NETWORK = _constants.INIC_NETWORK
+INIC_NAME = _constants.INIC_NAME
+INIC_VLAN = _constants.INIC_VLAN
+INIC_BRIDGE = _constants.INIC_BRIDGE
+INIC_PARAMS_TYPES = _constants.INIC_PARAMS_TYPES
+INIC_PARAMS = _constants.INIC_PARAMS
# Hypervisor constants
-HT_XEN_PVM = "xen-pvm"
-HT_FAKE = "fake"
-HT_XEN_HVM = "xen-hvm"
-HT_KVM = "kvm"
-HT_CHROOT = "chroot"
-HT_LXC = "lxc"
-HYPER_TYPES = compat.UniqueFrozenset([
- HT_XEN_PVM,
- HT_FAKE,
- HT_XEN_HVM,
- HT_KVM,
- HT_CHROOT,
- HT_LXC,
- ])
-HTS_REQ_PORT = compat.UniqueFrozenset([HT_XEN_HVM, HT_KVM])
-
-VNC_BASE_PORT = 5900
-VNC_DEFAULT_BIND_ADDRESS = IP4_ADDRESS_ANY
-
+HT_XEN_PVM = _constants.HT_XEN_PVM
+HT_FAKE = _constants.HT_FAKE
+HT_XEN_HVM = _constants.HT_XEN_HVM
+HT_KVM = _constants.HT_KVM
+HT_CHROOT = _constants.HT_CHROOT
+HT_LXC = _constants.HT_LXC
+HYPER_TYPES = _constants.HYPER_TYPES
+HTS_REQ_PORT = _constants.HTS_REQ_PORT
+
+VNC_BASE_PORT = _constants.VNC_BASE_PORT
+VNC_DEFAULT_BIND_ADDRESS = _constants.VNC_DEFAULT_BIND_ADDRESS
# NIC types
HT_NIC_RTL8139 = "rtl8139"
HT_NIC_NE2K_PCI = "ne2k_pci"
HT_KVM_FLAG_VALUES = compat.UniqueFrozenset([HT_KVM_ENABLED, HT_KVM_DISABLED])
# Migration type
-HT_MIGRATION_LIVE = "live"
-HT_MIGRATION_NONLIVE = "non-live"
-HT_MIGRATION_MODES = compat.UniqueFrozenset([
- HT_MIGRATION_LIVE,
- HT_MIGRATION_NONLIVE,
- ])
+HT_MIGRATION_LIVE = _constants.HT_MIGRATION_LIVE
+HT_MIGRATION_NONLIVE = _constants.HT_MIGRATION_NONLIVE
+HT_MIGRATION_MODES = _constants.HT_MIGRATION_MODES
# Cluster Verify steps
-VERIFY_NPLUSONE_MEM = "nplusone_mem"
-VERIFY_OPTIONAL_CHECKS = compat.UniqueFrozenset([VERIFY_NPLUSONE_MEM])
+VERIFY_NPLUSONE_MEM = _constants.VERIFY_NPLUSONE_MEM
+VERIFY_OPTIONAL_CHECKS = _constants.VERIFY_OPTIONAL_CHECKS
# Cluster Verify error classes
-CV_TCLUSTER = "cluster"
-CV_TGROUP = "group"
-CV_TNODE = "node"
-CV_TINSTANCE = "instance"
+CV_TCLUSTER = _constants.CV_TCLUSTER
+CV_TGROUP = _constants.CV_TGROUP
+CV_TNODE = _constants.CV_TNODE
+CV_TINSTANCE = _constants.CV_TINSTANCE
# 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_EGROUPDIFFERENTPVSIZE = \
- (CV_TGROUP, "EGROUPDIFFERENTPVSIZE", "PVs in the group have different sizes")
-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_EINSTANCEPOLICY = \
- (CV_TINSTANCE, "EINSTANCEPOLICY",
- "Instance does not meet policy")
-CV_EINSTANCEUNSUITABLENODE = \
- (CV_TINSTANCE, "EINSTANCEUNSUITABLENODE",
- "Instance running on nodes that are not suitable for it")
-CV_EINSTANCEMISSINGCFGPARAMETER = \
- (CV_TINSTANCE, "EINSTANCEMISSINGCFGPARAMETER",
- "A configuration parameter for an instance is missing")
-CV_ENODEDRBD = \
- (CV_TNODE, "ENODEDRBD", "Error parsing the DRBD status file")
-CV_ENODEDRBDVERSION = \
- (CV_TNODE, "ENODEDRBDVERSION", "DRBD version mismatch within a node group")
-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_ENODEFILESTORAGEPATHS = \
- (CV_TNODE, "ENODEFILESTORAGEPATHS", "Detected bad file storage paths")
-CV_ENODEFILESTORAGEPATHUNUSABLE = \
- (CV_TNODE, "ENODEFILESTORAGEPATHUNUSABLE", "File storage path unusable")
-
-CV_ALL_ECODES = compat.UniqueFrozenset([
- 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_EINSTANCEPOLICY,
- 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_ENODEFILESTORAGEPATHS,
- CV_ENODEFILESTORAGEPATHUNUSABLE,
- ])
-
-CV_ALL_ECODES_STRINGS = \
- compat.UniqueFrozenset(estr for (_, estr, _) in CV_ALL_ECODES)
-
-# Node verify constants
-NV_BRIDGES = "bridges"
-NV_DRBDHELPER = "drbd-helper"
-NV_DRBDVERSION = "drbd-version"
-NV_DRBDLIST = "drbd-list"
-NV_EXCLUSIVEPVS = "exclusive-pvs"
-NV_FILELIST = "filelist"
-NV_ACCEPTED_STORAGE_PATHS = "allowed-file-storage-paths"
-NV_FILE_STORAGE_PATH = "file-storage-path"
-NV_SHARED_FILE_STORAGE_PATH = "shared-file-storage-path"
-NV_HVINFO = "hvinfo"
-NV_HVPARAMS = "hvparms"
-NV_HYPERVISOR = "hypervisor"
-NV_INSTANCELIST = "instancelist"
-NV_LVLIST = "lvlist"
-NV_MASTERIP = "master-ip"
-NV_NODELIST = "nodelist"
-NV_NODENETTEST = "node-net-test"
-NV_NODESETUP = "nodesetup"
-NV_OOB_PATHS = "oob-paths"
-NV_OSLIST = "oslist"
-NV_PVLIST = "pvlist"
-NV_TIME = "time"
-NV_USERSCRIPTS = "user-scripts"
-NV_VERSION = "version"
-NV_VGLIST = "vglist"
-NV_VMNODES = "vmnodes"
-
-# 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_ERRORUP = "ERROR_up"
-INSTST_ERRORDOWN = "ERROR_down"
-INSTST_ALL = compat.UniqueFrozenset([
- INSTST_RUNNING,
- INSTST_ADMINDOWN,
- INSTST_ADMINOFFLINE,
- INSTST_NODEOFFLINE,
- INSTST_NODEDOWN,
- INSTST_WRONGNODE,
- INSTST_ERRORUP,
- INSTST_ERRORDOWN,
- ])
+CV_ECLUSTERCFG = _constants.CV_ECLUSTERCFG
+CV_ECLUSTERCERT = _constants.CV_ECLUSTERCERT
+CV_ECLUSTERFILECHECK = _constants.CV_ECLUSTERFILECHECK
+CV_ECLUSTERDANGLINGNODES = _constants.CV_ECLUSTERDANGLINGNODES
+CV_ECLUSTERDANGLINGINST = _constants.CV_ECLUSTERDANGLINGINST
+CV_EGROUPDIFFERENTPVSIZE = _constants.CV_EGROUPDIFFERENTPVSIZE
+CV_EINSTANCEBADNODE = _constants.CV_EINSTANCEBADNODE
+CV_EINSTANCEDOWN = _constants.CV_EINSTANCEDOWN
+CV_EINSTANCELAYOUT = _constants.CV_EINSTANCELAYOUT
+CV_EINSTANCEMISSINGDISK = _constants.CV_EINSTANCEMISSINGDISK
+CV_EINSTANCEFAULTYDISK = _constants.CV_EINSTANCEFAULTYDISK
+CV_EINSTANCEWRONGNODE = _constants.CV_EINSTANCEWRONGNODE
+CV_EINSTANCESPLITGROUPS = _constants.CV_EINSTANCESPLITGROUPS
+CV_EINSTANCEPOLICY = _constants.CV_EINSTANCEPOLICY
+CV_EINSTANCEUNSUITABLENODE = _constants.CV_EINSTANCEUNSUITABLENODE
+CV_EINSTANCEMISSINGCFGPARAMETER = _constants.CV_EINSTANCEMISSINGCFGPARAMETER
+CV_ENODEDRBD = _constants.CV_ENODEDRBD
+CV_ENODEDRBDVERSION = _constants.CV_ENODEDRBDVERSION
+CV_ENODEDRBDHELPER = _constants.CV_ENODEDRBDHELPER
+CV_ENODEFILECHECK = _constants.CV_ENODEFILECHECK
+CV_ENODEHOOKS = _constants.CV_ENODEHOOKS
+CV_ENODEHV = _constants.CV_ENODEHV
+CV_ENODELVM = _constants.CV_ENODELVM
+CV_ENODEN1 = _constants.CV_ENODEN1
+CV_ENODENET = _constants.CV_ENODENET
+CV_ENODEOS = _constants.CV_ENODEOS
+CV_ENODEORPHANINSTANCE = _constants.CV_ENODEORPHANINSTANCE
+CV_ENODEORPHANLV = _constants.CV_ENODEORPHANLV
+CV_ENODERPC = _constants.CV_ENODERPC
+CV_ENODESSH = _constants.CV_ENODESSH
+CV_ENODEVERSION = _constants.CV_ENODEVERSION
+CV_ENODESETUP = _constants.CV_ENODESETUP
+CV_ENODETIME = _constants.CV_ENODETIME
+CV_ENODEOOBPATH = _constants.CV_ENODEOOBPATH
+CV_ENODEUSERSCRIPTS = _constants.CV_ENODEUSERSCRIPTS
+CV_ENODEFILESTORAGEPATHS = _constants.CV_ENODEFILESTORAGEPATHS
+CV_ENODEFILESTORAGEPATHUNUSABLE = _constants.CV_ENODEFILESTORAGEPATHUNUSABLE
+CV_ENODESHAREDFILESTORAGEPATHUNUSABLE = \
+ _constants.CV_ENODESHAREDFILESTORAGEPATHUNUSABLE
+
+CV_ALL_ECODES = _constants.CV_ALL_ECODES
+CV_ALL_ECODES_STRINGS = _constants.CV_ALL_ECODES_STRINGS
+
+NV_BRIDGES = _constants.NV_BRIDGES
+NV_DRBDHELPER = _constants.NV_DRBDHELPER
+NV_DRBDVERSION = _constants.NV_DRBDVERSION
+NV_DRBDLIST = _constants.NV_DRBDLIST
+NV_EXCLUSIVEPVS = _constants.NV_EXCLUSIVEPVS
+NV_FILELIST = _constants.NV_FILELIST
+NV_ACCEPTED_STORAGE_PATHS = _constants.NV_ACCEPTED_STORAGE_PATHS
+NV_FILE_STORAGE_PATH = _constants.NV_FILE_STORAGE_PATH
+NV_SHARED_FILE_STORAGE_PATH = _constants.NV_SHARED_FILE_STORAGE_PATH
+NV_HVINFO = _constants.NV_HVINFO
+NV_HVPARAMS = _constants.NV_HVPARAMS
+NV_HYPERVISOR = _constants.NV_HYPERVISOR
+NV_INSTANCELIST = _constants.NV_INSTANCELIST
+NV_LVLIST = _constants.NV_LVLIST
+NV_MASTERIP = _constants.NV_MASTERIP
+NV_NODELIST = _constants.NV_NODELIST
+NV_NODENETTEST = _constants.NV_NODENETTEST
+NV_NODESETUP = _constants.NV_NODESETUP
+NV_OOB_PATHS = _constants.NV_OOB_PATHS
+NV_OSLIST = _constants.NV_OSLIST
+NV_PVLIST = _constants.NV_PVLIST
+NV_TIME = _constants.NV_TIME
+NV_USERSCRIPTS = _constants.NV_USERSCRIPTS
+NV_VERSION = _constants.NV_VERSION
+NV_VGLIST = _constants.NV_VGLIST
+NV_VMNODES = _constants.NV_VMNODES
+
+INSTST_RUNNING = _constants.INSTST_RUNNING
+INSTST_ADMINDOWN = _constants.INSTST_ADMINDOWN
+INSTST_ADMINOFFLINE = _constants.INSTST_ADMINOFFLINE
+INSTST_NODEOFFLINE = _constants.INSTST_NODEOFFLINE
+INSTST_NODEDOWN = _constants.INSTST_NODEDOWN
+INSTST_WRONGNODE = _constants.INSTST_WRONGNODE
+INSTST_ERRORUP = _constants.INSTST_ERRORUP
+INSTST_ERRORDOWN = _constants.INSTST_ERRORDOWN
+INSTST_ALL = _constants.INSTST_ALL
# Admin states
-ADMINST_UP = "up"
-ADMINST_DOWN = "down"
-ADMINST_OFFLINE = "offline"
-ADMINST_ALL = compat.UniqueFrozenset([
- ADMINST_UP,
- ADMINST_DOWN,
- ADMINST_OFFLINE,
- ])
+ADMINST_UP = _constants.ADMINST_UP
+ADMINST_DOWN = _constants.ADMINST_DOWN
+ADMINST_OFFLINE = _constants.ADMINST_OFFLINE
+ADMINST_ALL = _constants.ADMINST_ALL
# Node roles
-NR_REGULAR = "R"
-NR_MASTER = "M"
-NR_MCANDIDATE = "C"
-NR_DRAINED = "D"
-NR_OFFLINE = "O"
-NR_ALL = compat.UniqueFrozenset([
- NR_REGULAR,
- NR_MASTER,
- NR_MCANDIDATE,
- NR_DRAINED,
- NR_OFFLINE,
- ])
+NR_REGULAR = _constants.NR_REGULAR
+NR_MASTER = _constants.NR_MASTER
+NR_MCANDIDATE = _constants.NR_MCANDIDATE
+NR_DRAINED = _constants.NR_DRAINED
+NR_OFFLINE = _constants.NR_OFFLINE
+NR_ALL = _constants.NR_ALL
-# SSL certificate check constants (in days)
-SSL_CERT_EXPIRATION_WARN = 30
-SSL_CERT_EXPIRATION_ERROR = 7
+SSL_CERT_EXPIRATION_WARN = _constants.SSL_CERT_EXPIRATION_WARN
+SSL_CERT_EXPIRATION_ERROR = _constants.SSL_CERT_EXPIRATION_ERROR
# Allocator framework constants
-IALLOCATOR_VERSION = 2
-IALLOCATOR_DIR_IN = "in"
-IALLOCATOR_DIR_OUT = "out"
-VALID_IALLOCATOR_DIRECTIONS = compat.UniqueFrozenset([
- IALLOCATOR_DIR_IN,
- IALLOCATOR_DIR_OUT,
- ])
-IALLOCATOR_MODE_ALLOC = "allocate"
-IALLOCATOR_MODE_RELOC = "relocate"
-IALLOCATOR_MODE_CHG_GROUP = "change-group"
-IALLOCATOR_MODE_NODE_EVAC = "node-evacuate"
-IALLOCATOR_MODE_MULTI_ALLOC = "multi-allocate"
-VALID_IALLOCATOR_MODES = compat.UniqueFrozenset([
- IALLOCATOR_MODE_ALLOC,
- IALLOCATOR_MODE_RELOC,
- IALLOCATOR_MODE_CHG_GROUP,
- IALLOCATOR_MODE_NODE_EVAC,
- IALLOCATOR_MODE_MULTI_ALLOC,
- ])
-IALLOCATOR_SEARCH_PATH = _autoconf.IALLOCATOR_SEARCH_PATH
-DEFAULT_IALLOCATOR_SHORTCUT = "."
-
-IALLOCATOR_NEVAC_PRI = "primary-only"
-IALLOCATOR_NEVAC_SEC = "secondary-only"
-IALLOCATOR_NEVAC_ALL = "all"
-IALLOCATOR_NEVAC_MODES = compat.UniqueFrozenset([
- IALLOCATOR_NEVAC_PRI,
- IALLOCATOR_NEVAC_SEC,
- IALLOCATOR_NEVAC_ALL,
- ])
+IALLOCATOR_VERSION = _constants.IALLOCATOR_VERSION
+IALLOCATOR_DIR_IN = _constants.IALLOCATOR_DIR_IN
+IALLOCATOR_DIR_OUT = _constants.IALLOCATOR_DIR_OUT
+VALID_IALLOCATOR_DIRECTIONS = _constants.VALID_IALLOCATOR_DIRECTIONS
+
+IALLOCATOR_MODE_ALLOC = _constants.IALLOCATOR_MODE_ALLOC
+IALLOCATOR_MODE_RELOC = _constants.IALLOCATOR_MODE_RELOC
+IALLOCATOR_MODE_CHG_GROUP = _constants.IALLOCATOR_MODE_CHG_GROUP
+IALLOCATOR_MODE_NODE_EVAC = _constants.IALLOCATOR_MODE_NODE_EVAC
+IALLOCATOR_MODE_MULTI_ALLOC = _constants.IALLOCATOR_MODE_MULTI_ALLOC
+VALID_IALLOCATOR_MODES = _constants.VALID_IALLOCATOR_MODES
+
+IALLOCATOR_SEARCH_PATH = _constants.IALLOCATOR_SEARCH_PATH
+DEFAULT_IALLOCATOR_SHORTCUT = _constants.DEFAULT_IALLOCATOR_SHORTCUT
# Node evacuation
-NODE_EVAC_PRI = "primary-only"
-NODE_EVAC_SEC = "secondary-only"
-NODE_EVAC_ALL = "all"
-NODE_EVAC_MODES = compat.UniqueFrozenset([
- NODE_EVAC_PRI,
- NODE_EVAC_SEC,
- NODE_EVAC_ALL,
- ])
+NODE_EVAC_PRI = _constants.NODE_EVAC_PRI
+NODE_EVAC_SEC = _constants.NODE_EVAC_SEC
+NODE_EVAC_ALL = _constants.NODE_EVAC_ALL
+NODE_EVAC_MODES = _constants.NODE_EVAC_MODES
-# Job queue
-JOB_QUEUE_VERSION = 1
-JOB_QUEUE_SIZE_HARD_LIMIT = 5000
-JOB_QUEUE_FILES_PERMS = 0640
+JOB_QUEUE_VERSION = _constants.JOB_QUEUE_VERSION
+JOB_QUEUE_SIZE_HARD_LIMIT = _constants.JOB_QUEUE_SIZE_HARD_LIMIT
+JOB_QUEUE_FILES_PERMS = _constants.JOB_QUEUE_FILES_PERMS
JOB_ID_TEMPLATE = r"\d+"
JOB_FILE_RE = re.compile(r"^job-(%s)$" % JOB_ID_TEMPLATE)
-# unchanged job return
-JOB_NOTCHANGED = "nochange"
+JOB_NOTCHANGED = _constants.JOB_NOTCHANGED
# Job status
-JOB_STATUS_QUEUED = "queued"
-JOB_STATUS_WAITING = "waiting"
-JOB_STATUS_CANCELING = "canceling"
-JOB_STATUS_RUNNING = "running"
-JOB_STATUS_CANCELED = "canceled"
-JOB_STATUS_SUCCESS = "success"
-JOB_STATUS_ERROR = "error"
-JOBS_PENDING = compat.UniqueFrozenset([
- JOB_STATUS_QUEUED,
- JOB_STATUS_WAITING,
- JOB_STATUS_CANCELING,
- ])
-JOBS_FINALIZED = compat.UniqueFrozenset([
- JOB_STATUS_CANCELED,
- JOB_STATUS_SUCCESS,
- JOB_STATUS_ERROR,
- ])
-JOB_STATUS_ALL = compat.UniqueFrozenset([
- JOB_STATUS_RUNNING,
- ]) | JOBS_PENDING | JOBS_FINALIZED
+JOB_STATUS_QUEUED = _constants.JOB_STATUS_QUEUED
+JOB_STATUS_WAITING = _constants.JOB_STATUS_WAITING
+JOB_STATUS_CANCELING = _constants.JOB_STATUS_CANCELING
+JOB_STATUS_RUNNING = _constants.JOB_STATUS_RUNNING
+JOB_STATUS_CANCELED = _constants.JOB_STATUS_CANCELED
+JOB_STATUS_SUCCESS = _constants.JOB_STATUS_SUCCESS
+JOB_STATUS_ERROR = _constants.JOB_STATUS_ERROR
+JOBS_PENDING = _constants.JOBS_PENDING
+JOBS_FINALIZED = _constants.JOBS_FINALIZED
+JOB_STATUS_ALL = _constants.JOB_STATUS_ALL
# OpCode status
# not yet finalized
-OP_STATUS_QUEUED = "queued"
-OP_STATUS_WAITING = "waiting"
-OP_STATUS_CANCELING = "canceling"
-OP_STATUS_RUNNING = "running"
+OP_STATUS_QUEUED = _constants.OP_STATUS_QUEUED
+OP_STATUS_WAITING = _constants.OP_STATUS_WAITING
+OP_STATUS_CANCELING = _constants.OP_STATUS_CANCELING
+OP_STATUS_RUNNING = _constants.OP_STATUS_RUNNING
# finalized
-OP_STATUS_CANCELED = "canceled"
-OP_STATUS_SUCCESS = "success"
-OP_STATUS_ERROR = "error"
-OPS_FINALIZED = compat.UniqueFrozenset([
- OP_STATUS_CANCELED,
- OP_STATUS_SUCCESS,
- OP_STATUS_ERROR,
- ])
+OP_STATUS_CANCELED = _constants.OP_STATUS_CANCELED
+OP_STATUS_SUCCESS = _constants.OP_STATUS_SUCCESS
+OP_STATUS_ERROR = _constants.OP_STATUS_ERROR
+OPS_FINALIZED = _constants.OPS_FINALIZED
# OpCode priority
-OP_PRIO_LOWEST = +19
-OP_PRIO_HIGHEST = -20
+OP_PRIO_LOWEST = _constants.OP_PRIO_LOWEST
+OP_PRIO_HIGHEST = _constants.OP_PRIO_HIGHEST
+OP_PRIO_LOW = _constants.OP_PRIO_LOW
+OP_PRIO_NORMAL = _constants.OP_PRIO_NORMAL
+OP_PRIO_HIGH = _constants.OP_PRIO_HIGH
+OP_PRIO_SUBMIT_VALID = _constants.OP_PRIO_SUBMIT_VALID
+OP_PRIO_DEFAULT = _constants.OP_PRIO_DEFAULT
-OP_PRIO_LOW = +10
-OP_PRIO_NORMAL = 0
-OP_PRIO_HIGH = -10
+LOCKS_REPLACE = _constants.LOCKS_REPLACE
+LOCKS_APPEND = _constants.LOCKS_APPEND
-OP_PRIO_SUBMIT_VALID = compat.UniqueFrozenset([
- OP_PRIO_LOW,
- OP_PRIO_NORMAL,
- OP_PRIO_HIGH,
- ])
-
-OP_PRIO_DEFAULT = OP_PRIO_NORMAL
-
-# Lock recalculate mode
-LOCKS_REPLACE = "replace"
-LOCKS_APPEND = "append"
-
-# Lock timeout (sum) before we should go into blocking acquire (still
-# can be reset by priority change); computed as max time (10 hours)
-# before we should actually go into blocking acquire given that we
-# start from default priority level; in seconds
-# TODO
-LOCK_ATTEMPTS_TIMEOUT = 10 * 3600 / (OP_PRIO_DEFAULT - OP_PRIO_HIGHEST)
-LOCK_ATTEMPTS_MAXWAIT = 15.0
-LOCK_ATTEMPTS_MINWAIT = 1.0
+LOCK_ATTEMPTS_TIMEOUT = _constants.LOCK_ATTEMPTS_TIMEOUT
+LOCK_ATTEMPTS_MAXWAIT = _constants.LOCK_ATTEMPTS_MAXWAIT
+LOCK_ATTEMPTS_MINWAIT = _constants.LOCK_ATTEMPTS_MINWAIT
# Execution log types
-ELOG_MESSAGE = "message"
-ELOG_REMOTE_IMPORT = "remote-import"
-ELOG_JQUEUE_TEST = "jqueue-test"
+ELOG_MESSAGE = _constants.ELOG_MESSAGE
+ELOG_REMOTE_IMPORT = _constants.ELOG_REMOTE_IMPORT
+ELOG_JQUEUE_TEST = _constants.ELOG_JQUEUE_TEST
# /etc/hosts modification
ETC_HOSTS_ADD = "add"
HV_CPU_WEIGHT: 256,
HV_VIF_SCRIPT: "",
HV_XEN_CMD: XEN_CMD_XM,
+ HV_XEN_CPUID: "",
+ HV_SOUNDHW: "",
},
HT_XEN_HVM: {
HV_BOOT_ORDER: "cd",
HV_CPU_WEIGHT: 256,
HV_VIF_TYPE: HT_HVM_VIF_IOEMU,
HV_VIF_SCRIPT: "",
+ HV_VIRIDIAN: False,
HV_XEN_CMD: XEN_CMD_XM,
+ HV_XEN_CPUID: "",
+ HV_SOUNDHW: "",
},
HT_KVM: {
HV_KVM_PATH: KVM_PATH,
ND_OOB_PROGRAM: "",
ND_SPINDLE_COUNT: 1,
ND_EXCLUSIVE_STORAGE: False,
+ ND_OVS: False,
+ ND_OVS_NAME: DEFAULT_OVS,
+ ND_OVS_LINK: ""
}
NDC_GLOBALS = compat.UniqueFrozenset([
])
DISK_LD_DEFAULTS = {
- LD_DRBD8: {
+ DT_DRBD8: {
LDP_RESYNC_RATE: CLASSIC_DRBD_SYNC_SPEED,
- LDP_BARRIERS: _autoconf.DRBD_BARRIERS,
- LDP_NO_META_FLUSH: _autoconf.DRBD_NO_META_FLUSH,
+ LDP_BARRIERS: _constants.DRBD_BARRIERS,
+ LDP_NO_META_FLUSH: _constants.DRBD_NO_META_FLUSH,
LDP_DEFAULT_METAVG: DEFAULT_VG,
LDP_DISK_CUSTOM: "",
LDP_NET_CUSTOM: "",
LDP_MAX_RATE: CLASSIC_DRBD_SYNC_SPEED, # KiB/s
LDP_MIN_RATE: 4 * 1024, # KiB/s
},
- LD_LV: {
- LDP_STRIPES: _autoconf.LVM_STRIPECOUNT
+ DT_PLAIN: {
+ LDP_STRIPES: _constants.LVM_STRIPECOUNT
},
- LD_FILE: {},
- LD_BLOCKDEV: {},
- LD_RBD: {
- LDP_POOL: "rbd"
+ DT_FILE: {},
+ DT_SHARED_FILE: {},
+ DT_BLOCK: {},
+ DT_RBD: {
+ LDP_POOL: "rbd",
+ LDP_ACCESS: DISK_KERNELSPACE,
},
- LD_EXT: {},
+ DT_EXT: {},
}
# readability shortcuts
-_LV_DEFAULTS = DISK_LD_DEFAULTS[LD_LV]
-_DRBD_DEFAULTS = DISK_LD_DEFAULTS[LD_DRBD8]
+_LV_DEFAULTS = DISK_LD_DEFAULTS[DT_PLAIN]
+_DRBD_DEFAULTS = DISK_LD_DEFAULTS[DT_DRBD8]
DISK_DT_DEFAULTS = {
DT_PLAIN: {
- LV_STRIPES: DISK_LD_DEFAULTS[LD_LV][LDP_STRIPES],
+ LV_STRIPES: DISK_LD_DEFAULTS[DT_PLAIN][LDP_STRIPES],
},
DT_DRBD8: {
DRBD_RESYNC_RATE: _DRBD_DEFAULTS[LDP_RESYNC_RATE],
DT_SHARED_FILE: {},
DT_BLOCK: {},
DT_RBD: {
- RBD_POOL: DISK_LD_DEFAULTS[LD_RBD][LDP_POOL]
+ RBD_POOL: DISK_LD_DEFAULTS[DT_RBD][LDP_POOL],
+ RBD_ACCESS: DISK_LD_DEFAULTS[DT_RBD][LDP_ACCESS],
},
DT_EXT: {},
}
# Space reserved when creating instance disks
PART_RESERVED = .02
-CONFD_PROTOCOL_VERSION = 1
+CONFD_PROTOCOL_VERSION = _constants.CONFD_PROTOCOL_VERSION
-CONFD_REQ_PING = 0
-CONFD_REQ_NODE_ROLE_BYNAME = 1
-CONFD_REQ_NODE_PIP_BY_INSTANCE_IP = 2
-CONFD_REQ_CLUSTER_MASTER = 3
-CONFD_REQ_NODE_PIP_LIST = 4
-CONFD_REQ_MC_PIP_LIST = 5
-CONFD_REQ_INSTANCES_IPS_LIST = 6
-CONFD_REQ_NODE_DRBD = 7
-CONFD_REQ_NODE_INSTANCES = 8
+CONFD_REQ_PING = _constants.CONFD_REQ_PING
+CONFD_REQ_NODE_ROLE_BYNAME = _constants.CONFD_REQ_NODE_ROLE_BYNAME
+CONFD_REQ_NODE_PIP_BY_INSTANCE_IP = _constants.CONFD_REQ_NODE_PIP_BY_INSTANCE_IP
+CONFD_REQ_CLUSTER_MASTER = _constants.CONFD_REQ_CLUSTER_MASTER
+CONFD_REQ_NODE_PIP_LIST = _constants.CONFD_REQ_NODE_PIP_LIST
+CONFD_REQ_MC_PIP_LIST = _constants.CONFD_REQ_MC_PIP_LIST
+CONFD_REQ_INSTANCES_IPS_LIST = _constants.CONFD_REQ_INSTANCES_IPS_LIST
+CONFD_REQ_NODE_DRBD = _constants.CONFD_REQ_NODE_DRBD
+CONFD_REQ_NODE_INSTANCES = _constants.CONFD_REQ_NODE_INSTANCES
+CONFD_REQS = _constants.CONFD_REQS
# Confd request query fields. These are used to narrow down queries.
# These must be strings rather than integers, because json-encoding
# converts them to strings anyway, as they're used as dict-keys.
-CONFD_REQQ_LINK = "0"
-CONFD_REQQ_IP = "1"
-CONFD_REQQ_IPLIST = "2"
-CONFD_REQQ_FIELDS = "3"
-
-CONFD_REQFIELD_NAME = "0"
-CONFD_REQFIELD_IP = "1"
-CONFD_REQFIELD_MNODE_PIP = "2"
-
-CONFD_REQS = compat.UniqueFrozenset([
- CONFD_REQ_PING,
- CONFD_REQ_NODE_ROLE_BYNAME,
- CONFD_REQ_NODE_PIP_BY_INSTANCE_IP,
- CONFD_REQ_CLUSTER_MASTER,
- CONFD_REQ_NODE_PIP_LIST,
- CONFD_REQ_MC_PIP_LIST,
- CONFD_REQ_INSTANCES_IPS_LIST,
- CONFD_REQ_NODE_DRBD,
- ])
-
-CONFD_REPL_STATUS_OK = 0
-CONFD_REPL_STATUS_ERROR = 1
-CONFD_REPL_STATUS_NOTIMPLEMENTED = 2
-
-CONFD_REPL_STATUSES = compat.UniqueFrozenset([
- CONFD_REPL_STATUS_OK,
- CONFD_REPL_STATUS_ERROR,
- CONFD_REPL_STATUS_NOTIMPLEMENTED,
- ])
-
-(CONFD_NODE_ROLE_MASTER,
- CONFD_NODE_ROLE_CANDIDATE,
- CONFD_NODE_ROLE_OFFLINE,
- CONFD_NODE_ROLE_DRAINED,
- CONFD_NODE_ROLE_REGULAR,
- ) = range(5)
-
-# A few common errors for confd
-CONFD_ERROR_UNKNOWN_ENTRY = 1
-CONFD_ERROR_INTERNAL = 2
-CONFD_ERROR_ARGUMENT = 3
+CONFD_REQQ_LINK = _constants.CONFD_REQQ_LINK
+CONFD_REQQ_IP = _constants.CONFD_REQQ_IP
+CONFD_REQQ_IPLIST = _constants.CONFD_REQQ_IPLIST
+CONFD_REQQ_FIELDS = _constants.CONFD_REQQ_FIELDS
+
+# FIXME: perhaps update code that uses these constants to deal with
+# integers instead of strings
+CONFD_REQFIELD_NAME = str(_constants.CONFD_REQFIELD_NAME)
+CONFD_REQFIELD_IP = str(_constants.CONFD_REQFIELD_IP)
+CONFD_REQFIELD_MNODE_PIP = str(_constants.CONFD_REQFIELD_MNODE_PIP)
+
+CONFD_REPL_STATUS_OK = _constants.CONFD_REPL_STATUS_OK
+CONFD_REPL_STATUS_ERROR = _constants.CONFD_REPL_STATUS_ERROR
+CONFD_REPL_STATUS_NOTIMPLEMENTED = _constants.CONFD_REPL_STATUS_NOTIMPLEMENTED
+CONFD_REPL_STATUSES = _constants.CONFD_REPL_STATUSES
+
+CONFD_NODE_ROLE_MASTER = _constants.CONFD_NODE_ROLE_MASTER
+CONFD_NODE_ROLE_CANDIDATE = _constants.CONFD_NODE_ROLE_CANDIDATE
+CONFD_NODE_ROLE_OFFLINE = _constants.CONFD_NODE_ROLE_OFFLINE
+CONFD_NODE_ROLE_DRAINED = _constants.CONFD_NODE_ROLE_DRAINED
+CONFD_NODE_ROLE_REGULAR = _constants.CONFD_NODE_ROLE_REGULAR
+
+CONFD_ERROR_UNKNOWN_ENTRY = _constants.CONFD_ERROR_UNKNOWN_ENTRY
+CONFD_ERROR_INTERNAL = _constants.CONFD_ERROR_INTERNAL
+CONFD_ERROR_ARGUMENT = _constants.CONFD_ERROR_ARGUMENT
# Each request is "salted" by the current timestamp.
# This constants decides how many seconds of skew to accept.
# TODO: make this a default and allow the value to be more configurable
-CONFD_MAX_CLOCK_SKEW = 2 * NODE_MAX_CLOCK_SKEW
+CONFD_MAX_CLOCK_SKEW = _constants.CONFD_MAX_CLOCK_SKEW
# When we haven't reloaded the config for more than this amount of
# seconds, we force a test to see if inotify is betraying us. Using a
# prime number to ensure we get less chance of 'same wakeup' with
# other processes.
-CONFD_CONFIG_RELOAD_TIMEOUT = 17
+CONFD_CONFIG_RELOAD_TIMEOUT = _constants.CONFD_CONFIG_RELOAD_TIMEOUT
# If we receive more than one update in this amount of microseconds,
# we move to polling every RATELIMIT seconds, rather than relying on
# inotify, to be able to serve more requests.
-CONFD_CONFIG_RELOAD_RATELIMIT = 250000
+CONFD_CONFIG_RELOAD_RATELIMIT = _constants.CONFD_CONFIG_RELOAD_RATELIMIT
# Magic number prepended to all confd queries.
# This allows us to distinguish different types of confd protocols and handle
# them. For example by changing this we can move the whole payload to be
# compressed, or move away from json.
-CONFD_MAGIC_FOURCC = "plj0"
+CONFD_MAGIC_FOURCC = _constants.CONFD_MAGIC_FOURCC
# By default a confd request is sent to the minimum between this number and all
# MCs. 6 was chosen because even in the case of a disastrous 50% response rate,
# we should have enough answers to be able to compare more than one.
-CONFD_DEFAULT_REQ_COVERAGE = 6
+CONFD_DEFAULT_REQ_COVERAGE = _constants.CONFD_DEFAULT_REQ_COVERAGE
# Timeout in seconds to expire pending query request in the confd client
# library. We don't actually expect any answer more than 10 seconds after we
# sent a request.
-CONFD_CLIENT_EXPIRE_TIMEOUT = 10
+CONFD_CLIENT_EXPIRE_TIMEOUT = _constants.CONFD_CLIENT_EXPIRE_TIMEOUT
# Maximum UDP datagram size.
# On IPv4: 64K - 20 (ip header size) - 8 (udp header size) = 65507
INITIAL_NODE_GROUP_NAME = "default"
# Possible values for NodeGroup.alloc_policy
-ALLOC_POLICY_PREFERRED = "preferred"
-ALLOC_POLICY_LAST_RESORT = "last_resort"
-ALLOC_POLICY_UNALLOCABLE = "unallocable"
-VALID_ALLOC_POLICIES = [
- ALLOC_POLICY_PREFERRED,
- ALLOC_POLICY_LAST_RESORT,
- ALLOC_POLICY_UNALLOCABLE,
- ]
+ALLOC_POLICY_PREFERRED = _constants.ALLOC_POLICY_PREFERRED
+ALLOC_POLICY_LAST_RESORT = _constants.ALLOC_POLICY_LAST_RESORT
+ALLOC_POLICY_UNALLOCABLE = _constants.ALLOC_POLICY_UNALLOCABLE
+VALID_ALLOC_POLICIES = _constants.VALID_ALLOC_POLICIES
# Temporary external/shared storage parameters
-BLOCKDEV_DRIVER_MANUAL = "manual"
+BLOCKDEV_DRIVER_MANUAL = _constants.BLOCKDEV_DRIVER_MANUAL
# qemu-img path, required for ovfconverter
-QEMUIMG_PATH = _autoconf.QEMUIMG_PATH
+QEMUIMG_PATH = _constants.QEMUIMG_PATH
# Whether htools was enabled at compilation time
-HTOOLS = _autoconf.HTOOLS
+HTOOLS = _constants.HTOOLS
# The hail iallocator
IALLOC_HAIL = "hail"
NDS_START_NODE_DAEMON = "start_node_daemon"
# Path generating random UUID
-RANDOM_UUID_FILE = "/proc/sys/kernel/random/uuid"
+RANDOM_UUID_FILE = _constants.RANDOM_UUID_FILE
# Regex string for verifying a UUID
UUID_REGEX = "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"
# Auto-repair tag prefixes
-AUTO_REPAIR_TAG_PREFIX = "ganeti:watcher:autorepair:"
-AUTO_REPAIR_TAG_ENABLED = AUTO_REPAIR_TAG_PREFIX
-AUTO_REPAIR_TAG_SUSPENDED = AUTO_REPAIR_TAG_ENABLED + "suspend:"
-AUTO_REPAIR_TAG_PENDING = AUTO_REPAIR_TAG_PREFIX + "pending:"
-AUTO_REPAIR_TAG_RESULT = AUTO_REPAIR_TAG_PREFIX + "result:"
+AUTO_REPAIR_TAG_PREFIX = _constants.AUTO_REPAIR_TAG_PREFIX
+AUTO_REPAIR_TAG_ENABLED = _constants.AUTO_REPAIR_TAG_ENABLED
+AUTO_REPAIR_TAG_SUSPENDED = _constants.AUTO_REPAIR_TAG_SUSPENDED
+AUTO_REPAIR_TAG_PENDING = _constants.AUTO_REPAIR_TAG_PENDING
+AUTO_REPAIR_TAG_RESULT = _constants.AUTO_REPAIR_TAG_RESULT
# Auto-repair levels
-AUTO_REPAIR_FIX_STORAGE = "fix-storage"
-AUTO_REPAIR_MIGRATE = "migrate"
-AUTO_REPAIR_FAILOVER = "failover"
-AUTO_REPAIR_REINSTALL = "reinstall"
-AUTO_REPAIR_ALL_TYPES = [
- AUTO_REPAIR_FIX_STORAGE,
- AUTO_REPAIR_MIGRATE,
- AUTO_REPAIR_FAILOVER,
- AUTO_REPAIR_REINSTALL,
-]
+AUTO_REPAIR_FIX_STORAGE = _constants.AUTO_REPAIR_FIX_STORAGE
+AUTO_REPAIR_MIGRATE = _constants.AUTO_REPAIR_MIGRATE
+AUTO_REPAIR_FAILOVER = _constants.AUTO_REPAIR_FAILOVER
+AUTO_REPAIR_REINSTALL = _constants.AUTO_REPAIR_REINSTALL
+AUTO_REPAIR_ALL_TYPES = _constants.AUTO_REPAIR_ALL_TYPES
# Auto-repair results
-AUTO_REPAIR_SUCCESS = "success"
-AUTO_REPAIR_FAILURE = "failure"
-AUTO_REPAIR_ENOPERM = "enoperm"
-AUTO_REPAIR_ALL_RESULTS = frozenset([
- AUTO_REPAIR_SUCCESS,
- AUTO_REPAIR_FAILURE,
- AUTO_REPAIR_ENOPERM,
-])
+AUTO_REPAIR_SUCCESS = _constants.AUTO_REPAIR_SUCCESS
+AUTO_REPAIR_FAILURE = _constants.AUTO_REPAIR_FAILURE
+AUTO_REPAIR_ENOPERM = _constants.AUTO_REPAIR_ENOPERM
+AUTO_REPAIR_ALL_RESULTS = _constants.AUTO_REPAIR_ALL_RESULTS
# The version identifier for builtin data collectors
-BUILTIN_DATA_COLLECTOR_VERSION = "B"
+BUILTIN_DATA_COLLECTOR_VERSION = _constants.BUILTIN_DATA_COLLECTOR_VERSION
# The reason trail opcode parameter name
-OPCODE_REASON = "reason"
+OPCODE_REASON = _constants.OPCODE_REASON
# The source reasons for the execution of an OpCode
OPCODE_REASON_SRC_CLIENT = "gnt:client"
OPCODE_REASON_SRC_USER,
])
-DISKSTATS_FILE = "/proc/diskstats"
+DISKSTATS_FILE = _constants.DISKSTATS_FILE
# CPU load collector variables
-STAT_FILE = "/proc/stat"
-CPUAVGLOAD_BUFFER_SIZE = 150
-CPUAVGLOAD_WINDOW_SIZE = 600
+STAT_FILE = _constants.STAT_FILE
+CPUAVGLOAD_BUFFER_SIZE = _constants.CPUAVGLOAD_BUFFER_SIZE
+CPUAVGLOAD_WINDOW_SIZE = _constants.CPUAVGLOAD_WINDOW_SIZE
# Mond's variable for periodical data collection
-MOND_TIME_INTERVAL = 5
+MOND_TIME_INTERVAL = _constants.MOND_TIME_INTERVAL
+
+# MonD's latest API version
+MOND_LATEST_API_VERSION = 1
+
+# Timeouts for upgrades
+
+UPGRADE_QUEUE_DRAIN_TIMEOUT = _constants.UPGRADE_QUEUE_DRAIN_TIMEOUT
+UPGRADE_QUEUE_POLL_INTERVAL = _constants.UPGRADE_QUEUE_POLL_INTERVAL
# Do not re-export imported modules
-del re, _vcsversion, _autoconf, socket, pathutils, compat
+del re, _vcsversion, _constants, socket, pathutils, compat
+
+
+ALLOCATABLE_KEY = "allocatable"
+FAILED_KEY = "failed"