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_SEP = _constants.CPU_PINNING_SEP
76 CPU_PINNING_ALL = _constants.CPU_PINNING_ALL
77 CPU_PINNING_ALL_VAL = _constants.CPU_PINNING_ALL_VAL
78 CPU_PINNING_OFF = _constants.CPU_PINNING_OFF
80 CPU_PINNING_ALL_XEN = _constants.CPU_PINNING_ALL_XEN
82 CPU_PINNING_ALL_KVM = _constants.CPU_PINNING_ALL_KVM
84 DD_CMD = _constants.DD_CMD
85 MAX_WIPE_CHUNK = _constants.MAX_WIPE_CHUNK
86 MIN_WIPE_CHUNK_PERCENT = _constants.MIN_WIPE_CHUNK_PERCENT
88 RUN_DIRS_MODE = _constants.RUN_DIRS_MODE
89 SECURE_DIR_MODE = _constants.SECURE_DIR_MODE
90 SECURE_FILE_MODE = _constants.SECURE_FILE_MODE
91 ADOPTABLE_BLOCKDEV_ROOT = _constants.ADOPTABLE_BLOCKDEV_ROOT
92 ENABLE_CONFD = _constants.ENABLE_CONFD
93 ENABLE_MOND = _constants.ENABLE_MOND
94 ENABLE_SPLIT_QUERY = _constants.ENABLE_SPLIT_QUERY
95 ENABLE_RESTRICTED_COMMANDS = _constants.ENABLE_RESTRICTED_COMMANDS
101 NODED = _constants.NODED
102 CONFD = _constants.CONFD
103 LUXID = _constants.LUXID
104 RAPI = _constants.RAPI
105 MASTERD = _constants.MASTERD
106 MOND = _constants.MOND
108 DAEMONS = _constants.DAEMONS
110 DAEMONS_PORTS = _constants.DAEMONS_PORTS
112 DEFAULT_NODED_PORT = _constants.DEFAULT_NODED_PORT
113 DEFAULT_CONFD_PORT = _constants.DEFAULT_CONFD_PORT
114 DEFAULT_MOND_PORT = _constants.DEFAULT_MOND_PORT
115 DEFAULT_RAPI_PORT = _constants.DEFAULT_RAPI_PORT
117 FIRST_DRBD_PORT = _constants.FIRST_DRBD_PORT
118 LAST_DRBD_PORT = _constants.LAST_DRBD_PORT
120 DAEMONS_LOGBASE = _constants.DAEMONS_LOGBASE
123 dict((daemon, pathutils.GetLogFilename(DAEMONS_LOGBASE[daemon]))
124 for daemon in DAEMONS_LOGBASE)
126 # Some daemons might require more than one logfile.
127 # Specifically, right now only the Haskell http library "snap", used by the
128 # monitoring daemon, requires multiple log files.
130 # These are the only valid reasons for having an extra logfile
131 EXTRA_LOGREASON_ACCESS = "access"
132 EXTRA_LOGREASON_ERROR = "error"
134 VALID_EXTRA_LOGREASONS = compat.UniqueFrozenset([
135 EXTRA_LOGREASON_ACCESS,
136 EXTRA_LOGREASON_ERROR,
139 # These are the extra logfiles, grouped by daemon
140 DAEMONS_EXTRA_LOGBASE = {
142 EXTRA_LOGREASON_ACCESS: _constants.EXTRA_LOGREASON_ACCESS,
143 EXTRA_LOGREASON_ERROR: _constants.EXTRA_LOGREASON_ERROR,
147 DAEMONS_EXTRA_LOGFILES = \
148 dict((daemon, dict((extra,
149 pathutils.GetLogFilename(DAEMONS_EXTRA_LOGBASE[daemon][extra]))
150 for extra in DAEMONS_EXTRA_LOGBASE[daemon]))
151 for daemon in DAEMONS_EXTRA_LOGBASE)
153 DEV_CONSOLE = _constants.DEV_CONSOLE
155 PROC_MOUNTS = _constants.PROC_MOUNTS
157 LUXI_EOM = _constants.LUXI_EOM
158 LUXI_VERSION = _constants.LUXI_VERSION
159 LUXI_OVERRIDE = _constants.LUXI_OVERRIDE
160 LUXI_OVERRIDE_MASTER = _constants.LUXI_OVERRIDE_MASTER
161 LUXI_OVERRIDE_QUERY = _constants.LUXI_OVERRIDE_QUERY
162 # one of "no", "yes", "only"
163 SYSLOG_USAGE = _constants.SYSLOG_USAGE
164 SYSLOG_NO = _constants.SYSLOG_NO
165 SYSLOG_YES = _constants.SYSLOG_YES
166 SYSLOG_ONLY = _constants.SYSLOG_ONLY
167 SYSLOG_SOCKET = _constants.SYSLOG_SOCKET
169 EXPORT_CONF_FILE = _constants.EXPORT_CONF_FILE
171 XEN_BOOTLOADER = _constants.XEN_BOOTLOADER
172 XEN_KERNEL = _constants.XEN_KERNEL
173 XEN_INITRD = _constants.XEN_INITRD
174 XEN_CMD_XM = _constants.XEN_CMD_XM
175 XEN_CMD_XL = _constants.XEN_CMD_XL
176 KNOWN_XEN_COMMANDS = _constants.KNOWN_XEN_COMMANDS
178 # When the Xen toolstack used is "xl", live migration requires the source host
179 # to connect to the target host via ssh (xl runs this command). We need to pass
180 # the command xl runs some extra info so that it can use Ganeti's key
181 # verification and not fail. Note that this string is incomplete: it must be
182 # filled with the cluster name before being used.
183 XL_SSH_CMD = ("ssh -l %s -oGlobalKnownHostsFile=%s"
184 " -oUserKnownHostsFile=/dev/null"
185 " -oCheckHostIp=no -oStrictHostKeyChecking=yes"
186 " -oHostKeyAlias=%%s") % (SSH_LOGIN_USER,
187 pathutils.SSH_KNOWN_HOSTS_FILE)
189 KVM_PATH = _constants.KVM_PATH
190 KVM_KERNEL = _constants.KVM_KERNEL
191 SOCAT_PATH = _constants.SOCAT_PATH
192 SOCAT_USE_ESCAPE = _constants.SOCAT_USE_ESCAPE
193 SOCAT_USE_COMPRESS = _constants.SOCAT_USE_COMPRESS
194 SOCAT_ESCAPE_CODE = _constants.SOCAT_ESCAPE_CODE
197 CONS_SSH = _constants.CONS_SSH
198 CONS_VNC = _constants.CONS_VNC
199 CONS_SPICE = _constants.CONS_SPICE
200 CONS_MESSAGE = _constants.CONS_MESSAGE
201 CONS_ALL = _constants.CONS_ALL
203 RSA_KEY_BITS = _constants.RSA_KEY_BITS
204 OPENSSL_CIPHERS = _constants.OPENSSL_CIPHERS
206 X509_CERT_SIGN_DIGEST = _constants.X509_CERT_SIGN_DIGEST
207 X509_CERT_DEFAULT_VALIDITY = _constants.X509_CERT_DEFAULT_VALIDITY
208 X509_CERT_CN = _constants.X509_CERT_CN
209 X509_CERT_SIGNATURE_HEADER = _constants.X509_CERT_SIGNATURE_HEADER
211 # Import/export daemon mode
212 IEM_IMPORT = _constants.IEM_IMPORT
213 IEM_EXPORT = _constants.IEM_EXPORT
215 # Import/export transport compression
216 IEC_NONE = _constants.IEC_NONE
217 IEC_GZIP = _constants.IEC_GZIP
218 IEC_ALL = _constants.IEC_ALL
220 IE_CUSTOM_SIZE = _constants.IE_CUSTOM_SIZE
222 IE_MAGIC_RE = re.compile(r"^[-_.a-zA-Z0-9]{5,100}$")
224 IEIO_FILE = _constants.IEIO_FILE
225 IEIO_RAW_DISK = _constants.IEIO_RAW_DISK
226 IEIO_SCRIPT = _constants.IEIO_SCRIPT
228 VALUE_DEFAULT = "default"
230 VALUE_GENERATE = "generate"
233 VALUE_FALSE = "false"
234 VALUE_HS_NOTHING = {"Nothing": None}
237 # External script validation mask
238 EXT_PLUGIN_MASK = re.compile("^[a-zA-Z0-9_-]+$")
240 HOOKS_PHASE_PRE = _constants.HOOKS_PHASE_PRE
241 HOOKS_PHASE_POST = _constants.HOOKS_PHASE_POST
242 HOOKS_NAME_CFGUPDATE = _constants.HOOKS_NAME_CFGUPDATE
243 HOOKS_NAME_WATCHER = _constants.HOOKS_NAME_WATCHER
244 HOOKS_VERSION = _constants.HOOKS_VERSION
245 HOOKS_PATH = _constants.HOOKS_PATH
247 HTYPE_CLUSTER = _constants.HTYPE_CLUSTER
248 HTYPE_NODE = _constants.HTYPE_NODE
249 HTYPE_GROUP = _constants.HTYPE_GROUP
250 HTYPE_INSTANCE = _constants.HTYPE_INSTANCE
251 HTYPE_NETWORK = _constants.HTYPE_NETWORK
253 HKR_SKIP = _constants.HKR_SKIP
254 HKR_FAIL = _constants.HKR_FAIL
255 HKR_SUCCESS = _constants.HKR_SUCCESS
258 ST_BLOCK = _constants.ST_BLOCK
259 ST_DISKLESS = _constants.ST_DISKLESS
260 ST_EXT = _constants.ST_EXT
261 ST_FILE = _constants.ST_FILE
262 ST_LVM_PV = _constants.ST_LVM_PV
263 ST_LVM_VG = _constants.ST_LVM_VG
264 ST_RADOS = _constants.ST_RADOS
265 STORAGE_TYPES = _constants.STORAGE_TYPES
266 STS_REPORT = _constants.STS_REPORT
269 # first two are valid in LU context only, not passed to backend
270 SF_NODE = _constants.SF_NODE
271 SF_TYPE = _constants.SF_TYPE
272 # and the rest are valid in backend
273 SF_NAME = _constants.SF_NAME
274 SF_SIZE = _constants.SF_SIZE
275 SF_FREE = _constants.SF_FREE
276 SF_USED = _constants.SF_USED
277 SF_ALLOCATABLE = _constants.SF_ALLOCATABLE
278 VALID_STORAGE_FIELDS = _constants.VALID_STORAGE_FIELDS
279 MODIFIABLE_STORAGE_FIELDS = _constants.MODIFIABLE_STORAGE_FIELDS
281 SO_FIX_CONSISTENCY = _constants.SO_FIX_CONSISTENCY
282 VALID_STORAGE_OPERATIONS = _constants.VALID_STORAGE_OPERATIONS
284 VF_DEV = _constants.VF_DEV
285 VF_INSTANCE = _constants.VF_INSTANCE
286 VF_NAME = _constants.VF_NAME
287 VF_NODE = _constants.VF_NODE
288 VF_PHYS = _constants.VF_PHYS
289 VF_SIZE = _constants.VF_SIZE
290 VF_VG = _constants.VF_VG
292 LDS_OKAY = _constants.LDS_OKAY
293 LDS_UNKNOWN = _constants.LDS_UNKNOWN
294 LDS_FAULTY = _constants.LDS_FAULTY
295 LDS_NAMES = _constants.LDS_NAMES
297 # disk template types
298 DT_BLOCK = _constants.DT_BLOCK
299 DT_DISKLESS = _constants.DT_DISKLESS
300 DT_DRBD8 = _constants.DT_DRBD8
301 DT_EXT = _constants.DT_EXT
302 DT_FILE = _constants.DT_FILE
303 DT_PLAIN = _constants.DT_PLAIN
304 DT_RBD = _constants.DT_RBD
305 DT_SHARED_FILE = _constants.DT_SHARED_FILE
306 DISK_TEMPLATE_PREFERENCE = _constants.DISK_TEMPLATE_PREFERENCE
307 DISK_TEMPLATES = _constants.DISK_TEMPLATES
308 DEFAULT_ENABLED_DISK_TEMPLATES = _constants.DEFAULT_ENABLED_DISK_TEMPLATES
310 MAP_DISK_TEMPLATE_STORAGE_TYPE = _constants.MAP_DISK_TEMPLATE_STORAGE_TYPE
312 DTS_INT_MIRROR = _constants.DTS_INT_MIRROR
313 DTS_EXT_MIRROR = _constants.DTS_EXT_MIRROR
314 DTS_NOT_LVM = _constants.DTS_NOT_LVM
315 DTS_GROWABLE = _constants.DTS_GROWABLE
316 DTS_MAY_ADOPT = _constants.DTS_MAY_ADOPT
317 DTS_MUST_ADOPT = _constants.DTS_MUST_ADOPT
318 DTS_MIRRORED = _constants.DTS_MIRRORED
319 DTS_FILEBASED = _constants.DTS_FILEBASED
320 DTS_COPYABLE = _constants.DTS_COPYABLE
321 DTS_EXCL_STORAGE = _constants.DTS_EXCL_STORAGE
322 DTS_NO_FREE_SPACE_CHECK = _constants.DTS_NO_FREE_SPACE_CHECK
323 DTS_BLOCK = _constants.DTS_BLOCK
325 DRBD_HMAC_ALG = _constants.DRBD_HMAC_ALG
326 DRBD_DEFAULT_NET_PROTOCOL = _constants.DRBD_DEFAULT_NET_PROTOCOL
327 DRBD_MIGRATION_NET_PROTOCOL = _constants.DRBD_MIGRATION_NET_PROTOCOL
328 DRBD_STATUS_FILE = _constants.DRBD_STATUS_FILE
329 DRBD_META_SIZE = _constants.DRBD_META_SIZE
331 DRBD_B_NONE = _constants.DRBD_B_NONE
332 DRBD_B_DISK_BARRIERS = _constants.DRBD_B_DISK_BARRIERS
333 DRBD_B_DISK_DRAIN = _constants.DRBD_B_DISK_DRAIN
334 DRBD_B_DISK_FLUSH = _constants.DRBD_B_DISK_FLUSH
336 # Valid barrier combinations: "n" or any non-null subset of "bfd"
337 DRBD_VALID_BARRIER_OPT = compat.UniqueFrozenset([
338 frozenset([DRBD_B_NONE]),
339 frozenset([DRBD_B_DISK_BARRIERS]),
340 frozenset([DRBD_B_DISK_DRAIN]),
341 frozenset([DRBD_B_DISK_FLUSH]),
342 frozenset([DRBD_B_DISK_DRAIN, DRBD_B_DISK_FLUSH]),
343 frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_DRAIN]),
344 frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_FLUSH]),
345 frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_FLUSH, DRBD_B_DISK_DRAIN]),
348 RBD_CMD = _constants.RBD_CMD
350 FD_BLKTAP = _constants.FD_BLKTAP
351 FD_LOOP = _constants.FD_LOOP
352 FILE_DRIVER = _constants.FILE_DRIVER
354 LDS_DRBD = _constants.LDS_DRBD
357 DISK_RDONLY = _constants.DISK_RDONLY
358 DISK_RDWR = _constants.DISK_RDWR
359 DISK_ACCESS_SET = _constants.DISK_ACCESS_SET
360 DISK_USERSPACE = _constants.DISK_USERSPACE
361 DISK_KERNELSPACE = _constants.DISK_KERNELSPACE
362 DISK_VALID_ACCESS_MODES = _constants.DISK_VALID_ACCESS_MODES
364 REPLACE_DISK_PRI = _constants.REPLACE_DISK_PRI
365 REPLACE_DISK_SEC = _constants.REPLACE_DISK_SEC
366 REPLACE_DISK_CHG = _constants.REPLACE_DISK_CHG
367 REPLACE_DISK_AUTO = _constants.REPLACE_DISK_AUTO
368 REPLACE_MODES = _constants.REPLACE_MODES
370 # Instance export mode
371 EXPORT_MODE_LOCAL = _constants.EXPORT_MODE_LOCAL
372 EXPORT_MODE_REMOTE = _constants.EXPORT_MODE_REMOTE
373 EXPORT_MODES = _constants.EXPORT_MODES
375 # instance creation modes
376 INSTANCE_CREATE = _constants.INSTANCE_CREATE
377 INSTANCE_IMPORT = _constants.INSTANCE_IMPORT
378 INSTANCE_REMOTE_IMPORT = _constants.INSTANCE_REMOTE_IMPORT
379 INSTANCE_CREATE_MODES = _constants.INSTANCE_CREATE_MODES
381 # Remote import/export handshake message and version
383 RIE_HANDSHAKE = "Hi, I'm Ganeti"
385 # Remote import/export certificate validity in seconds
386 RIE_CERT_VALIDITY = 24 * 60 * 60
388 # Overall timeout for establishing connection
389 RIE_CONNECT_TIMEOUT = 180
391 # Export only: how long to wait per connection attempt (seconds)
392 RIE_CONNECT_ATTEMPT_TIMEOUT = 20
394 # Export only: number of attempts to connect
395 RIE_CONNECT_RETRIES = 10
397 #: Give child process up to 5 seconds to exit after sending a signal
398 CHILD_LINGER_TIMEOUT = 5.0
401 # import/export config options
402 INISECT_EXP = "export"
403 INISECT_INS = "instance"
404 INISECT_HYP = "hypervisor"
405 INISECT_BEP = "backend"
408 # dynamic device modification
409 DDM_ADD = _constants.DDM_ADD
410 DDM_MODIFY = _constants.DDM_MODIFY
411 DDM_REMOVE = _constants.DDM_REMOVE
412 DDMS_VALUES = _constants.DDMS_VALUES
413 DDMS_VALUES_WITH_MODIFY = _constants.DDMS_VALUES_WITH_MODIFY
414 # TODO: DDM_SWAP, DDM_MOVE?
417 EXIT_SUCCESS = _constants.EXIT_SUCCESS
418 EXIT_FAILURE = _constants.EXIT_FAILURE
419 EXIT_NOTCLUSTER = _constants.EXIT_NOTCLUSTER
420 EXIT_NOTMASTER = _constants.EXIT_NOTMASTER
421 EXIT_NODESETUP_ERROR = _constants.EXIT_NODESETUP_ERROR
422 EXIT_CONFIRMATION = _constants.EXIT_CONFIRMATION # need user confirmation
424 #: Exit code for query operations with unknown fields
425 EXIT_UNKNOWN_FIELD = _constants.EXIT_UNKNOWN_FIELD
428 TAG_CLUSTER = _constants.TAG_CLUSTER
429 TAG_NODEGROUP = _constants.TAG_NODEGROUP
430 TAG_NODE = _constants.TAG_NODE
431 TAG_INSTANCE = _constants.TAG_INSTANCE
432 TAG_NETWORK = _constants.TAG_NETWORK
433 VALID_TAG_TYPES = _constants.VALID_TAG_TYPES
435 MAX_TAG_LEN = _constants.MAX_TAG_LEN
436 MAX_TAGS_PER_OBJ = _constants.MAX_TAGS_PER_OBJ
439 DEFAULT_BRIDGE = "xen-br0"
440 DEFAULT_OVS = "switch1"
441 CLASSIC_DRBD_SYNC_SPEED = 60 * 1024 # 60 MiB, expressed in KiB
442 IP4_ADDRESS_LOCALHOST = "127.0.0.1"
443 IP4_ADDRESS_ANY = "0.0.0.0"
444 IP6_ADDRESS_LOCALHOST = "::1"
445 IP6_ADDRESS_ANY = "::"
448 VALID_IP_VERSIONS = compat.UniqueFrozenset([IP4_VERSION, IP6_VERSION])
449 # for export to htools
450 IP4_FAMILY = socket.AF_INET
451 IP6_FAMILY = socket.AF_INET6
453 TCP_PING_TIMEOUT = 10
455 DEFAULT_DRBD_HELPER = "/bin/true"
457 DEFAULT_MAC_PREFIX = "aa:00:00"
458 # default maximum instance wait time, in seconds.
459 DEFAULT_SHUTDOWN_TIMEOUT = 120
460 NODE_MAX_CLOCK_SKEW = _constants.NODE_MAX_CLOCK_SKEW
461 # Time for an intra-cluster disk transfer to wait for a connection
462 DISK_TRANSFER_CONNECT_TIMEOUT = 60
463 # Disk index separator
464 DISK_SEPARATOR = _constants.DISK_SEPARATOR
465 IP_COMMAND_PATH = _constants.IP_COMMAND_PATH
467 RPC_TMO_URGENT = _constants.RPC_TMO_URGENT
468 RPC_TMO_FAST = _constants.RPC_TMO_FAST
469 RPC_TMO_NORMAL = _constants.RPC_TMO_NORMAL
470 RPC_TMO_SLOW = _constants.RPC_TMO_SLOW
471 RPC_TMO_4HRS = _constants.RPC_TMO_4HRS
472 RPC_TMO_1DAY = _constants.RPC_TMO_1DAY
473 RPC_CONNECT_TIMEOUT = _constants.RPC_CONNECT_TIMEOUT
475 #: Key for job IDs in opcode result
481 RUNPARTS_ERR) = range(3)
483 RUNPARTS_STATUS = compat.UniqueFrozenset([
491 RPC_ENCODING_ZLIB_BASE64) = range(2)
493 # os related constants
494 OS_SCRIPT_CREATE = "create"
495 OS_SCRIPT_IMPORT = "import"
496 OS_SCRIPT_EXPORT = "export"
497 OS_SCRIPT_RENAME = "rename"
498 OS_SCRIPT_VERIFY = "verify"
499 OS_SCRIPTS = compat.UniqueFrozenset([
507 OS_API_FILE = "ganeti_api_version"
508 OS_VARIANTS_FILE = "variants.list"
509 OS_PARAMETERS_FILE = "parameters.list"
511 OS_VALIDATE_PARAMETERS = "parameters"
512 OS_VALIDATE_CALLS = compat.UniqueFrozenset([OS_VALIDATE_PARAMETERS])
514 # External Storage (ES) related constants
515 ES_ACTION_CREATE = "create"
516 ES_ACTION_REMOVE = "remove"
517 ES_ACTION_GROW = "grow"
518 ES_ACTION_ATTACH = "attach"
519 ES_ACTION_DETACH = "detach"
520 ES_ACTION_SETINFO = "setinfo"
521 ES_ACTION_VERIFY = "verify"
523 ES_SCRIPT_CREATE = ES_ACTION_CREATE
524 ES_SCRIPT_REMOVE = ES_ACTION_REMOVE
525 ES_SCRIPT_GROW = ES_ACTION_GROW
526 ES_SCRIPT_ATTACH = ES_ACTION_ATTACH
527 ES_SCRIPT_DETACH = ES_ACTION_DETACH
528 ES_SCRIPT_SETINFO = ES_ACTION_SETINFO
529 ES_SCRIPT_VERIFY = ES_ACTION_VERIFY
530 ES_SCRIPTS = frozenset([
540 ES_PARAMETERS_FILE = "parameters.list"
543 INSTANCE_REBOOT_SOFT = _constants.INSTANCE_REBOOT_SOFT
544 INSTANCE_REBOOT_HARD = _constants.INSTANCE_REBOOT_HARD
545 INSTANCE_REBOOT_FULL = _constants.INSTANCE_REBOOT_FULL
546 REBOOT_TYPES = _constants.REBOOT_TYPES
548 # instance reboot behaviors
549 INSTANCE_REBOOT_ALLOWED = "reboot"
550 INSTANCE_REBOOT_EXIT = "exit"
552 REBOOT_BEHAVIORS = compat.UniqueFrozenset([
553 INSTANCE_REBOOT_ALLOWED,
554 INSTANCE_REBOOT_EXIT,
557 VTYPE_STRING = _constants.VTYPE_STRING
558 VTYPE_MAYBE_STRING = _constants.VTYPE_MAYBE_STRING
559 VTYPE_BOOL = _constants.VTYPE_BOOL
560 VTYPE_SIZE = _constants.VTYPE_SIZE
561 VTYPE_INT = _constants.VTYPE_INT
562 ENFORCEABLE_TYPES = _constants.ENFORCEABLE_TYPES
564 # Constant representing that the user does not specify any IP version
565 IFACE_NO_IP_VERSION_SPECIFIED = 0
567 VALID_SERIAL_SPEEDS = compat.UniqueFrozenset([
588 # HV parameter names (global namespace)
589 HV_BOOT_ORDER = "boot_order"
590 HV_CDROM_IMAGE_PATH = "cdrom_image_path"
591 HV_KVM_CDROM2_IMAGE_PATH = "cdrom2_image_path"
592 HV_KVM_FLOPPY_IMAGE_PATH = "floppy_image_path"
593 HV_NIC_TYPE = "nic_type"
594 HV_DISK_TYPE = "disk_type"
595 HV_KVM_CDROM_DISK_TYPE = "cdrom_disk_type"
596 HV_VNC_BIND_ADDRESS = "vnc_bind_address"
597 HV_VNC_PASSWORD_FILE = "vnc_password_file"
598 HV_VNC_TLS = "vnc_tls"
599 HV_VNC_X509 = "vnc_x509_path"
600 HV_VNC_X509_VERIFY = "vnc_x509_verify"
601 HV_KVM_SPICE_BIND = "spice_bind"
602 HV_KVM_SPICE_IP_VERSION = "spice_ip_version"
603 HV_KVM_SPICE_PASSWORD_FILE = "spice_password_file"
604 HV_KVM_SPICE_LOSSLESS_IMG_COMPR = "spice_image_compression"
605 HV_KVM_SPICE_JPEG_IMG_COMPR = "spice_jpeg_wan_compression"
606 HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR = "spice_zlib_glz_wan_compression"
607 HV_KVM_SPICE_STREAMING_VIDEO_DETECTION = "spice_streaming_video"
608 HV_KVM_SPICE_AUDIO_COMPR = "spice_playback_compression"
609 HV_KVM_SPICE_USE_TLS = "spice_use_tls"
610 HV_KVM_SPICE_TLS_CIPHERS = "spice_tls_ciphers"
611 HV_KVM_SPICE_USE_VDAGENT = "spice_use_vdagent"
614 HV_USE_BOOTLOADER = "use_bootloader"
615 HV_BOOTLOADER_ARGS = "bootloader_args"
616 HV_BOOTLOADER_PATH = "bootloader_path"
617 HV_KERNEL_ARGS = "kernel_args"
618 HV_KERNEL_PATH = "kernel_path"
619 HV_INITRD_PATH = "initrd_path"
620 HV_ROOT_PATH = "root_path"
621 HV_SERIAL_CONSOLE = "serial_console"
622 HV_SERIAL_SPEED = "serial_speed"
623 HV_USB_MOUSE = "usb_mouse"
625 HV_DEVICE_MODEL = "device_model"
626 HV_INIT_SCRIPT = "init_script"
627 HV_MIGRATION_PORT = "migration_port"
628 HV_MIGRATION_BANDWIDTH = "migration_bandwidth"
629 HV_MIGRATION_DOWNTIME = "migration_downtime"
630 HV_MIGRATION_MODE = "migration_mode"
631 HV_USE_LOCALTIME = "use_localtime"
632 HV_DISK_CACHE = "disk_cache"
633 HV_SECURITY_MODEL = "security_model"
634 HV_SECURITY_DOMAIN = "security_domain"
635 HV_KVM_FLAG = "kvm_flag"
636 HV_VHOST_NET = "vhost_net"
637 HV_KVM_USE_CHROOT = "use_chroot"
638 HV_CPU_MASK = "cpu_mask"
639 HV_MEM_PATH = "mem_path"
640 HV_PASSTHROUGH = "pci_pass"
641 HV_BLOCKDEV_PREFIX = "blockdev_prefix"
642 HV_REBOOT_BEHAVIOR = "reboot_behavior"
643 HV_CPU_TYPE = "cpu_type"
644 HV_CPU_CAP = "cpu_cap"
645 HV_CPU_WEIGHT = "cpu_weight"
646 HV_CPU_CORES = "cpu_cores"
647 HV_CPU_THREADS = "cpu_threads"
648 HV_CPU_SOCKETS = "cpu_sockets"
649 HV_SOUNDHW = "soundhw"
650 HV_USB_DEVICES = "usb_devices"
652 HV_KVM_EXTRA = "kvm_extra"
653 HV_KVM_MACHINE_VERSION = "machine_version"
654 HV_KVM_PATH = "kvm_path"
655 HV_VIF_TYPE = "vif_type"
656 HV_VIF_SCRIPT = "vif_script"
657 HV_XEN_CMD = "xen_cmd"
658 HV_XEN_CPUID = "cpuid"
659 HV_VNET_HDR = "vnet_hdr"
660 HV_VIRIDIAN = "viridian"
663 HVS_PARAMETER_TYPES = {
664 HV_KVM_PATH: VTYPE_STRING,
665 HV_BOOT_ORDER: VTYPE_STRING,
666 HV_KVM_FLOPPY_IMAGE_PATH: VTYPE_STRING,
667 HV_CDROM_IMAGE_PATH: VTYPE_STRING,
668 HV_KVM_CDROM2_IMAGE_PATH: VTYPE_STRING,
669 HV_NIC_TYPE: VTYPE_STRING,
670 HV_DISK_TYPE: VTYPE_STRING,
671 HV_KVM_CDROM_DISK_TYPE: VTYPE_STRING,
672 HV_VNC_PASSWORD_FILE: VTYPE_STRING,
673 HV_VNC_BIND_ADDRESS: VTYPE_STRING,
674 HV_VNC_TLS: VTYPE_BOOL,
675 HV_VNC_X509: VTYPE_STRING,
676 HV_VNC_X509_VERIFY: VTYPE_BOOL,
677 HV_KVM_SPICE_BIND: VTYPE_STRING,
678 HV_KVM_SPICE_IP_VERSION: VTYPE_INT,
679 HV_KVM_SPICE_PASSWORD_FILE: VTYPE_STRING,
680 HV_KVM_SPICE_LOSSLESS_IMG_COMPR: VTYPE_STRING,
681 HV_KVM_SPICE_JPEG_IMG_COMPR: VTYPE_STRING,
682 HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR: VTYPE_STRING,
683 HV_KVM_SPICE_STREAMING_VIDEO_DETECTION: VTYPE_STRING,
684 HV_KVM_SPICE_AUDIO_COMPR: VTYPE_BOOL,
685 HV_KVM_SPICE_USE_TLS: VTYPE_BOOL,
686 HV_KVM_SPICE_TLS_CIPHERS: VTYPE_STRING,
687 HV_KVM_SPICE_USE_VDAGENT: VTYPE_BOOL,
690 HV_USE_BOOTLOADER: VTYPE_BOOL,
691 HV_BOOTLOADER_PATH: VTYPE_STRING,
692 HV_BOOTLOADER_ARGS: VTYPE_STRING,
693 HV_KERNEL_PATH: VTYPE_STRING,
694 HV_KERNEL_ARGS: VTYPE_STRING,
695 HV_INITRD_PATH: VTYPE_STRING,
696 HV_ROOT_PATH: VTYPE_MAYBE_STRING,
697 HV_SERIAL_CONSOLE: VTYPE_BOOL,
698 HV_SERIAL_SPEED: VTYPE_INT,
699 HV_USB_MOUSE: VTYPE_STRING,
700 HV_KEYMAP: VTYPE_STRING,
701 HV_DEVICE_MODEL: VTYPE_STRING,
702 HV_INIT_SCRIPT: VTYPE_STRING,
703 HV_MIGRATION_PORT: VTYPE_INT,
704 HV_MIGRATION_BANDWIDTH: VTYPE_INT,
705 HV_MIGRATION_DOWNTIME: VTYPE_INT,
706 HV_MIGRATION_MODE: VTYPE_STRING,
707 HV_USE_LOCALTIME: VTYPE_BOOL,
708 HV_DISK_CACHE: VTYPE_STRING,
709 HV_SECURITY_MODEL: VTYPE_STRING,
710 HV_SECURITY_DOMAIN: VTYPE_STRING,
711 HV_KVM_FLAG: VTYPE_STRING,
712 HV_VHOST_NET: VTYPE_BOOL,
713 HV_KVM_USE_CHROOT: VTYPE_BOOL,
714 HV_CPU_MASK: VTYPE_STRING,
715 HV_MEM_PATH: VTYPE_STRING,
716 HV_PASSTHROUGH: VTYPE_STRING,
717 HV_BLOCKDEV_PREFIX: VTYPE_STRING,
718 HV_REBOOT_BEHAVIOR: VTYPE_STRING,
719 HV_CPU_TYPE: VTYPE_STRING,
720 HV_CPU_CAP: VTYPE_INT,
721 HV_CPU_WEIGHT: VTYPE_INT,
722 HV_CPU_CORES: VTYPE_INT,
723 HV_CPU_THREADS: VTYPE_INT,
724 HV_CPU_SOCKETS: VTYPE_INT,
725 HV_SOUNDHW: VTYPE_STRING,
726 HV_USB_DEVICES: VTYPE_STRING,
727 HV_VGA: VTYPE_STRING,
728 HV_KVM_EXTRA: VTYPE_STRING,
729 HV_KVM_MACHINE_VERSION: VTYPE_STRING,
730 HV_VIF_TYPE: VTYPE_STRING,
731 HV_VIF_SCRIPT: VTYPE_STRING,
732 HV_XEN_CMD: VTYPE_STRING,
733 HV_XEN_CPUID: VTYPE_STRING,
734 HV_VNET_HDR: VTYPE_BOOL,
735 HV_VIRIDIAN: VTYPE_BOOL,
738 HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
740 HVS_PARAMETER_TITLES = {
742 HV_BOOT_ORDER: "Boot_order",
743 HV_CDROM_IMAGE_PATH: "CDROM_image_path",
744 HV_DISK_TYPE: "Disk_type",
745 HV_INITRD_PATH: "Initrd_path",
746 HV_KERNEL_PATH: "Kernel_path",
747 HV_NIC_TYPE: "NIC_type",
749 HV_VNC_BIND_ADDRESS: "VNC_bind_address",
750 HV_PASSTHROUGH: "pci_pass",
751 HV_CPU_TYPE: "cpu_type",
755 HV_MIGRATION_COMPLETED = "completed"
756 HV_MIGRATION_ACTIVE = "active"
757 HV_MIGRATION_FAILED = "failed"
758 HV_MIGRATION_CANCELLED = "cancelled"
760 HV_MIGRATION_VALID_STATUSES = compat.UniqueFrozenset([
761 HV_MIGRATION_COMPLETED,
764 HV_MIGRATION_CANCELLED,
767 HV_MIGRATION_FAILED_STATUSES = compat.UniqueFrozenset([
769 HV_MIGRATION_CANCELLED,
772 # KVM-specific statuses
773 HV_KVM_MIGRATION_VALID_STATUSES = HV_MIGRATION_VALID_STATUSES
776 HV_NODEINFO_KEY_VERSION = "hv_version"
779 HVST_MEMORY_TOTAL = "mem_total"
780 HVST_MEMORY_NODE = "mem_node"
781 HVST_MEMORY_HV = "mem_hv"
782 HVST_CPU_TOTAL = "cpu_total"
783 HVST_CPU_NODE = "cpu_node"
786 HVST_MEMORY_TOTAL: 0,
793 HVSTS_PARAMETER_TYPES = {
794 HVST_MEMORY_TOTAL: VTYPE_INT,
795 HVST_MEMORY_NODE: VTYPE_INT,
796 HVST_MEMORY_HV: VTYPE_INT,
797 HVST_CPU_TOTAL: VTYPE_INT,
798 HVST_CPU_NODE: VTYPE_INT,
801 HVSTS_PARAMETERS = frozenset(HVSTS_PARAMETER_TYPES.keys())
804 DS_DISK_TOTAL = "disk_total"
805 DS_DISK_RESERVED = "disk_reserved"
806 DS_DISK_OVERHEAD = "disk_overhead"
814 ISPEC_MEM_SIZE = _constants.ISPEC_MEM_SIZE
815 ISPEC_CPU_COUNT = _constants.ISPEC_CPU_COUNT
816 ISPEC_DISK_COUNT = _constants.ISPEC_DISK_COUNT
817 ISPEC_DISK_SIZE = _constants.ISPEC_DISK_SIZE
818 ISPEC_NIC_COUNT = _constants.ISPEC_NIC_COUNT
819 ISPEC_SPINDLE_USE = _constants.ISPEC_SPINDLE_USE
820 ISPECS_PARAMETER_TYPES = _constants.ISPECS_PARAMETER_TYPES
821 ISPECS_PARAMETERS = _constants.ISPECS_PARAMETERS
823 ISPECS_MINMAX = _constants.ISPECS_MINMAX
824 ISPECS_MIN = _constants.ISPECS_MIN
825 ISPECS_MAX = _constants.ISPECS_MAX
826 ISPECS_STD = _constants.ISPECS_STD
827 IPOLICY_DTS = _constants.IPOLICY_DTS
828 IPOLICY_VCPU_RATIO = _constants.IPOLICY_VCPU_RATIO
829 IPOLICY_SPINDLE_RATIO = _constants.IPOLICY_SPINDLE_RATIO
830 ISPECS_MINMAX_KEYS = _constants.ISPECS_MINMAX_KEYS
831 IPOLICY_PARAMETERS = _constants.IPOLICY_PARAMETERS
832 IPOLICY_ALL_KEYS = _constants.IPOLICY_ALL_KEYS
834 ND_OOB_PROGRAM = _constants.ND_OOB_PROGRAM
835 ND_SPINDLE_COUNT = _constants.ND_SPINDLE_COUNT
836 ND_EXCLUSIVE_STORAGE = _constants.ND_EXCLUSIVE_STORAGE
837 ND_OVS = _constants.ND_OVS
838 ND_OVS_NAME = _constants.ND_OVS_NAME
839 ND_OVS_LINK = _constants.ND_OVS_LINK
841 NDS_PARAMETER_TYPES = _constants.NDS_PARAMETER_TYPES
842 NDS_PARAMETERS = _constants.NDS_PARAMETERS
843 NDS_PARAMETER_TITLES = _constants.NDS_PARAMETER_TITLES
844 DSS_PARAMETER_TYPES = {
845 DS_DISK_TOTAL: VTYPE_INT,
846 DS_DISK_RESERVED: VTYPE_INT,
847 DS_DISK_OVERHEAD: VTYPE_INT,
850 DSS_PARAMETERS = frozenset(DSS_PARAMETER_TYPES.keys())
851 DS_VALID_TYPES = compat.UniqueFrozenset([DT_PLAIN])
853 # Backend parameter names
854 BE_MEMORY = "memory" # deprecated and replaced by max and min mem
858 BE_AUTO_BALANCE = "auto_balance"
859 BE_ALWAYS_FAILOVER = "always_failover"
860 BE_SPINDLE_USE = "spindle_use"
862 BES_PARAMETER_TYPES = {
863 BE_MAXMEM: VTYPE_SIZE,
864 BE_MINMEM: VTYPE_SIZE,
866 BE_AUTO_BALANCE: VTYPE_BOOL,
867 BE_ALWAYS_FAILOVER: VTYPE_BOOL,
868 BE_SPINDLE_USE: VTYPE_INT,
871 BES_PARAMETER_TITLES = {
872 BE_AUTO_BALANCE: "Auto_balance",
873 BE_MAXMEM: "ConfigMaxMem",
874 BE_MINMEM: "ConfigMinMem",
875 BE_VCPUS: "ConfigVCPUs",
878 BES_PARAMETER_COMPAT = {
879 BE_MEMORY: VTYPE_SIZE,
881 BES_PARAMETER_COMPAT.update(BES_PARAMETER_TYPES)
883 BES_PARAMETERS = frozenset(BES_PARAMETER_TYPES.keys())
885 # Logical Disks parameters
886 LDP_RESYNC_RATE = "resync-rate"
887 LDP_STRIPES = "stripes"
888 LDP_BARRIERS = "disabled-barriers"
889 LDP_NO_META_FLUSH = "disable-meta-flush"
890 LDP_DEFAULT_METAVG = "default-metavg"
891 LDP_DISK_CUSTOM = "disk-custom"
892 LDP_NET_CUSTOM = "net-custom"
893 LDP_PROTOCOL = "protocol"
894 LDP_DYNAMIC_RESYNC = "dynamic-resync"
895 LDP_PLAN_AHEAD = "c-plan-ahead"
896 LDP_FILL_TARGET = "c-fill-target"
897 LDP_DELAY_TARGET = "c-delay-target"
898 LDP_MAX_RATE = "c-max-rate"
899 LDP_MIN_RATE = "c-min-rate"
901 LDP_ACCESS = "access"
903 LDP_RESYNC_RATE: VTYPE_INT,
904 LDP_STRIPES: VTYPE_INT,
905 LDP_BARRIERS: VTYPE_STRING,
906 LDP_NO_META_FLUSH: VTYPE_BOOL,
907 LDP_DEFAULT_METAVG: VTYPE_STRING,
908 LDP_DISK_CUSTOM: VTYPE_STRING,
909 LDP_NET_CUSTOM: VTYPE_STRING,
910 LDP_PROTOCOL: VTYPE_STRING,
911 LDP_DYNAMIC_RESYNC: VTYPE_BOOL,
912 LDP_PLAN_AHEAD: VTYPE_INT,
913 LDP_FILL_TARGET: VTYPE_INT,
914 LDP_DELAY_TARGET: VTYPE_INT,
915 LDP_MAX_RATE: VTYPE_INT,
916 LDP_MIN_RATE: VTYPE_INT,
917 LDP_POOL: VTYPE_STRING,
918 LDP_ACCESS: VTYPE_STRING,
920 DISK_LD_PARAMETERS = frozenset(DISK_LD_TYPES.keys())
922 # Disk template parameters (can be set/changed by the user via gnt-cluster and
924 DRBD_RESYNC_RATE = "resync-rate"
925 DRBD_DATA_STRIPES = "data-stripes"
926 DRBD_META_STRIPES = "meta-stripes"
927 DRBD_DISK_BARRIERS = "disk-barriers"
928 DRBD_META_BARRIERS = "meta-barriers"
929 DRBD_DEFAULT_METAVG = "metavg"
930 DRBD_DISK_CUSTOM = "disk-custom"
931 DRBD_NET_CUSTOM = "net-custom"
932 DRBD_PROTOCOL = "protocol"
933 DRBD_DYNAMIC_RESYNC = "dynamic-resync"
934 DRBD_PLAN_AHEAD = "c-plan-ahead"
935 DRBD_FILL_TARGET = "c-fill-target"
936 DRBD_DELAY_TARGET = "c-delay-target"
937 DRBD_MAX_RATE = "c-max-rate"
938 DRBD_MIN_RATE = "c-min-rate"
939 LV_STRIPES = "stripes"
941 RBD_ACCESS = "access"
943 DRBD_RESYNC_RATE: VTYPE_INT,
944 DRBD_DATA_STRIPES: VTYPE_INT,
945 DRBD_META_STRIPES: VTYPE_INT,
946 DRBD_DISK_BARRIERS: VTYPE_STRING,
947 DRBD_META_BARRIERS: VTYPE_BOOL,
948 DRBD_DEFAULT_METAVG: VTYPE_STRING,
949 DRBD_DISK_CUSTOM: VTYPE_STRING,
950 DRBD_NET_CUSTOM: VTYPE_STRING,
951 DRBD_PROTOCOL: VTYPE_STRING,
952 DRBD_DYNAMIC_RESYNC: VTYPE_BOOL,
953 DRBD_PLAN_AHEAD: VTYPE_INT,
954 DRBD_FILL_TARGET: VTYPE_INT,
955 DRBD_DELAY_TARGET: VTYPE_INT,
956 DRBD_MAX_RATE: VTYPE_INT,
957 DRBD_MIN_RATE: VTYPE_INT,
958 LV_STRIPES: VTYPE_INT,
959 RBD_POOL: VTYPE_STRING,
960 RBD_ACCESS: VTYPE_STRING,
963 DISK_DT_PARAMETERS = frozenset(DISK_DT_TYPES.keys())
965 # dynamic disk parameters
966 DDP_LOCAL_IP = "local-ip"
967 DDP_REMOTE_IP = "remote-ip"
969 DDP_LOCAL_MINOR = "local-minor"
970 DDP_REMOTE_MINOR = "remote-minor"
972 # OOB supported commands
973 OOB_POWER_ON = _constants.OOB_POWER_ON
974 OOB_POWER_OFF = _constants.OOB_POWER_OFF
975 OOB_POWER_CYCLE = _constants.OOB_POWER_CYCLE
976 OOB_POWER_STATUS = _constants.OOB_POWER_STATUS
977 OOB_HEALTH = _constants.OOB_HEALTH
978 OOB_COMMANDS = _constants.OOB_COMMANDS
980 OOB_POWER_STATUS_POWERED = _constants.OOB_POWER_STATUS_POWERED
982 OOB_TIMEOUT = _constants.OOB_TIMEOUT
983 OOB_POWER_DELAY = _constants.OOB_POWER_DELAY
985 OOB_STATUS_OK = _constants.OOB_STATUS_OK
986 OOB_STATUS_WARNING = _constants.OOB_STATUS_WARNING
987 OOB_STATUS_CRITICAL = _constants.OOB_STATUS_CRITICAL
988 OOB_STATUS_UNKNOWN = _constants.OOB_STATUS_UNKNOWN
989 OOB_STATUSES = _constants.OOB_STATUSES
991 # Instance Parameters Profile
992 PP_DEFAULT = "default"
994 # NIC_* constants are used inside the ganeti config
995 NIC_MODE = _constants.NIC_MODE
996 NIC_LINK = _constants.NIC_LINK
997 NIC_VLAN = _constants.NIC_VLAN
999 NIC_MODE_BRIDGED = _constants.NIC_MODE_BRIDGED
1000 NIC_MODE_ROUTED = _constants.NIC_MODE_ROUTED
1001 NIC_MODE_OVS = _constants.NIC_MODE_OVS
1002 NIC_IP_POOL = _constants.NIC_IP_POOL
1003 NIC_VALID_MODES = _constants.NIC_VALID_MODES
1005 RESERVE_ACTION = "reserve"
1006 RELEASE_ACTION = "release"
1008 NICS_PARAMETER_TYPES = {
1009 NIC_MODE: VTYPE_STRING,
1010 NIC_LINK: VTYPE_STRING,
1011 NIC_VLAN: VTYPE_MAYBE_STRING,
1014 NICS_PARAMETERS = frozenset(NICS_PARAMETER_TYPES.keys())
1016 # IDISK_* constants are used in opcodes, to create/change disks
1018 IDISK_SPINDLES = "spindles"
1020 IDISK_ADOPT = "adopt"
1022 IDISK_METAVG = "metavg"
1023 IDISK_PROVIDER = "provider"
1025 IDISK_PARAMS_TYPES = {
1026 IDISK_SIZE: VTYPE_SIZE,
1027 IDISK_SPINDLES: VTYPE_INT,
1028 IDISK_MODE: VTYPE_STRING,
1029 IDISK_ADOPT: VTYPE_STRING,
1030 IDISK_VG: VTYPE_STRING,
1031 IDISK_METAVG: VTYPE_STRING,
1032 IDISK_PROVIDER: VTYPE_STRING,
1033 IDISK_NAME: VTYPE_MAYBE_STRING,
1035 IDISK_PARAMS = frozenset(IDISK_PARAMS_TYPES.keys())
1037 # INIC_* constants are used in opcodes, to create/change nics
1042 INIC_NETWORK = "network"
1045 INIC_BRIDGE = "bridge"
1046 INIC_PARAMS_TYPES = {
1047 INIC_IP: VTYPE_MAYBE_STRING,
1048 INIC_LINK: VTYPE_STRING,
1049 INIC_MAC: VTYPE_STRING,
1050 INIC_MODE: VTYPE_STRING,
1051 INIC_NETWORK: VTYPE_MAYBE_STRING,
1052 INIC_NAME: VTYPE_MAYBE_STRING,
1053 INIC_VLAN: VTYPE_MAYBE_STRING,
1054 INIC_BRIDGE: VTYPE_MAYBE_STRING
1056 INIC_PARAMS = frozenset(INIC_PARAMS_TYPES.keys())
1058 # Hypervisor constants
1059 HT_XEN_PVM = _constants.HT_XEN_PVM
1060 HT_FAKE = _constants.HT_FAKE
1061 HT_XEN_HVM = _constants.HT_XEN_HVM
1062 HT_KVM = _constants.HT_KVM
1063 HT_CHROOT = _constants.HT_CHROOT
1064 HT_LXC = _constants.HT_LXC
1065 HYPER_TYPES = _constants.HYPER_TYPES
1066 HTS_REQ_PORT = _constants.HTS_REQ_PORT
1068 VNC_BASE_PORT = 5900
1069 VNC_DEFAULT_BIND_ADDRESS = IP4_ADDRESS_ANY
1072 HT_NIC_RTL8139 = "rtl8139"
1073 HT_NIC_NE2K_PCI = "ne2k_pci"
1074 HT_NIC_NE2K_ISA = "ne2k_isa"
1075 HT_NIC_I82551 = "i82551"
1076 HT_NIC_I85557B = "i82557b"
1077 HT_NIC_I8259ER = "i82559er"
1078 HT_NIC_PCNET = "pcnet"
1079 HT_NIC_E1000 = "e1000"
1080 HT_NIC_PARAVIRTUAL = HT_DISK_PARAVIRTUAL = "paravirtual"
1082 HT_HVM_VALID_NIC_TYPES = compat.UniqueFrozenset([
1089 HT_KVM_VALID_NIC_TYPES = compat.UniqueFrozenset([
1102 # default vif type in xen-hvm
1103 HT_HVM_VIF_IOEMU = "ioemu"
1104 HT_HVM_VIF_VIF = "vif"
1105 HT_HVM_VALID_VIF_TYPES = compat.UniqueFrozenset([
1111 HT_DISK_IOEMU = "ioemu"
1113 HT_DISK_SCSI = "scsi"
1116 HT_DISK_PFLASH = "pflash"
1118 HT_CACHE_DEFAULT = "default"
1119 HT_CACHE_NONE = "none"
1120 HT_CACHE_WTHROUGH = "writethrough"
1121 HT_CACHE_WBACK = "writeback"
1122 HT_VALID_CACHE_TYPES = compat.UniqueFrozenset([
1129 HT_HVM_VALID_DISK_TYPES = compat.UniqueFrozenset([
1130 HT_DISK_PARAVIRTUAL,
1133 HT_KVM_VALID_DISK_TYPES = compat.UniqueFrozenset([
1134 HT_DISK_PARAVIRTUAL,
1143 HT_MOUSE_MOUSE = "mouse"
1144 HT_MOUSE_TABLET = "tablet"
1146 HT_KVM_VALID_MOUSE_TYPES = compat.UniqueFrozenset([
1152 HT_BO_FLOPPY = "floppy"
1153 HT_BO_CDROM = "cdrom"
1155 HT_BO_NETWORK = "network"
1157 HT_KVM_VALID_BO_TYPES = compat.UniqueFrozenset([
1164 # SPICE lossless image compression options
1165 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_GLZ = "auto_glz"
1166 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_LZ = "auto_lz"
1167 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_QUIC = "quic"
1168 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_GLZ = "glz"
1169 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_LZ = "lz"
1170 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_OFF = "off"
1172 HT_KVM_SPICE_VALID_LOSSLESS_IMG_COMPR_OPTIONS = compat.UniqueFrozenset([
1173 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_GLZ,
1174 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_LZ,
1175 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_QUIC,
1176 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_GLZ,
1177 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_LZ,
1178 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_OFF,
1181 # SPICE lossy image compression options (valid for both jpeg and zlib-glz)
1182 HT_KVM_SPICE_LOSSY_IMG_COMPR_AUTO = "auto"
1183 HT_KVM_SPICE_LOSSY_IMG_COMPR_NEVER = "never"
1184 HT_KVM_SPICE_LOSSY_IMG_COMPR_ALWAYS = "always"
1186 HT_KVM_SPICE_VALID_LOSSY_IMG_COMPR_OPTIONS = compat.UniqueFrozenset([
1187 HT_KVM_SPICE_LOSSY_IMG_COMPR_AUTO,
1188 HT_KVM_SPICE_LOSSY_IMG_COMPR_NEVER,
1189 HT_KVM_SPICE_LOSSY_IMG_COMPR_ALWAYS,
1192 # SPICE video stream detection
1193 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_OFF = "off"
1194 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_ALL = "all"
1195 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_FILTER = "filter"
1197 HT_KVM_SPICE_VALID_VIDEO_STREAM_DETECTION_OPTIONS = compat.UniqueFrozenset([
1198 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_OFF,
1199 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_ALL,
1200 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_FILTER,
1208 HT_KVM_VALID_SM_TYPES = compat.UniqueFrozenset([
1215 HT_KVM_ENABLED = "enabled"
1216 HT_KVM_DISABLED = "disabled"
1218 HT_KVM_FLAG_VALUES = compat.UniqueFrozenset([HT_KVM_ENABLED, HT_KVM_DISABLED])
1221 HT_MIGRATION_LIVE = _constants.HT_MIGRATION_LIVE
1222 HT_MIGRATION_NONLIVE = _constants.HT_MIGRATION_NONLIVE
1223 HT_MIGRATION_MODES = _constants.HT_MIGRATION_MODES
1225 # Cluster Verify steps
1226 VERIFY_NPLUSONE_MEM = _constants.VERIFY_NPLUSONE_MEM
1227 VERIFY_OPTIONAL_CHECKS = _constants.VERIFY_OPTIONAL_CHECKS
1229 # Cluster Verify error classes
1230 CV_TCLUSTER = _constants.CV_TCLUSTER
1231 CV_TGROUP = _constants.CV_TGROUP
1232 CV_TNODE = _constants.CV_TNODE
1233 CV_TINSTANCE = _constants.CV_TINSTANCE
1235 # Cluster Verify error codes and documentation
1236 CV_ECLUSTERCFG = _constants.CV_ECLUSTERCFG
1237 CV_ECLUSTERCERT = _constants.CV_ECLUSTERCERT
1238 CV_ECLUSTERFILECHECK = _constants.CV_ECLUSTERFILECHECK
1239 CV_ECLUSTERDANGLINGNODES = _constants.CV_ECLUSTERDANGLINGNODES
1240 CV_ECLUSTERDANGLINGINST = _constants.CV_ECLUSTERDANGLINGINST
1241 CV_EGROUPDIFFERENTPVSIZE = _constants.CV_EGROUPDIFFERENTPVSIZE
1242 CV_EINSTANCEBADNODE = _constants.CV_EINSTANCEBADNODE
1243 CV_EINSTANCEDOWN = _constants.CV_EINSTANCEDOWN
1244 CV_EINSTANCELAYOUT = _constants.CV_EINSTANCELAYOUT
1245 CV_EINSTANCEMISSINGDISK = _constants.CV_EINSTANCEMISSINGDISK
1246 CV_EINSTANCEFAULTYDISK = _constants.CV_EINSTANCEFAULTYDISK
1247 CV_EINSTANCEWRONGNODE = _constants.CV_EINSTANCEWRONGNODE
1248 CV_EINSTANCESPLITGROUPS = _constants.CV_EINSTANCESPLITGROUPS
1249 CV_EINSTANCEPOLICY = _constants.CV_EINSTANCEPOLICY
1250 CV_EINSTANCEUNSUITABLENODE = _constants.CV_EINSTANCEUNSUITABLENODE
1251 CV_EINSTANCEMISSINGCFGPARAMETER = _constants.CV_EINSTANCEMISSINGCFGPARAMETER
1252 CV_ENODEDRBD = _constants.CV_ENODEDRBD
1253 CV_ENODEDRBDVERSION = _constants.CV_ENODEDRBDVERSION
1254 CV_ENODEDRBDHELPER = _constants.CV_ENODEDRBDHELPER
1255 CV_ENODEFILECHECK = _constants.CV_ENODEFILECHECK
1256 CV_ENODEHOOKS = _constants.CV_ENODEHOOKS
1257 CV_ENODEHV = _constants.CV_ENODEHV
1258 CV_ENODELVM = _constants.CV_ENODELVM
1259 CV_ENODEN1 = _constants.CV_ENODEN1
1260 CV_ENODENET = _constants.CV_ENODENET
1261 CV_ENODEOS = _constants.CV_ENODEOS
1262 CV_ENODEORPHANINSTANCE = _constants.CV_ENODEORPHANINSTANCE
1263 CV_ENODEORPHANLV = _constants.CV_ENODEORPHANLV
1264 CV_ENODERPC = _constants.CV_ENODERPC
1265 CV_ENODESSH = _constants.CV_ENODESSH
1266 CV_ENODEVERSION = _constants.CV_ENODEVERSION
1267 CV_ENODESETUP = _constants.CV_ENODESETUP
1268 CV_ENODETIME = _constants.CV_ENODETIME
1269 CV_ENODEOOBPATH = _constants.CV_ENODEOOBPATH
1270 CV_ENODEUSERSCRIPTS = _constants.CV_ENODEUSERSCRIPTS
1271 CV_ENODEFILESTORAGEPATHS = _constants.CV_ENODEFILESTORAGEPATHS
1272 CV_ENODEFILESTORAGEPATHUNUSABLE = _constants.CV_ENODEFILESTORAGEPATHUNUSABLE
1273 CV_ENODESHAREDFILESTORAGEPATHUNUSABLE = \
1274 _constants.CV_ENODESHAREDFILESTORAGEPATHUNUSABLE
1276 CV_ALL_ECODES = _constants.CV_ALL_ECODES
1277 CV_ALL_ECODES_STRINGS = _constants.CV_ALL_ECODES_STRINGS
1279 # Node verify constants
1280 NV_BRIDGES = "bridges"
1281 NV_DRBDHELPER = "drbd-helper"
1282 NV_DRBDVERSION = "drbd-version"
1283 NV_DRBDLIST = "drbd-list"
1284 NV_EXCLUSIVEPVS = "exclusive-pvs"
1285 NV_FILELIST = "filelist"
1286 NV_ACCEPTED_STORAGE_PATHS = "allowed-file-storage-paths"
1287 NV_FILE_STORAGE_PATH = "file-storage-path"
1288 NV_SHARED_FILE_STORAGE_PATH = "shared-file-storage-path"
1289 NV_HVINFO = "hvinfo"
1290 NV_HVPARAMS = "hvparms"
1291 NV_HYPERVISOR = "hypervisor"
1292 NV_INSTANCELIST = "instancelist"
1293 NV_LVLIST = "lvlist"
1294 NV_MASTERIP = "master-ip"
1295 NV_NODELIST = "nodelist"
1296 NV_NODENETTEST = "node-net-test"
1297 NV_NODESETUP = "nodesetup"
1298 NV_OOB_PATHS = "oob-paths"
1299 NV_OSLIST = "oslist"
1300 NV_PVLIST = "pvlist"
1302 NV_USERSCRIPTS = "user-scripts"
1303 NV_VERSION = "version"
1304 NV_VGLIST = "vglist"
1305 NV_VMNODES = "vmnodes"
1308 INSTST_RUNNING = _constants.INSTST_RUNNING
1309 INSTST_ADMINDOWN = _constants.INSTST_ADMINDOWN
1310 INSTST_ADMINOFFLINE = _constants.INSTST_ADMINOFFLINE
1311 INSTST_NODEOFFLINE = _constants.INSTST_NODEOFFLINE
1312 INSTST_NODEDOWN = _constants.INSTST_NODEDOWN
1313 INSTST_WRONGNODE = _constants.INSTST_WRONGNODE
1314 INSTST_ERRORUP = _constants.INSTST_ERRORUP
1315 INSTST_ERRORDOWN = _constants.INSTST_ERRORDOWN
1316 INSTST_ALL = _constants.INSTST_ALL
1319 ADMINST_UP = _constants.ADMINST_UP
1320 ADMINST_DOWN = _constants.ADMINST_DOWN
1321 ADMINST_OFFLINE = _constants.ADMINST_OFFLINE
1322 ADMINST_ALL = _constants.ADMINST_ALL
1325 NR_REGULAR = _constants.NR_REGULAR
1326 NR_MASTER = _constants.NR_MASTER
1327 NR_MCANDIDATE = _constants.NR_MCANDIDATE
1328 NR_DRAINED = _constants.NR_DRAINED
1329 NR_OFFLINE = _constants.NR_OFFLINE
1330 NR_ALL = _constants.NR_ALL
1332 # SSL certificate check constants (in days)
1333 SSL_CERT_EXPIRATION_WARN = 30
1334 SSL_CERT_EXPIRATION_ERROR = 7
1336 # Allocator framework constants
1337 IALLOCATOR_VERSION = _constants.IALLOCATOR_VERSION
1338 IALLOCATOR_DIR_IN = _constants.IALLOCATOR_DIR_IN
1339 IALLOCATOR_DIR_OUT = _constants.IALLOCATOR_DIR_OUT
1340 VALID_IALLOCATOR_DIRECTIONS = _constants.VALID_IALLOCATOR_DIRECTIONS
1342 IALLOCATOR_MODE_ALLOC = _constants.IALLOCATOR_MODE_ALLOC
1343 IALLOCATOR_MODE_RELOC = _constants.IALLOCATOR_MODE_RELOC
1344 IALLOCATOR_MODE_CHG_GROUP = _constants.IALLOCATOR_MODE_CHG_GROUP
1345 IALLOCATOR_MODE_NODE_EVAC = _constants.IALLOCATOR_MODE_NODE_EVAC
1346 IALLOCATOR_MODE_MULTI_ALLOC = _constants.IALLOCATOR_MODE_MULTI_ALLOC
1347 VALID_IALLOCATOR_MODES = _constants.VALID_IALLOCATOR_MODES
1349 IALLOCATOR_SEARCH_PATH = _constants.IALLOCATOR_SEARCH_PATH
1350 DEFAULT_IALLOCATOR_SHORTCUT = _constants.DEFAULT_IALLOCATOR_SHORTCUT
1353 NODE_EVAC_PRI = _constants.NODE_EVAC_PRI
1354 NODE_EVAC_SEC = _constants.NODE_EVAC_SEC
1355 NODE_EVAC_ALL = _constants.NODE_EVAC_ALL
1356 NODE_EVAC_MODES = _constants.NODE_EVAC_MODES
1359 JOB_QUEUE_VERSION = 1
1360 JOB_QUEUE_SIZE_HARD_LIMIT = 5000
1361 JOB_QUEUE_FILES_PERMS = 0640
1363 JOB_ID_TEMPLATE = r"\d+"
1364 JOB_FILE_RE = re.compile(r"^job-(%s)$" % JOB_ID_TEMPLATE)
1366 # unchanged job return
1367 JOB_NOTCHANGED = "nochange"
1370 JOB_STATUS_QUEUED = _constants.JOB_STATUS_QUEUED
1371 JOB_STATUS_WAITING = _constants.JOB_STATUS_WAITING
1372 JOB_STATUS_CANCELING = _constants.JOB_STATUS_CANCELING
1373 JOB_STATUS_RUNNING = _constants.JOB_STATUS_RUNNING
1374 JOB_STATUS_CANCELED = _constants.JOB_STATUS_CANCELED
1375 JOB_STATUS_SUCCESS = _constants.JOB_STATUS_SUCCESS
1376 JOB_STATUS_ERROR = _constants.JOB_STATUS_ERROR
1377 JOBS_PENDING = _constants.JOBS_PENDING
1378 JOBS_FINALIZED = _constants.JOBS_FINALIZED
1379 JOB_STATUS_ALL = _constants.JOB_STATUS_ALL
1383 OP_STATUS_QUEUED = _constants.OP_STATUS_QUEUED
1384 OP_STATUS_WAITING = _constants.OP_STATUS_WAITING
1385 OP_STATUS_CANCELING = _constants.OP_STATUS_CANCELING
1386 OP_STATUS_RUNNING = _constants.OP_STATUS_RUNNING
1388 OP_STATUS_CANCELED = _constants.OP_STATUS_CANCELED
1389 OP_STATUS_SUCCESS = _constants.OP_STATUS_SUCCESS
1390 OP_STATUS_ERROR = _constants.OP_STATUS_ERROR
1391 OPS_FINALIZED = _constants.OPS_FINALIZED
1394 OP_PRIO_LOWEST = _constants.OP_PRIO_LOWEST
1395 OP_PRIO_HIGHEST = _constants.OP_PRIO_HIGHEST
1396 OP_PRIO_LOW = _constants.OP_PRIO_LOW
1397 OP_PRIO_NORMAL = _constants.OP_PRIO_NORMAL
1398 OP_PRIO_HIGH = _constants.OP_PRIO_HIGH
1399 OP_PRIO_SUBMIT_VALID = _constants.OP_PRIO_SUBMIT_VALID
1400 OP_PRIO_DEFAULT = _constants.OP_PRIO_DEFAULT
1402 # Lock recalculate mode
1403 LOCKS_REPLACE = "replace"
1404 LOCKS_APPEND = "append"
1406 # Lock timeout (sum) before we should go into blocking acquire (still
1407 # can be reset by priority change); computed as max time (10 hours)
1408 # before we should actually go into blocking acquire given that we
1409 # start from default priority level; in seconds
1411 LOCK_ATTEMPTS_TIMEOUT = 10 * 3600 / (OP_PRIO_DEFAULT - OP_PRIO_HIGHEST)
1412 LOCK_ATTEMPTS_MAXWAIT = 15.0
1413 LOCK_ATTEMPTS_MINWAIT = 1.0
1415 # Execution log types
1416 ELOG_MESSAGE = _constants.ELOG_MESSAGE
1417 ELOG_REMOTE_IMPORT = _constants.ELOG_REMOTE_IMPORT
1418 ELOG_JQUEUE_TEST = _constants.ELOG_JQUEUE_TEST
1420 # /etc/hosts modification
1421 ETC_HOSTS_ADD = "add"
1422 ETC_HOSTS_REMOVE = "remove"
1425 JQT_MSGPREFIX = "TESTMSG="
1426 JQT_EXPANDNAMES = "expandnames"
1428 JQT_LOGMSG = "logmsg"
1429 JQT_STARTMSG = "startmsg"
1430 JQT_ALL = compat.UniqueFrozenset([
1438 QR_CLUSTER = "cluster"
1439 QR_INSTANCE = "instance"
1445 QR_EXPORT = "export"
1446 QR_NETWORK = "network"
1447 QR_EXTSTORAGE = "extstorage"
1449 #: List of resources which can be queried using L{opcodes.OpQuery}
1450 QR_VIA_OP = compat.UniqueFrozenset([
1461 #: List of resources which can be queried using Local UniX Interface
1462 QR_VIA_LUXI = QR_VIA_OP.union([
1467 #: List of resources which can be queried using RAPI
1468 QR_VIA_RAPI = QR_VIA_LUXI
1471 QFT_UNKNOWN = "unknown"
1474 QFT_NUMBER = "number"
1476 QFT_TIMESTAMP = "timestamp"
1479 #: All query field types
1480 QFT_ALL = compat.UniqueFrozenset([
1490 # Query result field status (don't change or reuse values as they're used by
1492 #: Normal field status
1496 #: No data (e.g. RPC error), can be used instead of L{RS_OFFLINE}
1498 #: Value unavailable/unsupported for item; if this field is supported
1499 #: but we cannot get the data for the moment, RS_NODATA or
1500 #: RS_OFFLINE should be used
1502 #: Resource marked offline
1505 RS_ALL = compat.UniqueFrozenset([
1513 #: Dictionary with special field cases and their verbose/terse formatting
1515 RS_UNKNOWN: ("(unknown)", "??"),
1516 RS_NODATA: ("(nodata)", "?"),
1517 RS_OFFLINE: ("(offline)", "*"),
1518 RS_UNAVAIL: ("(unavail)", "-"),
1521 # max dynamic devices
1525 # SSCONF file prefix
1526 SSCONF_FILEPREFIX = "ssconf_"
1528 SS_CLUSTER_NAME = "cluster_name"
1529 SS_CLUSTER_TAGS = "cluster_tags"
1530 SS_FILE_STORAGE_DIR = "file_storage_dir"
1531 SS_SHARED_FILE_STORAGE_DIR = "shared_file_storage_dir"
1532 SS_MASTER_CANDIDATES = "master_candidates"
1533 SS_MASTER_CANDIDATES_IPS = "master_candidates_ips"
1534 SS_MASTER_IP = "master_ip"
1535 SS_MASTER_NETDEV = "master_netdev"
1536 SS_MASTER_NETMASK = "master_netmask"
1537 SS_MASTER_NODE = "master_node"
1538 SS_NODE_LIST = "node_list"
1539 SS_NODE_PRIMARY_IPS = "node_primary_ips"
1540 SS_NODE_SECONDARY_IPS = "node_secondary_ips"
1541 SS_OFFLINE_NODES = "offline_nodes"
1542 SS_ONLINE_NODES = "online_nodes"
1543 SS_PRIMARY_IP_FAMILY = "primary_ip_family"
1544 SS_INSTANCE_LIST = "instance_list"
1545 SS_RELEASE_VERSION = "release_version"
1546 SS_HYPERVISOR_LIST = "hypervisor_list"
1547 SS_MAINTAIN_NODE_HEALTH = "maintain_node_health"
1548 SS_UID_POOL = "uid_pool"
1549 SS_NODEGROUPS = "nodegroups"
1550 SS_NETWORKS = "networks"
1552 # This is not a complete SSCONF key, but the prefix for the hypervisor keys
1553 SS_HVPARAMS_PREF = "hvparams_"
1556 SS_HVPARAMS_XEN_PVM = SS_HVPARAMS_PREF + HT_XEN_PVM
1557 SS_HVPARAMS_XEN_FAKE = SS_HVPARAMS_PREF + HT_FAKE
1558 SS_HVPARAMS_XEN_HVM = SS_HVPARAMS_PREF + HT_XEN_HVM
1559 SS_HVPARAMS_XEN_KVM = SS_HVPARAMS_PREF + HT_KVM
1560 SS_HVPARAMS_XEN_CHROOT = SS_HVPARAMS_PREF + HT_CHROOT
1561 SS_HVPARAMS_XEN_LXC = SS_HVPARAMS_PREF + HT_LXC
1563 VALID_SS_HVPARAMS_KEYS = compat.UniqueFrozenset([
1564 SS_HVPARAMS_XEN_PVM,
1565 SS_HVPARAMS_XEN_FAKE,
1566 SS_HVPARAMS_XEN_HVM,
1567 SS_HVPARAMS_XEN_KVM,
1568 SS_HVPARAMS_XEN_CHROOT,
1569 SS_HVPARAMS_XEN_LXC,
1572 SS_FILE_PERMS = 0444
1574 # cluster wide default parameters
1575 DEFAULT_ENABLED_HYPERVISOR = HT_XEN_PVM
1579 HV_USE_BOOTLOADER: False,
1580 HV_BOOTLOADER_PATH: XEN_BOOTLOADER,
1581 HV_BOOTLOADER_ARGS: "",
1582 HV_KERNEL_PATH: XEN_KERNEL,
1584 HV_ROOT_PATH: "/dev/xvda1",
1585 HV_KERNEL_ARGS: "ro",
1586 HV_MIGRATION_PORT: 8002,
1587 HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1588 HV_BLOCKDEV_PREFIX: "sd",
1589 HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1590 HV_CPU_MASK: CPU_PINNING_ALL,
1594 HV_XEN_CMD: XEN_CMD_XM,
1599 HV_BOOT_ORDER: "cd",
1600 HV_CDROM_IMAGE_PATH: "",
1601 HV_NIC_TYPE: HT_NIC_RTL8139,
1602 HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
1603 HV_VNC_BIND_ADDRESS: IP4_ADDRESS_ANY,
1604 HV_VNC_PASSWORD_FILE: pathutils.VNC_PASSWORD_FILE,
1607 HV_KERNEL_PATH: "/usr/lib/xen/boot/hvmloader",
1608 HV_DEVICE_MODEL: "/usr/lib/xen/bin/qemu-dm",
1609 HV_MIGRATION_PORT: 8002,
1610 HV_MIGRATION_MODE: HT_MIGRATION_NONLIVE,
1611 HV_USE_LOCALTIME: False,
1612 HV_BLOCKDEV_PREFIX: "hd",
1614 HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1615 HV_CPU_MASK: CPU_PINNING_ALL,
1618 HV_VIF_TYPE: HT_HVM_VIF_IOEMU,
1621 HV_XEN_CMD: XEN_CMD_XM,
1626 HV_KVM_PATH: KVM_PATH,
1627 HV_KERNEL_PATH: KVM_KERNEL,
1629 HV_KERNEL_ARGS: "ro",
1630 HV_ROOT_PATH: "/dev/vda1",
1632 HV_SERIAL_CONSOLE: True,
1633 HV_SERIAL_SPEED: 38400,
1634 HV_VNC_BIND_ADDRESS: "",
1637 HV_VNC_X509_VERIFY: False,
1638 HV_VNC_PASSWORD_FILE: "",
1639 HV_KVM_SPICE_BIND: "",
1640 HV_KVM_SPICE_IP_VERSION: IFACE_NO_IP_VERSION_SPECIFIED,
1641 HV_KVM_SPICE_PASSWORD_FILE: "",
1642 HV_KVM_SPICE_LOSSLESS_IMG_COMPR: "",
1643 HV_KVM_SPICE_JPEG_IMG_COMPR: "",
1644 HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR: "",
1645 HV_KVM_SPICE_STREAMING_VIDEO_DETECTION: "",
1646 HV_KVM_SPICE_AUDIO_COMPR: True,
1647 HV_KVM_SPICE_USE_TLS: False,
1648 HV_KVM_SPICE_TLS_CIPHERS: OPENSSL_CIPHERS,
1649 HV_KVM_SPICE_USE_VDAGENT: True,
1650 HV_KVM_FLOPPY_IMAGE_PATH: "",
1651 HV_CDROM_IMAGE_PATH: "",
1652 HV_KVM_CDROM2_IMAGE_PATH: "",
1653 HV_BOOT_ORDER: HT_BO_DISK,
1654 HV_NIC_TYPE: HT_NIC_PARAVIRTUAL,
1655 HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
1656 HV_KVM_CDROM_DISK_TYPE: "",
1659 HV_MIGRATION_PORT: 8102,
1660 HV_MIGRATION_BANDWIDTH: 32, # MiB/s
1661 HV_MIGRATION_DOWNTIME: 30, # ms
1662 HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1663 HV_USE_LOCALTIME: False,
1664 HV_DISK_CACHE: HT_CACHE_DEFAULT,
1665 HV_SECURITY_MODEL: HT_SM_NONE,
1666 HV_SECURITY_DOMAIN: "",
1668 HV_VHOST_NET: False,
1669 HV_KVM_USE_CHROOT: False,
1671 HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1672 HV_CPU_MASK: CPU_PINNING_ALL,
1681 HV_KVM_MACHINE_VERSION: "",
1685 HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1688 HV_INIT_SCRIPT: "/ganeti-chroot",
1695 HVC_GLOBALS = compat.UniqueFrozenset([
1697 HV_MIGRATION_BANDWIDTH,
1706 BE_AUTO_BALANCE: True,
1707 BE_ALWAYS_FAILOVER: False,
1713 ND_SPINDLE_COUNT: 1,
1714 ND_EXCLUSIVE_STORAGE: False,
1716 ND_OVS_NAME: DEFAULT_OVS,
1720 NDC_GLOBALS = compat.UniqueFrozenset([
1721 ND_EXCLUSIVE_STORAGE,
1724 DISK_LD_DEFAULTS = {
1726 LDP_RESYNC_RATE: CLASSIC_DRBD_SYNC_SPEED,
1727 LDP_BARRIERS: _constants.DRBD_BARRIERS,
1728 LDP_NO_META_FLUSH: _constants.DRBD_NO_META_FLUSH,
1729 LDP_DEFAULT_METAVG: DEFAULT_VG,
1730 LDP_DISK_CUSTOM: "",
1732 LDP_PROTOCOL: DRBD_DEFAULT_NET_PROTOCOL,
1733 LDP_DYNAMIC_RESYNC: False,
1735 # The default values for the DRBD dynamic resync speed algorithm
1736 # are taken from the drbsetup 8.3.11 man page, except for
1737 # c-plan-ahead (that we don't need to set to 0, because we have a
1738 # separate option to enable it) and for c-max-rate, that we cap to
1739 # the default value for the static resync rate.
1740 LDP_PLAN_AHEAD: 20, # ds
1741 LDP_FILL_TARGET: 0, # sectors
1742 LDP_DELAY_TARGET: 1, # ds
1743 LDP_MAX_RATE: CLASSIC_DRBD_SYNC_SPEED, # KiB/s
1744 LDP_MIN_RATE: 4 * 1024, # KiB/s
1747 LDP_STRIPES: _constants.LVM_STRIPECOUNT
1754 LDP_ACCESS: DISK_KERNELSPACE,
1759 # readability shortcuts
1760 _LV_DEFAULTS = DISK_LD_DEFAULTS[DT_PLAIN]
1761 _DRBD_DEFAULTS = DISK_LD_DEFAULTS[DT_DRBD8]
1763 DISK_DT_DEFAULTS = {
1765 LV_STRIPES: DISK_LD_DEFAULTS[DT_PLAIN][LDP_STRIPES],
1768 DRBD_RESYNC_RATE: _DRBD_DEFAULTS[LDP_RESYNC_RATE],
1769 DRBD_DATA_STRIPES: _LV_DEFAULTS[LDP_STRIPES],
1770 DRBD_META_STRIPES: _LV_DEFAULTS[LDP_STRIPES],
1771 DRBD_DISK_BARRIERS: _DRBD_DEFAULTS[LDP_BARRIERS],
1772 DRBD_META_BARRIERS: _DRBD_DEFAULTS[LDP_NO_META_FLUSH],
1773 DRBD_DEFAULT_METAVG: _DRBD_DEFAULTS[LDP_DEFAULT_METAVG],
1774 DRBD_DISK_CUSTOM: _DRBD_DEFAULTS[LDP_DISK_CUSTOM],
1775 DRBD_NET_CUSTOM: _DRBD_DEFAULTS[LDP_NET_CUSTOM],
1776 DRBD_PROTOCOL: _DRBD_DEFAULTS[LDP_PROTOCOL],
1777 DRBD_DYNAMIC_RESYNC: _DRBD_DEFAULTS[LDP_DYNAMIC_RESYNC],
1778 DRBD_PLAN_AHEAD: _DRBD_DEFAULTS[LDP_PLAN_AHEAD],
1779 DRBD_FILL_TARGET: _DRBD_DEFAULTS[LDP_FILL_TARGET],
1780 DRBD_DELAY_TARGET: _DRBD_DEFAULTS[LDP_DELAY_TARGET],
1781 DRBD_MAX_RATE: _DRBD_DEFAULTS[LDP_MAX_RATE],
1782 DRBD_MIN_RATE: _DRBD_DEFAULTS[LDP_MIN_RATE],
1789 RBD_POOL: DISK_LD_DEFAULTS[DT_RBD][LDP_POOL],
1790 RBD_ACCESS: DISK_LD_DEFAULTS[DT_RBD][LDP_ACCESS],
1795 # we don't want to export the shortcuts
1796 del _LV_DEFAULTS, _DRBD_DEFAULTS
1799 NIC_MODE: NIC_MODE_BRIDGED,
1800 NIC_LINK: DEFAULT_BRIDGE,
1801 NIC_VLAN: VALUE_HS_NOTHING,
1804 # All of the following values are quite arbitrarily - there are no
1805 # "good" defaults, these must be customised per-site
1806 ISPECS_MINMAX_DEFAULTS = {
1808 ISPEC_MEM_SIZE: 128,
1810 ISPEC_DISK_COUNT: 1,
1811 ISPEC_DISK_SIZE: 1024,
1813 ISPEC_SPINDLE_USE: 1,
1816 ISPEC_MEM_SIZE: 32768,
1818 ISPEC_DISK_COUNT: MAX_DISKS,
1819 ISPEC_DISK_SIZE: 1024 * 1024,
1820 ISPEC_NIC_COUNT: MAX_NICS,
1821 ISPEC_SPINDLE_USE: 12,
1824 IPOLICY_DEFAULTS = {
1825 ISPECS_MINMAX: [ISPECS_MINMAX_DEFAULTS],
1827 ISPEC_MEM_SIZE: 128,
1829 ISPEC_DISK_COUNT: 1,
1830 ISPEC_DISK_SIZE: 1024,
1832 ISPEC_SPINDLE_USE: 1,
1834 IPOLICY_DTS: list(DISK_TEMPLATES),
1835 IPOLICY_VCPU_RATIO: 4.0,
1836 IPOLICY_SPINDLE_RATIO: 32.0,
1839 MASTER_POOL_SIZE_DEFAULT = 10
1841 # Exclusive storage:
1842 # Error margin used to compare physical disks
1844 # Space reserved when creating instance disks
1847 CONFD_PROTOCOL_VERSION = _constants.CONFD_PROTOCOL_VERSION
1849 CONFD_REQ_PING = _constants.CONFD_REQ_PING
1850 CONFD_REQ_NODE_ROLE_BYNAME = _constants.CONFD_REQ_NODE_ROLE_BYNAME
1851 CONFD_REQ_NODE_PIP_BY_INSTANCE_IP = _constants.CONFD_REQ_NODE_PIP_BY_INSTANCE_IP
1852 CONFD_REQ_CLUSTER_MASTER = _constants.CONFD_REQ_CLUSTER_MASTER
1853 CONFD_REQ_NODE_PIP_LIST = _constants.CONFD_REQ_NODE_PIP_LIST
1854 CONFD_REQ_MC_PIP_LIST = _constants.CONFD_REQ_MC_PIP_LIST
1855 CONFD_REQ_INSTANCES_IPS_LIST = _constants.CONFD_REQ_INSTANCES_IPS_LIST
1856 CONFD_REQ_NODE_DRBD = _constants.CONFD_REQ_NODE_DRBD
1857 CONFD_REQ_NODE_INSTANCES = _constants.CONFD_REQ_NODE_INSTANCES
1858 CONFD_REQS = _constants.CONFD_REQS
1860 # Confd request query fields. These are used to narrow down queries.
1861 # These must be strings rather than integers, because json-encoding
1862 # converts them to strings anyway, as they're used as dict-keys.
1863 CONFD_REQQ_LINK = _constants.CONFD_REQQ_LINK
1864 CONFD_REQQ_IP = _constants.CONFD_REQQ_IP
1865 CONFD_REQQ_IPLIST = _constants.CONFD_REQQ_IPLIST
1866 CONFD_REQQ_FIELDS = _constants.CONFD_REQQ_FIELDS
1868 # FIXME: perhaps update code that uses these constants to deal with
1869 # integers instead of strings
1870 CONFD_REQFIELD_NAME = str(_constants.CONFD_REQFIELD_NAME)
1871 CONFD_REQFIELD_IP = str(_constants.CONFD_REQFIELD_IP)
1872 CONFD_REQFIELD_MNODE_PIP = str(_constants.CONFD_REQFIELD_MNODE_PIP)
1874 CONFD_REPL_STATUS_OK = _constants.CONFD_REPL_STATUS_OK
1875 CONFD_REPL_STATUS_ERROR = _constants.CONFD_REPL_STATUS_ERROR
1876 CONFD_REPL_STATUS_NOTIMPLEMENTED = _constants.CONFD_REPL_STATUS_NOTIMPLEMENTED
1877 CONFD_REPL_STATUSES = _constants.CONFD_REPL_STATUSES
1879 CONFD_NODE_ROLE_MASTER = _constants.CONFD_NODE_ROLE_MASTER
1880 CONFD_NODE_ROLE_CANDIDATE = _constants.CONFD_NODE_ROLE_CANDIDATE
1881 CONFD_NODE_ROLE_OFFLINE = _constants.CONFD_NODE_ROLE_OFFLINE
1882 CONFD_NODE_ROLE_DRAINED = _constants.CONFD_NODE_ROLE_DRAINED
1883 CONFD_NODE_ROLE_REGULAR = _constants.CONFD_NODE_ROLE_REGULAR
1885 CONFD_ERROR_UNKNOWN_ENTRY = _constants.CONFD_ERROR_UNKNOWN_ENTRY
1886 CONFD_ERROR_INTERNAL = _constants.CONFD_ERROR_INTERNAL
1887 CONFD_ERROR_ARGUMENT = _constants.CONFD_ERROR_ARGUMENT
1889 # Each request is "salted" by the current timestamp.
1890 # This constants decides how many seconds of skew to accept.
1891 # TODO: make this a default and allow the value to be more configurable
1892 CONFD_MAX_CLOCK_SKEW = _constants.CONFD_MAX_CLOCK_SKEW
1894 # When we haven't reloaded the config for more than this amount of
1895 # seconds, we force a test to see if inotify is betraying us. Using a
1896 # prime number to ensure we get less chance of 'same wakeup' with
1898 CONFD_CONFIG_RELOAD_TIMEOUT = _constants.CONFD_CONFIG_RELOAD_TIMEOUT
1900 # If we receive more than one update in this amount of microseconds,
1901 # we move to polling every RATELIMIT seconds, rather than relying on
1902 # inotify, to be able to serve more requests.
1903 CONFD_CONFIG_RELOAD_RATELIMIT = _constants.CONFD_CONFIG_RELOAD_RATELIMIT
1905 # Magic number prepended to all confd queries.
1906 # This allows us to distinguish different types of confd protocols and handle
1907 # them. For example by changing this we can move the whole payload to be
1908 # compressed, or move away from json.
1909 CONFD_MAGIC_FOURCC = _constants.CONFD_MAGIC_FOURCC
1911 # By default a confd request is sent to the minimum between this number and all
1912 # MCs. 6 was chosen because even in the case of a disastrous 50% response rate,
1913 # we should have enough answers to be able to compare more than one.
1914 CONFD_DEFAULT_REQ_COVERAGE = _constants.CONFD_DEFAULT_REQ_COVERAGE
1916 # Timeout in seconds to expire pending query request in the confd client
1917 # library. We don't actually expect any answer more than 10 seconds after we
1919 CONFD_CLIENT_EXPIRE_TIMEOUT = _constants.CONFD_CLIENT_EXPIRE_TIMEOUT
1921 # Maximum UDP datagram size.
1922 # On IPv4: 64K - 20 (ip header size) - 8 (udp header size) = 65507
1923 # On IPv6: 64K - 40 (ip6 header size) - 8 (udp header size) = 65487
1924 # (assuming we can't use jumbo frames)
1925 # We just set this to 60K, which should be enough
1926 MAX_UDP_DATA_SIZE = 61440
1928 # User-id pool minimum/maximum acceptable user-ids.
1930 UIDPOOL_UID_MAX = 2 ** 32 - 1 # Assuming 32 bit user-ids
1932 # Name or path of the pgrep command
1935 # Name of the node group that gets created at cluster init or upgrade
1936 INITIAL_NODE_GROUP_NAME = "default"
1938 # Possible values for NodeGroup.alloc_policy
1939 ALLOC_POLICY_PREFERRED = _constants.ALLOC_POLICY_PREFERRED
1940 ALLOC_POLICY_LAST_RESORT = _constants.ALLOC_POLICY_LAST_RESORT
1941 ALLOC_POLICY_UNALLOCABLE = _constants.ALLOC_POLICY_UNALLOCABLE
1942 VALID_ALLOC_POLICIES = _constants.VALID_ALLOC_POLICIES
1944 # Temporary external/shared storage parameters
1945 BLOCKDEV_DRIVER_MANUAL = _constants.BLOCKDEV_DRIVER_MANUAL
1947 # qemu-img path, required for ovfconverter
1948 QEMUIMG_PATH = _constants.QEMUIMG_PATH
1950 # Whether htools was enabled at compilation time
1951 HTOOLS = _constants.HTOOLS
1952 # The hail iallocator
1953 IALLOC_HAIL = "hail"
1955 # Fake opcodes for functions that have hooks attached to them via
1956 # backend.RunLocalHooks
1957 FAKE_OP_MASTER_TURNUP = "OP_CLUSTER_IP_TURNUP"
1958 FAKE_OP_MASTER_TURNDOWN = "OP_CLUSTER_IP_TURNDOWN"
1963 SSHK_ALL = compat.UniqueFrozenset([SSHK_RSA, SSHK_DSA])
1965 # SSH authorized key types
1966 SSHAK_RSA = "ssh-rsa"
1967 SSHAK_DSS = "ssh-dss"
1968 SSHAK_ALL = compat.UniqueFrozenset([SSHAK_RSA, SSHAK_DSS])
1971 SSHS_CLUSTER_NAME = "cluster_name"
1972 SSHS_SSH_HOST_KEY = "ssh_host_key"
1973 SSHS_SSH_ROOT_KEY = "ssh_root_key"
1974 SSHS_NODE_DAEMON_CERTIFICATE = "node_daemon_certificate"
1976 #: Key files for SSH daemon
1977 SSH_DAEMON_KEYFILES = {
1978 SSHK_RSA: (pathutils.SSH_HOST_RSA_PRIV, pathutils.SSH_HOST_RSA_PUB),
1979 SSHK_DSA: (pathutils.SSH_HOST_DSA_PRIV, pathutils.SSH_HOST_DSA_PUB),
1983 NDS_CLUSTER_NAME = "cluster_name"
1984 NDS_NODE_DAEMON_CERTIFICATE = "node_daemon_certificate"
1985 NDS_SSCONF = "ssconf"
1986 NDS_START_NODE_DAEMON = "start_node_daemon"
1988 # Path generating random UUID
1989 RANDOM_UUID_FILE = _constants.RANDOM_UUID_FILE
1991 # Regex string for verifying a UUID
1992 UUID_REGEX = "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"
1994 # Auto-repair tag prefixes
1995 AUTO_REPAIR_TAG_PREFIX = _constants.AUTO_REPAIR_TAG_PREFIX
1996 AUTO_REPAIR_TAG_ENABLED = _constants.AUTO_REPAIR_TAG_ENABLED
1997 AUTO_REPAIR_TAG_SUSPENDED = _constants.AUTO_REPAIR_TAG_SUSPENDED
1998 AUTO_REPAIR_TAG_PENDING = _constants.AUTO_REPAIR_TAG_PENDING
1999 AUTO_REPAIR_TAG_RESULT = _constants.AUTO_REPAIR_TAG_RESULT
2001 # Auto-repair levels
2002 AUTO_REPAIR_FIX_STORAGE = _constants.AUTO_REPAIR_FIX_STORAGE
2003 AUTO_REPAIR_MIGRATE = _constants.AUTO_REPAIR_MIGRATE
2004 AUTO_REPAIR_FAILOVER = _constants.AUTO_REPAIR_FAILOVER
2005 AUTO_REPAIR_REINSTALL = _constants.AUTO_REPAIR_REINSTALL
2006 AUTO_REPAIR_ALL_TYPES = _constants.AUTO_REPAIR_ALL_TYPES
2008 # Auto-repair results
2009 AUTO_REPAIR_SUCCESS = _constants.AUTO_REPAIR_SUCCESS
2010 AUTO_REPAIR_FAILURE = _constants.AUTO_REPAIR_FAILURE
2011 AUTO_REPAIR_ENOPERM = _constants.AUTO_REPAIR_ENOPERM
2012 AUTO_REPAIR_ALL_RESULTS = _constants.AUTO_REPAIR_ALL_RESULTS
2014 # The version identifier for builtin data collectors
2015 BUILTIN_DATA_COLLECTOR_VERSION = _constants.BUILTIN_DATA_COLLECTOR_VERSION
2017 # The reason trail opcode parameter name
2018 OPCODE_REASON = _constants.OPCODE_REASON
2020 # The source reasons for the execution of an OpCode
2021 OPCODE_REASON_SRC_CLIENT = "gnt:client"
2022 OPCODE_REASON_SRC_NODED = "gnt:daemon:noded"
2023 OPCODE_REASON_SRC_OPCODE = "gnt:opcode"
2024 OPCODE_REASON_SRC_RLIB2 = "gnt:library:rlib2"
2025 OPCODE_REASON_SRC_USER = "gnt:user"
2027 OPCODE_REASON_SOURCES = compat.UniqueFrozenset([
2028 OPCODE_REASON_SRC_CLIENT,
2029 OPCODE_REASON_SRC_NODED,
2030 OPCODE_REASON_SRC_OPCODE,
2031 OPCODE_REASON_SRC_RLIB2,
2032 OPCODE_REASON_SRC_USER,
2035 DISKSTATS_FILE = _constants.DISKSTATS_FILE
2037 # CPU load collector variables
2038 STAT_FILE = _constants.STAT_FILE
2039 CPUAVGLOAD_BUFFER_SIZE = _constants.CPUAVGLOAD_BUFFER_SIZE
2040 CPUAVGLOAD_WINDOW_SIZE = _constants.CPUAVGLOAD_WINDOW_SIZE
2042 # Mond's variable for periodical data collection
2043 MOND_TIME_INTERVAL = _constants.MOND_TIME_INTERVAL
2045 # MonD's latest API version
2046 MOND_LATEST_API_VERSION = 1
2048 # Timeouts for upgrades
2050 UPGRADE_QUEUE_DRAIN_TIMEOUT = _constants.UPGRADE_QUEUE_DRAIN_TIMEOUT
2051 UPGRADE_QUEUE_POLL_INTERVAL = _constants.UPGRADE_QUEUE_POLL_INTERVAL
2053 # Do not re-export imported modules
2054 del re, _vcsversion, _constants, socket, pathutils, compat
2057 ALLOCATABLE_KEY = "allocatable"
2058 FAILED_KEY = "failed"