import re
from ganeti import _autoconf
+from ganeti import _vcsversion
# various versions
RELEASE_VERSION = _autoconf.PACKAGE_VERSION
OS_API_V15 = 15
OS_API_V20 = 20
OS_API_VERSIONS = frozenset([OS_API_V10, OS_API_V15, OS_API_V20])
-VCS_VERSION = _autoconf.VCS_VERSION
+VCS_VERSION = _vcsversion.VCS_VERSION
EXPORT_VERSION = 0
RAPI_VERSION = 2
CONFD_USER = _autoconf.CONFD_USER
CONFD_GROUP = _autoconf.CONFD_GROUP
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_UPFILE = RUN_GANETI_DIR + "/instance-status"
+INSTANCE_STATUS_FILE = RUN_GANETI_DIR + "/instance-status"
SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts"
RAPI_USERS_FILE = DATA_DIR + "/rapi/users"
QUEUE_DIR = DATA_DIR + "/queue"
DAEMON_UTIL = _autoconf.PKGLIBDIR + "/daemon-util"
SETUP_SSH = _autoconf.TOOLSDIR + "/setup-ssh"
KVM_IFUP = _autoconf.PKGLIBDIR + "/kvm-ifup"
+KVM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/kvm-console-wrapper"
+XM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/xm-console-wrapper"
ETC_HOSTS = "/etc/hosts"
DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR
DEFAULT_SHARED_FILE_STORAGE_DIR = _autoconf.SHARED_FILE_STORAGE_DIR
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"
+
+#: 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])
+ALL_CERT_FILES = frozenset([
+ NODED_CERT_FILE,
+ RAPI_CERT_FILE,
+ SPICE_CERT_FILE,
+ SPICE_CACERT_FILE,
+ ])
MASTER_SOCKET = SOCKET_DIR + "/ganeti-master"
LUXI_EOM = "\3"
LUXI_VERSION = CONFIG_VERSION
-# one of 'no', 'yes', 'only'
+# one of "no", "yes", "only"
SYSLOG_USAGE = _autoconf.SYSLOG_USAGE
SYSLOG_NO = "no"
SYSLOG_YES = "yes"
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"
SO_FIX_CONSISTENCY = "fix-consistency"
# Available fields per storage type
-VALID_STORAGE_FIELDS = frozenset([SF_NAME, SF_TYPE, SF_SIZE,
- SF_USED, SF_FREE, SF_ALLOCATABLE])
+VALID_STORAGE_FIELDS = frozenset([
+ SF_NAME,
+ SF_TYPE,
+ SF_SIZE,
+ SF_USED,
+ SF_FREE,
+ SF_ALLOCATABLE
+ ])
VALID_STORAGE_TYPES = frozenset([ST_FILE, ST_LVM_PV, ST_LVM_VG])
# 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 = frozenset([DT_FILE, DT_SHARED_FILE])
# logical disk types
LD_LV = "lvm"
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"
EXPORT_MODE_REMOTE,
])
-# lock recalculate mode
-LOCKS_REPLACE = 'replace'
-LOCKS_APPEND = 'append'
+# 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
+LOCK_ATTEMPTS_TIMEOUT = 10 * 3600 / 20.0
+LOCK_ATTEMPTS_MAXWAIT = 15.0
+LOCK_ATTEMPTS_MINWAIT = 1.0
# instance creation modes
INSTANCE_CREATE = "create"
#: Give child process up to 5 seconds to exit after sending a signal
CHILD_LINGER_TIMEOUT = 5.0
-DISK_TEMPLATES = frozenset([DT_DISKLESS, DT_PLAIN, DT_DRBD8,
- DT_FILE, DT_SHARED_FILE, DT_BLOCK])
+DISK_TEMPLATES = frozenset([
+ DT_DISKLESS,
+ DT_PLAIN,
+ DT_DRBD8,
+ DT_FILE,
+ DT_SHARED_FILE,
+ DT_BLOCK
+ ])
FILE_DRIVER = frozenset([FD_LOOP, FD_BLKTAP])
# tags
TAG_CLUSTER = "cluster"
+TAG_NODEGROUP = "nodegroup"
TAG_NODE = "node"
TAG_INSTANCE = "instance"
VALID_TAG_TYPES = frozenset([
TAG_CLUSTER,
+ TAG_NODEGROUP,
TAG_NODE,
TAG_INSTANCE,
])
# 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"
# runparts results
(RUNPARTS_SKIP,
RPC_ENCODING_ZLIB_BASE64) = range(2)
# 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 = frozenset([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_SCRIPT_CREATE = "create"
+OS_SCRIPT_IMPORT = "import"
+OS_SCRIPT_EXPORT = "export"
+OS_SCRIPT_RENAME = "rename"
+OS_SCRIPT_VERIFY = "verify"
+OS_SCRIPTS = frozenset([
+ 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 = frozenset([OS_VALIDATE_PARAMETERS])
# ssh constants
INSTANCE_REBOOT_HARD = "hard"
INSTANCE_REBOOT_FULL = "full"
-REBOOT_TYPES = frozenset([INSTANCE_REBOOT_SOFT,
- INSTANCE_REBOOT_HARD,
- INSTANCE_REBOOT_FULL])
+REBOOT_TYPES = frozenset([
+ INSTANCE_REBOOT_SOFT,
+ INSTANCE_REBOOT_HARD,
+ INSTANCE_REBOOT_FULL
+ ])
+
+# instance reboot behaviors
+INSTANCE_REBOOT_ALLOWED = "reboot"
+INSTANCE_REBOOT_EXIT = "exit"
-VTYPE_STRING = 'string'
+REBOOT_BEHAVIORS = frozenset([
+ 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'
+VTYPE_BOOL = "bool"
+VTYPE_SIZE = "size" # size, in MiBs
+VTYPE_INT = "int"
ENFORCEABLE_TYPES = frozenset([
- VTYPE_STRING,
- VTYPE_MAYBE_STRING,
- VTYPE_BOOL,
- VTYPE_SIZE,
- VTYPE_INT,
- ])
+ 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
# 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_ROOT_PATH = "root_path"
HV_SERIAL_CONSOLE = "serial_console"
HV_USB_MOUSE = "usb_mouse"
+HV_KEYMAP = "keymap"
HV_DEVICE_MODEL = "device_model"
HV_INIT_SCRIPT = "init_script"
HV_MIGRATION_PORT = "migration_port"
HV_CPU_MASK = "cpu_mask"
HV_MEM_PATH = "mem_path"
HV_BLOCKDEV_PREFIX = "blockdev_prefix"
+HV_REBOOT_BEHAVIOR = "reboot_behavior"
HVS_PARAMETER_TYPES = {
HV_BOOT_ORDER: VTYPE_STRING,
+ HV_KVM_FLOPPY_IMAGE_PATH: VTYPE_STRING,
HV_CDROM_IMAGE_PATH: VTYPE_STRING,
+ HV_KVM_CDROM2_IMAGE_PATH: VTYPE_STRING,
HV_NIC_TYPE: VTYPE_STRING,
HV_DISK_TYPE: VTYPE_STRING,
+ HV_KVM_CDROM_DISK_TYPE: VTYPE_STRING,
HV_VNC_PASSWORD_FILE: VTYPE_STRING,
HV_VNC_BIND_ADDRESS: VTYPE_STRING,
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,
HV_KERNEL_PATH: VTYPE_STRING,
HV_KERNEL_ARGS: VTYPE_STRING,
HV_INITRD_PATH: VTYPE_STRING,
- HV_ROOT_PATH: VTYPE_STRING,
+ HV_ROOT_PATH: VTYPE_MAYBE_STRING,
HV_SERIAL_CONSOLE: VTYPE_BOOL,
HV_USB_MOUSE: VTYPE_STRING,
+ HV_KEYMAP: VTYPE_STRING,
HV_DEVICE_MODEL: VTYPE_STRING,
HV_INIT_SCRIPT: VTYPE_STRING,
HV_MIGRATION_PORT: VTYPE_INT,
HV_CPU_MASK: VTYPE_STRING,
HV_MEM_PATH: VTYPE_STRING,
HV_BLOCKDEV_PREFIX: VTYPE_STRING,
+ HV_REBOOT_BEHAVIOR: VTYPE_STRING,
}
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"
OOB_POWER_STATUS = "power-status"
OOB_HEALTH = "health"
-OOB_COMMANDS = frozenset([OOB_POWER_ON, OOB_POWER_OFF, OOB_POWER_CYCLE,
- OOB_POWER_STATUS, OOB_HEALTH])
+OOB_COMMANDS = frozenset([
+ OOB_POWER_ON,
+ OOB_POWER_OFF,
+ OOB_POWER_CYCLE,
+ OOB_POWER_STATUS,
+ OOB_HEALTH
+ ])
OOB_POWER_STATUS_POWERED = "powered"
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())
IDISK_MODE = "mode"
IDISK_ADOPT = "adopt"
IDISK_VG = "vg"
+IDISK_METAVG = "metavg"
IDISK_PARAMS_TYPES = {
IDISK_SIZE: VTYPE_SIZE,
IDISK_MODE: VTYPE_STRING,
IDISK_ADOPT: VTYPE_STRING,
IDISK_VG: VTYPE_STRING,
+ IDISK_METAVG: VTYPE_STRING,
}
IDISK_PARAMS = frozenset(IDISK_PARAMS_TYPES.keys())
HT_NIC_E1000 = "e1000"
HT_NIC_PARAVIRTUAL = HT_DISK_PARAVIRTUAL = "paravirtual"
-HT_HVM_VALID_NIC_TYPES = frozenset([HT_NIC_RTL8139, HT_NIC_NE2K_PCI,
- HT_NIC_E1000, HT_NIC_NE2K_ISA,
- HT_NIC_PARAVIRTUAL])
-HT_KVM_VALID_NIC_TYPES = frozenset([HT_NIC_RTL8139, HT_NIC_NE2K_PCI,
- HT_NIC_NE2K_ISA, HT_NIC_I82551,
- HT_NIC_I85557B, HT_NIC_I8259ER,
- HT_NIC_PCNET, HT_NIC_E1000,
- HT_NIC_PARAVIRTUAL])
+HT_HVM_VALID_NIC_TYPES = frozenset([
+ HT_NIC_RTL8139,
+ HT_NIC_NE2K_PCI,
+ HT_NIC_E1000,
+ HT_NIC_NE2K_ISA,
+ HT_NIC_PARAVIRTUAL
+ ])
+HT_KVM_VALID_NIC_TYPES = frozenset([
+ HT_NIC_RTL8139,
+ HT_NIC_NE2K_PCI,
+ HT_NIC_NE2K_ISA,
+ HT_NIC_I82551,
+ HT_NIC_I85557B,
+ HT_NIC_I8259ER,
+ HT_NIC_PCNET,
+ HT_NIC_E1000,
+ HT_NIC_PARAVIRTUAL
+ ])
+
# Disk types
HT_DISK_IOEMU = "ioemu"
HT_DISK_IDE = "ide"
HT_CACHE_NONE = "none"
HT_CACHE_WTHROUGH = "writethrough"
HT_CACHE_WBACK = "writeback"
-HT_VALID_CACHE_TYPES = frozenset([HT_CACHE_DEFAULT,
- HT_CACHE_NONE,
- HT_CACHE_WTHROUGH,
- HT_CACHE_WBACK])
+HT_VALID_CACHE_TYPES = frozenset([
+ HT_CACHE_DEFAULT,
+ HT_CACHE_NONE,
+ HT_CACHE_WTHROUGH,
+ HT_CACHE_WBACK
+ ])
HT_HVM_VALID_DISK_TYPES = frozenset([HT_DISK_PARAVIRTUAL, HT_DISK_IOEMU])
-HT_KVM_VALID_DISK_TYPES = frozenset([HT_DISK_PARAVIRTUAL, HT_DISK_IDE,
- HT_DISK_SCSI, HT_DISK_SD, HT_DISK_MTD,
- HT_DISK_PFLASH])
+HT_KVM_VALID_DISK_TYPES = frozenset([
+ HT_DISK_PARAVIRTUAL,
+ HT_DISK_IDE,
+ HT_DISK_SCSI,
+ HT_DISK_SD,
+ HT_DISK_MTD,
+ HT_DISK_PFLASH
+ ])
# Mouse types:
HT_MOUSE_MOUSE = "mouse"
HT_KVM_VALID_MOUSE_TYPES = frozenset([HT_MOUSE_MOUSE, HT_MOUSE_TABLET])
# Boot order
+HT_BO_FLOPPY = "floppy"
HT_BO_CDROM = "cdrom"
HT_BO_DISK = "disk"
HT_BO_NETWORK = "network"
-HT_KVM_VALID_BO_TYPES = frozenset([HT_BO_CDROM, HT_BO_DISK, HT_BO_NETWORK])
+HT_KVM_VALID_BO_TYPES = frozenset([
+ HT_BO_FLOPPY,
+ HT_BO_CDROM,
+ HT_BO_DISK,
+ 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_MIGRATION_MODES = frozenset([HT_MIGRATION_LIVE, HT_MIGRATION_NONLIVE])
# Cluster Verify steps
-VERIFY_NPLUSONE_MEM = 'nplusone_mem'
+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_VGLIST = "vglist"
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_SEARCH_PATH = _autoconf.IALLOCATOR_SEARCH_PATH
+IALLOCATOR_NEVAC_PRI = "primary-only"
+IALLOCATOR_NEVAC_SEC = "secondary-only"
+IALLOCATOR_NEVAC_ALL = "all"
+IALLOCATOR_NEVAC_MODES = frozenset([
+ IALLOCATOR_NEVAC_PRI,
+ IALLOCATOR_NEVAC_SEC,
+ 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"
# Job status
JOB_STATUS_QUEUED = "queued"
-JOB_STATUS_WAITLOCK = "waiting"
+JOB_STATUS_WAITING = "waiting"
JOB_STATUS_CANCELING = "canceling"
JOB_STATUS_RUNNING = "running"
JOB_STATUS_CANCELED = "canceled"
])
JOB_STATUS_ALL = frozenset([
JOB_STATUS_QUEUED,
- JOB_STATUS_WAITLOCK,
+ JOB_STATUS_WAITING,
JOB_STATUS_CANCELING,
JOB_STATUS_RUNNING,
]) | JOBS_FINALIZED
# OpCode status
# not yet finalized
OP_STATUS_QUEUED = "queued"
-OP_STATUS_WAITLOCK = "waiting"
+OP_STATUS_WAITING = "waiting"
OP_STATUS_CANCELING = "canceling"
OP_STATUS_RUNNING = "running"
# finalized
OP_STATUS_CANCELED = "canceled"
OP_STATUS_SUCCESS = "success"
OP_STATUS_ERROR = "error"
-OPS_FINALIZED = frozenset([OP_STATUS_CANCELED,
- OP_STATUS_SUCCESS,
- OP_STATUS_ERROR])
+OPS_FINALIZED = frozenset([
+ OP_STATUS_CANCELED,
+ OP_STATUS_SUCCESS,
+ OP_STATUS_ERROR
+ ])
# OpCode priority
OP_PRIO_LOWEST = +19
QR_NODE = "node"
QR_LOCK = "lock"
QR_GROUP = "group"
+QR_OS = "os"
#: List of resources which can be queried using L{opcodes.OpQuery}
-QR_OP_QUERY = frozenset([QR_INSTANCE, QR_NODE, QR_GROUP])
+QR_VIA_OP = frozenset([QR_INSTANCE, QR_NODE, QR_GROUP, QR_OS])
#: List of resources which can be queried using Local UniX Interface
-QR_OP_LUXI = QR_OP_QUERY.union([
+QR_VIA_LUXI = QR_VIA_OP.union([
QR_LOCK,
])
+#: List of resources which can be queried using RAPI
+QR_VIA_RAPI = QR_VIA_LUXI
+
# Query field types
QFT_UNKNOWN = "unknown"
QFT_TEXT = "text"
#: 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
HT_XEN_PVM: {
HV_USE_BOOTLOADER: False,
HV_BOOTLOADER_PATH: XEN_BOOTLOADER,
- HV_BOOTLOADER_ARGS: '',
+ HV_BOOTLOADER_ARGS: "",
HV_KERNEL_PATH: "/boot/vmlinuz-2.6-xenU",
- HV_INITRD_PATH: '',
- HV_ROOT_PATH: '/dev/sda1',
- HV_KERNEL_ARGS: 'ro',
+ HV_INITRD_PATH: "",
+ HV_ROOT_PATH: "/dev/sda1",
+ HV_KERNEL_ARGS: "ro",
HV_MIGRATION_PORT: 8002,
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_CDROM_IMAGE_PATH: '',
+ HV_CDROM_IMAGE_PATH: "",
HV_NIC_TYPE: HT_NIC_RTL8139,
HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
HV_VNC_BIND_ADDRESS: IP4_ADDRESS_ANY,
HV_MIGRATION_MODE: HT_MIGRATION_NONLIVE,
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_INITRD_PATH: '',
- HV_KERNEL_ARGS: 'ro',
- HV_ROOT_PATH: '/dev/vda1',
+ HV_INITRD_PATH: "",
+ HV_KERNEL_ARGS: "ro",
+ HV_ROOT_PATH: "/dev/vda1",
HV_ACPI: True,
HV_SERIAL_CONSOLE: True,
- HV_VNC_BIND_ADDRESS: '',
+ HV_VNC_BIND_ADDRESS: "",
HV_VNC_TLS: False,
- HV_VNC_X509: '',
+ HV_VNC_X509: "",
HV_VNC_X509_VERIFY: False,
- HV_VNC_PASSWORD_FILE: '',
- HV_CDROM_IMAGE_PATH: '',
+ 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_BOOT_ORDER: HT_BO_DISK,
HV_NIC_TYPE: HT_NIC_PARAVIRTUAL,
HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
- HV_USB_MOUSE: '',
+ HV_KVM_CDROM_DISK_TYPE: "",
+ HV_USB_MOUSE: "",
+ HV_KEYMAP: "",
HV_MIGRATION_PORT: 8102,
HV_MIGRATION_BANDWIDTH: 32, # MiB/s
HV_MIGRATION_DOWNTIME: 30, # ms
HV_USE_LOCALTIME: False,
HV_DISK_CACHE: HT_CACHE_DEFAULT,
HV_SECURITY_MODEL: HT_SM_NONE,
- HV_SECURITY_DOMAIN: '',
+ HV_SECURITY_DOMAIN: "",
HV_KVM_FLAG: "",
HV_VHOST_NET: False,
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
# 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 = "plj0"
# 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,
# 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