4 # Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 """Module holding different constants."""
27 from ganeti import _constants
28 from ganeti import _vcsversion
29 from ganeti import compat
30 from ganeti import pathutils
34 RELEASE_VERSION = _constants.RELEASE_VERSION
35 OS_API_V10 = _constants.OS_API_V10
36 OS_API_V15 = _constants.OS_API_V15
37 OS_API_V20 = _constants.OS_API_V20
38 OS_API_VERSIONS = _constants.OS_API_VERSIONS
39 VCS_VERSION = _vcsversion.VCS_VERSION
40 EXPORT_VERSION = _constants.EXPORT_VERSION
41 RAPI_VERSION = _constants.RAPI_VERSION
43 VERSION_MAJOR = _constants.VERSION_MAJOR
44 VERSION_MINOR = _constants.VERSION_MINOR
45 VERSION_REVISION = _constants.VERSION_REVISION
47 DIR_VERSION = _constants.DIR_VERSION
49 CONFIG_MAJOR = _constants.CONFIG_MAJOR
50 CONFIG_MINOR = _constants.CONFIG_MINOR
51 CONFIG_REVISION = _constants.CONFIG_REVISION
52 CONFIG_VERSION = _constants.CONFIG_VERSION
54 #: RPC protocol version
55 PROTOCOL_VERSION = _constants.PROTOCOL_VERSION
58 DAEMONS_GROUP = _constants.DAEMONS_GROUP
59 ADMIN_GROUP = _constants.ADMIN_GROUP
60 MASTERD_USER = _constants.MASTERD_USER
61 MASTERD_GROUP = _constants.MASTERD_GROUP
62 RAPI_USER = _constants.RAPI_USER
63 RAPI_GROUP = _constants.RAPI_GROUP
64 CONFD_USER = _constants.CONFD_USER
65 CONFD_GROUP = _constants.CONFD_GROUP
66 LUXID_USER = _constants.LUXID_USER
67 LUXID_GROUP = _constants.LUXID_GROUP
68 NODED_USER = _constants.NODED_USER
69 NODED_GROUP = _constants.NODED_GROUP
70 MOND_USER = _constants.MOND_USER
71 MOND_GROUP = _constants.MOND_GROUP
72 SSH_LOGIN_USER = _constants.SSH_LOGIN_USER
73 SSH_CONSOLE_USER = _constants.SSH_CONSOLE_USER
75 # cpu pinning separators and constants
77 CPU_PINNING_ALL = "all"
78 # internal representation of "all"
79 CPU_PINNING_ALL_VAL = -1
80 # one "all" entry in a CPU list means CPU pinning is off
81 CPU_PINNING_OFF = [CPU_PINNING_ALL_VAL]
83 # A Xen-specific implementation detail - there is no way to actually say
84 # "use any cpu for pinning" in a Xen configuration file, as opposed to the
85 # command line, where you can say "xm vcpu-pin <domain> <vcpu> all".
86 # The workaround used in Xen is "0-63" (see source code function
87 # xm_vcpu_pin in <xen-source>/tools/python/xen/xm/main.py).
88 # To support future changes, the following constant is treated as a
89 # blackbox string that simply means use-any-cpu-for-pinning-under-xen.
90 CPU_PINNING_ALL_XEN = "0-63"
92 # A KVM-specific implementation detail - the following value is used
93 # to set CPU affinity to all processors (#0 through #31), per taskset
95 # FIXME: This only works for machines with up to 32 CPU cores
96 CPU_PINNING_ALL_KVM = 0xFFFFFFFF
99 DD_CMD = _constants.DD_CMD
100 MAX_WIPE_CHUNK = _constants.MAX_WIPE_CHUNK
101 MIN_WIPE_CHUNK_PERCENT = _constants.MIN_WIPE_CHUNK_PERCENT
103 RUN_DIRS_MODE = _constants.RUN_DIRS_MODE
104 SECURE_DIR_MODE = _constants.SECURE_DIR_MODE
105 SECURE_FILE_MODE = _constants.SECURE_FILE_MODE
106 ADOPTABLE_BLOCKDEV_ROOT = _constants.ADOPTABLE_BLOCKDEV_ROOT
107 ENABLE_CONFD = _constants.ENABLE_CONFD
108 ENABLE_MOND = _constants.ENABLE_MOND
109 ENABLE_SPLIT_QUERY = _constants.ENABLE_SPLIT_QUERY
110 ENABLE_RESTRICTED_COMMANDS = _constants.ENABLE_RESTRICTED_COMMANDS
116 NODED = _constants.NODED
117 CONFD = _constants.CONFD
118 LUXID = _constants.LUXID
119 RAPI = _constants.RAPI
120 MASTERD = _constants.MASTERD
121 MOND = _constants.MOND
123 DAEMONS = _constants.DAEMONS
125 DAEMONS_PORTS = _constants.DAEMONS_PORTS
127 DEFAULT_NODED_PORT = _constants.DEFAULT_NODED_PORT
128 DEFAULT_CONFD_PORT = _constants.DEFAULT_CONFD_PORT
129 DEFAULT_MOND_PORT = _constants.DEFAULT_MOND_PORT
130 DEFAULT_RAPI_PORT = _constants.DEFAULT_RAPI_PORT
132 FIRST_DRBD_PORT = _constants.FIRST_DRBD_PORT
133 LAST_DRBD_PORT = _constants.LAST_DRBD_PORT
135 DAEMONS_LOGBASE = _constants.DAEMONS_LOGBASE
138 dict((daemon, pathutils.GetLogFilename(DAEMONS_LOGBASE[daemon]))
139 for daemon in DAEMONS_LOGBASE)
141 # Some daemons might require more than one logfile.
142 # Specifically, right now only the Haskell http library "snap", used by the
143 # monitoring daemon, requires multiple log files.
145 # These are the only valid reasons for having an extra logfile
146 EXTRA_LOGREASON_ACCESS = "access"
147 EXTRA_LOGREASON_ERROR = "error"
149 VALID_EXTRA_LOGREASONS = compat.UniqueFrozenset([
150 EXTRA_LOGREASON_ACCESS,
151 EXTRA_LOGREASON_ERROR,
154 # These are the extra logfiles, grouped by daemon
155 DAEMONS_EXTRA_LOGBASE = {
157 EXTRA_LOGREASON_ACCESS: _constants.EXTRA_LOGREASON_ACCESS,
158 EXTRA_LOGREASON_ERROR: _constants.EXTRA_LOGREASON_ERROR,
162 DAEMONS_EXTRA_LOGFILES = \
163 dict((daemon, dict((extra,
164 pathutils.GetLogFilename(DAEMONS_EXTRA_LOGBASE[daemon][extra]))
165 for extra in DAEMONS_EXTRA_LOGBASE[daemon]))
166 for daemon in DAEMONS_EXTRA_LOGBASE)
168 DEV_CONSOLE = _constants.DEV_CONSOLE
170 PROC_MOUNTS = "/proc/mounts"
172 LUXI_EOM = _constants.LUXI_EOM
173 LUXI_VERSION = _constants.LUXI_VERSION
174 LUXI_OVERRIDE = _constants.LUXI_OVERRIDE
175 LUXI_OVERRIDE_MASTER = _constants.LUXI_OVERRIDE_MASTER
176 LUXI_OVERRIDE_QUERY = _constants.LUXI_OVERRIDE_QUERY
177 # one of "no", "yes", "only"
178 SYSLOG_USAGE = _constants.SYSLOG_USAGE
179 SYSLOG_NO = _constants.SYSLOG_NO
180 SYSLOG_YES = _constants.SYSLOG_YES
181 SYSLOG_ONLY = _constants.SYSLOG_ONLY
182 SYSLOG_SOCKET = _constants.SYSLOG_SOCKET
184 EXPORT_CONF_FILE = "config.ini"
186 XEN_BOOTLOADER = _constants.XEN_BOOTLOADER
187 XEN_KERNEL = _constants.XEN_KERNEL
188 XEN_INITRD = _constants.XEN_INITRD
189 XEN_CMD_XM = _constants.XEN_CMD_XM
190 XEN_CMD_XL = _constants.XEN_CMD_XL
191 KNOWN_XEN_COMMANDS = _constants.KNOWN_XEN_COMMANDS
193 # When the Xen toolstack used is "xl", live migration requires the source host
194 # to connect to the target host via ssh (xl runs this command). We need to pass
195 # the command xl runs some extra info so that it can use Ganeti's key
196 # verification and not fail. Note that this string is incomplete: it must be
197 # filled with the cluster name before being used.
198 XL_SSH_CMD = ("ssh -l %s -oGlobalKnownHostsFile=%s"
199 " -oUserKnownHostsFile=/dev/null"
200 " -oCheckHostIp=no -oStrictHostKeyChecking=yes"
201 " -oHostKeyAlias=%%s") % (SSH_LOGIN_USER,
202 pathutils.SSH_KNOWN_HOSTS_FILE)
204 KVM_PATH = _constants.KVM_PATH
205 KVM_KERNEL = _constants.KVM_KERNEL
206 SOCAT_PATH = _constants.SOCAT_PATH
207 SOCAT_USE_ESCAPE = _constants.SOCAT_USE_ESCAPE
208 SOCAT_USE_COMPRESS = _constants.SOCAT_USE_COMPRESS
209 SOCAT_ESCAPE_CODE = _constants.SOCAT_ESCAPE_CODE
211 #: Console as SSH command
214 #: Console as VNC server
217 #: Console as SPICE server
220 #: Display a message for console access
224 CONS_ALL = compat.UniqueFrozenset([
231 # For RSA keys more bits are better, but they also make operations more
232 # expensive. NIST SP 800-131 recommends a minimum of 2048 bits from the year
236 # Ciphers allowed for SSL connections. For the format, see ciphers(1). A better
237 # way to disable ciphers would be to use the exclamation mark (!), but socat
238 # versions below 1.5 can't parse exclamation marks in options properly. When
239 # modifying the ciphers, ensure not to accidentially add something after it's
240 # been removed. Use the "openssl" utility to check the allowed ciphers, e.g.
241 # "openssl ciphers -v HIGH:-DES".
242 OPENSSL_CIPHERS = "HIGH:-DES:-3DES:-EXPORT:-ADH"
244 # Digest used to sign certificates ("openssl x509" uses SHA1 by default)
245 X509_CERT_SIGN_DIGEST = "SHA1"
247 # Default validity of certificates in days
248 X509_CERT_DEFAULT_VALIDITY = 365 * 5
250 # commonName (CN) used in certificates
251 X509_CERT_CN = "ganeti.example.com"
253 X509_CERT_SIGNATURE_HEADER = "X-Ganeti-Signature"
255 # Import/export daemon mode
256 IEM_IMPORT = "import"
257 IEM_EXPORT = "export"
259 # Import/export transport compression
262 IEC_ALL = compat.UniqueFrozenset([
267 IE_CUSTOM_SIZE = "fd"
269 IE_MAGIC_RE = re.compile(r"^[-_.a-zA-Z0-9]{5,100}$")
272 # Direct file I/O, equivalent to a shell's I/O redirection using '<' or '>'
274 # Raw block device I/O using "dd"
275 IEIO_RAW_DISK = "raw"
276 # OS definition import/export script
277 IEIO_SCRIPT = "script"
279 VALUE_DEFAULT = "default"
281 VALUE_GENERATE = "generate"
284 VALUE_FALSE = "false"
285 VALUE_HS_NOTHING = {"Nothing": None}
288 # External script validation mask
289 EXT_PLUGIN_MASK = re.compile("^[a-zA-Z0-9_-]+$")
291 # hooks-related constants
292 HOOKS_PHASE_PRE = "pre"
293 HOOKS_PHASE_POST = "post"
294 HOOKS_NAME_CFGUPDATE = "config-update"
295 HOOKS_NAME_WATCHER = "watcher"
297 HOOKS_PATH = "/sbin:/bin:/usr/sbin:/usr/bin"
299 # hooks subject type (what object type does the LU deal with)
300 HTYPE_CLUSTER = "CLUSTER"
302 HTYPE_GROUP = "GROUP"
303 HTYPE_INSTANCE = "INSTANCE"
304 HTYPE_NETWORK = "NETWORK"
311 ST_BLOCK = _constants.ST_BLOCK
312 ST_DISKLESS = _constants.ST_DISKLESS
313 ST_EXT = _constants.ST_EXT
314 ST_FILE = _constants.ST_FILE
315 ST_LVM_PV = _constants.ST_LVM_PV
316 ST_LVM_VG = _constants.ST_LVM_VG
317 ST_RADOS = _constants.ST_RADOS
318 STORAGE_TYPES = _constants.STORAGE_TYPES
320 # the set of storage types for which storage reporting is available
321 # FIXME: Remove this, once storage reporting is available for all types.
322 STS_REPORT = compat.UniqueFrozenset([ST_FILE, ST_LVM_PV, ST_LVM_VG])
325 # first two are valid in LU context only, not passed to backend
326 SF_NODE = _constants.SF_NODE
327 SF_TYPE = _constants.SF_TYPE
328 # and the rest are valid in backend
329 SF_NAME = _constants.SF_NAME
330 SF_SIZE = _constants.SF_SIZE
331 SF_FREE = _constants.SF_FREE
332 SF_USED = _constants.SF_USED
333 SF_ALLOCATABLE = _constants.SF_ALLOCATABLE
336 SO_FIX_CONSISTENCY = "fix-consistency"
338 # Available fields per storage type
339 VALID_STORAGE_FIELDS = compat.UniqueFrozenset([
349 MODIFIABLE_STORAGE_FIELDS = {
350 ST_LVM_PV: frozenset([SF_ALLOCATABLE]),
353 LDS_OKAY = _constants.LDS_OKAY
354 LDS_UNKNOWN = _constants.LDS_UNKNOWN
355 LDS_FAULTY = _constants.LDS_FAULTY
356 LDS_NAMES = _constants.LDS_NAMES
357 VALID_STORAGE_OPERATIONS = {
358 ST_LVM_VG: frozenset([SO_FIX_CONSISTENCY]),
363 VF_INSTANCE = "instance"
370 # disk template types
371 DT_BLOCK = _constants.DT_BLOCK
372 DT_DISKLESS = _constants.DT_DISKLESS
373 DT_DRBD8 = _constants.DT_DRBD8
374 DT_EXT = _constants.DT_EXT
375 DT_FILE = _constants.DT_FILE
376 DT_PLAIN = _constants.DT_PLAIN
377 DT_RBD = _constants.DT_RBD
378 DT_SHARED_FILE = _constants.DT_SHARED_FILE
379 DISK_TEMPLATE_PREFERENCE = _constants.DISK_TEMPLATE_PREFERENCE
380 DISK_TEMPLATES = _constants.DISK_TEMPLATES
381 DEFAULT_ENABLED_DISK_TEMPLATES = _constants.DEFAULT_ENABLED_DISK_TEMPLATES
383 # mapping of disk templates to storage types
384 MAP_DISK_TEMPLATE_STORAGE_TYPE = {
386 DT_DISKLESS: ST_DISKLESS,
392 DT_SHARED_FILE: ST_FILE,
397 DRBD_HMAC_ALG = "md5"
398 DRBD_DEFAULT_NET_PROTOCOL = "C"
399 DRBD_MIGRATION_NET_PROTOCOL = "C"
400 DRBD_STATUS_FILE = "/proc/drbd"
402 #: Size of DRBD meta block device
405 DTS_INT_MIRROR = _constants.DTS_INT_MIRROR
406 DTS_EXT_MIRROR = _constants.DTS_EXT_MIRROR
407 DTS_NOT_LVM = _constants.DTS_NOT_LVM
408 DTS_GROWABLE = _constants.DTS_GROWABLE
409 DTS_MAY_ADOPT = _constants.DTS_MAY_ADOPT
410 DTS_MUST_ADOPT = _constants.DTS_MUST_ADOPT
411 DTS_MIRRORED = _constants.DTS_MIRRORED
412 DTS_FILEBASED = _constants.DTS_FILEBASED
413 DTS_COPYABLE = _constants.DTS_COPYABLE
414 DTS_EXCL_STORAGE = _constants.DTS_EXCL_STORAGE
415 DTS_NO_FREE_SPACE_CHECK = _constants.DTS_NO_FREE_SPACE_CHECK
416 DTS_BLOCK = _constants.DTS_BLOCK
419 DRBD_B_DISK_BARRIERS = "b"
420 DRBD_B_DISK_DRAIN = "d"
421 DRBD_B_DISK_FLUSH = "f"
423 # Valid barrier combinations: "n" or any non-null subset of "bfd"
424 DRBD_VALID_BARRIER_OPT = compat.UniqueFrozenset([
425 frozenset([DRBD_B_NONE]),
426 frozenset([DRBD_B_DISK_BARRIERS]),
427 frozenset([DRBD_B_DISK_DRAIN]),
428 frozenset([DRBD_B_DISK_FLUSH]),
429 frozenset([DRBD_B_DISK_DRAIN, DRBD_B_DISK_FLUSH]),
430 frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_DRAIN]),
431 frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_FLUSH]),
432 frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_FLUSH, DRBD_B_DISK_DRAIN]),
438 FD_BLKTAP = _constants.FD_BLKTAP
439 FD_LOOP = _constants.FD_LOOP
440 FILE_DRIVER = _constants.FILE_DRIVER
442 LDS_DRBD = _constants.LDS_DRBD
445 DISK_RDONLY = _constants.DISK_RDONLY
446 DISK_RDWR = _constants.DISK_RDWR
447 DISK_ACCESS_SET = _constants.DISK_ACCESS_SET
448 DISK_USERSPACE = _constants.DISK_USERSPACE
449 DISK_KERNELSPACE = _constants.DISK_KERNELSPACE
450 DISK_VALID_ACCESS_MODES = _constants.DISK_VALID_ACCESS_MODES
452 REPLACE_DISK_PRI = _constants.REPLACE_DISK_PRI
453 REPLACE_DISK_SEC = _constants.REPLACE_DISK_SEC
454 REPLACE_DISK_CHG = _constants.REPLACE_DISK_CHG
455 REPLACE_DISK_AUTO = _constants.REPLACE_DISK_AUTO
456 REPLACE_MODES = _constants.REPLACE_MODES
458 # Instance export mode
459 EXPORT_MODE_LOCAL = _constants.EXPORT_MODE_LOCAL
460 EXPORT_MODE_REMOTE = _constants.EXPORT_MODE_REMOTE
461 EXPORT_MODES = _constants.EXPORT_MODES
463 # instance creation modes
464 INSTANCE_CREATE = _constants.INSTANCE_CREATE
465 INSTANCE_IMPORT = _constants.INSTANCE_IMPORT
466 INSTANCE_REMOTE_IMPORT = _constants.INSTANCE_REMOTE_IMPORT
467 INSTANCE_CREATE_MODES = _constants.INSTANCE_CREATE_MODES
469 # Remote import/export handshake message and version
471 RIE_HANDSHAKE = "Hi, I'm Ganeti"
473 # Remote import/export certificate validity in seconds
474 RIE_CERT_VALIDITY = 24 * 60 * 60
476 # Overall timeout for establishing connection
477 RIE_CONNECT_TIMEOUT = 180
479 # Export only: how long to wait per connection attempt (seconds)
480 RIE_CONNECT_ATTEMPT_TIMEOUT = 20
482 # Export only: number of attempts to connect
483 RIE_CONNECT_RETRIES = 10
485 #: Give child process up to 5 seconds to exit after sending a signal
486 CHILD_LINGER_TIMEOUT = 5.0
489 # import/export config options
490 INISECT_EXP = "export"
491 INISECT_INS = "instance"
492 INISECT_HYP = "hypervisor"
493 INISECT_BEP = "backend"
496 # dynamic device modification
497 DDM_ADD = _constants.DDM_ADD
498 DDM_MODIFY = _constants.DDM_MODIFY
499 DDM_REMOVE = _constants.DDM_REMOVE
500 DDMS_VALUES = _constants.DDMS_VALUES
501 DDMS_VALUES_WITH_MODIFY = _constants.DDMS_VALUES_WITH_MODIFY
502 # TODO: DDM_SWAP, DDM_MOVE?
505 EXIT_SUCCESS = _constants.EXIT_SUCCESS
506 EXIT_FAILURE = _constants.EXIT_FAILURE
507 EXIT_NOTCLUSTER = _constants.EXIT_NOTCLUSTER
508 EXIT_NOTMASTER = _constants.EXIT_NOTMASTER
509 EXIT_NODESETUP_ERROR = _constants.EXIT_NODESETUP_ERROR
510 EXIT_CONFIRMATION = _constants.EXIT_CONFIRMATION # need user confirmation
512 #: Exit code for query operations with unknown fields
513 EXIT_UNKNOWN_FIELD = _constants.EXIT_UNKNOWN_FIELD
516 TAG_CLUSTER = _constants.TAG_CLUSTER
517 TAG_NODEGROUP = _constants.TAG_NODEGROUP
518 TAG_NODE = _constants.TAG_NODE
519 TAG_INSTANCE = _constants.TAG_INSTANCE
520 TAG_NETWORK = _constants.TAG_NETWORK
521 VALID_TAG_TYPES = _constants.VALID_TAG_TYPES
523 MAX_TAG_LEN = _constants.MAX_TAG_LEN
524 MAX_TAGS_PER_OBJ = _constants.MAX_TAGS_PER_OBJ
527 DEFAULT_BRIDGE = "xen-br0"
528 DEFAULT_OVS = "switch1"
529 CLASSIC_DRBD_SYNC_SPEED = 60 * 1024 # 60 MiB, expressed in KiB
530 IP4_ADDRESS_LOCALHOST = "127.0.0.1"
531 IP4_ADDRESS_ANY = "0.0.0.0"
532 IP6_ADDRESS_LOCALHOST = "::1"
533 IP6_ADDRESS_ANY = "::"
536 VALID_IP_VERSIONS = compat.UniqueFrozenset([IP4_VERSION, IP6_VERSION])
537 # for export to htools
538 IP4_FAMILY = socket.AF_INET
539 IP6_FAMILY = socket.AF_INET6
541 TCP_PING_TIMEOUT = 10
543 DEFAULT_DRBD_HELPER = "/bin/true"
545 DEFAULT_MAC_PREFIX = "aa:00:00"
546 # default maximum instance wait time, in seconds.
547 DEFAULT_SHUTDOWN_TIMEOUT = 120
548 NODE_MAX_CLOCK_SKEW = _constants.NODE_MAX_CLOCK_SKEW
549 # Time for an intra-cluster disk transfer to wait for a connection
550 DISK_TRANSFER_CONNECT_TIMEOUT = 60
551 # Disk index separator
552 DISK_SEPARATOR = _constants.DISK_SEPARATOR
553 IP_COMMAND_PATH = _constants.IP_COMMAND_PATH
555 RPC_TMO_URGENT = _constants.RPC_TMO_URGENT
556 RPC_TMO_FAST = _constants.RPC_TMO_FAST
557 RPC_TMO_NORMAL = _constants.RPC_TMO_NORMAL
558 RPC_TMO_SLOW = _constants.RPC_TMO_SLOW
559 RPC_TMO_4HRS = _constants.RPC_TMO_4HRS
560 RPC_TMO_1DAY = _constants.RPC_TMO_1DAY
561 RPC_CONNECT_TIMEOUT = _constants.RPC_CONNECT_TIMEOUT
563 #: Key for job IDs in opcode result
569 RUNPARTS_ERR) = range(3)
571 RUNPARTS_STATUS = compat.UniqueFrozenset([
579 RPC_ENCODING_ZLIB_BASE64) = range(2)
581 # os related constants
582 OS_SCRIPT_CREATE = "create"
583 OS_SCRIPT_IMPORT = "import"
584 OS_SCRIPT_EXPORT = "export"
585 OS_SCRIPT_RENAME = "rename"
586 OS_SCRIPT_VERIFY = "verify"
587 OS_SCRIPTS = compat.UniqueFrozenset([
595 OS_API_FILE = "ganeti_api_version"
596 OS_VARIANTS_FILE = "variants.list"
597 OS_PARAMETERS_FILE = "parameters.list"
599 OS_VALIDATE_PARAMETERS = "parameters"
600 OS_VALIDATE_CALLS = compat.UniqueFrozenset([OS_VALIDATE_PARAMETERS])
602 # External Storage (ES) related constants
603 ES_ACTION_CREATE = "create"
604 ES_ACTION_REMOVE = "remove"
605 ES_ACTION_GROW = "grow"
606 ES_ACTION_ATTACH = "attach"
607 ES_ACTION_DETACH = "detach"
608 ES_ACTION_SETINFO = "setinfo"
609 ES_ACTION_VERIFY = "verify"
611 ES_SCRIPT_CREATE = ES_ACTION_CREATE
612 ES_SCRIPT_REMOVE = ES_ACTION_REMOVE
613 ES_SCRIPT_GROW = ES_ACTION_GROW
614 ES_SCRIPT_ATTACH = ES_ACTION_ATTACH
615 ES_SCRIPT_DETACH = ES_ACTION_DETACH
616 ES_SCRIPT_SETINFO = ES_ACTION_SETINFO
617 ES_SCRIPT_VERIFY = ES_ACTION_VERIFY
618 ES_SCRIPTS = frozenset([
628 ES_PARAMETERS_FILE = "parameters.list"
631 INSTANCE_REBOOT_SOFT = _constants.INSTANCE_REBOOT_SOFT
632 INSTANCE_REBOOT_HARD = _constants.INSTANCE_REBOOT_HARD
633 INSTANCE_REBOOT_FULL = _constants.INSTANCE_REBOOT_FULL
634 REBOOT_TYPES = _constants.REBOOT_TYPES
636 # instance reboot behaviors
637 INSTANCE_REBOOT_ALLOWED = "reboot"
638 INSTANCE_REBOOT_EXIT = "exit"
640 REBOOT_BEHAVIORS = compat.UniqueFrozenset([
641 INSTANCE_REBOOT_ALLOWED,
642 INSTANCE_REBOOT_EXIT,
645 VTYPE_STRING = _constants.VTYPE_STRING
646 VTYPE_MAYBE_STRING = _constants.VTYPE_MAYBE_STRING
647 VTYPE_BOOL = _constants.VTYPE_BOOL
648 VTYPE_SIZE = _constants.VTYPE_SIZE
649 VTYPE_INT = _constants.VTYPE_INT
650 ENFORCEABLE_TYPES = _constants.ENFORCEABLE_TYPES
652 # Constant representing that the user does not specify any IP version
653 IFACE_NO_IP_VERSION_SPECIFIED = 0
655 VALID_SERIAL_SPEEDS = compat.UniqueFrozenset([
676 # HV parameter names (global namespace)
677 HV_BOOT_ORDER = "boot_order"
678 HV_CDROM_IMAGE_PATH = "cdrom_image_path"
679 HV_KVM_CDROM2_IMAGE_PATH = "cdrom2_image_path"
680 HV_KVM_FLOPPY_IMAGE_PATH = "floppy_image_path"
681 HV_NIC_TYPE = "nic_type"
682 HV_DISK_TYPE = "disk_type"
683 HV_KVM_CDROM_DISK_TYPE = "cdrom_disk_type"
684 HV_VNC_BIND_ADDRESS = "vnc_bind_address"
685 HV_VNC_PASSWORD_FILE = "vnc_password_file"
686 HV_VNC_TLS = "vnc_tls"
687 HV_VNC_X509 = "vnc_x509_path"
688 HV_VNC_X509_VERIFY = "vnc_x509_verify"
689 HV_KVM_SPICE_BIND = "spice_bind"
690 HV_KVM_SPICE_IP_VERSION = "spice_ip_version"
691 HV_KVM_SPICE_PASSWORD_FILE = "spice_password_file"
692 HV_KVM_SPICE_LOSSLESS_IMG_COMPR = "spice_image_compression"
693 HV_KVM_SPICE_JPEG_IMG_COMPR = "spice_jpeg_wan_compression"
694 HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR = "spice_zlib_glz_wan_compression"
695 HV_KVM_SPICE_STREAMING_VIDEO_DETECTION = "spice_streaming_video"
696 HV_KVM_SPICE_AUDIO_COMPR = "spice_playback_compression"
697 HV_KVM_SPICE_USE_TLS = "spice_use_tls"
698 HV_KVM_SPICE_TLS_CIPHERS = "spice_tls_ciphers"
699 HV_KVM_SPICE_USE_VDAGENT = "spice_use_vdagent"
702 HV_USE_BOOTLOADER = "use_bootloader"
703 HV_BOOTLOADER_ARGS = "bootloader_args"
704 HV_BOOTLOADER_PATH = "bootloader_path"
705 HV_KERNEL_ARGS = "kernel_args"
706 HV_KERNEL_PATH = "kernel_path"
707 HV_INITRD_PATH = "initrd_path"
708 HV_ROOT_PATH = "root_path"
709 HV_SERIAL_CONSOLE = "serial_console"
710 HV_SERIAL_SPEED = "serial_speed"
711 HV_USB_MOUSE = "usb_mouse"
713 HV_DEVICE_MODEL = "device_model"
714 HV_INIT_SCRIPT = "init_script"
715 HV_MIGRATION_PORT = "migration_port"
716 HV_MIGRATION_BANDWIDTH = "migration_bandwidth"
717 HV_MIGRATION_DOWNTIME = "migration_downtime"
718 HV_MIGRATION_MODE = "migration_mode"
719 HV_USE_LOCALTIME = "use_localtime"
720 HV_DISK_CACHE = "disk_cache"
721 HV_SECURITY_MODEL = "security_model"
722 HV_SECURITY_DOMAIN = "security_domain"
723 HV_KVM_FLAG = "kvm_flag"
724 HV_VHOST_NET = "vhost_net"
725 HV_KVM_USE_CHROOT = "use_chroot"
726 HV_CPU_MASK = "cpu_mask"
727 HV_MEM_PATH = "mem_path"
728 HV_PASSTHROUGH = "pci_pass"
729 HV_BLOCKDEV_PREFIX = "blockdev_prefix"
730 HV_REBOOT_BEHAVIOR = "reboot_behavior"
731 HV_CPU_TYPE = "cpu_type"
732 HV_CPU_CAP = "cpu_cap"
733 HV_CPU_WEIGHT = "cpu_weight"
734 HV_CPU_CORES = "cpu_cores"
735 HV_CPU_THREADS = "cpu_threads"
736 HV_CPU_SOCKETS = "cpu_sockets"
737 HV_SOUNDHW = "soundhw"
738 HV_USB_DEVICES = "usb_devices"
740 HV_KVM_EXTRA = "kvm_extra"
741 HV_KVM_MACHINE_VERSION = "machine_version"
742 HV_KVM_PATH = "kvm_path"
743 HV_VIF_TYPE = "vif_type"
744 HV_VIF_SCRIPT = "vif_script"
745 HV_XEN_CMD = "xen_cmd"
746 HV_XEN_CPUID = "cpuid"
747 HV_VNET_HDR = "vnet_hdr"
748 HV_VIRIDIAN = "viridian"
751 HVS_PARAMETER_TYPES = {
752 HV_KVM_PATH: VTYPE_STRING,
753 HV_BOOT_ORDER: VTYPE_STRING,
754 HV_KVM_FLOPPY_IMAGE_PATH: VTYPE_STRING,
755 HV_CDROM_IMAGE_PATH: VTYPE_STRING,
756 HV_KVM_CDROM2_IMAGE_PATH: VTYPE_STRING,
757 HV_NIC_TYPE: VTYPE_STRING,
758 HV_DISK_TYPE: VTYPE_STRING,
759 HV_KVM_CDROM_DISK_TYPE: VTYPE_STRING,
760 HV_VNC_PASSWORD_FILE: VTYPE_STRING,
761 HV_VNC_BIND_ADDRESS: VTYPE_STRING,
762 HV_VNC_TLS: VTYPE_BOOL,
763 HV_VNC_X509: VTYPE_STRING,
764 HV_VNC_X509_VERIFY: VTYPE_BOOL,
765 HV_KVM_SPICE_BIND: VTYPE_STRING,
766 HV_KVM_SPICE_IP_VERSION: VTYPE_INT,
767 HV_KVM_SPICE_PASSWORD_FILE: VTYPE_STRING,
768 HV_KVM_SPICE_LOSSLESS_IMG_COMPR: VTYPE_STRING,
769 HV_KVM_SPICE_JPEG_IMG_COMPR: VTYPE_STRING,
770 HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR: VTYPE_STRING,
771 HV_KVM_SPICE_STREAMING_VIDEO_DETECTION: VTYPE_STRING,
772 HV_KVM_SPICE_AUDIO_COMPR: VTYPE_BOOL,
773 HV_KVM_SPICE_USE_TLS: VTYPE_BOOL,
774 HV_KVM_SPICE_TLS_CIPHERS: VTYPE_STRING,
775 HV_KVM_SPICE_USE_VDAGENT: VTYPE_BOOL,
778 HV_USE_BOOTLOADER: VTYPE_BOOL,
779 HV_BOOTLOADER_PATH: VTYPE_STRING,
780 HV_BOOTLOADER_ARGS: VTYPE_STRING,
781 HV_KERNEL_PATH: VTYPE_STRING,
782 HV_KERNEL_ARGS: VTYPE_STRING,
783 HV_INITRD_PATH: VTYPE_STRING,
784 HV_ROOT_PATH: VTYPE_MAYBE_STRING,
785 HV_SERIAL_CONSOLE: VTYPE_BOOL,
786 HV_SERIAL_SPEED: VTYPE_INT,
787 HV_USB_MOUSE: VTYPE_STRING,
788 HV_KEYMAP: VTYPE_STRING,
789 HV_DEVICE_MODEL: VTYPE_STRING,
790 HV_INIT_SCRIPT: VTYPE_STRING,
791 HV_MIGRATION_PORT: VTYPE_INT,
792 HV_MIGRATION_BANDWIDTH: VTYPE_INT,
793 HV_MIGRATION_DOWNTIME: VTYPE_INT,
794 HV_MIGRATION_MODE: VTYPE_STRING,
795 HV_USE_LOCALTIME: VTYPE_BOOL,
796 HV_DISK_CACHE: VTYPE_STRING,
797 HV_SECURITY_MODEL: VTYPE_STRING,
798 HV_SECURITY_DOMAIN: VTYPE_STRING,
799 HV_KVM_FLAG: VTYPE_STRING,
800 HV_VHOST_NET: VTYPE_BOOL,
801 HV_KVM_USE_CHROOT: VTYPE_BOOL,
802 HV_CPU_MASK: VTYPE_STRING,
803 HV_MEM_PATH: VTYPE_STRING,
804 HV_PASSTHROUGH: VTYPE_STRING,
805 HV_BLOCKDEV_PREFIX: VTYPE_STRING,
806 HV_REBOOT_BEHAVIOR: VTYPE_STRING,
807 HV_CPU_TYPE: VTYPE_STRING,
808 HV_CPU_CAP: VTYPE_INT,
809 HV_CPU_WEIGHT: VTYPE_INT,
810 HV_CPU_CORES: VTYPE_INT,
811 HV_CPU_THREADS: VTYPE_INT,
812 HV_CPU_SOCKETS: VTYPE_INT,
813 HV_SOUNDHW: VTYPE_STRING,
814 HV_USB_DEVICES: VTYPE_STRING,
815 HV_VGA: VTYPE_STRING,
816 HV_KVM_EXTRA: VTYPE_STRING,
817 HV_KVM_MACHINE_VERSION: VTYPE_STRING,
818 HV_VIF_TYPE: VTYPE_STRING,
819 HV_VIF_SCRIPT: VTYPE_STRING,
820 HV_XEN_CMD: VTYPE_STRING,
821 HV_XEN_CPUID: VTYPE_STRING,
822 HV_VNET_HDR: VTYPE_BOOL,
823 HV_VIRIDIAN: VTYPE_BOOL,
826 HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
828 HVS_PARAMETER_TITLES = {
830 HV_BOOT_ORDER: "Boot_order",
831 HV_CDROM_IMAGE_PATH: "CDROM_image_path",
832 HV_DISK_TYPE: "Disk_type",
833 HV_INITRD_PATH: "Initrd_path",
834 HV_KERNEL_PATH: "Kernel_path",
835 HV_NIC_TYPE: "NIC_type",
837 HV_VNC_BIND_ADDRESS: "VNC_bind_address",
838 HV_PASSTHROUGH: "pci_pass",
839 HV_CPU_TYPE: "cpu_type",
843 HV_MIGRATION_COMPLETED = "completed"
844 HV_MIGRATION_ACTIVE = "active"
845 HV_MIGRATION_FAILED = "failed"
846 HV_MIGRATION_CANCELLED = "cancelled"
848 HV_MIGRATION_VALID_STATUSES = compat.UniqueFrozenset([
849 HV_MIGRATION_COMPLETED,
852 HV_MIGRATION_CANCELLED,
855 HV_MIGRATION_FAILED_STATUSES = compat.UniqueFrozenset([
857 HV_MIGRATION_CANCELLED,
860 # KVM-specific statuses
861 HV_KVM_MIGRATION_VALID_STATUSES = HV_MIGRATION_VALID_STATUSES
864 HV_NODEINFO_KEY_VERSION = "hv_version"
867 HVST_MEMORY_TOTAL = "mem_total"
868 HVST_MEMORY_NODE = "mem_node"
869 HVST_MEMORY_HV = "mem_hv"
870 HVST_CPU_TOTAL = "cpu_total"
871 HVST_CPU_NODE = "cpu_node"
874 HVST_MEMORY_TOTAL: 0,
881 HVSTS_PARAMETER_TYPES = {
882 HVST_MEMORY_TOTAL: VTYPE_INT,
883 HVST_MEMORY_NODE: VTYPE_INT,
884 HVST_MEMORY_HV: VTYPE_INT,
885 HVST_CPU_TOTAL: VTYPE_INT,
886 HVST_CPU_NODE: VTYPE_INT,
889 HVSTS_PARAMETERS = frozenset(HVSTS_PARAMETER_TYPES.keys())
892 DS_DISK_TOTAL = "disk_total"
893 DS_DISK_RESERVED = "disk_reserved"
894 DS_DISK_OVERHEAD = "disk_overhead"
902 ISPEC_MEM_SIZE = _constants.ISPEC_MEM_SIZE
903 ISPEC_CPU_COUNT = _constants.ISPEC_CPU_COUNT
904 ISPEC_DISK_COUNT = _constants.ISPEC_DISK_COUNT
905 ISPEC_DISK_SIZE = _constants.ISPEC_DISK_SIZE
906 ISPEC_NIC_COUNT = _constants.ISPEC_NIC_COUNT
907 ISPEC_SPINDLE_USE = _constants.ISPEC_SPINDLE_USE
908 ISPECS_PARAMETER_TYPES = _constants.ISPECS_PARAMETER_TYPES
909 ISPECS_PARAMETERS = _constants.ISPECS_PARAMETERS
911 ISPECS_MINMAX = _constants.ISPECS_MINMAX
912 ISPECS_MIN = _constants.ISPECS_MIN
913 ISPECS_MAX = _constants.ISPECS_MAX
914 ISPECS_STD = _constants.ISPECS_STD
915 IPOLICY_DTS = _constants.IPOLICY_DTS
916 IPOLICY_VCPU_RATIO = _constants.IPOLICY_VCPU_RATIO
917 IPOLICY_SPINDLE_RATIO = _constants.IPOLICY_SPINDLE_RATIO
918 ISPECS_MINMAX_KEYS = _constants.ISPECS_MINMAX_KEYS
919 IPOLICY_PARAMETERS = _constants.IPOLICY_PARAMETERS
920 IPOLICY_ALL_KEYS = _constants.IPOLICY_ALL_KEYS
922 ND_OOB_PROGRAM = _constants.ND_OOB_PROGRAM
923 ND_SPINDLE_COUNT = _constants.ND_SPINDLE_COUNT
924 ND_EXCLUSIVE_STORAGE = _constants.ND_EXCLUSIVE_STORAGE
925 ND_OVS = _constants.ND_OVS
926 ND_OVS_NAME = _constants.ND_OVS_NAME
927 ND_OVS_LINK = _constants.ND_OVS_LINK
929 NDS_PARAMETER_TYPES = _constants.NDS_PARAMETER_TYPES
930 NDS_PARAMETERS = _constants.NDS_PARAMETERS
931 NDS_PARAMETER_TITLES = _constants.NDS_PARAMETER_TITLES
932 DSS_PARAMETER_TYPES = {
933 DS_DISK_TOTAL: VTYPE_INT,
934 DS_DISK_RESERVED: VTYPE_INT,
935 DS_DISK_OVERHEAD: VTYPE_INT,
938 DSS_PARAMETERS = frozenset(DSS_PARAMETER_TYPES.keys())
939 DS_VALID_TYPES = compat.UniqueFrozenset([DT_PLAIN])
941 # Backend parameter names
942 BE_MEMORY = "memory" # deprecated and replaced by max and min mem
946 BE_AUTO_BALANCE = "auto_balance"
947 BE_ALWAYS_FAILOVER = "always_failover"
948 BE_SPINDLE_USE = "spindle_use"
950 BES_PARAMETER_TYPES = {
951 BE_MAXMEM: VTYPE_SIZE,
952 BE_MINMEM: VTYPE_SIZE,
954 BE_AUTO_BALANCE: VTYPE_BOOL,
955 BE_ALWAYS_FAILOVER: VTYPE_BOOL,
956 BE_SPINDLE_USE: VTYPE_INT,
959 BES_PARAMETER_TITLES = {
960 BE_AUTO_BALANCE: "Auto_balance",
961 BE_MAXMEM: "ConfigMaxMem",
962 BE_MINMEM: "ConfigMinMem",
963 BE_VCPUS: "ConfigVCPUs",
966 BES_PARAMETER_COMPAT = {
967 BE_MEMORY: VTYPE_SIZE,
969 BES_PARAMETER_COMPAT.update(BES_PARAMETER_TYPES)
971 BES_PARAMETERS = frozenset(BES_PARAMETER_TYPES.keys())
973 # Logical Disks parameters
974 LDP_RESYNC_RATE = "resync-rate"
975 LDP_STRIPES = "stripes"
976 LDP_BARRIERS = "disabled-barriers"
977 LDP_NO_META_FLUSH = "disable-meta-flush"
978 LDP_DEFAULT_METAVG = "default-metavg"
979 LDP_DISK_CUSTOM = "disk-custom"
980 LDP_NET_CUSTOM = "net-custom"
981 LDP_PROTOCOL = "protocol"
982 LDP_DYNAMIC_RESYNC = "dynamic-resync"
983 LDP_PLAN_AHEAD = "c-plan-ahead"
984 LDP_FILL_TARGET = "c-fill-target"
985 LDP_DELAY_TARGET = "c-delay-target"
986 LDP_MAX_RATE = "c-max-rate"
987 LDP_MIN_RATE = "c-min-rate"
989 LDP_ACCESS = "access"
991 LDP_RESYNC_RATE: VTYPE_INT,
992 LDP_STRIPES: VTYPE_INT,
993 LDP_BARRIERS: VTYPE_STRING,
994 LDP_NO_META_FLUSH: VTYPE_BOOL,
995 LDP_DEFAULT_METAVG: VTYPE_STRING,
996 LDP_DISK_CUSTOM: VTYPE_STRING,
997 LDP_NET_CUSTOM: VTYPE_STRING,
998 LDP_PROTOCOL: VTYPE_STRING,
999 LDP_DYNAMIC_RESYNC: VTYPE_BOOL,
1000 LDP_PLAN_AHEAD: VTYPE_INT,
1001 LDP_FILL_TARGET: VTYPE_INT,
1002 LDP_DELAY_TARGET: VTYPE_INT,
1003 LDP_MAX_RATE: VTYPE_INT,
1004 LDP_MIN_RATE: VTYPE_INT,
1005 LDP_POOL: VTYPE_STRING,
1006 LDP_ACCESS: VTYPE_STRING,
1008 DISK_LD_PARAMETERS = frozenset(DISK_LD_TYPES.keys())
1010 # Disk template parameters (can be set/changed by the user via gnt-cluster and
1012 DRBD_RESYNC_RATE = "resync-rate"
1013 DRBD_DATA_STRIPES = "data-stripes"
1014 DRBD_META_STRIPES = "meta-stripes"
1015 DRBD_DISK_BARRIERS = "disk-barriers"
1016 DRBD_META_BARRIERS = "meta-barriers"
1017 DRBD_DEFAULT_METAVG = "metavg"
1018 DRBD_DISK_CUSTOM = "disk-custom"
1019 DRBD_NET_CUSTOM = "net-custom"
1020 DRBD_PROTOCOL = "protocol"
1021 DRBD_DYNAMIC_RESYNC = "dynamic-resync"
1022 DRBD_PLAN_AHEAD = "c-plan-ahead"
1023 DRBD_FILL_TARGET = "c-fill-target"
1024 DRBD_DELAY_TARGET = "c-delay-target"
1025 DRBD_MAX_RATE = "c-max-rate"
1026 DRBD_MIN_RATE = "c-min-rate"
1027 LV_STRIPES = "stripes"
1029 RBD_ACCESS = "access"
1031 DRBD_RESYNC_RATE: VTYPE_INT,
1032 DRBD_DATA_STRIPES: VTYPE_INT,
1033 DRBD_META_STRIPES: VTYPE_INT,
1034 DRBD_DISK_BARRIERS: VTYPE_STRING,
1035 DRBD_META_BARRIERS: VTYPE_BOOL,
1036 DRBD_DEFAULT_METAVG: VTYPE_STRING,
1037 DRBD_DISK_CUSTOM: VTYPE_STRING,
1038 DRBD_NET_CUSTOM: VTYPE_STRING,
1039 DRBD_PROTOCOL: VTYPE_STRING,
1040 DRBD_DYNAMIC_RESYNC: VTYPE_BOOL,
1041 DRBD_PLAN_AHEAD: VTYPE_INT,
1042 DRBD_FILL_TARGET: VTYPE_INT,
1043 DRBD_DELAY_TARGET: VTYPE_INT,
1044 DRBD_MAX_RATE: VTYPE_INT,
1045 DRBD_MIN_RATE: VTYPE_INT,
1046 LV_STRIPES: VTYPE_INT,
1047 RBD_POOL: VTYPE_STRING,
1048 RBD_ACCESS: VTYPE_STRING,
1051 DISK_DT_PARAMETERS = frozenset(DISK_DT_TYPES.keys())
1053 # dynamic disk parameters
1054 DDP_LOCAL_IP = "local-ip"
1055 DDP_REMOTE_IP = "remote-ip"
1057 DDP_LOCAL_MINOR = "local-minor"
1058 DDP_REMOTE_MINOR = "remote-minor"
1060 # OOB supported commands
1061 OOB_POWER_ON = _constants.OOB_POWER_ON
1062 OOB_POWER_OFF = _constants.OOB_POWER_OFF
1063 OOB_POWER_CYCLE = _constants.OOB_POWER_CYCLE
1064 OOB_POWER_STATUS = _constants.OOB_POWER_STATUS
1065 OOB_HEALTH = _constants.OOB_HEALTH
1066 OOB_COMMANDS = _constants.OOB_COMMANDS
1068 OOB_POWER_STATUS_POWERED = _constants.OOB_POWER_STATUS_POWERED
1070 OOB_TIMEOUT = _constants.OOB_TIMEOUT
1071 OOB_POWER_DELAY = _constants.OOB_POWER_DELAY
1073 OOB_STATUS_OK = _constants.OOB_STATUS_OK
1074 OOB_STATUS_WARNING = _constants.OOB_STATUS_WARNING
1075 OOB_STATUS_CRITICAL = _constants.OOB_STATUS_CRITICAL
1076 OOB_STATUS_UNKNOWN = _constants.OOB_STATUS_UNKNOWN
1077 OOB_STATUSES = _constants.OOB_STATUSES
1079 # Instance Parameters Profile
1080 PP_DEFAULT = "default"
1082 # NIC_* constants are used inside the ganeti config
1083 NIC_MODE = _constants.NIC_MODE
1084 NIC_LINK = _constants.NIC_LINK
1085 NIC_VLAN = _constants.NIC_VLAN
1087 NIC_MODE_BRIDGED = _constants.NIC_MODE_BRIDGED
1088 NIC_MODE_ROUTED = _constants.NIC_MODE_ROUTED
1089 NIC_MODE_OVS = _constants.NIC_MODE_OVS
1090 NIC_IP_POOL = _constants.NIC_IP_POOL
1091 NIC_VALID_MODES = _constants.NIC_VALID_MODES
1093 RESERVE_ACTION = "reserve"
1094 RELEASE_ACTION = "release"
1096 NICS_PARAMETER_TYPES = {
1097 NIC_MODE: VTYPE_STRING,
1098 NIC_LINK: VTYPE_STRING,
1099 NIC_VLAN: VTYPE_MAYBE_STRING,
1102 NICS_PARAMETERS = frozenset(NICS_PARAMETER_TYPES.keys())
1104 # IDISK_* constants are used in opcodes, to create/change disks
1106 IDISK_SPINDLES = "spindles"
1108 IDISK_ADOPT = "adopt"
1110 IDISK_METAVG = "metavg"
1111 IDISK_PROVIDER = "provider"
1113 IDISK_PARAMS_TYPES = {
1114 IDISK_SIZE: VTYPE_SIZE,
1115 IDISK_SPINDLES: VTYPE_INT,
1116 IDISK_MODE: VTYPE_STRING,
1117 IDISK_ADOPT: VTYPE_STRING,
1118 IDISK_VG: VTYPE_STRING,
1119 IDISK_METAVG: VTYPE_STRING,
1120 IDISK_PROVIDER: VTYPE_STRING,
1121 IDISK_NAME: VTYPE_MAYBE_STRING,
1123 IDISK_PARAMS = frozenset(IDISK_PARAMS_TYPES.keys())
1125 # INIC_* constants are used in opcodes, to create/change nics
1130 INIC_NETWORK = "network"
1133 INIC_BRIDGE = "bridge"
1134 INIC_PARAMS_TYPES = {
1135 INIC_IP: VTYPE_MAYBE_STRING,
1136 INIC_LINK: VTYPE_STRING,
1137 INIC_MAC: VTYPE_STRING,
1138 INIC_MODE: VTYPE_STRING,
1139 INIC_NETWORK: VTYPE_MAYBE_STRING,
1140 INIC_NAME: VTYPE_MAYBE_STRING,
1141 INIC_VLAN: VTYPE_MAYBE_STRING,
1142 INIC_BRIDGE: VTYPE_MAYBE_STRING
1144 INIC_PARAMS = frozenset(INIC_PARAMS_TYPES.keys())
1146 # Hypervisor constants
1147 HT_XEN_PVM = _constants.HT_XEN_PVM
1148 HT_FAKE = _constants.HT_FAKE
1149 HT_XEN_HVM = _constants.HT_XEN_HVM
1150 HT_KVM = _constants.HT_KVM
1151 HT_CHROOT = _constants.HT_CHROOT
1152 HT_LXC = _constants.HT_LXC
1153 HYPER_TYPES = _constants.HYPER_TYPES
1154 HTS_REQ_PORT = _constants.HTS_REQ_PORT
1156 VNC_BASE_PORT = 5900
1157 VNC_DEFAULT_BIND_ADDRESS = IP4_ADDRESS_ANY
1160 HT_NIC_RTL8139 = "rtl8139"
1161 HT_NIC_NE2K_PCI = "ne2k_pci"
1162 HT_NIC_NE2K_ISA = "ne2k_isa"
1163 HT_NIC_I82551 = "i82551"
1164 HT_NIC_I85557B = "i82557b"
1165 HT_NIC_I8259ER = "i82559er"
1166 HT_NIC_PCNET = "pcnet"
1167 HT_NIC_E1000 = "e1000"
1168 HT_NIC_PARAVIRTUAL = HT_DISK_PARAVIRTUAL = "paravirtual"
1170 HT_HVM_VALID_NIC_TYPES = compat.UniqueFrozenset([
1177 HT_KVM_VALID_NIC_TYPES = compat.UniqueFrozenset([
1190 # default vif type in xen-hvm
1191 HT_HVM_VIF_IOEMU = "ioemu"
1192 HT_HVM_VIF_VIF = "vif"
1193 HT_HVM_VALID_VIF_TYPES = compat.UniqueFrozenset([
1199 HT_DISK_IOEMU = "ioemu"
1201 HT_DISK_SCSI = "scsi"
1204 HT_DISK_PFLASH = "pflash"
1206 HT_CACHE_DEFAULT = "default"
1207 HT_CACHE_NONE = "none"
1208 HT_CACHE_WTHROUGH = "writethrough"
1209 HT_CACHE_WBACK = "writeback"
1210 HT_VALID_CACHE_TYPES = compat.UniqueFrozenset([
1217 HT_HVM_VALID_DISK_TYPES = compat.UniqueFrozenset([
1218 HT_DISK_PARAVIRTUAL,
1221 HT_KVM_VALID_DISK_TYPES = compat.UniqueFrozenset([
1222 HT_DISK_PARAVIRTUAL,
1231 HT_MOUSE_MOUSE = "mouse"
1232 HT_MOUSE_TABLET = "tablet"
1234 HT_KVM_VALID_MOUSE_TYPES = compat.UniqueFrozenset([
1240 HT_BO_FLOPPY = "floppy"
1241 HT_BO_CDROM = "cdrom"
1243 HT_BO_NETWORK = "network"
1245 HT_KVM_VALID_BO_TYPES = compat.UniqueFrozenset([
1252 # SPICE lossless image compression options
1253 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_GLZ = "auto_glz"
1254 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_LZ = "auto_lz"
1255 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_QUIC = "quic"
1256 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_GLZ = "glz"
1257 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_LZ = "lz"
1258 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_OFF = "off"
1260 HT_KVM_SPICE_VALID_LOSSLESS_IMG_COMPR_OPTIONS = compat.UniqueFrozenset([
1261 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_GLZ,
1262 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_LZ,
1263 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_QUIC,
1264 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_GLZ,
1265 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_LZ,
1266 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_OFF,
1269 # SPICE lossy image compression options (valid for both jpeg and zlib-glz)
1270 HT_KVM_SPICE_LOSSY_IMG_COMPR_AUTO = "auto"
1271 HT_KVM_SPICE_LOSSY_IMG_COMPR_NEVER = "never"
1272 HT_KVM_SPICE_LOSSY_IMG_COMPR_ALWAYS = "always"
1274 HT_KVM_SPICE_VALID_LOSSY_IMG_COMPR_OPTIONS = compat.UniqueFrozenset([
1275 HT_KVM_SPICE_LOSSY_IMG_COMPR_AUTO,
1276 HT_KVM_SPICE_LOSSY_IMG_COMPR_NEVER,
1277 HT_KVM_SPICE_LOSSY_IMG_COMPR_ALWAYS,
1280 # SPICE video stream detection
1281 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_OFF = "off"
1282 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_ALL = "all"
1283 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_FILTER = "filter"
1285 HT_KVM_SPICE_VALID_VIDEO_STREAM_DETECTION_OPTIONS = compat.UniqueFrozenset([
1286 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_OFF,
1287 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_ALL,
1288 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_FILTER,
1296 HT_KVM_VALID_SM_TYPES = compat.UniqueFrozenset([
1303 HT_KVM_ENABLED = "enabled"
1304 HT_KVM_DISABLED = "disabled"
1306 HT_KVM_FLAG_VALUES = compat.UniqueFrozenset([HT_KVM_ENABLED, HT_KVM_DISABLED])
1309 HT_MIGRATION_LIVE = _constants.HT_MIGRATION_LIVE
1310 HT_MIGRATION_NONLIVE = _constants.HT_MIGRATION_NONLIVE
1311 HT_MIGRATION_MODES = _constants.HT_MIGRATION_MODES
1313 # Cluster Verify steps
1314 VERIFY_NPLUSONE_MEM = _constants.VERIFY_NPLUSONE_MEM
1315 VERIFY_OPTIONAL_CHECKS = _constants.VERIFY_OPTIONAL_CHECKS
1317 # Cluster Verify error classes
1318 CV_TCLUSTER = _constants.CV_TCLUSTER
1319 CV_TGROUP = _constants.CV_TGROUP
1320 CV_TNODE = _constants.CV_TNODE
1321 CV_TINSTANCE = _constants.CV_TINSTANCE
1323 # Cluster Verify error codes and documentation
1324 CV_ECLUSTERCFG = _constants.CV_ECLUSTERCFG
1325 CV_ECLUSTERCERT = _constants.CV_ECLUSTERCERT
1326 CV_ECLUSTERFILECHECK = _constants.CV_ECLUSTERFILECHECK
1327 CV_ECLUSTERDANGLINGNODES = _constants.CV_ECLUSTERDANGLINGNODES
1328 CV_ECLUSTERDANGLINGINST = _constants.CV_ECLUSTERDANGLINGINST
1329 CV_EGROUPDIFFERENTPVSIZE = _constants.CV_EGROUPDIFFERENTPVSIZE
1330 CV_EINSTANCEBADNODE = _constants.CV_EINSTANCEBADNODE
1331 CV_EINSTANCEDOWN = _constants.CV_EINSTANCEDOWN
1332 CV_EINSTANCELAYOUT = _constants.CV_EINSTANCELAYOUT
1333 CV_EINSTANCEMISSINGDISK = _constants.CV_EINSTANCEMISSINGDISK
1334 CV_EINSTANCEFAULTYDISK = _constants.CV_EINSTANCEFAULTYDISK
1335 CV_EINSTANCEWRONGNODE = _constants.CV_EINSTANCEWRONGNODE
1336 CV_EINSTANCESPLITGROUPS = _constants.CV_EINSTANCESPLITGROUPS
1337 CV_EINSTANCEPOLICY = _constants.CV_EINSTANCEPOLICY
1338 CV_EINSTANCEUNSUITABLENODE = _constants.CV_EINSTANCEUNSUITABLENODE
1339 CV_EINSTANCEMISSINGCFGPARAMETER = _constants.CV_EINSTANCEMISSINGCFGPARAMETER
1340 CV_ENODEDRBD = _constants.CV_ENODEDRBD
1341 CV_ENODEDRBDVERSION = _constants.CV_ENODEDRBDVERSION
1342 CV_ENODEDRBDHELPER = _constants.CV_ENODEDRBDHELPER
1343 CV_ENODEFILECHECK = _constants.CV_ENODEFILECHECK
1344 CV_ENODEHOOKS = _constants.CV_ENODEHOOKS
1345 CV_ENODEHV = _constants.CV_ENODEHV
1346 CV_ENODELVM = _constants.CV_ENODELVM
1347 CV_ENODEN1 = _constants.CV_ENODEN1
1348 CV_ENODENET = _constants.CV_ENODENET
1349 CV_ENODEOS = _constants.CV_ENODEOS
1350 CV_ENODEORPHANINSTANCE = _constants.CV_ENODEORPHANINSTANCE
1351 CV_ENODEORPHANLV = _constants.CV_ENODEORPHANLV
1352 CV_ENODERPC = _constants.CV_ENODERPC
1353 CV_ENODESSH = _constants.CV_ENODESSH
1354 CV_ENODEVERSION = _constants.CV_ENODEVERSION
1355 CV_ENODESETUP = _constants.CV_ENODESETUP
1356 CV_ENODETIME = _constants.CV_ENODETIME
1357 CV_ENODEOOBPATH = _constants.CV_ENODEOOBPATH
1358 CV_ENODEUSERSCRIPTS = _constants.CV_ENODEUSERSCRIPTS
1359 CV_ENODEFILESTORAGEPATHS = _constants.CV_ENODEFILESTORAGEPATHS
1360 CV_ENODEFILESTORAGEPATHUNUSABLE = _constants.CV_ENODEFILESTORAGEPATHUNUSABLE
1361 CV_ENODESHAREDFILESTORAGEPATHUNUSABLE = \
1362 _constants.CV_ENODESHAREDFILESTORAGEPATHUNUSABLE
1364 CV_ALL_ECODES = _constants.CV_ALL_ECODES
1365 CV_ALL_ECODES_STRINGS = _constants.CV_ALL_ECODES_STRINGS
1367 # Node verify constants
1368 NV_BRIDGES = "bridges"
1369 NV_DRBDHELPER = "drbd-helper"
1370 NV_DRBDVERSION = "drbd-version"
1371 NV_DRBDLIST = "drbd-list"
1372 NV_EXCLUSIVEPVS = "exclusive-pvs"
1373 NV_FILELIST = "filelist"
1374 NV_ACCEPTED_STORAGE_PATHS = "allowed-file-storage-paths"
1375 NV_FILE_STORAGE_PATH = "file-storage-path"
1376 NV_SHARED_FILE_STORAGE_PATH = "shared-file-storage-path"
1377 NV_HVINFO = "hvinfo"
1378 NV_HVPARAMS = "hvparms"
1379 NV_HYPERVISOR = "hypervisor"
1380 NV_INSTANCELIST = "instancelist"
1381 NV_LVLIST = "lvlist"
1382 NV_MASTERIP = "master-ip"
1383 NV_NODELIST = "nodelist"
1384 NV_NODENETTEST = "node-net-test"
1385 NV_NODESETUP = "nodesetup"
1386 NV_OOB_PATHS = "oob-paths"
1387 NV_OSLIST = "oslist"
1388 NV_PVLIST = "pvlist"
1390 NV_USERSCRIPTS = "user-scripts"
1391 NV_VERSION = "version"
1392 NV_VGLIST = "vglist"
1393 NV_VMNODES = "vmnodes"
1396 INSTST_RUNNING = _constants.INSTST_RUNNING
1397 INSTST_ADMINDOWN = _constants.INSTST_ADMINDOWN
1398 INSTST_ADMINOFFLINE = _constants.INSTST_ADMINOFFLINE
1399 INSTST_NODEOFFLINE = _constants.INSTST_NODEOFFLINE
1400 INSTST_NODEDOWN = _constants.INSTST_NODEDOWN
1401 INSTST_WRONGNODE = _constants.INSTST_WRONGNODE
1402 INSTST_ERRORUP = _constants.INSTST_ERRORUP
1403 INSTST_ERRORDOWN = _constants.INSTST_ERRORDOWN
1404 INSTST_ALL = _constants.INSTST_ALL
1407 ADMINST_UP = _constants.ADMINST_UP
1408 ADMINST_DOWN = _constants.ADMINST_DOWN
1409 ADMINST_OFFLINE = _constants.ADMINST_OFFLINE
1410 ADMINST_ALL = _constants.ADMINST_ALL
1413 NR_REGULAR = _constants.NR_REGULAR
1414 NR_MASTER = _constants.NR_MASTER
1415 NR_MCANDIDATE = _constants.NR_MCANDIDATE
1416 NR_DRAINED = _constants.NR_DRAINED
1417 NR_OFFLINE = _constants.NR_OFFLINE
1418 NR_ALL = _constants.NR_ALL
1420 # SSL certificate check constants (in days)
1421 SSL_CERT_EXPIRATION_WARN = 30
1422 SSL_CERT_EXPIRATION_ERROR = 7
1424 # Allocator framework constants
1425 IALLOCATOR_VERSION = _constants.IALLOCATOR_VERSION
1426 IALLOCATOR_DIR_IN = _constants.IALLOCATOR_DIR_IN
1427 IALLOCATOR_DIR_OUT = _constants.IALLOCATOR_DIR_OUT
1428 VALID_IALLOCATOR_DIRECTIONS = _constants.VALID_IALLOCATOR_DIRECTIONS
1430 IALLOCATOR_MODE_ALLOC = _constants.IALLOCATOR_MODE_ALLOC
1431 IALLOCATOR_MODE_RELOC = _constants.IALLOCATOR_MODE_RELOC
1432 IALLOCATOR_MODE_CHG_GROUP = _constants.IALLOCATOR_MODE_CHG_GROUP
1433 IALLOCATOR_MODE_NODE_EVAC = _constants.IALLOCATOR_MODE_NODE_EVAC
1434 IALLOCATOR_MODE_MULTI_ALLOC = _constants.IALLOCATOR_MODE_MULTI_ALLOC
1435 VALID_IALLOCATOR_MODES = _constants.VALID_IALLOCATOR_MODES
1437 IALLOCATOR_SEARCH_PATH = _constants.IALLOCATOR_SEARCH_PATH
1438 DEFAULT_IALLOCATOR_SHORTCUT = _constants.DEFAULT_IALLOCATOR_SHORTCUT
1441 NODE_EVAC_PRI = _constants.NODE_EVAC_PRI
1442 NODE_EVAC_SEC = _constants.NODE_EVAC_SEC
1443 NODE_EVAC_ALL = _constants.NODE_EVAC_ALL
1444 NODE_EVAC_MODES = _constants.NODE_EVAC_MODES
1447 JOB_QUEUE_VERSION = 1
1448 JOB_QUEUE_SIZE_HARD_LIMIT = 5000
1449 JOB_QUEUE_FILES_PERMS = 0640
1451 JOB_ID_TEMPLATE = r"\d+"
1452 JOB_FILE_RE = re.compile(r"^job-(%s)$" % JOB_ID_TEMPLATE)
1454 # unchanged job return
1455 JOB_NOTCHANGED = "nochange"
1458 JOB_STATUS_QUEUED = _constants.JOB_STATUS_QUEUED
1459 JOB_STATUS_WAITING = _constants.JOB_STATUS_WAITING
1460 JOB_STATUS_CANCELING = _constants.JOB_STATUS_CANCELING
1461 JOB_STATUS_RUNNING = _constants.JOB_STATUS_RUNNING
1462 JOB_STATUS_CANCELED = _constants.JOB_STATUS_CANCELED
1463 JOB_STATUS_SUCCESS = _constants.JOB_STATUS_SUCCESS
1464 JOB_STATUS_ERROR = _constants.JOB_STATUS_ERROR
1465 JOBS_PENDING = _constants.JOBS_PENDING
1466 JOBS_FINALIZED = _constants.JOBS_FINALIZED
1467 JOB_STATUS_ALL = _constants.JOB_STATUS_ALL
1471 OP_STATUS_QUEUED = _constants.OP_STATUS_QUEUED
1472 OP_STATUS_WAITING = _constants.OP_STATUS_WAITING
1473 OP_STATUS_CANCELING = _constants.OP_STATUS_CANCELING
1474 OP_STATUS_RUNNING = _constants.OP_STATUS_RUNNING
1476 OP_STATUS_CANCELED = _constants.OP_STATUS_CANCELED
1477 OP_STATUS_SUCCESS = _constants.OP_STATUS_SUCCESS
1478 OP_STATUS_ERROR = _constants.OP_STATUS_ERROR
1479 OPS_FINALIZED = _constants.OPS_FINALIZED
1482 OP_PRIO_LOWEST = _constants.OP_PRIO_LOWEST
1483 OP_PRIO_HIGHEST = _constants.OP_PRIO_HIGHEST
1484 OP_PRIO_LOW = _constants.OP_PRIO_LOW
1485 OP_PRIO_NORMAL = _constants.OP_PRIO_NORMAL
1486 OP_PRIO_HIGH = _constants.OP_PRIO_HIGH
1487 OP_PRIO_SUBMIT_VALID = _constants.OP_PRIO_SUBMIT_VALID
1488 OP_PRIO_DEFAULT = _constants.OP_PRIO_DEFAULT
1490 # Lock recalculate mode
1491 LOCKS_REPLACE = "replace"
1492 LOCKS_APPEND = "append"
1494 # Lock timeout (sum) before we should go into blocking acquire (still
1495 # can be reset by priority change); computed as max time (10 hours)
1496 # before we should actually go into blocking acquire given that we
1497 # start from default priority level; in seconds
1499 LOCK_ATTEMPTS_TIMEOUT = 10 * 3600 / (OP_PRIO_DEFAULT - OP_PRIO_HIGHEST)
1500 LOCK_ATTEMPTS_MAXWAIT = 15.0
1501 LOCK_ATTEMPTS_MINWAIT = 1.0
1503 # Execution log types
1504 ELOG_MESSAGE = _constants.ELOG_MESSAGE
1505 ELOG_REMOTE_IMPORT = _constants.ELOG_REMOTE_IMPORT
1506 ELOG_JQUEUE_TEST = _constants.ELOG_JQUEUE_TEST
1508 # /etc/hosts modification
1509 ETC_HOSTS_ADD = "add"
1510 ETC_HOSTS_REMOVE = "remove"
1513 JQT_MSGPREFIX = "TESTMSG="
1514 JQT_EXPANDNAMES = "expandnames"
1516 JQT_LOGMSG = "logmsg"
1517 JQT_STARTMSG = "startmsg"
1518 JQT_ALL = compat.UniqueFrozenset([
1526 QR_CLUSTER = "cluster"
1527 QR_INSTANCE = "instance"
1533 QR_EXPORT = "export"
1534 QR_NETWORK = "network"
1535 QR_EXTSTORAGE = "extstorage"
1537 #: List of resources which can be queried using L{opcodes.OpQuery}
1538 QR_VIA_OP = compat.UniqueFrozenset([
1549 #: List of resources which can be queried using Local UniX Interface
1550 QR_VIA_LUXI = QR_VIA_OP.union([
1555 #: List of resources which can be queried using RAPI
1556 QR_VIA_RAPI = QR_VIA_LUXI
1559 QFT_UNKNOWN = "unknown"
1562 QFT_NUMBER = "number"
1564 QFT_TIMESTAMP = "timestamp"
1567 #: All query field types
1568 QFT_ALL = compat.UniqueFrozenset([
1578 # Query result field status (don't change or reuse values as they're used by
1580 #: Normal field status
1584 #: No data (e.g. RPC error), can be used instead of L{RS_OFFLINE}
1586 #: Value unavailable/unsupported for item; if this field is supported
1587 #: but we cannot get the data for the moment, RS_NODATA or
1588 #: RS_OFFLINE should be used
1590 #: Resource marked offline
1593 RS_ALL = compat.UniqueFrozenset([
1601 #: Dictionary with special field cases and their verbose/terse formatting
1603 RS_UNKNOWN: ("(unknown)", "??"),
1604 RS_NODATA: ("(nodata)", "?"),
1605 RS_OFFLINE: ("(offline)", "*"),
1606 RS_UNAVAIL: ("(unavail)", "-"),
1609 # max dynamic devices
1613 # SSCONF file prefix
1614 SSCONF_FILEPREFIX = "ssconf_"
1616 SS_CLUSTER_NAME = "cluster_name"
1617 SS_CLUSTER_TAGS = "cluster_tags"
1618 SS_FILE_STORAGE_DIR = "file_storage_dir"
1619 SS_SHARED_FILE_STORAGE_DIR = "shared_file_storage_dir"
1620 SS_MASTER_CANDIDATES = "master_candidates"
1621 SS_MASTER_CANDIDATES_IPS = "master_candidates_ips"
1622 SS_MASTER_IP = "master_ip"
1623 SS_MASTER_NETDEV = "master_netdev"
1624 SS_MASTER_NETMASK = "master_netmask"
1625 SS_MASTER_NODE = "master_node"
1626 SS_NODE_LIST = "node_list"
1627 SS_NODE_PRIMARY_IPS = "node_primary_ips"
1628 SS_NODE_SECONDARY_IPS = "node_secondary_ips"
1629 SS_OFFLINE_NODES = "offline_nodes"
1630 SS_ONLINE_NODES = "online_nodes"
1631 SS_PRIMARY_IP_FAMILY = "primary_ip_family"
1632 SS_INSTANCE_LIST = "instance_list"
1633 SS_RELEASE_VERSION = "release_version"
1634 SS_HYPERVISOR_LIST = "hypervisor_list"
1635 SS_MAINTAIN_NODE_HEALTH = "maintain_node_health"
1636 SS_UID_POOL = "uid_pool"
1637 SS_NODEGROUPS = "nodegroups"
1638 SS_NETWORKS = "networks"
1640 # This is not a complete SSCONF key, but the prefix for the hypervisor keys
1641 SS_HVPARAMS_PREF = "hvparams_"
1644 SS_HVPARAMS_XEN_PVM = SS_HVPARAMS_PREF + HT_XEN_PVM
1645 SS_HVPARAMS_XEN_FAKE = SS_HVPARAMS_PREF + HT_FAKE
1646 SS_HVPARAMS_XEN_HVM = SS_HVPARAMS_PREF + HT_XEN_HVM
1647 SS_HVPARAMS_XEN_KVM = SS_HVPARAMS_PREF + HT_KVM
1648 SS_HVPARAMS_XEN_CHROOT = SS_HVPARAMS_PREF + HT_CHROOT
1649 SS_HVPARAMS_XEN_LXC = SS_HVPARAMS_PREF + HT_LXC
1651 VALID_SS_HVPARAMS_KEYS = compat.UniqueFrozenset([
1652 SS_HVPARAMS_XEN_PVM,
1653 SS_HVPARAMS_XEN_FAKE,
1654 SS_HVPARAMS_XEN_HVM,
1655 SS_HVPARAMS_XEN_KVM,
1656 SS_HVPARAMS_XEN_CHROOT,
1657 SS_HVPARAMS_XEN_LXC,
1660 SS_FILE_PERMS = 0444
1662 # cluster wide default parameters
1663 DEFAULT_ENABLED_HYPERVISOR = HT_XEN_PVM
1667 HV_USE_BOOTLOADER: False,
1668 HV_BOOTLOADER_PATH: XEN_BOOTLOADER,
1669 HV_BOOTLOADER_ARGS: "",
1670 HV_KERNEL_PATH: XEN_KERNEL,
1672 HV_ROOT_PATH: "/dev/xvda1",
1673 HV_KERNEL_ARGS: "ro",
1674 HV_MIGRATION_PORT: 8002,
1675 HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1676 HV_BLOCKDEV_PREFIX: "sd",
1677 HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1678 HV_CPU_MASK: CPU_PINNING_ALL,
1682 HV_XEN_CMD: XEN_CMD_XM,
1687 HV_BOOT_ORDER: "cd",
1688 HV_CDROM_IMAGE_PATH: "",
1689 HV_NIC_TYPE: HT_NIC_RTL8139,
1690 HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
1691 HV_VNC_BIND_ADDRESS: IP4_ADDRESS_ANY,
1692 HV_VNC_PASSWORD_FILE: pathutils.VNC_PASSWORD_FILE,
1695 HV_KERNEL_PATH: "/usr/lib/xen/boot/hvmloader",
1696 HV_DEVICE_MODEL: "/usr/lib/xen/bin/qemu-dm",
1697 HV_MIGRATION_PORT: 8002,
1698 HV_MIGRATION_MODE: HT_MIGRATION_NONLIVE,
1699 HV_USE_LOCALTIME: False,
1700 HV_BLOCKDEV_PREFIX: "hd",
1702 HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1703 HV_CPU_MASK: CPU_PINNING_ALL,
1706 HV_VIF_TYPE: HT_HVM_VIF_IOEMU,
1709 HV_XEN_CMD: XEN_CMD_XM,
1714 HV_KVM_PATH: KVM_PATH,
1715 HV_KERNEL_PATH: KVM_KERNEL,
1717 HV_KERNEL_ARGS: "ro",
1718 HV_ROOT_PATH: "/dev/vda1",
1720 HV_SERIAL_CONSOLE: True,
1721 HV_SERIAL_SPEED: 38400,
1722 HV_VNC_BIND_ADDRESS: "",
1725 HV_VNC_X509_VERIFY: False,
1726 HV_VNC_PASSWORD_FILE: "",
1727 HV_KVM_SPICE_BIND: "",
1728 HV_KVM_SPICE_IP_VERSION: IFACE_NO_IP_VERSION_SPECIFIED,
1729 HV_KVM_SPICE_PASSWORD_FILE: "",
1730 HV_KVM_SPICE_LOSSLESS_IMG_COMPR: "",
1731 HV_KVM_SPICE_JPEG_IMG_COMPR: "",
1732 HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR: "",
1733 HV_KVM_SPICE_STREAMING_VIDEO_DETECTION: "",
1734 HV_KVM_SPICE_AUDIO_COMPR: True,
1735 HV_KVM_SPICE_USE_TLS: False,
1736 HV_KVM_SPICE_TLS_CIPHERS: OPENSSL_CIPHERS,
1737 HV_KVM_SPICE_USE_VDAGENT: True,
1738 HV_KVM_FLOPPY_IMAGE_PATH: "",
1739 HV_CDROM_IMAGE_PATH: "",
1740 HV_KVM_CDROM2_IMAGE_PATH: "",
1741 HV_BOOT_ORDER: HT_BO_DISK,
1742 HV_NIC_TYPE: HT_NIC_PARAVIRTUAL,
1743 HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
1744 HV_KVM_CDROM_DISK_TYPE: "",
1747 HV_MIGRATION_PORT: 8102,
1748 HV_MIGRATION_BANDWIDTH: 32, # MiB/s
1749 HV_MIGRATION_DOWNTIME: 30, # ms
1750 HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1751 HV_USE_LOCALTIME: False,
1752 HV_DISK_CACHE: HT_CACHE_DEFAULT,
1753 HV_SECURITY_MODEL: HT_SM_NONE,
1754 HV_SECURITY_DOMAIN: "",
1756 HV_VHOST_NET: False,
1757 HV_KVM_USE_CHROOT: False,
1759 HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1760 HV_CPU_MASK: CPU_PINNING_ALL,
1769 HV_KVM_MACHINE_VERSION: "",
1773 HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1776 HV_INIT_SCRIPT: "/ganeti-chroot",
1783 HVC_GLOBALS = compat.UniqueFrozenset([
1785 HV_MIGRATION_BANDWIDTH,
1794 BE_AUTO_BALANCE: True,
1795 BE_ALWAYS_FAILOVER: False,
1801 ND_SPINDLE_COUNT: 1,
1802 ND_EXCLUSIVE_STORAGE: False,
1804 ND_OVS_NAME: DEFAULT_OVS,
1808 NDC_GLOBALS = compat.UniqueFrozenset([
1809 ND_EXCLUSIVE_STORAGE,
1812 DISK_LD_DEFAULTS = {
1814 LDP_RESYNC_RATE: CLASSIC_DRBD_SYNC_SPEED,
1815 LDP_BARRIERS: _constants.DRBD_BARRIERS,
1816 LDP_NO_META_FLUSH: _constants.DRBD_NO_META_FLUSH,
1817 LDP_DEFAULT_METAVG: DEFAULT_VG,
1818 LDP_DISK_CUSTOM: "",
1820 LDP_PROTOCOL: DRBD_DEFAULT_NET_PROTOCOL,
1821 LDP_DYNAMIC_RESYNC: False,
1823 # The default values for the DRBD dynamic resync speed algorithm
1824 # are taken from the drbsetup 8.3.11 man page, except for
1825 # c-plan-ahead (that we don't need to set to 0, because we have a
1826 # separate option to enable it) and for c-max-rate, that we cap to
1827 # the default value for the static resync rate.
1828 LDP_PLAN_AHEAD: 20, # ds
1829 LDP_FILL_TARGET: 0, # sectors
1830 LDP_DELAY_TARGET: 1, # ds
1831 LDP_MAX_RATE: CLASSIC_DRBD_SYNC_SPEED, # KiB/s
1832 LDP_MIN_RATE: 4 * 1024, # KiB/s
1835 LDP_STRIPES: _constants.LVM_STRIPECOUNT
1842 LDP_ACCESS: DISK_KERNELSPACE,
1847 # readability shortcuts
1848 _LV_DEFAULTS = DISK_LD_DEFAULTS[DT_PLAIN]
1849 _DRBD_DEFAULTS = DISK_LD_DEFAULTS[DT_DRBD8]
1851 DISK_DT_DEFAULTS = {
1853 LV_STRIPES: DISK_LD_DEFAULTS[DT_PLAIN][LDP_STRIPES],
1856 DRBD_RESYNC_RATE: _DRBD_DEFAULTS[LDP_RESYNC_RATE],
1857 DRBD_DATA_STRIPES: _LV_DEFAULTS[LDP_STRIPES],
1858 DRBD_META_STRIPES: _LV_DEFAULTS[LDP_STRIPES],
1859 DRBD_DISK_BARRIERS: _DRBD_DEFAULTS[LDP_BARRIERS],
1860 DRBD_META_BARRIERS: _DRBD_DEFAULTS[LDP_NO_META_FLUSH],
1861 DRBD_DEFAULT_METAVG: _DRBD_DEFAULTS[LDP_DEFAULT_METAVG],
1862 DRBD_DISK_CUSTOM: _DRBD_DEFAULTS[LDP_DISK_CUSTOM],
1863 DRBD_NET_CUSTOM: _DRBD_DEFAULTS[LDP_NET_CUSTOM],
1864 DRBD_PROTOCOL: _DRBD_DEFAULTS[LDP_PROTOCOL],
1865 DRBD_DYNAMIC_RESYNC: _DRBD_DEFAULTS[LDP_DYNAMIC_RESYNC],
1866 DRBD_PLAN_AHEAD: _DRBD_DEFAULTS[LDP_PLAN_AHEAD],
1867 DRBD_FILL_TARGET: _DRBD_DEFAULTS[LDP_FILL_TARGET],
1868 DRBD_DELAY_TARGET: _DRBD_DEFAULTS[LDP_DELAY_TARGET],
1869 DRBD_MAX_RATE: _DRBD_DEFAULTS[LDP_MAX_RATE],
1870 DRBD_MIN_RATE: _DRBD_DEFAULTS[LDP_MIN_RATE],
1877 RBD_POOL: DISK_LD_DEFAULTS[DT_RBD][LDP_POOL],
1878 RBD_ACCESS: DISK_LD_DEFAULTS[DT_RBD][LDP_ACCESS],
1883 # we don't want to export the shortcuts
1884 del _LV_DEFAULTS, _DRBD_DEFAULTS
1887 NIC_MODE: NIC_MODE_BRIDGED,
1888 NIC_LINK: DEFAULT_BRIDGE,
1889 NIC_VLAN: VALUE_HS_NOTHING,
1892 # All of the following values are quite arbitrarily - there are no
1893 # "good" defaults, these must be customised per-site
1894 ISPECS_MINMAX_DEFAULTS = {
1896 ISPEC_MEM_SIZE: 128,
1898 ISPEC_DISK_COUNT: 1,
1899 ISPEC_DISK_SIZE: 1024,
1901 ISPEC_SPINDLE_USE: 1,
1904 ISPEC_MEM_SIZE: 32768,
1906 ISPEC_DISK_COUNT: MAX_DISKS,
1907 ISPEC_DISK_SIZE: 1024 * 1024,
1908 ISPEC_NIC_COUNT: MAX_NICS,
1909 ISPEC_SPINDLE_USE: 12,
1912 IPOLICY_DEFAULTS = {
1913 ISPECS_MINMAX: [ISPECS_MINMAX_DEFAULTS],
1915 ISPEC_MEM_SIZE: 128,
1917 ISPEC_DISK_COUNT: 1,
1918 ISPEC_DISK_SIZE: 1024,
1920 ISPEC_SPINDLE_USE: 1,
1922 IPOLICY_DTS: list(DISK_TEMPLATES),
1923 IPOLICY_VCPU_RATIO: 4.0,
1924 IPOLICY_SPINDLE_RATIO: 32.0,
1927 MASTER_POOL_SIZE_DEFAULT = 10
1929 # Exclusive storage:
1930 # Error margin used to compare physical disks
1932 # Space reserved when creating instance disks
1935 CONFD_PROTOCOL_VERSION = _constants.CONFD_PROTOCOL_VERSION
1937 CONFD_REQ_PING = _constants.CONFD_REQ_PING
1938 CONFD_REQ_NODE_ROLE_BYNAME = _constants.CONFD_REQ_NODE_ROLE_BYNAME
1939 CONFD_REQ_NODE_PIP_BY_INSTANCE_IP = _constants.CONFD_REQ_NODE_PIP_BY_INSTANCE_IP
1940 CONFD_REQ_CLUSTER_MASTER = _constants.CONFD_REQ_CLUSTER_MASTER
1941 CONFD_REQ_NODE_PIP_LIST = _constants.CONFD_REQ_NODE_PIP_LIST
1942 CONFD_REQ_MC_PIP_LIST = _constants.CONFD_REQ_MC_PIP_LIST
1943 CONFD_REQ_INSTANCES_IPS_LIST = _constants.CONFD_REQ_INSTANCES_IPS_LIST
1944 CONFD_REQ_NODE_DRBD = _constants.CONFD_REQ_NODE_DRBD
1945 CONFD_REQ_NODE_INSTANCES = _constants.CONFD_REQ_NODE_INSTANCES
1946 CONFD_REQS = _constants.CONFD_REQS
1948 # Confd request query fields. These are used to narrow down queries.
1949 # These must be strings rather than integers, because json-encoding
1950 # converts them to strings anyway, as they're used as dict-keys.
1951 CONFD_REQQ_LINK = _constants.CONFD_REQQ_LINK
1952 CONFD_REQQ_IP = _constants.CONFD_REQQ_IP
1953 CONFD_REQQ_IPLIST = _constants.CONFD_REQQ_IPLIST
1954 CONFD_REQQ_FIELDS = _constants.CONFD_REQQ_FIELDS
1956 # FIXME: perhaps update code that uses these constants to deal with
1957 # integers instead of strings
1958 CONFD_REQFIELD_NAME = str(_constants.CONFD_REQFIELD_NAME)
1959 CONFD_REQFIELD_IP = str(_constants.CONFD_REQFIELD_IP)
1960 CONFD_REQFIELD_MNODE_PIP = str(_constants.CONFD_REQFIELD_MNODE_PIP)
1962 CONFD_REPL_STATUS_OK = _constants.CONFD_REPL_STATUS_OK
1963 CONFD_REPL_STATUS_ERROR = _constants.CONFD_REPL_STATUS_ERROR
1964 CONFD_REPL_STATUS_NOTIMPLEMENTED = _constants.CONFD_REPL_STATUS_NOTIMPLEMENTED
1965 CONFD_REPL_STATUSES = _constants.CONFD_REPL_STATUSES
1967 CONFD_NODE_ROLE_MASTER = _constants.CONFD_NODE_ROLE_MASTER
1968 CONFD_NODE_ROLE_CANDIDATE = _constants.CONFD_NODE_ROLE_CANDIDATE
1969 CONFD_NODE_ROLE_OFFLINE = _constants.CONFD_NODE_ROLE_OFFLINE
1970 CONFD_NODE_ROLE_DRAINED = _constants.CONFD_NODE_ROLE_DRAINED
1971 CONFD_NODE_ROLE_REGULAR = _constants.CONFD_NODE_ROLE_REGULAR
1973 CONFD_ERROR_UNKNOWN_ENTRY = _constants.CONFD_ERROR_UNKNOWN_ENTRY
1974 CONFD_ERROR_INTERNAL = _constants.CONFD_ERROR_INTERNAL
1975 CONFD_ERROR_ARGUMENT = _constants.CONFD_ERROR_ARGUMENT
1977 # Each request is "salted" by the current timestamp.
1978 # This constants decides how many seconds of skew to accept.
1979 # TODO: make this a default and allow the value to be more configurable
1980 CONFD_MAX_CLOCK_SKEW = _constants.CONFD_MAX_CLOCK_SKEW
1982 # When we haven't reloaded the config for more than this amount of
1983 # seconds, we force a test to see if inotify is betraying us. Using a
1984 # prime number to ensure we get less chance of 'same wakeup' with
1986 CONFD_CONFIG_RELOAD_TIMEOUT = _constants.CONFD_CONFIG_RELOAD_TIMEOUT
1988 # If we receive more than one update in this amount of microseconds,
1989 # we move to polling every RATELIMIT seconds, rather than relying on
1990 # inotify, to be able to serve more requests.
1991 CONFD_CONFIG_RELOAD_RATELIMIT = _constants.CONFD_CONFIG_RELOAD_RATELIMIT
1993 # Magic number prepended to all confd queries.
1994 # This allows us to distinguish different types of confd protocols and handle
1995 # them. For example by changing this we can move the whole payload to be
1996 # compressed, or move away from json.
1997 CONFD_MAGIC_FOURCC = _constants.CONFD_MAGIC_FOURCC
1999 # By default a confd request is sent to the minimum between this number and all
2000 # MCs. 6 was chosen because even in the case of a disastrous 50% response rate,
2001 # we should have enough answers to be able to compare more than one.
2002 CONFD_DEFAULT_REQ_COVERAGE = _constants.CONFD_DEFAULT_REQ_COVERAGE
2004 # Timeout in seconds to expire pending query request in the confd client
2005 # library. We don't actually expect any answer more than 10 seconds after we
2007 CONFD_CLIENT_EXPIRE_TIMEOUT = _constants.CONFD_CLIENT_EXPIRE_TIMEOUT
2009 # Maximum UDP datagram size.
2010 # On IPv4: 64K - 20 (ip header size) - 8 (udp header size) = 65507
2011 # On IPv6: 64K - 40 (ip6 header size) - 8 (udp header size) = 65487
2012 # (assuming we can't use jumbo frames)
2013 # We just set this to 60K, which should be enough
2014 MAX_UDP_DATA_SIZE = 61440
2016 # User-id pool minimum/maximum acceptable user-ids.
2018 UIDPOOL_UID_MAX = 2 ** 32 - 1 # Assuming 32 bit user-ids
2020 # Name or path of the pgrep command
2023 # Name of the node group that gets created at cluster init or upgrade
2024 INITIAL_NODE_GROUP_NAME = "default"
2026 # Possible values for NodeGroup.alloc_policy
2027 ALLOC_POLICY_PREFERRED = _constants.ALLOC_POLICY_PREFERRED
2028 ALLOC_POLICY_LAST_RESORT = _constants.ALLOC_POLICY_LAST_RESORT
2029 ALLOC_POLICY_UNALLOCABLE = _constants.ALLOC_POLICY_UNALLOCABLE
2030 VALID_ALLOC_POLICIES = _constants.VALID_ALLOC_POLICIES
2032 # Temporary external/shared storage parameters
2033 BLOCKDEV_DRIVER_MANUAL = _constants.BLOCKDEV_DRIVER_MANUAL
2035 # qemu-img path, required for ovfconverter
2036 QEMUIMG_PATH = _constants.QEMUIMG_PATH
2038 # Whether htools was enabled at compilation time
2039 HTOOLS = _constants.HTOOLS
2040 # The hail iallocator
2041 IALLOC_HAIL = "hail"
2043 # Fake opcodes for functions that have hooks attached to them via
2044 # backend.RunLocalHooks
2045 FAKE_OP_MASTER_TURNUP = "OP_CLUSTER_IP_TURNUP"
2046 FAKE_OP_MASTER_TURNDOWN = "OP_CLUSTER_IP_TURNDOWN"
2051 SSHK_ALL = compat.UniqueFrozenset([SSHK_RSA, SSHK_DSA])
2053 # SSH authorized key types
2054 SSHAK_RSA = "ssh-rsa"
2055 SSHAK_DSS = "ssh-dss"
2056 SSHAK_ALL = compat.UniqueFrozenset([SSHAK_RSA, SSHAK_DSS])
2059 SSHS_CLUSTER_NAME = "cluster_name"
2060 SSHS_SSH_HOST_KEY = "ssh_host_key"
2061 SSHS_SSH_ROOT_KEY = "ssh_root_key"
2062 SSHS_NODE_DAEMON_CERTIFICATE = "node_daemon_certificate"
2064 #: Key files for SSH daemon
2065 SSH_DAEMON_KEYFILES = {
2066 SSHK_RSA: (pathutils.SSH_HOST_RSA_PRIV, pathutils.SSH_HOST_RSA_PUB),
2067 SSHK_DSA: (pathutils.SSH_HOST_DSA_PRIV, pathutils.SSH_HOST_DSA_PUB),
2071 NDS_CLUSTER_NAME = "cluster_name"
2072 NDS_NODE_DAEMON_CERTIFICATE = "node_daemon_certificate"
2073 NDS_SSCONF = "ssconf"
2074 NDS_START_NODE_DAEMON = "start_node_daemon"
2076 # Path generating random UUID
2077 RANDOM_UUID_FILE = _constants.RANDOM_UUID_FILE
2079 # Regex string for verifying a UUID
2080 UUID_REGEX = "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"
2082 # Auto-repair tag prefixes
2083 AUTO_REPAIR_TAG_PREFIX = _constants.AUTO_REPAIR_TAG_PREFIX
2084 AUTO_REPAIR_TAG_ENABLED = _constants.AUTO_REPAIR_TAG_ENABLED
2085 AUTO_REPAIR_TAG_SUSPENDED = _constants.AUTO_REPAIR_TAG_SUSPENDED
2086 AUTO_REPAIR_TAG_PENDING = _constants.AUTO_REPAIR_TAG_PENDING
2087 AUTO_REPAIR_TAG_RESULT = _constants.AUTO_REPAIR_TAG_RESULT
2089 # Auto-repair levels
2090 AUTO_REPAIR_FIX_STORAGE = _constants.AUTO_REPAIR_FIX_STORAGE
2091 AUTO_REPAIR_MIGRATE = _constants.AUTO_REPAIR_MIGRATE
2092 AUTO_REPAIR_FAILOVER = _constants.AUTO_REPAIR_FAILOVER
2093 AUTO_REPAIR_REINSTALL = _constants.AUTO_REPAIR_REINSTALL
2094 AUTO_REPAIR_ALL_TYPES = _constants.AUTO_REPAIR_ALL_TYPES
2096 # Auto-repair results
2097 AUTO_REPAIR_SUCCESS = _constants.AUTO_REPAIR_SUCCESS
2098 AUTO_REPAIR_FAILURE = _constants.AUTO_REPAIR_FAILURE
2099 AUTO_REPAIR_ENOPERM = _constants.AUTO_REPAIR_ENOPERM
2100 AUTO_REPAIR_ALL_RESULTS = _constants.AUTO_REPAIR_ALL_RESULTS
2102 # The version identifier for builtin data collectors
2103 BUILTIN_DATA_COLLECTOR_VERSION = _constants.BUILTIN_DATA_COLLECTOR_VERSION
2105 # The reason trail opcode parameter name
2106 OPCODE_REASON = _constants.OPCODE_REASON
2108 # The source reasons for the execution of an OpCode
2109 OPCODE_REASON_SRC_CLIENT = "gnt:client"
2110 OPCODE_REASON_SRC_NODED = "gnt:daemon:noded"
2111 OPCODE_REASON_SRC_OPCODE = "gnt:opcode"
2112 OPCODE_REASON_SRC_RLIB2 = "gnt:library:rlib2"
2113 OPCODE_REASON_SRC_USER = "gnt:user"
2115 OPCODE_REASON_SOURCES = compat.UniqueFrozenset([
2116 OPCODE_REASON_SRC_CLIENT,
2117 OPCODE_REASON_SRC_NODED,
2118 OPCODE_REASON_SRC_OPCODE,
2119 OPCODE_REASON_SRC_RLIB2,
2120 OPCODE_REASON_SRC_USER,
2123 DISKSTATS_FILE = _constants.DISKSTATS_FILE
2125 # CPU load collector variables
2126 STAT_FILE = _constants.STAT_FILE
2127 CPUAVGLOAD_BUFFER_SIZE = _constants.CPUAVGLOAD_BUFFER_SIZE
2128 CPUAVGLOAD_WINDOW_SIZE = _constants.CPUAVGLOAD_WINDOW_SIZE
2130 # Mond's variable for periodical data collection
2131 MOND_TIME_INTERVAL = _constants.MOND_TIME_INTERVAL
2133 # MonD's latest API version
2134 MOND_LATEST_API_VERSION = 1
2136 # Timeouts for upgrades
2138 UPGRADE_QUEUE_DRAIN_TIMEOUT = _constants.UPGRADE_QUEUE_DRAIN_TIMEOUT
2139 UPGRADE_QUEUE_POLL_INTERVAL = _constants.UPGRADE_QUEUE_POLL_INTERVAL
2141 # Do not re-export imported modules
2142 del re, _vcsversion, _constants, socket, pathutils, compat
2145 ALLOCATABLE_KEY = "allocatable"
2146 FAILED_KEY = "failed"