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 DRBD_HMAC_ALG = "md5"
313 DRBD_DEFAULT_NET_PROTOCOL = "C"
314 DRBD_MIGRATION_NET_PROTOCOL = "C"
315 DRBD_STATUS_FILE = "/proc/drbd"
317 #: Size of DRBD meta block device
320 DTS_INT_MIRROR = _constants.DTS_INT_MIRROR
321 DTS_EXT_MIRROR = _constants.DTS_EXT_MIRROR
322 DTS_NOT_LVM = _constants.DTS_NOT_LVM
323 DTS_GROWABLE = _constants.DTS_GROWABLE
324 DTS_MAY_ADOPT = _constants.DTS_MAY_ADOPT
325 DTS_MUST_ADOPT = _constants.DTS_MUST_ADOPT
326 DTS_MIRRORED = _constants.DTS_MIRRORED
327 DTS_FILEBASED = _constants.DTS_FILEBASED
328 DTS_COPYABLE = _constants.DTS_COPYABLE
329 DTS_EXCL_STORAGE = _constants.DTS_EXCL_STORAGE
330 DTS_NO_FREE_SPACE_CHECK = _constants.DTS_NO_FREE_SPACE_CHECK
331 DTS_BLOCK = _constants.DTS_BLOCK
334 DRBD_B_DISK_BARRIERS = "b"
335 DRBD_B_DISK_DRAIN = "d"
336 DRBD_B_DISK_FLUSH = "f"
338 # Valid barrier combinations: "n" or any non-null subset of "bfd"
339 DRBD_VALID_BARRIER_OPT = compat.UniqueFrozenset([
340 frozenset([DRBD_B_NONE]),
341 frozenset([DRBD_B_DISK_BARRIERS]),
342 frozenset([DRBD_B_DISK_DRAIN]),
343 frozenset([DRBD_B_DISK_FLUSH]),
344 frozenset([DRBD_B_DISK_DRAIN, DRBD_B_DISK_FLUSH]),
345 frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_DRAIN]),
346 frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_FLUSH]),
347 frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_FLUSH, DRBD_B_DISK_DRAIN]),
353 FD_BLKTAP = _constants.FD_BLKTAP
354 FD_LOOP = _constants.FD_LOOP
355 FILE_DRIVER = _constants.FILE_DRIVER
357 LDS_DRBD = _constants.LDS_DRBD
360 DISK_RDONLY = _constants.DISK_RDONLY
361 DISK_RDWR = _constants.DISK_RDWR
362 DISK_ACCESS_SET = _constants.DISK_ACCESS_SET
363 DISK_USERSPACE = _constants.DISK_USERSPACE
364 DISK_KERNELSPACE = _constants.DISK_KERNELSPACE
365 DISK_VALID_ACCESS_MODES = _constants.DISK_VALID_ACCESS_MODES
367 REPLACE_DISK_PRI = _constants.REPLACE_DISK_PRI
368 REPLACE_DISK_SEC = _constants.REPLACE_DISK_SEC
369 REPLACE_DISK_CHG = _constants.REPLACE_DISK_CHG
370 REPLACE_DISK_AUTO = _constants.REPLACE_DISK_AUTO
371 REPLACE_MODES = _constants.REPLACE_MODES
373 # Instance export mode
374 EXPORT_MODE_LOCAL = _constants.EXPORT_MODE_LOCAL
375 EXPORT_MODE_REMOTE = _constants.EXPORT_MODE_REMOTE
376 EXPORT_MODES = _constants.EXPORT_MODES
378 # instance creation modes
379 INSTANCE_CREATE = _constants.INSTANCE_CREATE
380 INSTANCE_IMPORT = _constants.INSTANCE_IMPORT
381 INSTANCE_REMOTE_IMPORT = _constants.INSTANCE_REMOTE_IMPORT
382 INSTANCE_CREATE_MODES = _constants.INSTANCE_CREATE_MODES
384 # Remote import/export handshake message and version
386 RIE_HANDSHAKE = "Hi, I'm Ganeti"
388 # Remote import/export certificate validity in seconds
389 RIE_CERT_VALIDITY = 24 * 60 * 60
391 # Overall timeout for establishing connection
392 RIE_CONNECT_TIMEOUT = 180
394 # Export only: how long to wait per connection attempt (seconds)
395 RIE_CONNECT_ATTEMPT_TIMEOUT = 20
397 # Export only: number of attempts to connect
398 RIE_CONNECT_RETRIES = 10
400 #: Give child process up to 5 seconds to exit after sending a signal
401 CHILD_LINGER_TIMEOUT = 5.0
404 # import/export config options
405 INISECT_EXP = "export"
406 INISECT_INS = "instance"
407 INISECT_HYP = "hypervisor"
408 INISECT_BEP = "backend"
411 # dynamic device modification
412 DDM_ADD = _constants.DDM_ADD
413 DDM_MODIFY = _constants.DDM_MODIFY
414 DDM_REMOVE = _constants.DDM_REMOVE
415 DDMS_VALUES = _constants.DDMS_VALUES
416 DDMS_VALUES_WITH_MODIFY = _constants.DDMS_VALUES_WITH_MODIFY
417 # TODO: DDM_SWAP, DDM_MOVE?
420 EXIT_SUCCESS = _constants.EXIT_SUCCESS
421 EXIT_FAILURE = _constants.EXIT_FAILURE
422 EXIT_NOTCLUSTER = _constants.EXIT_NOTCLUSTER
423 EXIT_NOTMASTER = _constants.EXIT_NOTMASTER
424 EXIT_NODESETUP_ERROR = _constants.EXIT_NODESETUP_ERROR
425 EXIT_CONFIRMATION = _constants.EXIT_CONFIRMATION # need user confirmation
427 #: Exit code for query operations with unknown fields
428 EXIT_UNKNOWN_FIELD = _constants.EXIT_UNKNOWN_FIELD
431 TAG_CLUSTER = _constants.TAG_CLUSTER
432 TAG_NODEGROUP = _constants.TAG_NODEGROUP
433 TAG_NODE = _constants.TAG_NODE
434 TAG_INSTANCE = _constants.TAG_INSTANCE
435 TAG_NETWORK = _constants.TAG_NETWORK
436 VALID_TAG_TYPES = _constants.VALID_TAG_TYPES
438 MAX_TAG_LEN = _constants.MAX_TAG_LEN
439 MAX_TAGS_PER_OBJ = _constants.MAX_TAGS_PER_OBJ
442 DEFAULT_BRIDGE = "xen-br0"
443 DEFAULT_OVS = "switch1"
444 CLASSIC_DRBD_SYNC_SPEED = 60 * 1024 # 60 MiB, expressed in KiB
445 IP4_ADDRESS_LOCALHOST = "127.0.0.1"
446 IP4_ADDRESS_ANY = "0.0.0.0"
447 IP6_ADDRESS_LOCALHOST = "::1"
448 IP6_ADDRESS_ANY = "::"
451 VALID_IP_VERSIONS = compat.UniqueFrozenset([IP4_VERSION, IP6_VERSION])
452 # for export to htools
453 IP4_FAMILY = socket.AF_INET
454 IP6_FAMILY = socket.AF_INET6
456 TCP_PING_TIMEOUT = 10
458 DEFAULT_DRBD_HELPER = "/bin/true"
460 DEFAULT_MAC_PREFIX = "aa:00:00"
461 # default maximum instance wait time, in seconds.
462 DEFAULT_SHUTDOWN_TIMEOUT = 120
463 NODE_MAX_CLOCK_SKEW = _constants.NODE_MAX_CLOCK_SKEW
464 # Time for an intra-cluster disk transfer to wait for a connection
465 DISK_TRANSFER_CONNECT_TIMEOUT = 60
466 # Disk index separator
467 DISK_SEPARATOR = _constants.DISK_SEPARATOR
468 IP_COMMAND_PATH = _constants.IP_COMMAND_PATH
470 RPC_TMO_URGENT = _constants.RPC_TMO_URGENT
471 RPC_TMO_FAST = _constants.RPC_TMO_FAST
472 RPC_TMO_NORMAL = _constants.RPC_TMO_NORMAL
473 RPC_TMO_SLOW = _constants.RPC_TMO_SLOW
474 RPC_TMO_4HRS = _constants.RPC_TMO_4HRS
475 RPC_TMO_1DAY = _constants.RPC_TMO_1DAY
476 RPC_CONNECT_TIMEOUT = _constants.RPC_CONNECT_TIMEOUT
478 #: Key for job IDs in opcode result
484 RUNPARTS_ERR) = range(3)
486 RUNPARTS_STATUS = compat.UniqueFrozenset([
494 RPC_ENCODING_ZLIB_BASE64) = range(2)
496 # os related constants
497 OS_SCRIPT_CREATE = "create"
498 OS_SCRIPT_IMPORT = "import"
499 OS_SCRIPT_EXPORT = "export"
500 OS_SCRIPT_RENAME = "rename"
501 OS_SCRIPT_VERIFY = "verify"
502 OS_SCRIPTS = compat.UniqueFrozenset([
510 OS_API_FILE = "ganeti_api_version"
511 OS_VARIANTS_FILE = "variants.list"
512 OS_PARAMETERS_FILE = "parameters.list"
514 OS_VALIDATE_PARAMETERS = "parameters"
515 OS_VALIDATE_CALLS = compat.UniqueFrozenset([OS_VALIDATE_PARAMETERS])
517 # External Storage (ES) related constants
518 ES_ACTION_CREATE = "create"
519 ES_ACTION_REMOVE = "remove"
520 ES_ACTION_GROW = "grow"
521 ES_ACTION_ATTACH = "attach"
522 ES_ACTION_DETACH = "detach"
523 ES_ACTION_SETINFO = "setinfo"
524 ES_ACTION_VERIFY = "verify"
526 ES_SCRIPT_CREATE = ES_ACTION_CREATE
527 ES_SCRIPT_REMOVE = ES_ACTION_REMOVE
528 ES_SCRIPT_GROW = ES_ACTION_GROW
529 ES_SCRIPT_ATTACH = ES_ACTION_ATTACH
530 ES_SCRIPT_DETACH = ES_ACTION_DETACH
531 ES_SCRIPT_SETINFO = ES_ACTION_SETINFO
532 ES_SCRIPT_VERIFY = ES_ACTION_VERIFY
533 ES_SCRIPTS = frozenset([
543 ES_PARAMETERS_FILE = "parameters.list"
546 INSTANCE_REBOOT_SOFT = _constants.INSTANCE_REBOOT_SOFT
547 INSTANCE_REBOOT_HARD = _constants.INSTANCE_REBOOT_HARD
548 INSTANCE_REBOOT_FULL = _constants.INSTANCE_REBOOT_FULL
549 REBOOT_TYPES = _constants.REBOOT_TYPES
551 # instance reboot behaviors
552 INSTANCE_REBOOT_ALLOWED = "reboot"
553 INSTANCE_REBOOT_EXIT = "exit"
555 REBOOT_BEHAVIORS = compat.UniqueFrozenset([
556 INSTANCE_REBOOT_ALLOWED,
557 INSTANCE_REBOOT_EXIT,
560 VTYPE_STRING = _constants.VTYPE_STRING
561 VTYPE_MAYBE_STRING = _constants.VTYPE_MAYBE_STRING
562 VTYPE_BOOL = _constants.VTYPE_BOOL
563 VTYPE_SIZE = _constants.VTYPE_SIZE
564 VTYPE_INT = _constants.VTYPE_INT
565 ENFORCEABLE_TYPES = _constants.ENFORCEABLE_TYPES
567 # Constant representing that the user does not specify any IP version
568 IFACE_NO_IP_VERSION_SPECIFIED = 0
570 VALID_SERIAL_SPEEDS = compat.UniqueFrozenset([
591 # HV parameter names (global namespace)
592 HV_BOOT_ORDER = "boot_order"
593 HV_CDROM_IMAGE_PATH = "cdrom_image_path"
594 HV_KVM_CDROM2_IMAGE_PATH = "cdrom2_image_path"
595 HV_KVM_FLOPPY_IMAGE_PATH = "floppy_image_path"
596 HV_NIC_TYPE = "nic_type"
597 HV_DISK_TYPE = "disk_type"
598 HV_KVM_CDROM_DISK_TYPE = "cdrom_disk_type"
599 HV_VNC_BIND_ADDRESS = "vnc_bind_address"
600 HV_VNC_PASSWORD_FILE = "vnc_password_file"
601 HV_VNC_TLS = "vnc_tls"
602 HV_VNC_X509 = "vnc_x509_path"
603 HV_VNC_X509_VERIFY = "vnc_x509_verify"
604 HV_KVM_SPICE_BIND = "spice_bind"
605 HV_KVM_SPICE_IP_VERSION = "spice_ip_version"
606 HV_KVM_SPICE_PASSWORD_FILE = "spice_password_file"
607 HV_KVM_SPICE_LOSSLESS_IMG_COMPR = "spice_image_compression"
608 HV_KVM_SPICE_JPEG_IMG_COMPR = "spice_jpeg_wan_compression"
609 HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR = "spice_zlib_glz_wan_compression"
610 HV_KVM_SPICE_STREAMING_VIDEO_DETECTION = "spice_streaming_video"
611 HV_KVM_SPICE_AUDIO_COMPR = "spice_playback_compression"
612 HV_KVM_SPICE_USE_TLS = "spice_use_tls"
613 HV_KVM_SPICE_TLS_CIPHERS = "spice_tls_ciphers"
614 HV_KVM_SPICE_USE_VDAGENT = "spice_use_vdagent"
617 HV_USE_BOOTLOADER = "use_bootloader"
618 HV_BOOTLOADER_ARGS = "bootloader_args"
619 HV_BOOTLOADER_PATH = "bootloader_path"
620 HV_KERNEL_ARGS = "kernel_args"
621 HV_KERNEL_PATH = "kernel_path"
622 HV_INITRD_PATH = "initrd_path"
623 HV_ROOT_PATH = "root_path"
624 HV_SERIAL_CONSOLE = "serial_console"
625 HV_SERIAL_SPEED = "serial_speed"
626 HV_USB_MOUSE = "usb_mouse"
628 HV_DEVICE_MODEL = "device_model"
629 HV_INIT_SCRIPT = "init_script"
630 HV_MIGRATION_PORT = "migration_port"
631 HV_MIGRATION_BANDWIDTH = "migration_bandwidth"
632 HV_MIGRATION_DOWNTIME = "migration_downtime"
633 HV_MIGRATION_MODE = "migration_mode"
634 HV_USE_LOCALTIME = "use_localtime"
635 HV_DISK_CACHE = "disk_cache"
636 HV_SECURITY_MODEL = "security_model"
637 HV_SECURITY_DOMAIN = "security_domain"
638 HV_KVM_FLAG = "kvm_flag"
639 HV_VHOST_NET = "vhost_net"
640 HV_KVM_USE_CHROOT = "use_chroot"
641 HV_CPU_MASK = "cpu_mask"
642 HV_MEM_PATH = "mem_path"
643 HV_PASSTHROUGH = "pci_pass"
644 HV_BLOCKDEV_PREFIX = "blockdev_prefix"
645 HV_REBOOT_BEHAVIOR = "reboot_behavior"
646 HV_CPU_TYPE = "cpu_type"
647 HV_CPU_CAP = "cpu_cap"
648 HV_CPU_WEIGHT = "cpu_weight"
649 HV_CPU_CORES = "cpu_cores"
650 HV_CPU_THREADS = "cpu_threads"
651 HV_CPU_SOCKETS = "cpu_sockets"
652 HV_SOUNDHW = "soundhw"
653 HV_USB_DEVICES = "usb_devices"
655 HV_KVM_EXTRA = "kvm_extra"
656 HV_KVM_MACHINE_VERSION = "machine_version"
657 HV_KVM_PATH = "kvm_path"
658 HV_VIF_TYPE = "vif_type"
659 HV_VIF_SCRIPT = "vif_script"
660 HV_XEN_CMD = "xen_cmd"
661 HV_XEN_CPUID = "cpuid"
662 HV_VNET_HDR = "vnet_hdr"
663 HV_VIRIDIAN = "viridian"
666 HVS_PARAMETER_TYPES = {
667 HV_KVM_PATH: VTYPE_STRING,
668 HV_BOOT_ORDER: VTYPE_STRING,
669 HV_KVM_FLOPPY_IMAGE_PATH: VTYPE_STRING,
670 HV_CDROM_IMAGE_PATH: VTYPE_STRING,
671 HV_KVM_CDROM2_IMAGE_PATH: VTYPE_STRING,
672 HV_NIC_TYPE: VTYPE_STRING,
673 HV_DISK_TYPE: VTYPE_STRING,
674 HV_KVM_CDROM_DISK_TYPE: VTYPE_STRING,
675 HV_VNC_PASSWORD_FILE: VTYPE_STRING,
676 HV_VNC_BIND_ADDRESS: VTYPE_STRING,
677 HV_VNC_TLS: VTYPE_BOOL,
678 HV_VNC_X509: VTYPE_STRING,
679 HV_VNC_X509_VERIFY: VTYPE_BOOL,
680 HV_KVM_SPICE_BIND: VTYPE_STRING,
681 HV_KVM_SPICE_IP_VERSION: VTYPE_INT,
682 HV_KVM_SPICE_PASSWORD_FILE: VTYPE_STRING,
683 HV_KVM_SPICE_LOSSLESS_IMG_COMPR: VTYPE_STRING,
684 HV_KVM_SPICE_JPEG_IMG_COMPR: VTYPE_STRING,
685 HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR: VTYPE_STRING,
686 HV_KVM_SPICE_STREAMING_VIDEO_DETECTION: VTYPE_STRING,
687 HV_KVM_SPICE_AUDIO_COMPR: VTYPE_BOOL,
688 HV_KVM_SPICE_USE_TLS: VTYPE_BOOL,
689 HV_KVM_SPICE_TLS_CIPHERS: VTYPE_STRING,
690 HV_KVM_SPICE_USE_VDAGENT: VTYPE_BOOL,
693 HV_USE_BOOTLOADER: VTYPE_BOOL,
694 HV_BOOTLOADER_PATH: VTYPE_STRING,
695 HV_BOOTLOADER_ARGS: VTYPE_STRING,
696 HV_KERNEL_PATH: VTYPE_STRING,
697 HV_KERNEL_ARGS: VTYPE_STRING,
698 HV_INITRD_PATH: VTYPE_STRING,
699 HV_ROOT_PATH: VTYPE_MAYBE_STRING,
700 HV_SERIAL_CONSOLE: VTYPE_BOOL,
701 HV_SERIAL_SPEED: VTYPE_INT,
702 HV_USB_MOUSE: VTYPE_STRING,
703 HV_KEYMAP: VTYPE_STRING,
704 HV_DEVICE_MODEL: VTYPE_STRING,
705 HV_INIT_SCRIPT: VTYPE_STRING,
706 HV_MIGRATION_PORT: VTYPE_INT,
707 HV_MIGRATION_BANDWIDTH: VTYPE_INT,
708 HV_MIGRATION_DOWNTIME: VTYPE_INT,
709 HV_MIGRATION_MODE: VTYPE_STRING,
710 HV_USE_LOCALTIME: VTYPE_BOOL,
711 HV_DISK_CACHE: VTYPE_STRING,
712 HV_SECURITY_MODEL: VTYPE_STRING,
713 HV_SECURITY_DOMAIN: VTYPE_STRING,
714 HV_KVM_FLAG: VTYPE_STRING,
715 HV_VHOST_NET: VTYPE_BOOL,
716 HV_KVM_USE_CHROOT: VTYPE_BOOL,
717 HV_CPU_MASK: VTYPE_STRING,
718 HV_MEM_PATH: VTYPE_STRING,
719 HV_PASSTHROUGH: VTYPE_STRING,
720 HV_BLOCKDEV_PREFIX: VTYPE_STRING,
721 HV_REBOOT_BEHAVIOR: VTYPE_STRING,
722 HV_CPU_TYPE: VTYPE_STRING,
723 HV_CPU_CAP: VTYPE_INT,
724 HV_CPU_WEIGHT: VTYPE_INT,
725 HV_CPU_CORES: VTYPE_INT,
726 HV_CPU_THREADS: VTYPE_INT,
727 HV_CPU_SOCKETS: VTYPE_INT,
728 HV_SOUNDHW: VTYPE_STRING,
729 HV_USB_DEVICES: VTYPE_STRING,
730 HV_VGA: VTYPE_STRING,
731 HV_KVM_EXTRA: VTYPE_STRING,
732 HV_KVM_MACHINE_VERSION: VTYPE_STRING,
733 HV_VIF_TYPE: VTYPE_STRING,
734 HV_VIF_SCRIPT: VTYPE_STRING,
735 HV_XEN_CMD: VTYPE_STRING,
736 HV_XEN_CPUID: VTYPE_STRING,
737 HV_VNET_HDR: VTYPE_BOOL,
738 HV_VIRIDIAN: VTYPE_BOOL,
741 HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
743 HVS_PARAMETER_TITLES = {
745 HV_BOOT_ORDER: "Boot_order",
746 HV_CDROM_IMAGE_PATH: "CDROM_image_path",
747 HV_DISK_TYPE: "Disk_type",
748 HV_INITRD_PATH: "Initrd_path",
749 HV_KERNEL_PATH: "Kernel_path",
750 HV_NIC_TYPE: "NIC_type",
752 HV_VNC_BIND_ADDRESS: "VNC_bind_address",
753 HV_PASSTHROUGH: "pci_pass",
754 HV_CPU_TYPE: "cpu_type",
758 HV_MIGRATION_COMPLETED = "completed"
759 HV_MIGRATION_ACTIVE = "active"
760 HV_MIGRATION_FAILED = "failed"
761 HV_MIGRATION_CANCELLED = "cancelled"
763 HV_MIGRATION_VALID_STATUSES = compat.UniqueFrozenset([
764 HV_MIGRATION_COMPLETED,
767 HV_MIGRATION_CANCELLED,
770 HV_MIGRATION_FAILED_STATUSES = compat.UniqueFrozenset([
772 HV_MIGRATION_CANCELLED,
775 # KVM-specific statuses
776 HV_KVM_MIGRATION_VALID_STATUSES = HV_MIGRATION_VALID_STATUSES
779 HV_NODEINFO_KEY_VERSION = "hv_version"
782 HVST_MEMORY_TOTAL = "mem_total"
783 HVST_MEMORY_NODE = "mem_node"
784 HVST_MEMORY_HV = "mem_hv"
785 HVST_CPU_TOTAL = "cpu_total"
786 HVST_CPU_NODE = "cpu_node"
789 HVST_MEMORY_TOTAL: 0,
796 HVSTS_PARAMETER_TYPES = {
797 HVST_MEMORY_TOTAL: VTYPE_INT,
798 HVST_MEMORY_NODE: VTYPE_INT,
799 HVST_MEMORY_HV: VTYPE_INT,
800 HVST_CPU_TOTAL: VTYPE_INT,
801 HVST_CPU_NODE: VTYPE_INT,
804 HVSTS_PARAMETERS = frozenset(HVSTS_PARAMETER_TYPES.keys())
807 DS_DISK_TOTAL = "disk_total"
808 DS_DISK_RESERVED = "disk_reserved"
809 DS_DISK_OVERHEAD = "disk_overhead"
817 ISPEC_MEM_SIZE = _constants.ISPEC_MEM_SIZE
818 ISPEC_CPU_COUNT = _constants.ISPEC_CPU_COUNT
819 ISPEC_DISK_COUNT = _constants.ISPEC_DISK_COUNT
820 ISPEC_DISK_SIZE = _constants.ISPEC_DISK_SIZE
821 ISPEC_NIC_COUNT = _constants.ISPEC_NIC_COUNT
822 ISPEC_SPINDLE_USE = _constants.ISPEC_SPINDLE_USE
823 ISPECS_PARAMETER_TYPES = _constants.ISPECS_PARAMETER_TYPES
824 ISPECS_PARAMETERS = _constants.ISPECS_PARAMETERS
826 ISPECS_MINMAX = _constants.ISPECS_MINMAX
827 ISPECS_MIN = _constants.ISPECS_MIN
828 ISPECS_MAX = _constants.ISPECS_MAX
829 ISPECS_STD = _constants.ISPECS_STD
830 IPOLICY_DTS = _constants.IPOLICY_DTS
831 IPOLICY_VCPU_RATIO = _constants.IPOLICY_VCPU_RATIO
832 IPOLICY_SPINDLE_RATIO = _constants.IPOLICY_SPINDLE_RATIO
833 ISPECS_MINMAX_KEYS = _constants.ISPECS_MINMAX_KEYS
834 IPOLICY_PARAMETERS = _constants.IPOLICY_PARAMETERS
835 IPOLICY_ALL_KEYS = _constants.IPOLICY_ALL_KEYS
837 ND_OOB_PROGRAM = _constants.ND_OOB_PROGRAM
838 ND_SPINDLE_COUNT = _constants.ND_SPINDLE_COUNT
839 ND_EXCLUSIVE_STORAGE = _constants.ND_EXCLUSIVE_STORAGE
840 ND_OVS = _constants.ND_OVS
841 ND_OVS_NAME = _constants.ND_OVS_NAME
842 ND_OVS_LINK = _constants.ND_OVS_LINK
844 NDS_PARAMETER_TYPES = _constants.NDS_PARAMETER_TYPES
845 NDS_PARAMETERS = _constants.NDS_PARAMETERS
846 NDS_PARAMETER_TITLES = _constants.NDS_PARAMETER_TITLES
847 DSS_PARAMETER_TYPES = {
848 DS_DISK_TOTAL: VTYPE_INT,
849 DS_DISK_RESERVED: VTYPE_INT,
850 DS_DISK_OVERHEAD: VTYPE_INT,
853 DSS_PARAMETERS = frozenset(DSS_PARAMETER_TYPES.keys())
854 DS_VALID_TYPES = compat.UniqueFrozenset([DT_PLAIN])
856 # Backend parameter names
857 BE_MEMORY = "memory" # deprecated and replaced by max and min mem
861 BE_AUTO_BALANCE = "auto_balance"
862 BE_ALWAYS_FAILOVER = "always_failover"
863 BE_SPINDLE_USE = "spindle_use"
865 BES_PARAMETER_TYPES = {
866 BE_MAXMEM: VTYPE_SIZE,
867 BE_MINMEM: VTYPE_SIZE,
869 BE_AUTO_BALANCE: VTYPE_BOOL,
870 BE_ALWAYS_FAILOVER: VTYPE_BOOL,
871 BE_SPINDLE_USE: VTYPE_INT,
874 BES_PARAMETER_TITLES = {
875 BE_AUTO_BALANCE: "Auto_balance",
876 BE_MAXMEM: "ConfigMaxMem",
877 BE_MINMEM: "ConfigMinMem",
878 BE_VCPUS: "ConfigVCPUs",
881 BES_PARAMETER_COMPAT = {
882 BE_MEMORY: VTYPE_SIZE,
884 BES_PARAMETER_COMPAT.update(BES_PARAMETER_TYPES)
886 BES_PARAMETERS = frozenset(BES_PARAMETER_TYPES.keys())
888 # Logical Disks parameters
889 LDP_RESYNC_RATE = "resync-rate"
890 LDP_STRIPES = "stripes"
891 LDP_BARRIERS = "disabled-barriers"
892 LDP_NO_META_FLUSH = "disable-meta-flush"
893 LDP_DEFAULT_METAVG = "default-metavg"
894 LDP_DISK_CUSTOM = "disk-custom"
895 LDP_NET_CUSTOM = "net-custom"
896 LDP_PROTOCOL = "protocol"
897 LDP_DYNAMIC_RESYNC = "dynamic-resync"
898 LDP_PLAN_AHEAD = "c-plan-ahead"
899 LDP_FILL_TARGET = "c-fill-target"
900 LDP_DELAY_TARGET = "c-delay-target"
901 LDP_MAX_RATE = "c-max-rate"
902 LDP_MIN_RATE = "c-min-rate"
904 LDP_ACCESS = "access"
906 LDP_RESYNC_RATE: VTYPE_INT,
907 LDP_STRIPES: VTYPE_INT,
908 LDP_BARRIERS: VTYPE_STRING,
909 LDP_NO_META_FLUSH: VTYPE_BOOL,
910 LDP_DEFAULT_METAVG: VTYPE_STRING,
911 LDP_DISK_CUSTOM: VTYPE_STRING,
912 LDP_NET_CUSTOM: VTYPE_STRING,
913 LDP_PROTOCOL: VTYPE_STRING,
914 LDP_DYNAMIC_RESYNC: VTYPE_BOOL,
915 LDP_PLAN_AHEAD: VTYPE_INT,
916 LDP_FILL_TARGET: VTYPE_INT,
917 LDP_DELAY_TARGET: VTYPE_INT,
918 LDP_MAX_RATE: VTYPE_INT,
919 LDP_MIN_RATE: VTYPE_INT,
920 LDP_POOL: VTYPE_STRING,
921 LDP_ACCESS: VTYPE_STRING,
923 DISK_LD_PARAMETERS = frozenset(DISK_LD_TYPES.keys())
925 # Disk template parameters (can be set/changed by the user via gnt-cluster and
927 DRBD_RESYNC_RATE = "resync-rate"
928 DRBD_DATA_STRIPES = "data-stripes"
929 DRBD_META_STRIPES = "meta-stripes"
930 DRBD_DISK_BARRIERS = "disk-barriers"
931 DRBD_META_BARRIERS = "meta-barriers"
932 DRBD_DEFAULT_METAVG = "metavg"
933 DRBD_DISK_CUSTOM = "disk-custom"
934 DRBD_NET_CUSTOM = "net-custom"
935 DRBD_PROTOCOL = "protocol"
936 DRBD_DYNAMIC_RESYNC = "dynamic-resync"
937 DRBD_PLAN_AHEAD = "c-plan-ahead"
938 DRBD_FILL_TARGET = "c-fill-target"
939 DRBD_DELAY_TARGET = "c-delay-target"
940 DRBD_MAX_RATE = "c-max-rate"
941 DRBD_MIN_RATE = "c-min-rate"
942 LV_STRIPES = "stripes"
944 RBD_ACCESS = "access"
946 DRBD_RESYNC_RATE: VTYPE_INT,
947 DRBD_DATA_STRIPES: VTYPE_INT,
948 DRBD_META_STRIPES: VTYPE_INT,
949 DRBD_DISK_BARRIERS: VTYPE_STRING,
950 DRBD_META_BARRIERS: VTYPE_BOOL,
951 DRBD_DEFAULT_METAVG: VTYPE_STRING,
952 DRBD_DISK_CUSTOM: VTYPE_STRING,
953 DRBD_NET_CUSTOM: VTYPE_STRING,
954 DRBD_PROTOCOL: VTYPE_STRING,
955 DRBD_DYNAMIC_RESYNC: VTYPE_BOOL,
956 DRBD_PLAN_AHEAD: VTYPE_INT,
957 DRBD_FILL_TARGET: VTYPE_INT,
958 DRBD_DELAY_TARGET: VTYPE_INT,
959 DRBD_MAX_RATE: VTYPE_INT,
960 DRBD_MIN_RATE: VTYPE_INT,
961 LV_STRIPES: VTYPE_INT,
962 RBD_POOL: VTYPE_STRING,
963 RBD_ACCESS: VTYPE_STRING,
966 DISK_DT_PARAMETERS = frozenset(DISK_DT_TYPES.keys())
968 # dynamic disk parameters
969 DDP_LOCAL_IP = "local-ip"
970 DDP_REMOTE_IP = "remote-ip"
972 DDP_LOCAL_MINOR = "local-minor"
973 DDP_REMOTE_MINOR = "remote-minor"
975 # OOB supported commands
976 OOB_POWER_ON = _constants.OOB_POWER_ON
977 OOB_POWER_OFF = _constants.OOB_POWER_OFF
978 OOB_POWER_CYCLE = _constants.OOB_POWER_CYCLE
979 OOB_POWER_STATUS = _constants.OOB_POWER_STATUS
980 OOB_HEALTH = _constants.OOB_HEALTH
981 OOB_COMMANDS = _constants.OOB_COMMANDS
983 OOB_POWER_STATUS_POWERED = _constants.OOB_POWER_STATUS_POWERED
985 OOB_TIMEOUT = _constants.OOB_TIMEOUT
986 OOB_POWER_DELAY = _constants.OOB_POWER_DELAY
988 OOB_STATUS_OK = _constants.OOB_STATUS_OK
989 OOB_STATUS_WARNING = _constants.OOB_STATUS_WARNING
990 OOB_STATUS_CRITICAL = _constants.OOB_STATUS_CRITICAL
991 OOB_STATUS_UNKNOWN = _constants.OOB_STATUS_UNKNOWN
992 OOB_STATUSES = _constants.OOB_STATUSES
994 # Instance Parameters Profile
995 PP_DEFAULT = "default"
997 # NIC_* constants are used inside the ganeti config
998 NIC_MODE = _constants.NIC_MODE
999 NIC_LINK = _constants.NIC_LINK
1000 NIC_VLAN = _constants.NIC_VLAN
1002 NIC_MODE_BRIDGED = _constants.NIC_MODE_BRIDGED
1003 NIC_MODE_ROUTED = _constants.NIC_MODE_ROUTED
1004 NIC_MODE_OVS = _constants.NIC_MODE_OVS
1005 NIC_IP_POOL = _constants.NIC_IP_POOL
1006 NIC_VALID_MODES = _constants.NIC_VALID_MODES
1008 RESERVE_ACTION = "reserve"
1009 RELEASE_ACTION = "release"
1011 NICS_PARAMETER_TYPES = {
1012 NIC_MODE: VTYPE_STRING,
1013 NIC_LINK: VTYPE_STRING,
1014 NIC_VLAN: VTYPE_MAYBE_STRING,
1017 NICS_PARAMETERS = frozenset(NICS_PARAMETER_TYPES.keys())
1019 # IDISK_* constants are used in opcodes, to create/change disks
1021 IDISK_SPINDLES = "spindles"
1023 IDISK_ADOPT = "adopt"
1025 IDISK_METAVG = "metavg"
1026 IDISK_PROVIDER = "provider"
1028 IDISK_PARAMS_TYPES = {
1029 IDISK_SIZE: VTYPE_SIZE,
1030 IDISK_SPINDLES: VTYPE_INT,
1031 IDISK_MODE: VTYPE_STRING,
1032 IDISK_ADOPT: VTYPE_STRING,
1033 IDISK_VG: VTYPE_STRING,
1034 IDISK_METAVG: VTYPE_STRING,
1035 IDISK_PROVIDER: VTYPE_STRING,
1036 IDISK_NAME: VTYPE_MAYBE_STRING,
1038 IDISK_PARAMS = frozenset(IDISK_PARAMS_TYPES.keys())
1040 # INIC_* constants are used in opcodes, to create/change nics
1045 INIC_NETWORK = "network"
1048 INIC_BRIDGE = "bridge"
1049 INIC_PARAMS_TYPES = {
1050 INIC_IP: VTYPE_MAYBE_STRING,
1051 INIC_LINK: VTYPE_STRING,
1052 INIC_MAC: VTYPE_STRING,
1053 INIC_MODE: VTYPE_STRING,
1054 INIC_NETWORK: VTYPE_MAYBE_STRING,
1055 INIC_NAME: VTYPE_MAYBE_STRING,
1056 INIC_VLAN: VTYPE_MAYBE_STRING,
1057 INIC_BRIDGE: VTYPE_MAYBE_STRING
1059 INIC_PARAMS = frozenset(INIC_PARAMS_TYPES.keys())
1061 # Hypervisor constants
1062 HT_XEN_PVM = _constants.HT_XEN_PVM
1063 HT_FAKE = _constants.HT_FAKE
1064 HT_XEN_HVM = _constants.HT_XEN_HVM
1065 HT_KVM = _constants.HT_KVM
1066 HT_CHROOT = _constants.HT_CHROOT
1067 HT_LXC = _constants.HT_LXC
1068 HYPER_TYPES = _constants.HYPER_TYPES
1069 HTS_REQ_PORT = _constants.HTS_REQ_PORT
1071 VNC_BASE_PORT = 5900
1072 VNC_DEFAULT_BIND_ADDRESS = IP4_ADDRESS_ANY
1075 HT_NIC_RTL8139 = "rtl8139"
1076 HT_NIC_NE2K_PCI = "ne2k_pci"
1077 HT_NIC_NE2K_ISA = "ne2k_isa"
1078 HT_NIC_I82551 = "i82551"
1079 HT_NIC_I85557B = "i82557b"
1080 HT_NIC_I8259ER = "i82559er"
1081 HT_NIC_PCNET = "pcnet"
1082 HT_NIC_E1000 = "e1000"
1083 HT_NIC_PARAVIRTUAL = HT_DISK_PARAVIRTUAL = "paravirtual"
1085 HT_HVM_VALID_NIC_TYPES = compat.UniqueFrozenset([
1092 HT_KVM_VALID_NIC_TYPES = compat.UniqueFrozenset([
1105 # default vif type in xen-hvm
1106 HT_HVM_VIF_IOEMU = "ioemu"
1107 HT_HVM_VIF_VIF = "vif"
1108 HT_HVM_VALID_VIF_TYPES = compat.UniqueFrozenset([
1114 HT_DISK_IOEMU = "ioemu"
1116 HT_DISK_SCSI = "scsi"
1119 HT_DISK_PFLASH = "pflash"
1121 HT_CACHE_DEFAULT = "default"
1122 HT_CACHE_NONE = "none"
1123 HT_CACHE_WTHROUGH = "writethrough"
1124 HT_CACHE_WBACK = "writeback"
1125 HT_VALID_CACHE_TYPES = compat.UniqueFrozenset([
1132 HT_HVM_VALID_DISK_TYPES = compat.UniqueFrozenset([
1133 HT_DISK_PARAVIRTUAL,
1136 HT_KVM_VALID_DISK_TYPES = compat.UniqueFrozenset([
1137 HT_DISK_PARAVIRTUAL,
1146 HT_MOUSE_MOUSE = "mouse"
1147 HT_MOUSE_TABLET = "tablet"
1149 HT_KVM_VALID_MOUSE_TYPES = compat.UniqueFrozenset([
1155 HT_BO_FLOPPY = "floppy"
1156 HT_BO_CDROM = "cdrom"
1158 HT_BO_NETWORK = "network"
1160 HT_KVM_VALID_BO_TYPES = compat.UniqueFrozenset([
1167 # SPICE lossless image compression options
1168 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_GLZ = "auto_glz"
1169 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_LZ = "auto_lz"
1170 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_QUIC = "quic"
1171 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_GLZ = "glz"
1172 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_LZ = "lz"
1173 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_OFF = "off"
1175 HT_KVM_SPICE_VALID_LOSSLESS_IMG_COMPR_OPTIONS = compat.UniqueFrozenset([
1176 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_GLZ,
1177 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_LZ,
1178 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_QUIC,
1179 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_GLZ,
1180 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_LZ,
1181 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_OFF,
1184 # SPICE lossy image compression options (valid for both jpeg and zlib-glz)
1185 HT_KVM_SPICE_LOSSY_IMG_COMPR_AUTO = "auto"
1186 HT_KVM_SPICE_LOSSY_IMG_COMPR_NEVER = "never"
1187 HT_KVM_SPICE_LOSSY_IMG_COMPR_ALWAYS = "always"
1189 HT_KVM_SPICE_VALID_LOSSY_IMG_COMPR_OPTIONS = compat.UniqueFrozenset([
1190 HT_KVM_SPICE_LOSSY_IMG_COMPR_AUTO,
1191 HT_KVM_SPICE_LOSSY_IMG_COMPR_NEVER,
1192 HT_KVM_SPICE_LOSSY_IMG_COMPR_ALWAYS,
1195 # SPICE video stream detection
1196 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_OFF = "off"
1197 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_ALL = "all"
1198 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_FILTER = "filter"
1200 HT_KVM_SPICE_VALID_VIDEO_STREAM_DETECTION_OPTIONS = compat.UniqueFrozenset([
1201 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_OFF,
1202 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_ALL,
1203 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_FILTER,
1211 HT_KVM_VALID_SM_TYPES = compat.UniqueFrozenset([
1218 HT_KVM_ENABLED = "enabled"
1219 HT_KVM_DISABLED = "disabled"
1221 HT_KVM_FLAG_VALUES = compat.UniqueFrozenset([HT_KVM_ENABLED, HT_KVM_DISABLED])
1224 HT_MIGRATION_LIVE = _constants.HT_MIGRATION_LIVE
1225 HT_MIGRATION_NONLIVE = _constants.HT_MIGRATION_NONLIVE
1226 HT_MIGRATION_MODES = _constants.HT_MIGRATION_MODES
1228 # Cluster Verify steps
1229 VERIFY_NPLUSONE_MEM = _constants.VERIFY_NPLUSONE_MEM
1230 VERIFY_OPTIONAL_CHECKS = _constants.VERIFY_OPTIONAL_CHECKS
1232 # Cluster Verify error classes
1233 CV_TCLUSTER = _constants.CV_TCLUSTER
1234 CV_TGROUP = _constants.CV_TGROUP
1235 CV_TNODE = _constants.CV_TNODE
1236 CV_TINSTANCE = _constants.CV_TINSTANCE
1238 # Cluster Verify error codes and documentation
1239 CV_ECLUSTERCFG = _constants.CV_ECLUSTERCFG
1240 CV_ECLUSTERCERT = _constants.CV_ECLUSTERCERT
1241 CV_ECLUSTERFILECHECK = _constants.CV_ECLUSTERFILECHECK
1242 CV_ECLUSTERDANGLINGNODES = _constants.CV_ECLUSTERDANGLINGNODES
1243 CV_ECLUSTERDANGLINGINST = _constants.CV_ECLUSTERDANGLINGINST
1244 CV_EGROUPDIFFERENTPVSIZE = _constants.CV_EGROUPDIFFERENTPVSIZE
1245 CV_EINSTANCEBADNODE = _constants.CV_EINSTANCEBADNODE
1246 CV_EINSTANCEDOWN = _constants.CV_EINSTANCEDOWN
1247 CV_EINSTANCELAYOUT = _constants.CV_EINSTANCELAYOUT
1248 CV_EINSTANCEMISSINGDISK = _constants.CV_EINSTANCEMISSINGDISK
1249 CV_EINSTANCEFAULTYDISK = _constants.CV_EINSTANCEFAULTYDISK
1250 CV_EINSTANCEWRONGNODE = _constants.CV_EINSTANCEWRONGNODE
1251 CV_EINSTANCESPLITGROUPS = _constants.CV_EINSTANCESPLITGROUPS
1252 CV_EINSTANCEPOLICY = _constants.CV_EINSTANCEPOLICY
1253 CV_EINSTANCEUNSUITABLENODE = _constants.CV_EINSTANCEUNSUITABLENODE
1254 CV_EINSTANCEMISSINGCFGPARAMETER = _constants.CV_EINSTANCEMISSINGCFGPARAMETER
1255 CV_ENODEDRBD = _constants.CV_ENODEDRBD
1256 CV_ENODEDRBDVERSION = _constants.CV_ENODEDRBDVERSION
1257 CV_ENODEDRBDHELPER = _constants.CV_ENODEDRBDHELPER
1258 CV_ENODEFILECHECK = _constants.CV_ENODEFILECHECK
1259 CV_ENODEHOOKS = _constants.CV_ENODEHOOKS
1260 CV_ENODEHV = _constants.CV_ENODEHV
1261 CV_ENODELVM = _constants.CV_ENODELVM
1262 CV_ENODEN1 = _constants.CV_ENODEN1
1263 CV_ENODENET = _constants.CV_ENODENET
1264 CV_ENODEOS = _constants.CV_ENODEOS
1265 CV_ENODEORPHANINSTANCE = _constants.CV_ENODEORPHANINSTANCE
1266 CV_ENODEORPHANLV = _constants.CV_ENODEORPHANLV
1267 CV_ENODERPC = _constants.CV_ENODERPC
1268 CV_ENODESSH = _constants.CV_ENODESSH
1269 CV_ENODEVERSION = _constants.CV_ENODEVERSION
1270 CV_ENODESETUP = _constants.CV_ENODESETUP
1271 CV_ENODETIME = _constants.CV_ENODETIME
1272 CV_ENODEOOBPATH = _constants.CV_ENODEOOBPATH
1273 CV_ENODEUSERSCRIPTS = _constants.CV_ENODEUSERSCRIPTS
1274 CV_ENODEFILESTORAGEPATHS = _constants.CV_ENODEFILESTORAGEPATHS
1275 CV_ENODEFILESTORAGEPATHUNUSABLE = _constants.CV_ENODEFILESTORAGEPATHUNUSABLE
1276 CV_ENODESHAREDFILESTORAGEPATHUNUSABLE = \
1277 _constants.CV_ENODESHAREDFILESTORAGEPATHUNUSABLE
1279 CV_ALL_ECODES = _constants.CV_ALL_ECODES
1280 CV_ALL_ECODES_STRINGS = _constants.CV_ALL_ECODES_STRINGS
1282 # Node verify constants
1283 NV_BRIDGES = "bridges"
1284 NV_DRBDHELPER = "drbd-helper"
1285 NV_DRBDVERSION = "drbd-version"
1286 NV_DRBDLIST = "drbd-list"
1287 NV_EXCLUSIVEPVS = "exclusive-pvs"
1288 NV_FILELIST = "filelist"
1289 NV_ACCEPTED_STORAGE_PATHS = "allowed-file-storage-paths"
1290 NV_FILE_STORAGE_PATH = "file-storage-path"
1291 NV_SHARED_FILE_STORAGE_PATH = "shared-file-storage-path"
1292 NV_HVINFO = "hvinfo"
1293 NV_HVPARAMS = "hvparms"
1294 NV_HYPERVISOR = "hypervisor"
1295 NV_INSTANCELIST = "instancelist"
1296 NV_LVLIST = "lvlist"
1297 NV_MASTERIP = "master-ip"
1298 NV_NODELIST = "nodelist"
1299 NV_NODENETTEST = "node-net-test"
1300 NV_NODESETUP = "nodesetup"
1301 NV_OOB_PATHS = "oob-paths"
1302 NV_OSLIST = "oslist"
1303 NV_PVLIST = "pvlist"
1305 NV_USERSCRIPTS = "user-scripts"
1306 NV_VERSION = "version"
1307 NV_VGLIST = "vglist"
1308 NV_VMNODES = "vmnodes"
1311 INSTST_RUNNING = _constants.INSTST_RUNNING
1312 INSTST_ADMINDOWN = _constants.INSTST_ADMINDOWN
1313 INSTST_ADMINOFFLINE = _constants.INSTST_ADMINOFFLINE
1314 INSTST_NODEOFFLINE = _constants.INSTST_NODEOFFLINE
1315 INSTST_NODEDOWN = _constants.INSTST_NODEDOWN
1316 INSTST_WRONGNODE = _constants.INSTST_WRONGNODE
1317 INSTST_ERRORUP = _constants.INSTST_ERRORUP
1318 INSTST_ERRORDOWN = _constants.INSTST_ERRORDOWN
1319 INSTST_ALL = _constants.INSTST_ALL
1322 ADMINST_UP = _constants.ADMINST_UP
1323 ADMINST_DOWN = _constants.ADMINST_DOWN
1324 ADMINST_OFFLINE = _constants.ADMINST_OFFLINE
1325 ADMINST_ALL = _constants.ADMINST_ALL
1328 NR_REGULAR = _constants.NR_REGULAR
1329 NR_MASTER = _constants.NR_MASTER
1330 NR_MCANDIDATE = _constants.NR_MCANDIDATE
1331 NR_DRAINED = _constants.NR_DRAINED
1332 NR_OFFLINE = _constants.NR_OFFLINE
1333 NR_ALL = _constants.NR_ALL
1335 # SSL certificate check constants (in days)
1336 SSL_CERT_EXPIRATION_WARN = 30
1337 SSL_CERT_EXPIRATION_ERROR = 7
1339 # Allocator framework constants
1340 IALLOCATOR_VERSION = _constants.IALLOCATOR_VERSION
1341 IALLOCATOR_DIR_IN = _constants.IALLOCATOR_DIR_IN
1342 IALLOCATOR_DIR_OUT = _constants.IALLOCATOR_DIR_OUT
1343 VALID_IALLOCATOR_DIRECTIONS = _constants.VALID_IALLOCATOR_DIRECTIONS
1345 IALLOCATOR_MODE_ALLOC = _constants.IALLOCATOR_MODE_ALLOC
1346 IALLOCATOR_MODE_RELOC = _constants.IALLOCATOR_MODE_RELOC
1347 IALLOCATOR_MODE_CHG_GROUP = _constants.IALLOCATOR_MODE_CHG_GROUP
1348 IALLOCATOR_MODE_NODE_EVAC = _constants.IALLOCATOR_MODE_NODE_EVAC
1349 IALLOCATOR_MODE_MULTI_ALLOC = _constants.IALLOCATOR_MODE_MULTI_ALLOC
1350 VALID_IALLOCATOR_MODES = _constants.VALID_IALLOCATOR_MODES
1352 IALLOCATOR_SEARCH_PATH = _constants.IALLOCATOR_SEARCH_PATH
1353 DEFAULT_IALLOCATOR_SHORTCUT = _constants.DEFAULT_IALLOCATOR_SHORTCUT
1356 NODE_EVAC_PRI = _constants.NODE_EVAC_PRI
1357 NODE_EVAC_SEC = _constants.NODE_EVAC_SEC
1358 NODE_EVAC_ALL = _constants.NODE_EVAC_ALL
1359 NODE_EVAC_MODES = _constants.NODE_EVAC_MODES
1362 JOB_QUEUE_VERSION = 1
1363 JOB_QUEUE_SIZE_HARD_LIMIT = 5000
1364 JOB_QUEUE_FILES_PERMS = 0640
1366 JOB_ID_TEMPLATE = r"\d+"
1367 JOB_FILE_RE = re.compile(r"^job-(%s)$" % JOB_ID_TEMPLATE)
1369 # unchanged job return
1370 JOB_NOTCHANGED = "nochange"
1373 JOB_STATUS_QUEUED = _constants.JOB_STATUS_QUEUED
1374 JOB_STATUS_WAITING = _constants.JOB_STATUS_WAITING
1375 JOB_STATUS_CANCELING = _constants.JOB_STATUS_CANCELING
1376 JOB_STATUS_RUNNING = _constants.JOB_STATUS_RUNNING
1377 JOB_STATUS_CANCELED = _constants.JOB_STATUS_CANCELED
1378 JOB_STATUS_SUCCESS = _constants.JOB_STATUS_SUCCESS
1379 JOB_STATUS_ERROR = _constants.JOB_STATUS_ERROR
1380 JOBS_PENDING = _constants.JOBS_PENDING
1381 JOBS_FINALIZED = _constants.JOBS_FINALIZED
1382 JOB_STATUS_ALL = _constants.JOB_STATUS_ALL
1386 OP_STATUS_QUEUED = _constants.OP_STATUS_QUEUED
1387 OP_STATUS_WAITING = _constants.OP_STATUS_WAITING
1388 OP_STATUS_CANCELING = _constants.OP_STATUS_CANCELING
1389 OP_STATUS_RUNNING = _constants.OP_STATUS_RUNNING
1391 OP_STATUS_CANCELED = _constants.OP_STATUS_CANCELED
1392 OP_STATUS_SUCCESS = _constants.OP_STATUS_SUCCESS
1393 OP_STATUS_ERROR = _constants.OP_STATUS_ERROR
1394 OPS_FINALIZED = _constants.OPS_FINALIZED
1397 OP_PRIO_LOWEST = _constants.OP_PRIO_LOWEST
1398 OP_PRIO_HIGHEST = _constants.OP_PRIO_HIGHEST
1399 OP_PRIO_LOW = _constants.OP_PRIO_LOW
1400 OP_PRIO_NORMAL = _constants.OP_PRIO_NORMAL
1401 OP_PRIO_HIGH = _constants.OP_PRIO_HIGH
1402 OP_PRIO_SUBMIT_VALID = _constants.OP_PRIO_SUBMIT_VALID
1403 OP_PRIO_DEFAULT = _constants.OP_PRIO_DEFAULT
1405 # Lock recalculate mode
1406 LOCKS_REPLACE = "replace"
1407 LOCKS_APPEND = "append"
1409 # Lock timeout (sum) before we should go into blocking acquire (still
1410 # can be reset by priority change); computed as max time (10 hours)
1411 # before we should actually go into blocking acquire given that we
1412 # start from default priority level; in seconds
1414 LOCK_ATTEMPTS_TIMEOUT = 10 * 3600 / (OP_PRIO_DEFAULT - OP_PRIO_HIGHEST)
1415 LOCK_ATTEMPTS_MAXWAIT = 15.0
1416 LOCK_ATTEMPTS_MINWAIT = 1.0
1418 # Execution log types
1419 ELOG_MESSAGE = _constants.ELOG_MESSAGE
1420 ELOG_REMOTE_IMPORT = _constants.ELOG_REMOTE_IMPORT
1421 ELOG_JQUEUE_TEST = _constants.ELOG_JQUEUE_TEST
1423 # /etc/hosts modification
1424 ETC_HOSTS_ADD = "add"
1425 ETC_HOSTS_REMOVE = "remove"
1428 JQT_MSGPREFIX = "TESTMSG="
1429 JQT_EXPANDNAMES = "expandnames"
1431 JQT_LOGMSG = "logmsg"
1432 JQT_STARTMSG = "startmsg"
1433 JQT_ALL = compat.UniqueFrozenset([
1441 QR_CLUSTER = "cluster"
1442 QR_INSTANCE = "instance"
1448 QR_EXPORT = "export"
1449 QR_NETWORK = "network"
1450 QR_EXTSTORAGE = "extstorage"
1452 #: List of resources which can be queried using L{opcodes.OpQuery}
1453 QR_VIA_OP = compat.UniqueFrozenset([
1464 #: List of resources which can be queried using Local UniX Interface
1465 QR_VIA_LUXI = QR_VIA_OP.union([
1470 #: List of resources which can be queried using RAPI
1471 QR_VIA_RAPI = QR_VIA_LUXI
1474 QFT_UNKNOWN = "unknown"
1477 QFT_NUMBER = "number"
1479 QFT_TIMESTAMP = "timestamp"
1482 #: All query field types
1483 QFT_ALL = compat.UniqueFrozenset([
1493 # Query result field status (don't change or reuse values as they're used by
1495 #: Normal field status
1499 #: No data (e.g. RPC error), can be used instead of L{RS_OFFLINE}
1501 #: Value unavailable/unsupported for item; if this field is supported
1502 #: but we cannot get the data for the moment, RS_NODATA or
1503 #: RS_OFFLINE should be used
1505 #: Resource marked offline
1508 RS_ALL = compat.UniqueFrozenset([
1516 #: Dictionary with special field cases and their verbose/terse formatting
1518 RS_UNKNOWN: ("(unknown)", "??"),
1519 RS_NODATA: ("(nodata)", "?"),
1520 RS_OFFLINE: ("(offline)", "*"),
1521 RS_UNAVAIL: ("(unavail)", "-"),
1524 # max dynamic devices
1528 # SSCONF file prefix
1529 SSCONF_FILEPREFIX = "ssconf_"
1531 SS_CLUSTER_NAME = "cluster_name"
1532 SS_CLUSTER_TAGS = "cluster_tags"
1533 SS_FILE_STORAGE_DIR = "file_storage_dir"
1534 SS_SHARED_FILE_STORAGE_DIR = "shared_file_storage_dir"
1535 SS_MASTER_CANDIDATES = "master_candidates"
1536 SS_MASTER_CANDIDATES_IPS = "master_candidates_ips"
1537 SS_MASTER_IP = "master_ip"
1538 SS_MASTER_NETDEV = "master_netdev"
1539 SS_MASTER_NETMASK = "master_netmask"
1540 SS_MASTER_NODE = "master_node"
1541 SS_NODE_LIST = "node_list"
1542 SS_NODE_PRIMARY_IPS = "node_primary_ips"
1543 SS_NODE_SECONDARY_IPS = "node_secondary_ips"
1544 SS_OFFLINE_NODES = "offline_nodes"
1545 SS_ONLINE_NODES = "online_nodes"
1546 SS_PRIMARY_IP_FAMILY = "primary_ip_family"
1547 SS_INSTANCE_LIST = "instance_list"
1548 SS_RELEASE_VERSION = "release_version"
1549 SS_HYPERVISOR_LIST = "hypervisor_list"
1550 SS_MAINTAIN_NODE_HEALTH = "maintain_node_health"
1551 SS_UID_POOL = "uid_pool"
1552 SS_NODEGROUPS = "nodegroups"
1553 SS_NETWORKS = "networks"
1555 # This is not a complete SSCONF key, but the prefix for the hypervisor keys
1556 SS_HVPARAMS_PREF = "hvparams_"
1559 SS_HVPARAMS_XEN_PVM = SS_HVPARAMS_PREF + HT_XEN_PVM
1560 SS_HVPARAMS_XEN_FAKE = SS_HVPARAMS_PREF + HT_FAKE
1561 SS_HVPARAMS_XEN_HVM = SS_HVPARAMS_PREF + HT_XEN_HVM
1562 SS_HVPARAMS_XEN_KVM = SS_HVPARAMS_PREF + HT_KVM
1563 SS_HVPARAMS_XEN_CHROOT = SS_HVPARAMS_PREF + HT_CHROOT
1564 SS_HVPARAMS_XEN_LXC = SS_HVPARAMS_PREF + HT_LXC
1566 VALID_SS_HVPARAMS_KEYS = compat.UniqueFrozenset([
1567 SS_HVPARAMS_XEN_PVM,
1568 SS_HVPARAMS_XEN_FAKE,
1569 SS_HVPARAMS_XEN_HVM,
1570 SS_HVPARAMS_XEN_KVM,
1571 SS_HVPARAMS_XEN_CHROOT,
1572 SS_HVPARAMS_XEN_LXC,
1575 SS_FILE_PERMS = 0444
1577 # cluster wide default parameters
1578 DEFAULT_ENABLED_HYPERVISOR = HT_XEN_PVM
1582 HV_USE_BOOTLOADER: False,
1583 HV_BOOTLOADER_PATH: XEN_BOOTLOADER,
1584 HV_BOOTLOADER_ARGS: "",
1585 HV_KERNEL_PATH: XEN_KERNEL,
1587 HV_ROOT_PATH: "/dev/xvda1",
1588 HV_KERNEL_ARGS: "ro",
1589 HV_MIGRATION_PORT: 8002,
1590 HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1591 HV_BLOCKDEV_PREFIX: "sd",
1592 HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1593 HV_CPU_MASK: CPU_PINNING_ALL,
1597 HV_XEN_CMD: XEN_CMD_XM,
1602 HV_BOOT_ORDER: "cd",
1603 HV_CDROM_IMAGE_PATH: "",
1604 HV_NIC_TYPE: HT_NIC_RTL8139,
1605 HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
1606 HV_VNC_BIND_ADDRESS: IP4_ADDRESS_ANY,
1607 HV_VNC_PASSWORD_FILE: pathutils.VNC_PASSWORD_FILE,
1610 HV_KERNEL_PATH: "/usr/lib/xen/boot/hvmloader",
1611 HV_DEVICE_MODEL: "/usr/lib/xen/bin/qemu-dm",
1612 HV_MIGRATION_PORT: 8002,
1613 HV_MIGRATION_MODE: HT_MIGRATION_NONLIVE,
1614 HV_USE_LOCALTIME: False,
1615 HV_BLOCKDEV_PREFIX: "hd",
1617 HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1618 HV_CPU_MASK: CPU_PINNING_ALL,
1621 HV_VIF_TYPE: HT_HVM_VIF_IOEMU,
1624 HV_XEN_CMD: XEN_CMD_XM,
1629 HV_KVM_PATH: KVM_PATH,
1630 HV_KERNEL_PATH: KVM_KERNEL,
1632 HV_KERNEL_ARGS: "ro",
1633 HV_ROOT_PATH: "/dev/vda1",
1635 HV_SERIAL_CONSOLE: True,
1636 HV_SERIAL_SPEED: 38400,
1637 HV_VNC_BIND_ADDRESS: "",
1640 HV_VNC_X509_VERIFY: False,
1641 HV_VNC_PASSWORD_FILE: "",
1642 HV_KVM_SPICE_BIND: "",
1643 HV_KVM_SPICE_IP_VERSION: IFACE_NO_IP_VERSION_SPECIFIED,
1644 HV_KVM_SPICE_PASSWORD_FILE: "",
1645 HV_KVM_SPICE_LOSSLESS_IMG_COMPR: "",
1646 HV_KVM_SPICE_JPEG_IMG_COMPR: "",
1647 HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR: "",
1648 HV_KVM_SPICE_STREAMING_VIDEO_DETECTION: "",
1649 HV_KVM_SPICE_AUDIO_COMPR: True,
1650 HV_KVM_SPICE_USE_TLS: False,
1651 HV_KVM_SPICE_TLS_CIPHERS: OPENSSL_CIPHERS,
1652 HV_KVM_SPICE_USE_VDAGENT: True,
1653 HV_KVM_FLOPPY_IMAGE_PATH: "",
1654 HV_CDROM_IMAGE_PATH: "",
1655 HV_KVM_CDROM2_IMAGE_PATH: "",
1656 HV_BOOT_ORDER: HT_BO_DISK,
1657 HV_NIC_TYPE: HT_NIC_PARAVIRTUAL,
1658 HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
1659 HV_KVM_CDROM_DISK_TYPE: "",
1662 HV_MIGRATION_PORT: 8102,
1663 HV_MIGRATION_BANDWIDTH: 32, # MiB/s
1664 HV_MIGRATION_DOWNTIME: 30, # ms
1665 HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1666 HV_USE_LOCALTIME: False,
1667 HV_DISK_CACHE: HT_CACHE_DEFAULT,
1668 HV_SECURITY_MODEL: HT_SM_NONE,
1669 HV_SECURITY_DOMAIN: "",
1671 HV_VHOST_NET: False,
1672 HV_KVM_USE_CHROOT: False,
1674 HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1675 HV_CPU_MASK: CPU_PINNING_ALL,
1684 HV_KVM_MACHINE_VERSION: "",
1688 HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1691 HV_INIT_SCRIPT: "/ganeti-chroot",
1698 HVC_GLOBALS = compat.UniqueFrozenset([
1700 HV_MIGRATION_BANDWIDTH,
1709 BE_AUTO_BALANCE: True,
1710 BE_ALWAYS_FAILOVER: False,
1716 ND_SPINDLE_COUNT: 1,
1717 ND_EXCLUSIVE_STORAGE: False,
1719 ND_OVS_NAME: DEFAULT_OVS,
1723 NDC_GLOBALS = compat.UniqueFrozenset([
1724 ND_EXCLUSIVE_STORAGE,
1727 DISK_LD_DEFAULTS = {
1729 LDP_RESYNC_RATE: CLASSIC_DRBD_SYNC_SPEED,
1730 LDP_BARRIERS: _constants.DRBD_BARRIERS,
1731 LDP_NO_META_FLUSH: _constants.DRBD_NO_META_FLUSH,
1732 LDP_DEFAULT_METAVG: DEFAULT_VG,
1733 LDP_DISK_CUSTOM: "",
1735 LDP_PROTOCOL: DRBD_DEFAULT_NET_PROTOCOL,
1736 LDP_DYNAMIC_RESYNC: False,
1738 # The default values for the DRBD dynamic resync speed algorithm
1739 # are taken from the drbsetup 8.3.11 man page, except for
1740 # c-plan-ahead (that we don't need to set to 0, because we have a
1741 # separate option to enable it) and for c-max-rate, that we cap to
1742 # the default value for the static resync rate.
1743 LDP_PLAN_AHEAD: 20, # ds
1744 LDP_FILL_TARGET: 0, # sectors
1745 LDP_DELAY_TARGET: 1, # ds
1746 LDP_MAX_RATE: CLASSIC_DRBD_SYNC_SPEED, # KiB/s
1747 LDP_MIN_RATE: 4 * 1024, # KiB/s
1750 LDP_STRIPES: _constants.LVM_STRIPECOUNT
1757 LDP_ACCESS: DISK_KERNELSPACE,
1762 # readability shortcuts
1763 _LV_DEFAULTS = DISK_LD_DEFAULTS[DT_PLAIN]
1764 _DRBD_DEFAULTS = DISK_LD_DEFAULTS[DT_DRBD8]
1766 DISK_DT_DEFAULTS = {
1768 LV_STRIPES: DISK_LD_DEFAULTS[DT_PLAIN][LDP_STRIPES],
1771 DRBD_RESYNC_RATE: _DRBD_DEFAULTS[LDP_RESYNC_RATE],
1772 DRBD_DATA_STRIPES: _LV_DEFAULTS[LDP_STRIPES],
1773 DRBD_META_STRIPES: _LV_DEFAULTS[LDP_STRIPES],
1774 DRBD_DISK_BARRIERS: _DRBD_DEFAULTS[LDP_BARRIERS],
1775 DRBD_META_BARRIERS: _DRBD_DEFAULTS[LDP_NO_META_FLUSH],
1776 DRBD_DEFAULT_METAVG: _DRBD_DEFAULTS[LDP_DEFAULT_METAVG],
1777 DRBD_DISK_CUSTOM: _DRBD_DEFAULTS[LDP_DISK_CUSTOM],
1778 DRBD_NET_CUSTOM: _DRBD_DEFAULTS[LDP_NET_CUSTOM],
1779 DRBD_PROTOCOL: _DRBD_DEFAULTS[LDP_PROTOCOL],
1780 DRBD_DYNAMIC_RESYNC: _DRBD_DEFAULTS[LDP_DYNAMIC_RESYNC],
1781 DRBD_PLAN_AHEAD: _DRBD_DEFAULTS[LDP_PLAN_AHEAD],
1782 DRBD_FILL_TARGET: _DRBD_DEFAULTS[LDP_FILL_TARGET],
1783 DRBD_DELAY_TARGET: _DRBD_DEFAULTS[LDP_DELAY_TARGET],
1784 DRBD_MAX_RATE: _DRBD_DEFAULTS[LDP_MAX_RATE],
1785 DRBD_MIN_RATE: _DRBD_DEFAULTS[LDP_MIN_RATE],
1792 RBD_POOL: DISK_LD_DEFAULTS[DT_RBD][LDP_POOL],
1793 RBD_ACCESS: DISK_LD_DEFAULTS[DT_RBD][LDP_ACCESS],
1798 # we don't want to export the shortcuts
1799 del _LV_DEFAULTS, _DRBD_DEFAULTS
1802 NIC_MODE: NIC_MODE_BRIDGED,
1803 NIC_LINK: DEFAULT_BRIDGE,
1804 NIC_VLAN: VALUE_HS_NOTHING,
1807 # All of the following values are quite arbitrarily - there are no
1808 # "good" defaults, these must be customised per-site
1809 ISPECS_MINMAX_DEFAULTS = {
1811 ISPEC_MEM_SIZE: 128,
1813 ISPEC_DISK_COUNT: 1,
1814 ISPEC_DISK_SIZE: 1024,
1816 ISPEC_SPINDLE_USE: 1,
1819 ISPEC_MEM_SIZE: 32768,
1821 ISPEC_DISK_COUNT: MAX_DISKS,
1822 ISPEC_DISK_SIZE: 1024 * 1024,
1823 ISPEC_NIC_COUNT: MAX_NICS,
1824 ISPEC_SPINDLE_USE: 12,
1827 IPOLICY_DEFAULTS = {
1828 ISPECS_MINMAX: [ISPECS_MINMAX_DEFAULTS],
1830 ISPEC_MEM_SIZE: 128,
1832 ISPEC_DISK_COUNT: 1,
1833 ISPEC_DISK_SIZE: 1024,
1835 ISPEC_SPINDLE_USE: 1,
1837 IPOLICY_DTS: list(DISK_TEMPLATES),
1838 IPOLICY_VCPU_RATIO: 4.0,
1839 IPOLICY_SPINDLE_RATIO: 32.0,
1842 MASTER_POOL_SIZE_DEFAULT = 10
1844 # Exclusive storage:
1845 # Error margin used to compare physical disks
1847 # Space reserved when creating instance disks
1850 CONFD_PROTOCOL_VERSION = _constants.CONFD_PROTOCOL_VERSION
1852 CONFD_REQ_PING = _constants.CONFD_REQ_PING
1853 CONFD_REQ_NODE_ROLE_BYNAME = _constants.CONFD_REQ_NODE_ROLE_BYNAME
1854 CONFD_REQ_NODE_PIP_BY_INSTANCE_IP = _constants.CONFD_REQ_NODE_PIP_BY_INSTANCE_IP
1855 CONFD_REQ_CLUSTER_MASTER = _constants.CONFD_REQ_CLUSTER_MASTER
1856 CONFD_REQ_NODE_PIP_LIST = _constants.CONFD_REQ_NODE_PIP_LIST
1857 CONFD_REQ_MC_PIP_LIST = _constants.CONFD_REQ_MC_PIP_LIST
1858 CONFD_REQ_INSTANCES_IPS_LIST = _constants.CONFD_REQ_INSTANCES_IPS_LIST
1859 CONFD_REQ_NODE_DRBD = _constants.CONFD_REQ_NODE_DRBD
1860 CONFD_REQ_NODE_INSTANCES = _constants.CONFD_REQ_NODE_INSTANCES
1861 CONFD_REQS = _constants.CONFD_REQS
1863 # Confd request query fields. These are used to narrow down queries.
1864 # These must be strings rather than integers, because json-encoding
1865 # converts them to strings anyway, as they're used as dict-keys.
1866 CONFD_REQQ_LINK = _constants.CONFD_REQQ_LINK
1867 CONFD_REQQ_IP = _constants.CONFD_REQQ_IP
1868 CONFD_REQQ_IPLIST = _constants.CONFD_REQQ_IPLIST
1869 CONFD_REQQ_FIELDS = _constants.CONFD_REQQ_FIELDS
1871 # FIXME: perhaps update code that uses these constants to deal with
1872 # integers instead of strings
1873 CONFD_REQFIELD_NAME = str(_constants.CONFD_REQFIELD_NAME)
1874 CONFD_REQFIELD_IP = str(_constants.CONFD_REQFIELD_IP)
1875 CONFD_REQFIELD_MNODE_PIP = str(_constants.CONFD_REQFIELD_MNODE_PIP)
1877 CONFD_REPL_STATUS_OK = _constants.CONFD_REPL_STATUS_OK
1878 CONFD_REPL_STATUS_ERROR = _constants.CONFD_REPL_STATUS_ERROR
1879 CONFD_REPL_STATUS_NOTIMPLEMENTED = _constants.CONFD_REPL_STATUS_NOTIMPLEMENTED
1880 CONFD_REPL_STATUSES = _constants.CONFD_REPL_STATUSES
1882 CONFD_NODE_ROLE_MASTER = _constants.CONFD_NODE_ROLE_MASTER
1883 CONFD_NODE_ROLE_CANDIDATE = _constants.CONFD_NODE_ROLE_CANDIDATE
1884 CONFD_NODE_ROLE_OFFLINE = _constants.CONFD_NODE_ROLE_OFFLINE
1885 CONFD_NODE_ROLE_DRAINED = _constants.CONFD_NODE_ROLE_DRAINED
1886 CONFD_NODE_ROLE_REGULAR = _constants.CONFD_NODE_ROLE_REGULAR
1888 CONFD_ERROR_UNKNOWN_ENTRY = _constants.CONFD_ERROR_UNKNOWN_ENTRY
1889 CONFD_ERROR_INTERNAL = _constants.CONFD_ERROR_INTERNAL
1890 CONFD_ERROR_ARGUMENT = _constants.CONFD_ERROR_ARGUMENT
1892 # Each request is "salted" by the current timestamp.
1893 # This constants decides how many seconds of skew to accept.
1894 # TODO: make this a default and allow the value to be more configurable
1895 CONFD_MAX_CLOCK_SKEW = _constants.CONFD_MAX_CLOCK_SKEW
1897 # When we haven't reloaded the config for more than this amount of
1898 # seconds, we force a test to see if inotify is betraying us. Using a
1899 # prime number to ensure we get less chance of 'same wakeup' with
1901 CONFD_CONFIG_RELOAD_TIMEOUT = _constants.CONFD_CONFIG_RELOAD_TIMEOUT
1903 # If we receive more than one update in this amount of microseconds,
1904 # we move to polling every RATELIMIT seconds, rather than relying on
1905 # inotify, to be able to serve more requests.
1906 CONFD_CONFIG_RELOAD_RATELIMIT = _constants.CONFD_CONFIG_RELOAD_RATELIMIT
1908 # Magic number prepended to all confd queries.
1909 # This allows us to distinguish different types of confd protocols and handle
1910 # them. For example by changing this we can move the whole payload to be
1911 # compressed, or move away from json.
1912 CONFD_MAGIC_FOURCC = _constants.CONFD_MAGIC_FOURCC
1914 # By default a confd request is sent to the minimum between this number and all
1915 # MCs. 6 was chosen because even in the case of a disastrous 50% response rate,
1916 # we should have enough answers to be able to compare more than one.
1917 CONFD_DEFAULT_REQ_COVERAGE = _constants.CONFD_DEFAULT_REQ_COVERAGE
1919 # Timeout in seconds to expire pending query request in the confd client
1920 # library. We don't actually expect any answer more than 10 seconds after we
1922 CONFD_CLIENT_EXPIRE_TIMEOUT = _constants.CONFD_CLIENT_EXPIRE_TIMEOUT
1924 # Maximum UDP datagram size.
1925 # On IPv4: 64K - 20 (ip header size) - 8 (udp header size) = 65507
1926 # On IPv6: 64K - 40 (ip6 header size) - 8 (udp header size) = 65487
1927 # (assuming we can't use jumbo frames)
1928 # We just set this to 60K, which should be enough
1929 MAX_UDP_DATA_SIZE = 61440
1931 # User-id pool minimum/maximum acceptable user-ids.
1933 UIDPOOL_UID_MAX = 2 ** 32 - 1 # Assuming 32 bit user-ids
1935 # Name or path of the pgrep command
1938 # Name of the node group that gets created at cluster init or upgrade
1939 INITIAL_NODE_GROUP_NAME = "default"
1941 # Possible values for NodeGroup.alloc_policy
1942 ALLOC_POLICY_PREFERRED = _constants.ALLOC_POLICY_PREFERRED
1943 ALLOC_POLICY_LAST_RESORT = _constants.ALLOC_POLICY_LAST_RESORT
1944 ALLOC_POLICY_UNALLOCABLE = _constants.ALLOC_POLICY_UNALLOCABLE
1945 VALID_ALLOC_POLICIES = _constants.VALID_ALLOC_POLICIES
1947 # Temporary external/shared storage parameters
1948 BLOCKDEV_DRIVER_MANUAL = _constants.BLOCKDEV_DRIVER_MANUAL
1950 # qemu-img path, required for ovfconverter
1951 QEMUIMG_PATH = _constants.QEMUIMG_PATH
1953 # Whether htools was enabled at compilation time
1954 HTOOLS = _constants.HTOOLS
1955 # The hail iallocator
1956 IALLOC_HAIL = "hail"
1958 # Fake opcodes for functions that have hooks attached to them via
1959 # backend.RunLocalHooks
1960 FAKE_OP_MASTER_TURNUP = "OP_CLUSTER_IP_TURNUP"
1961 FAKE_OP_MASTER_TURNDOWN = "OP_CLUSTER_IP_TURNDOWN"
1966 SSHK_ALL = compat.UniqueFrozenset([SSHK_RSA, SSHK_DSA])
1968 # SSH authorized key types
1969 SSHAK_RSA = "ssh-rsa"
1970 SSHAK_DSS = "ssh-dss"
1971 SSHAK_ALL = compat.UniqueFrozenset([SSHAK_RSA, SSHAK_DSS])
1974 SSHS_CLUSTER_NAME = "cluster_name"
1975 SSHS_SSH_HOST_KEY = "ssh_host_key"
1976 SSHS_SSH_ROOT_KEY = "ssh_root_key"
1977 SSHS_NODE_DAEMON_CERTIFICATE = "node_daemon_certificate"
1979 #: Key files for SSH daemon
1980 SSH_DAEMON_KEYFILES = {
1981 SSHK_RSA: (pathutils.SSH_HOST_RSA_PRIV, pathutils.SSH_HOST_RSA_PUB),
1982 SSHK_DSA: (pathutils.SSH_HOST_DSA_PRIV, pathutils.SSH_HOST_DSA_PUB),
1986 NDS_CLUSTER_NAME = "cluster_name"
1987 NDS_NODE_DAEMON_CERTIFICATE = "node_daemon_certificate"
1988 NDS_SSCONF = "ssconf"
1989 NDS_START_NODE_DAEMON = "start_node_daemon"
1991 # Path generating random UUID
1992 RANDOM_UUID_FILE = _constants.RANDOM_UUID_FILE
1994 # Regex string for verifying a UUID
1995 UUID_REGEX = "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"
1997 # Auto-repair tag prefixes
1998 AUTO_REPAIR_TAG_PREFIX = _constants.AUTO_REPAIR_TAG_PREFIX
1999 AUTO_REPAIR_TAG_ENABLED = _constants.AUTO_REPAIR_TAG_ENABLED
2000 AUTO_REPAIR_TAG_SUSPENDED = _constants.AUTO_REPAIR_TAG_SUSPENDED
2001 AUTO_REPAIR_TAG_PENDING = _constants.AUTO_REPAIR_TAG_PENDING
2002 AUTO_REPAIR_TAG_RESULT = _constants.AUTO_REPAIR_TAG_RESULT
2004 # Auto-repair levels
2005 AUTO_REPAIR_FIX_STORAGE = _constants.AUTO_REPAIR_FIX_STORAGE
2006 AUTO_REPAIR_MIGRATE = _constants.AUTO_REPAIR_MIGRATE
2007 AUTO_REPAIR_FAILOVER = _constants.AUTO_REPAIR_FAILOVER
2008 AUTO_REPAIR_REINSTALL = _constants.AUTO_REPAIR_REINSTALL
2009 AUTO_REPAIR_ALL_TYPES = _constants.AUTO_REPAIR_ALL_TYPES
2011 # Auto-repair results
2012 AUTO_REPAIR_SUCCESS = _constants.AUTO_REPAIR_SUCCESS
2013 AUTO_REPAIR_FAILURE = _constants.AUTO_REPAIR_FAILURE
2014 AUTO_REPAIR_ENOPERM = _constants.AUTO_REPAIR_ENOPERM
2015 AUTO_REPAIR_ALL_RESULTS = _constants.AUTO_REPAIR_ALL_RESULTS
2017 # The version identifier for builtin data collectors
2018 BUILTIN_DATA_COLLECTOR_VERSION = _constants.BUILTIN_DATA_COLLECTOR_VERSION
2020 # The reason trail opcode parameter name
2021 OPCODE_REASON = _constants.OPCODE_REASON
2023 # The source reasons for the execution of an OpCode
2024 OPCODE_REASON_SRC_CLIENT = "gnt:client"
2025 OPCODE_REASON_SRC_NODED = "gnt:daemon:noded"
2026 OPCODE_REASON_SRC_OPCODE = "gnt:opcode"
2027 OPCODE_REASON_SRC_RLIB2 = "gnt:library:rlib2"
2028 OPCODE_REASON_SRC_USER = "gnt:user"
2030 OPCODE_REASON_SOURCES = compat.UniqueFrozenset([
2031 OPCODE_REASON_SRC_CLIENT,
2032 OPCODE_REASON_SRC_NODED,
2033 OPCODE_REASON_SRC_OPCODE,
2034 OPCODE_REASON_SRC_RLIB2,
2035 OPCODE_REASON_SRC_USER,
2038 DISKSTATS_FILE = _constants.DISKSTATS_FILE
2040 # CPU load collector variables
2041 STAT_FILE = _constants.STAT_FILE
2042 CPUAVGLOAD_BUFFER_SIZE = _constants.CPUAVGLOAD_BUFFER_SIZE
2043 CPUAVGLOAD_WINDOW_SIZE = _constants.CPUAVGLOAD_WINDOW_SIZE
2045 # Mond's variable for periodical data collection
2046 MOND_TIME_INTERVAL = _constants.MOND_TIME_INTERVAL
2048 # MonD's latest API version
2049 MOND_LATEST_API_VERSION = 1
2051 # Timeouts for upgrades
2053 UPGRADE_QUEUE_DRAIN_TIMEOUT = _constants.UPGRADE_QUEUE_DRAIN_TIMEOUT
2054 UPGRADE_QUEUE_POLL_INTERVAL = _constants.UPGRADE_QUEUE_POLL_INTERVAL
2056 # Do not re-export imported modules
2057 del re, _vcsversion, _constants, socket, pathutils, compat
2060 ALLOCATABLE_KEY = "allocatable"
2061 FAILED_KEY = "failed"