4 # Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 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."""
26 from ganeti import _autoconf
27 from ganeti import _vcsversion
30 RELEASE_VERSION = _autoconf.PACKAGE_VERSION
34 OS_API_VERSIONS = frozenset([OS_API_V10, OS_API_V15, OS_API_V20])
35 VCS_VERSION = _vcsversion.VCS_VERSION
40 # Format for CONFIG_VERSION:
41 # 01 03 0123 = 01030123
43 # | | + Configuration version/revision
47 # It stored as an integer. Make sure not to write an octal number.
49 # BuildVersion and SplitVersion must be in here because we can't import other
50 # modules. The cfgupgrade tool must be able to read and write version numbers
51 # and thus requires these functions. To avoid code duplication, they're kept in
54 def BuildVersion(major, minor, revision):
55 """Calculates int version number from major, minor and revision numbers.
57 Returns: int representing version number
60 assert isinstance(major, int)
61 assert isinstance(minor, int)
62 assert isinstance(revision, int)
63 return (1000000 * major +
68 def SplitVersion(version):
69 """Splits version number stored in an int.
71 Returns: tuple; (major, minor, revision)
74 assert isinstance(version, int)
76 (major, remainder) = divmod(version, 1000000)
77 (minor, revision) = divmod(remainder, 10000)
79 return (major, minor, revision)
82 CONFIG_MAJOR = int(_autoconf.VERSION_MAJOR)
83 CONFIG_MINOR = int(_autoconf.VERSION_MINOR)
85 CONFIG_VERSION = BuildVersion(CONFIG_MAJOR, CONFIG_MINOR, CONFIG_REVISION)
87 #: RPC protocol version
88 PROTOCOL_VERSION = BuildVersion(CONFIG_MAJOR, CONFIG_MINOR, 0)
91 DAEMONS_GROUP = _autoconf.DAEMONS_GROUP
92 ADMIN_GROUP = _autoconf.ADMIN_GROUP
93 MASTERD_USER = _autoconf.MASTERD_USER
94 MASTERD_GROUP = _autoconf.MASTERD_GROUP
95 RAPI_USER = _autoconf.RAPI_USER
96 RAPI_GROUP = _autoconf.RAPI_GROUP
97 CONFD_USER = _autoconf.CONFD_USER
98 CONFD_GROUP = _autoconf.CONFD_GROUP
99 NODED_USER = _autoconf.NODED_USER
100 NODED_GROUP = _autoconf.NODED_GROUP
102 # cpu pinning separators and constants
103 CPU_PINNING_SEP = ":"
104 CPU_PINNING_ALL = "all"
105 # internal representation of "all"
106 CPU_PINNING_ALL_VAL = -1
107 # one "all" entry in a CPU list means CPU pinning is off
108 CPU_PINNING_OFF = [CPU_PINNING_ALL_VAL]
110 # A Xen-specific implementation detail - there is no way to actually say
111 # "use any cpu for pinning" in a Xen configuration file, as opposed to the
112 # command line, where you can say "xm vcpu-pin <domain> <vcpu> all".
113 # The workaround used in Xen is "0-63" (see source code function
114 # xm_vcpu_pin in <xen-source>/tools/python/xen/xm/main.py).
115 # To support future changes, the following constant is treated as a
116 # blackbox string that simply means use-any-cpu-for-pinning-under-xen.
117 CPU_PINNING_ALL_XEN = "0-63"
119 # A KVM-specific implementation detail - the following value is used
120 # to set CPU affinity to all processors (#0 through #31), per taskset
122 CPU_PINNING_ALL_KVM = 0xFFFFFFFF
126 WIPE_BLOCK_SIZE = 1024 ** 2
127 MAX_WIPE_CHUNK = 1024 # 1GB
128 MIN_WIPE_CHUNK_PERCENT = 10
132 DATA_DIR = _autoconf.LOCALSTATEDIR + "/lib/ganeti"
133 RUN_DIR = _autoconf.LOCALSTATEDIR + "/run"
134 RUN_GANETI_DIR = RUN_DIR + "/ganeti"
135 BDEV_CACHE_DIR = RUN_GANETI_DIR + "/bdev-cache"
136 DISK_LINKS_DIR = RUN_GANETI_DIR + "/instance-disks"
138 SOCKET_DIR = RUN_GANETI_DIR + "/socket"
139 SECURE_DIR_MODE = 0700
140 SECURE_FILE_MODE = 0600
141 SOCKET_DIR_MODE = 0750
142 CRYPTO_KEYS_DIR = RUN_GANETI_DIR + "/crypto"
143 CRYPTO_KEYS_DIR_MODE = SECURE_DIR_MODE
144 IMPORT_EXPORT_DIR = RUN_GANETI_DIR + "/import-export"
145 IMPORT_EXPORT_DIR_MODE = 0755
146 ADOPTABLE_BLOCKDEV_ROOT = "/dev/disk/"
147 # keep RUN_GANETI_DIR first here, to make sure all get created when the node
148 # daemon is started (this takes care of RUN_DIR being tmpfs)
154 LOCK_DIR = _autoconf.LOCALSTATEDIR + "/lock"
155 SSCONF_LOCK_FILE = LOCK_DIR + "/ganeti-ssconf.lock"
156 # User-id pool lock directory
157 # The user-ids that are in use have a corresponding lock file in this directory
158 UIDPOOL_LOCKDIR = RUN_GANETI_DIR + "/uid-pool"
159 CLUSTER_CONF_FILE = DATA_DIR + "/config.data"
160 NODED_CERT_FILE = DATA_DIR + "/server.pem"
161 RAPI_CERT_FILE = DATA_DIR + "/rapi.pem"
162 CONFD_HMAC_KEY = DATA_DIR + "/hmac.key"
163 SPICE_CERT_FILE = DATA_DIR + "/spice.pem"
164 SPICE_CACERT_FILE = DATA_DIR + "/spice-ca.pem"
165 CLUSTER_DOMAIN_SECRET_FILE = DATA_DIR + "/cluster-domain-secret"
166 INSTANCE_STATUS_FILE = RUN_GANETI_DIR + "/instance-status"
167 SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts"
168 RAPI_USERS_FILE = DATA_DIR + "/rapi/users"
169 QUEUE_DIR = DATA_DIR + "/queue"
170 DAEMON_UTIL = _autoconf.PKGLIBDIR + "/daemon-util"
171 SETUP_SSH = _autoconf.TOOLSDIR + "/setup-ssh"
172 KVM_IFUP = _autoconf.PKGLIBDIR + "/kvm-ifup"
173 KVM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/kvm-console-wrapper"
174 XM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/xm-console-wrapper"
175 ETC_HOSTS = "/etc/hosts"
176 DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR
177 DEFAULT_SHARED_FILE_STORAGE_DIR = _autoconf.SHARED_FILE_STORAGE_DIR
178 ENABLE_FILE_STORAGE = _autoconf.ENABLE_FILE_STORAGE
179 ENABLE_SHARED_FILE_STORAGE = _autoconf.ENABLE_SHARED_FILE_STORAGE
180 SYSCONFDIR = _autoconf.SYSCONFDIR
181 TOOLSDIR = _autoconf.TOOLSDIR
182 CONF_DIR = SYSCONFDIR + "/ganeti"
183 USER_SCRIPTS_DIR = CONF_DIR + "/scripts"
184 ENABLE_CONFD = _autoconf.ENABLE_CONFD
186 #: Lock file for watcher, locked in shared mode by watcher; lock in exclusive
187 # mode to block watcher (see L{cli._RunWhileClusterStoppedHelper.Call}
188 WATCHER_LOCK_FILE = LOCK_DIR + "/ganeti-watcher.lock"
190 #: Status file for per-group watcher, locked in exclusive mode by watcher
191 WATCHER_GROUP_STATE_FILE = DATA_DIR + "/watcher.%s.data"
193 #: File for per-group instance status, merged into L{INSTANCE_STATUS_FILE} by
194 #: per-group processes
195 WATCHER_GROUP_INSTANCE_STATUS_FILE = DATA_DIR + "/watcher.%s.instance-status"
197 #: File containing Unix timestamp until which watcher should be paused
198 WATCHER_PAUSEFILE = DATA_DIR + "/watcher.pause"
200 # Master IP address setup scripts paths (default and user-provided)
201 DEFAULT_MASTER_SETUP_SCRIPT = TOOLSDIR + "/master-ip-setup"
202 EXTERNAL_MASTER_SETUP_SCRIPT = USER_SCRIPTS_DIR + "/master-ip-setup"
204 ALL_CERT_FILES = frozenset([
211 MASTER_SOCKET = SOCKET_DIR + "/ganeti-master"
213 NODED = "ganeti-noded"
214 CONFD = "ganeti-confd"
216 MASTERD = "ganeti-masterd"
217 # used in the ganeti-nbma project
221 # daemon-name: ("proto", "default-port")
222 NODED: ("tcp", 1811),
223 CONFD: ("udp", 1814),
226 # used in the ganeti-nbma project
229 DEFAULT_NODED_PORT = DAEMONS_PORTS[NODED][1]
230 DEFAULT_CONFD_PORT = DAEMONS_PORTS[CONFD][1]
231 DEFAULT_RAPI_PORT = DAEMONS_PORTS[RAPI][1]
232 # used in the ganeti-nbma project
233 DEFAULT_NLD_PORT = DAEMONS_PORTS[NLD][1]
235 FIRST_DRBD_PORT = 11000
236 LAST_DRBD_PORT = 14999
237 MASTER_SCRIPT = "ganeti-master"
239 LOG_DIR = _autoconf.LOCALSTATEDIR + "/log/ganeti/"
241 # "daemon-name": "logfile"
242 NODED: LOG_DIR + "node-daemon.log",
243 CONFD: LOG_DIR + "conf-daemon.log",
244 RAPI: LOG_DIR + "rapi-daemon.log",
245 MASTERD: LOG_DIR + "master-daemon.log",
246 # used in the ganeti-nbma project
247 NLD: LOG_DIR + "nl-daemon.log",
250 LOG_OS_DIR = LOG_DIR + "os"
251 LOG_WATCHER = LOG_DIR + "watcher.log"
252 LOG_COMMANDS = LOG_DIR + "commands.log"
253 LOG_BURNIN = LOG_DIR + "burnin.log"
254 LOG_SETUP_SSH = LOG_DIR + "setup-ssh.log"
256 DEV_CONSOLE = "/dev/console"
258 PROC_MOUNTS = "/proc/mounts"
260 # Local UniX Interface related constants
262 LUXI_VERSION = CONFIG_VERSION
264 # one of "no", "yes", "only"
265 SYSLOG_USAGE = _autoconf.SYSLOG_USAGE
269 SYSLOG_SOCKET = "/dev/log"
271 OS_SEARCH_PATH = _autoconf.OS_SEARCH_PATH
272 EXPORT_DIR = _autoconf.EXPORT_DIR
274 EXPORT_CONF_FILE = "config.ini"
276 XEN_BOOTLOADER = _autoconf.XEN_BOOTLOADER
277 XEN_KERNEL = _autoconf.XEN_KERNEL
278 XEN_INITRD = _autoconf.XEN_INITRD
281 KVM_PATH = _autoconf.KVM_PATH
282 SOCAT_PATH = _autoconf.SOCAT_PATH
283 SOCAT_USE_ESCAPE = _autoconf.SOCAT_USE_ESCAPE
284 SOCAT_USE_COMPRESS = _autoconf.SOCAT_USE_COMPRESS
285 SOCAT_ESCAPE_CODE = "0x1d"
287 #: Console as SSH command
290 #: Console as VNC server
293 #: Console as SPICE server
296 #: Display a message for console access
300 CONS_ALL = frozenset([CONS_SSH, CONS_VNC, CONS_SPICE, CONS_MESSAGE])
302 # For RSA keys more bits are better, but they also make operations more
303 # expensive. NIST SP 800-131 recommends a minimum of 2048 bits from the year
307 # Ciphers allowed for SSL connections. For the format, see ciphers(1). A better
308 # way to disable ciphers would be to use the exclamation mark (!), but socat
309 # versions below 1.5 can't parse exclamation marks in options properly. When
310 # modifying the ciphers, ensure not to accidentially add something after it's
311 # been removed. Use the "openssl" utility to check the allowed ciphers, e.g.
312 # "openssl ciphers -v HIGH:-DES".
313 OPENSSL_CIPHERS = "HIGH:-DES:-3DES:-EXPORT:-ADH"
315 # Digest used to sign certificates ("openssl x509" uses SHA1 by default)
316 X509_CERT_SIGN_DIGEST = "SHA1"
318 # Default validity of certificates in days
319 X509_CERT_DEFAULT_VALIDITY = 365 * 5
321 # commonName (CN) used in certificates
322 X509_CERT_CN = "ganeti.example.com"
324 X509_CERT_SIGNATURE_HEADER = "X-Ganeti-Signature"
326 IMPORT_EXPORT_DAEMON = _autoconf.PKGLIBDIR + "/import-export"
328 # Import/export daemon mode
329 IEM_IMPORT = "import"
330 IEM_EXPORT = "export"
332 # Import/export transport compression
335 IEC_ALL = frozenset([
340 IE_CUSTOM_SIZE = "fd"
342 IE_MAGIC_RE = re.compile(r"^[-_.a-zA-Z0-9]{5,100}$")
345 # Direct file I/O, equivalent to a shell's I/O redirection using '<' or '>'
347 # Raw block device I/O using "dd"
348 IEIO_RAW_DISK = "raw"
349 # OS definition import/export script
350 IEIO_SCRIPT = "script"
352 VALUE_DEFAULT = "default"
354 VALUE_GENERATE = "generate"
357 VALUE_FALSE = "false"
359 # External script validation mask
360 EXT_PLUGIN_MASK = re.compile("^[a-zA-Z0-9_-]+$")
362 # hooks-related constants
363 HOOKS_BASE_DIR = CONF_DIR + "/hooks"
364 HOOKS_PHASE_PRE = "pre"
365 HOOKS_PHASE_POST = "post"
366 HOOKS_NAME_CFGUPDATE = "config-update"
367 HOOKS_NAME_WATCHER = "watcher"
369 HOOKS_PATH = "/sbin:/bin:/usr/sbin:/usr/bin"
371 # hooks subject type (what object type does the LU deal with)
372 HTYPE_CLUSTER = "CLUSTER"
374 HTYPE_GROUP = "GROUP"
375 HTYPE_INSTANCE = "INSTANCE"
387 # first two are valid in LU context only, not passed to backend
390 # and the rest are valid in backend
395 SF_ALLOCATABLE = "allocatable"
398 SO_FIX_CONSISTENCY = "fix-consistency"
400 # Available fields per storage type
401 VALID_STORAGE_FIELDS = frozenset([
410 VALID_STORAGE_TYPES = frozenset([ST_FILE, ST_LVM_PV, ST_LVM_VG])
412 MODIFIABLE_STORAGE_FIELDS = {
413 ST_LVM_PV: frozenset([SF_ALLOCATABLE]),
416 VALID_STORAGE_OPERATIONS = {
417 ST_LVM_VG: frozenset([SO_FIX_CONSISTENCY]),
421 # Note: Code depends on LDS_OKAY < LDS_UNKNOWN < LDS_FAULTY
424 LDS_FAULTY) = range(1, 4)
426 # disk template types
427 DT_DISKLESS = "diskless"
431 DT_SHARED_FILE = "sharedfile"
432 DT_BLOCK = "blockdev"
435 # the set of network-mirrored disk templates
436 DTS_INT_MIRROR = frozenset([DT_DRBD8])
438 # the set of externally-mirrored disk templates (e.g. SAN, NAS)
439 DTS_EXT_MIRROR = frozenset([DT_SHARED_FILE, DT_BLOCK, DT_RBD])
441 # the set of non-lvm-based disk templates
442 DTS_NOT_LVM = frozenset([DT_DISKLESS, DT_FILE, DT_SHARED_FILE,
445 # the set of disk templates which can be grown
446 DTS_GROWABLE = frozenset([DT_PLAIN, DT_DRBD8, DT_FILE, DT_SHARED_FILE, DT_RBD])
448 # the set of disk templates that allow adoption
449 DTS_MAY_ADOPT = frozenset([DT_PLAIN, DT_BLOCK])
451 # the set of disk templates that *must* use adoption
452 DTS_MUST_ADOPT = frozenset([DT_BLOCK])
454 # the set of disk templates that allow migrations
455 DTS_MIRRORED = frozenset.union(DTS_INT_MIRROR, DTS_EXT_MIRROR)
457 # the set of file based disk templates
458 DTS_FILEBASED = frozenset([DT_FILE, DT_SHARED_FILE])
464 LD_BLOCKDEV = "blockdev"
466 LOGICAL_DISK_TYPES = frozenset([
474 LDS_BLOCK = frozenset([LD_LV, LD_DRBD8, LD_BLOCKDEV, LD_RBD])
477 DRBD_HMAC_ALG = "md5"
478 DRBD_NET_PROTOCOL = "C"
482 DRBD_B_DISK_BARRIERS = "b"
483 DRBD_B_DISK_DRAIN = "d"
484 DRBD_B_DISK_FLUSH = "f"
486 # Valid barrier combinations: "n" or any non-null subset of "bfd"
487 DRBD_VALID_BARRIER_OPT = frozenset([
488 frozenset([DRBD_B_NONE]),
489 frozenset([DRBD_B_DISK_BARRIERS]),
490 frozenset([DRBD_B_DISK_DRAIN]),
491 frozenset([DRBD_B_DISK_FLUSH]),
492 frozenset([DRBD_B_DISK_DRAIN, DRBD_B_DISK_FLUSH]),
493 frozenset([DRBD_B_DISK_DRAIN, DRBD_B_DISK_FLUSH]),
494 frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_DRAIN]),
495 frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_FLUSH]),
496 frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_FLUSH, DRBD_B_DISK_DRAIN]),
502 # file backend driver
506 # the set of drbd-like disk types
507 LDS_DRBD = frozenset([LD_DRBD8])
512 DISK_ACCESS_SET = frozenset([DISK_RDONLY, DISK_RDWR])
514 # disk replacement mode
515 REPLACE_DISK_PRI = "replace_on_primary" # replace disks on primary
516 REPLACE_DISK_SEC = "replace_on_secondary" # replace disks on secondary
517 REPLACE_DISK_CHG = "replace_new_secondary" # change secondary node
518 REPLACE_DISK_AUTO = "replace_auto"
519 REPLACE_MODES = frozenset([
526 # Instance export mode
527 EXPORT_MODE_LOCAL = "local"
528 EXPORT_MODE_REMOTE = "remote"
529 EXPORT_MODES = frozenset([
534 # Lock recalculate mode
535 LOCKS_REPLACE = "replace"
536 LOCKS_APPEND = "append"
538 # Lock timeout (sum) before we should go into blocking acquire (still
539 # can be reset by priority change); computed as max time (10 hours)
540 # before we should actually go into blocking acquire given that we
541 # start from default priority level; in seconds
542 LOCK_ATTEMPTS_TIMEOUT = 10 * 3600 / 20.0
543 LOCK_ATTEMPTS_MAXWAIT = 15.0
544 LOCK_ATTEMPTS_MINWAIT = 1.0
546 # instance creation modes
547 INSTANCE_CREATE = "create"
548 INSTANCE_IMPORT = "import"
549 INSTANCE_REMOTE_IMPORT = "remote-import"
550 INSTANCE_CREATE_MODES = frozenset([
553 INSTANCE_REMOTE_IMPORT,
556 # Remote import/export handshake message and version
558 RIE_HANDSHAKE = "Hi, I'm Ganeti"
560 # Remote import/export certificate validity in seconds
561 RIE_CERT_VALIDITY = 24 * 60 * 60
563 # Overall timeout for establishing connection
564 RIE_CONNECT_TIMEOUT = 180
566 # Export only: how long to wait per connection attempt (seconds)
567 RIE_CONNECT_ATTEMPT_TIMEOUT = 20
569 # Export only: number of attempts to connect
570 RIE_CONNECT_RETRIES = 10
572 #: Give child process up to 5 seconds to exit after sending a signal
573 CHILD_LINGER_TIMEOUT = 5.0
575 DISK_TEMPLATES = frozenset([
585 FILE_DRIVER = frozenset([FD_LOOP, FD_BLKTAP])
587 # import/export config options
588 INISECT_EXP = "export"
589 INISECT_INS = "instance"
590 INISECT_HYP = "hypervisor"
591 INISECT_BEP = "backend"
594 # dynamic device modification
596 DDM_REMOVE = "remove"
597 DDMS_VALUES = frozenset([DDM_ADD, DDM_REMOVE])
604 EXIT_NODESETUP_ERROR = 12
605 EXIT_CONFIRMATION = 13 # need user confirmation
607 #: Exit code for query operations with unknown fields
608 EXIT_UNKNOWN_FIELD = 14
611 TAG_CLUSTER = "cluster"
612 TAG_NODEGROUP = "nodegroup"
614 TAG_INSTANCE = "instance"
615 VALID_TAG_TYPES = frozenset([
622 MAX_TAGS_PER_OBJ = 4096
625 DEFAULT_BRIDGE = "xen-br0"
626 CLASSIC_DRBD_SYNC_SPEED = 60 * 1024 # 60 MiB, expressed in KiB
627 IP4_ADDRESS_LOCALHOST = "127.0.0.1"
628 IP4_ADDRESS_ANY = "0.0.0.0"
629 IP6_ADDRESS_LOCALHOST = "::1"
630 IP6_ADDRESS_ANY = "::"
633 VALID_IP_VERSIONS = frozenset([IP4_VERSION, IP6_VERSION])
634 TCP_PING_TIMEOUT = 10
635 GANETI_RUNAS = "root"
637 DEFAULT_DRBD_HELPER = "/bin/true"
639 DEFAULT_MAC_PREFIX = "aa:00:00"
640 # default maximum instance wait time, in seconds.
641 DEFAULT_SHUTDOWN_TIMEOUT = 120
642 NODE_MAX_CLOCK_SKEW = 150
643 # Time for an intra-cluster disk transfer to wait for a connection
644 DISK_TRANSFER_CONNECT_TIMEOUT = 60
645 # Disk index separator
646 DISK_SEPARATOR = _autoconf.DISK_SEPARATOR
647 IP_COMMAND_PATH = _autoconf.IP_PATH
649 #: Key for job IDs in opcode result
655 RUNPARTS_ERR) = range(3)
657 RUNPARTS_STATUS = frozenset([RUNPARTS_SKIP, RUNPARTS_RUN, RUNPARTS_ERR])
661 RPC_ENCODING_ZLIB_BASE64) = range(2)
663 # os related constants
664 OS_SCRIPT_CREATE = "create"
665 OS_SCRIPT_IMPORT = "import"
666 OS_SCRIPT_EXPORT = "export"
667 OS_SCRIPT_RENAME = "rename"
668 OS_SCRIPT_VERIFY = "verify"
669 OS_SCRIPTS = frozenset([
677 OS_API_FILE = "ganeti_api_version"
678 OS_VARIANTS_FILE = "variants.list"
679 OS_PARAMETERS_FILE = "parameters.list"
681 OS_VALIDATE_PARAMETERS = "parameters"
682 OS_VALIDATE_CALLS = frozenset([OS_VALIDATE_PARAMETERS])
685 SSH_CONFIG_DIR = _autoconf.SSH_CONFIG_DIR
686 SSH_HOST_DSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_dsa_key"
687 SSH_HOST_DSA_PUB = SSH_HOST_DSA_PRIV + ".pub"
688 SSH_HOST_RSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_rsa_key"
689 SSH_HOST_RSA_PUB = SSH_HOST_RSA_PRIV + ".pub"
694 INSTANCE_REBOOT_SOFT = "soft"
695 INSTANCE_REBOOT_HARD = "hard"
696 INSTANCE_REBOOT_FULL = "full"
698 REBOOT_TYPES = frozenset([
699 INSTANCE_REBOOT_SOFT,
700 INSTANCE_REBOOT_HARD,
704 # instance reboot behaviors
705 INSTANCE_REBOOT_ALLOWED = "reboot"
706 INSTANCE_REBOOT_EXIT = "exit"
708 REBOOT_BEHAVIORS = frozenset([
709 INSTANCE_REBOOT_ALLOWED,
713 VTYPE_STRING = "string"
714 VTYPE_MAYBE_STRING = "maybe-string"
716 VTYPE_SIZE = "size" # size, in MiBs
718 ENFORCEABLE_TYPES = frozenset([
726 # Constant representing that the user does not specify any IP version
727 IFACE_NO_IP_VERSION_SPECIFIED = 0
729 # HV parameter names (global namespace)
730 HV_BOOT_ORDER = "boot_order"
731 HV_CDROM_IMAGE_PATH = "cdrom_image_path"
732 HV_KVM_CDROM2_IMAGE_PATH = "cdrom2_image_path"
733 HV_KVM_FLOPPY_IMAGE_PATH = "floppy_image_path"
734 HV_NIC_TYPE = "nic_type"
735 HV_DISK_TYPE = "disk_type"
736 HV_KVM_CDROM_DISK_TYPE = "cdrom_disk_type"
737 HV_VNC_BIND_ADDRESS = "vnc_bind_address"
738 HV_VNC_PASSWORD_FILE = "vnc_password_file"
739 HV_VNC_TLS = "vnc_tls"
740 HV_VNC_X509 = "vnc_x509_path"
741 HV_VNC_X509_VERIFY = "vnc_x509_verify"
742 HV_KVM_SPICE_BIND = "spice_bind"
743 HV_KVM_SPICE_IP_VERSION = "spice_ip_version"
744 HV_KVM_SPICE_PASSWORD_FILE = "spice_password_file"
745 HV_KVM_SPICE_LOSSLESS_IMG_COMPR = "spice_image_compression"
746 HV_KVM_SPICE_JPEG_IMG_COMPR = "spice_jpeg_wan_compression"
747 HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR = "spice_zlib_glz_wan_compression"
748 HV_KVM_SPICE_STREAMING_VIDEO_DETECTION = "spice_streaming_video"
749 HV_KVM_SPICE_AUDIO_COMPR = "spice_playback_compression"
750 HV_KVM_SPICE_USE_TLS = "spice_use_tls"
751 HV_KVM_SPICE_TLS_CIPHERS = "spice_tls_ciphers"
752 HV_KVM_SPICE_USE_VDAGENT = "spice_use_vdagent"
755 HV_USE_BOOTLOADER = "use_bootloader"
756 HV_BOOTLOADER_ARGS = "bootloader_args"
757 HV_BOOTLOADER_PATH = "bootloader_path"
758 HV_KERNEL_ARGS = "kernel_args"
759 HV_KERNEL_PATH = "kernel_path"
760 HV_INITRD_PATH = "initrd_path"
761 HV_ROOT_PATH = "root_path"
762 HV_SERIAL_CONSOLE = "serial_console"
763 HV_USB_MOUSE = "usb_mouse"
765 HV_DEVICE_MODEL = "device_model"
766 HV_INIT_SCRIPT = "init_script"
767 HV_MIGRATION_PORT = "migration_port"
768 HV_MIGRATION_BANDWIDTH = "migration_bandwidth"
769 HV_MIGRATION_DOWNTIME = "migration_downtime"
770 HV_MIGRATION_MODE = "migration_mode"
771 HV_USE_LOCALTIME = "use_localtime"
772 HV_DISK_CACHE = "disk_cache"
773 HV_SECURITY_MODEL = "security_model"
774 HV_SECURITY_DOMAIN = "security_domain"
775 HV_KVM_FLAG = "kvm_flag"
776 HV_VHOST_NET = "vhost_net"
777 HV_KVM_USE_CHROOT = "use_chroot"
778 HV_CPU_MASK = "cpu_mask"
779 HV_MEM_PATH = "mem_path"
780 HV_BLOCKDEV_PREFIX = "blockdev_prefix"
781 HV_REBOOT_BEHAVIOR = "reboot_behavior"
783 HVS_PARAMETER_TYPES = {
784 HV_BOOT_ORDER: VTYPE_STRING,
785 HV_KVM_FLOPPY_IMAGE_PATH: VTYPE_STRING,
786 HV_CDROM_IMAGE_PATH: VTYPE_STRING,
787 HV_KVM_CDROM2_IMAGE_PATH: VTYPE_STRING,
788 HV_NIC_TYPE: VTYPE_STRING,
789 HV_DISK_TYPE: VTYPE_STRING,
790 HV_KVM_CDROM_DISK_TYPE: VTYPE_STRING,
791 HV_VNC_PASSWORD_FILE: VTYPE_STRING,
792 HV_VNC_BIND_ADDRESS: VTYPE_STRING,
793 HV_VNC_TLS: VTYPE_BOOL,
794 HV_VNC_X509: VTYPE_STRING,
795 HV_VNC_X509_VERIFY: VTYPE_BOOL,
796 HV_KVM_SPICE_BIND: VTYPE_STRING,
797 HV_KVM_SPICE_IP_VERSION: VTYPE_INT,
798 HV_KVM_SPICE_PASSWORD_FILE: VTYPE_STRING,
799 HV_KVM_SPICE_LOSSLESS_IMG_COMPR: VTYPE_STRING,
800 HV_KVM_SPICE_JPEG_IMG_COMPR: VTYPE_STRING,
801 HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR: VTYPE_STRING,
802 HV_KVM_SPICE_STREAMING_VIDEO_DETECTION: VTYPE_STRING,
803 HV_KVM_SPICE_AUDIO_COMPR: VTYPE_BOOL,
804 HV_KVM_SPICE_USE_TLS: VTYPE_BOOL,
805 HV_KVM_SPICE_TLS_CIPHERS: VTYPE_STRING,
806 HV_KVM_SPICE_USE_VDAGENT: VTYPE_BOOL,
809 HV_USE_BOOTLOADER: VTYPE_BOOL,
810 HV_BOOTLOADER_PATH: VTYPE_STRING,
811 HV_BOOTLOADER_ARGS: VTYPE_STRING,
812 HV_KERNEL_PATH: VTYPE_STRING,
813 HV_KERNEL_ARGS: VTYPE_STRING,
814 HV_INITRD_PATH: VTYPE_STRING,
815 HV_ROOT_PATH: VTYPE_MAYBE_STRING,
816 HV_SERIAL_CONSOLE: VTYPE_BOOL,
817 HV_USB_MOUSE: VTYPE_STRING,
818 HV_KEYMAP: VTYPE_STRING,
819 HV_DEVICE_MODEL: VTYPE_STRING,
820 HV_INIT_SCRIPT: VTYPE_STRING,
821 HV_MIGRATION_PORT: VTYPE_INT,
822 HV_MIGRATION_BANDWIDTH: VTYPE_INT,
823 HV_MIGRATION_DOWNTIME: VTYPE_INT,
824 HV_MIGRATION_MODE: VTYPE_STRING,
825 HV_USE_LOCALTIME: VTYPE_BOOL,
826 HV_DISK_CACHE: VTYPE_STRING,
827 HV_SECURITY_MODEL: VTYPE_STRING,
828 HV_SECURITY_DOMAIN: VTYPE_STRING,
829 HV_KVM_FLAG: VTYPE_STRING,
830 HV_VHOST_NET: VTYPE_BOOL,
831 HV_KVM_USE_CHROOT: VTYPE_BOOL,
832 HV_CPU_MASK: VTYPE_STRING,
833 HV_MEM_PATH: VTYPE_STRING,
834 HV_BLOCKDEV_PREFIX: VTYPE_STRING,
835 HV_REBOOT_BEHAVIOR: VTYPE_STRING,
838 HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
841 HV_MIGRATION_COMPLETED = "completed"
842 HV_MIGRATION_ACTIVE = "active"
843 HV_MIGRATION_FAILED = "failed"
844 HV_MIGRATION_CANCELLED = "cancelled"
846 HV_MIGRATION_VALID_STATUSES = frozenset([
847 HV_MIGRATION_COMPLETED,
850 HV_MIGRATION_CANCELLED,
853 HV_MIGRATION_FAILED_STATUSES = frozenset([
855 HV_MIGRATION_CANCELLED,
858 # KVM-specific statuses
859 HV_KVM_MIGRATION_VALID_STATUSES = HV_MIGRATION_VALID_STATUSES
862 HV_NODEINFO_KEY_VERSION = "hv_version"
865 HVST_MEMORY_TOTAL = "mem_total"
866 HVST_MEMORY_NODE = "mem_node"
867 HVST_MEMORY_HV = "mem_hv"
868 HVST_CPU_TOTAL = "cpu_total"
869 HVST_CPU_NODE = "cpu_node"
872 HVST_MEMORY_TOTAL: 0,
879 HVSTS_PARAMETER_TYPES = {
880 HVST_MEMORY_TOTAL: VTYPE_INT,
881 HVST_MEMORY_NODE: VTYPE_INT,
882 HVST_MEMORY_HV: VTYPE_INT,
883 HVST_CPU_TOTAL: VTYPE_INT,
884 HVST_CPU_NODE: VTYPE_INT,
887 HVSTS_PARAMETERS = frozenset(HVSTS_PARAMETER_TYPES.keys())
890 DS_DISK_TOTAL = "disk_total"
891 DS_DISK_RESERVED = "disk_reserved"
892 DS_DISK_OVERHEAD = "disk_overhead"
900 DSS_PARAMETER_TYPES = {
901 DS_DISK_TOTAL: VTYPE_INT,
902 DS_DISK_RESERVED: VTYPE_INT,
903 DS_DISK_OVERHEAD: VTYPE_INT,
906 DSS_PARAMETERS = frozenset(DSS_PARAMETER_TYPES.keys())
907 DS_VALID_TYPES = frozenset([LD_LV])
909 # Backend parameter names
910 BE_MEMORY = "memory" # deprecated and replaced by max and min mem
914 BE_AUTO_BALANCE = "auto_balance"
915 BE_ALWAYS_FAILOVER = "always_failover"
917 BES_PARAMETER_TYPES = {
918 BE_MAXMEM: VTYPE_SIZE,
919 BE_MINMEM: VTYPE_SIZE,
921 BE_AUTO_BALANCE: VTYPE_BOOL,
922 BE_ALWAYS_FAILOVER: VTYPE_BOOL,
925 BES_PARAMETER_COMPAT = {
926 BE_MEMORY: VTYPE_SIZE,
928 BES_PARAMETER_COMPAT.update(BES_PARAMETER_TYPES)
930 BES_PARAMETERS = frozenset(BES_PARAMETER_TYPES.keys())
933 ISPEC_MEM_SIZE = "memory-size"
934 ISPEC_CPU_COUNT = "cpu-count"
935 ISPEC_DISK_COUNT = "disk-count"
936 ISPEC_DISK_SIZE = "disk-size"
937 ISPEC_NIC_COUNT = "nic-count"
939 ISPECS_PARAMETER_TYPES = {
940 ISPEC_MEM_SIZE: VTYPE_INT,
941 ISPEC_CPU_COUNT: VTYPE_INT,
942 ISPEC_DISK_COUNT: VTYPE_INT,
943 ISPEC_DISK_SIZE: VTYPE_INT,
944 ISPEC_NIC_COUNT: VTYPE_INT,
947 ISPECS_PARAMETERS = frozenset(ISPECS_PARAMETER_TYPES.keys())
952 IPOLICY_DTS = "disk_templates"
953 IPOLICY_VCPU_RATIO = "vcpu_ratio"
955 IPOLICY_ISPECS = frozenset([
961 IPOLICY_PARAMETERS = frozenset([
965 IPOLICY_ALL_KEYS = (IPOLICY_ISPECS |
967 frozenset([IPOLICY_DTS]))
969 # Node parameter names
970 ND_OOB_PROGRAM = "oob_program"
972 NDS_PARAMETER_TYPES = {
973 ND_OOB_PROGRAM: VTYPE_MAYBE_STRING,
976 NDS_PARAMETERS = frozenset(NDS_PARAMETER_TYPES.keys())
978 # Logical Disks parameters
979 LDP_RESYNC_RATE = "resync-rate"
980 LDP_STRIPES = "stripes"
981 LDP_BARRIERS = "disabled-barriers"
982 LDP_NO_META_FLUSH = "disable-meta-flush"
983 LDP_DEFAULT_METAVG = "default-metavg"
984 LDP_DISK_CUSTOM = "disk-custom"
985 LDP_NET_CUSTOM = "net-custom"
986 LDP_DYNAMIC_RESYNC = "dynamic-resync"
987 LDP_PLAN_AHEAD = "c-plan-ahead"
988 LDP_FILL_TARGET = "c-fill-target"
989 LDP_DELAY_TARGET = "c-delay-target"
990 LDP_MAX_RATE = "c-max-rate"
991 LDP_MIN_RATE = "c-min-rate"
994 LDP_RESYNC_RATE: VTYPE_INT,
995 LDP_STRIPES: VTYPE_INT,
996 LDP_BARRIERS: VTYPE_STRING,
997 LDP_NO_META_FLUSH: VTYPE_BOOL,
998 LDP_DEFAULT_METAVG: VTYPE_STRING,
999 LDP_DISK_CUSTOM: VTYPE_STRING,
1000 LDP_NET_CUSTOM: VTYPE_STRING,
1001 LDP_DYNAMIC_RESYNC: VTYPE_BOOL,
1002 LDP_PLAN_AHEAD: VTYPE_INT,
1003 LDP_FILL_TARGET: VTYPE_INT,
1004 LDP_DELAY_TARGET: VTYPE_INT,
1005 LDP_MAX_RATE: VTYPE_INT,
1006 LDP_MIN_RATE: VTYPE_INT,
1007 LDP_POOL: VTYPE_STRING,
1009 DISK_LD_PARAMETERS = frozenset(DISK_LD_TYPES.keys())
1011 # Disk template parameters (can be set/changed by the user via gnt-cluster and
1013 DRBD_RESYNC_RATE = "resync-rate"
1014 DRBD_DATA_STRIPES = "data-stripes"
1015 DRBD_META_STRIPES = "meta-stripes"
1016 DRBD_DISK_BARRIERS = "disk-barriers"
1017 DRBD_META_BARRIERS = "meta-barriers"
1018 DRBD_DEFAULT_METAVG = "metavg"
1019 DRBD_DISK_CUSTOM = "disk-custom"
1020 DRBD_NET_CUSTOM = "net-custom"
1021 DRBD_DYNAMIC_RESYNC = "dynamic-resync"
1022 DRBD_PLAN_AHEAD = "c-plan-ahead"
1023 DRBD_FILL_TARGET = "c-fill-target"
1024 DRBD_DELAY_TARGET = "c-delay-target"
1025 DRBD_MAX_RATE = "c-max-rate"
1026 DRBD_MIN_RATE = "c-min-rate"
1027 LV_STRIPES = "stripes"
1030 DRBD_RESYNC_RATE: VTYPE_INT,
1031 DRBD_DATA_STRIPES: VTYPE_INT,
1032 DRBD_META_STRIPES: VTYPE_INT,
1033 DRBD_DISK_BARRIERS: VTYPE_STRING,
1034 DRBD_META_BARRIERS: VTYPE_BOOL,
1035 DRBD_DEFAULT_METAVG: VTYPE_STRING,
1036 DRBD_DISK_CUSTOM: VTYPE_STRING,
1037 DRBD_NET_CUSTOM: VTYPE_STRING,
1038 DRBD_DYNAMIC_RESYNC: VTYPE_BOOL,
1039 DRBD_PLAN_AHEAD: VTYPE_INT,
1040 DRBD_FILL_TARGET: VTYPE_INT,
1041 DRBD_DELAY_TARGET: VTYPE_INT,
1042 DRBD_MAX_RATE: VTYPE_INT,
1043 DRBD_MIN_RATE: VTYPE_INT,
1044 LV_STRIPES: VTYPE_INT,
1045 RBD_POOL: VTYPE_STRING,
1048 DISK_DT_PARAMETERS = frozenset(DISK_DT_TYPES.keys())
1050 # OOB supported commands
1051 OOB_POWER_ON = "power-on"
1052 OOB_POWER_OFF = "power-off"
1053 OOB_POWER_CYCLE = "power-cycle"
1054 OOB_POWER_STATUS = "power-status"
1055 OOB_HEALTH = "health"
1057 OOB_COMMANDS = frozenset([
1065 OOB_POWER_STATUS_POWERED = "powered"
1067 OOB_TIMEOUT = 60 # 60 seconds
1068 OOB_POWER_DELAY = 2.0 # 2 seconds
1070 OOB_STATUS_OK = "OK"
1071 OOB_STATUS_WARNING = "WARNING"
1072 OOB_STATUS_CRITICAL = "CRITICAL"
1073 OOB_STATUS_UNKNOWN = "UNKNOWN"
1075 OOB_STATUSES = frozenset([
1078 OOB_STATUS_CRITICAL,
1082 # Instance Parameters Profile
1083 PP_DEFAULT = "default"
1085 # NIC_* constants are used inside the ganeti config
1089 NIC_MODE_BRIDGED = "bridged"
1090 NIC_MODE_ROUTED = "routed"
1092 NIC_VALID_MODES = frozenset([NIC_MODE_BRIDGED, NIC_MODE_ROUTED])
1094 NICS_PARAMETER_TYPES = {
1095 NIC_MODE: VTYPE_STRING,
1096 NIC_LINK: VTYPE_STRING,
1099 NICS_PARAMETERS = frozenset(NICS_PARAMETER_TYPES.keys())
1101 # IDISK_* constants are used in opcodes, to create/change disks
1104 IDISK_ADOPT = "adopt"
1106 IDISK_METAVG = "metavg"
1107 IDISK_PARAMS_TYPES = {
1108 IDISK_SIZE: VTYPE_SIZE,
1109 IDISK_MODE: VTYPE_STRING,
1110 IDISK_ADOPT: VTYPE_STRING,
1111 IDISK_VG: VTYPE_STRING,
1112 IDISK_METAVG: VTYPE_STRING,
1114 IDISK_PARAMS = frozenset(IDISK_PARAMS_TYPES.keys())
1116 # INIC_* constants are used in opcodes, to create/change nics
1121 INIC_PARAMS_TYPES = {
1122 INIC_IP: VTYPE_MAYBE_STRING,
1123 INIC_LINK: VTYPE_STRING,
1124 INIC_MAC: VTYPE_STRING,
1125 INIC_MODE: VTYPE_STRING,
1127 INIC_PARAMS = frozenset(INIC_PARAMS_TYPES.keys())
1129 # Hypervisor constants
1130 HT_XEN_PVM = "xen-pvm"
1132 HT_XEN_HVM = "xen-hvm"
1134 HT_CHROOT = "chroot"
1136 HYPER_TYPES = frozenset([
1144 HTS_REQ_PORT = frozenset([HT_XEN_HVM, HT_KVM])
1146 VNC_BASE_PORT = 5900
1147 VNC_PASSWORD_FILE = CONF_DIR + "/vnc-cluster-password"
1148 VNC_DEFAULT_BIND_ADDRESS = IP4_ADDRESS_ANY
1151 HT_NIC_RTL8139 = "rtl8139"
1152 HT_NIC_NE2K_PCI = "ne2k_pci"
1153 HT_NIC_NE2K_ISA = "ne2k_isa"
1154 HT_NIC_I82551 = "i82551"
1155 HT_NIC_I85557B = "i82557b"
1156 HT_NIC_I8259ER = "i82559er"
1157 HT_NIC_PCNET = "pcnet"
1158 HT_NIC_E1000 = "e1000"
1159 HT_NIC_PARAVIRTUAL = HT_DISK_PARAVIRTUAL = "paravirtual"
1161 HT_HVM_VALID_NIC_TYPES = frozenset([
1168 HT_KVM_VALID_NIC_TYPES = frozenset([
1181 HT_DISK_IOEMU = "ioemu"
1183 HT_DISK_SCSI = "scsi"
1186 HT_DISK_PFLASH = "pflash"
1188 HT_CACHE_DEFAULT = "default"
1189 HT_CACHE_NONE = "none"
1190 HT_CACHE_WTHROUGH = "writethrough"
1191 HT_CACHE_WBACK = "writeback"
1192 HT_VALID_CACHE_TYPES = frozenset([
1199 HT_HVM_VALID_DISK_TYPES = frozenset([HT_DISK_PARAVIRTUAL, HT_DISK_IOEMU])
1200 HT_KVM_VALID_DISK_TYPES = frozenset([
1201 HT_DISK_PARAVIRTUAL,
1210 HT_MOUSE_MOUSE = "mouse"
1211 HT_MOUSE_TABLET = "tablet"
1213 HT_KVM_VALID_MOUSE_TYPES = frozenset([HT_MOUSE_MOUSE, HT_MOUSE_TABLET])
1216 HT_BO_FLOPPY = "floppy"
1217 HT_BO_CDROM = "cdrom"
1219 HT_BO_NETWORK = "network"
1221 HT_KVM_VALID_BO_TYPES = frozenset([
1228 # SPICE lossless image compression options
1229 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_GLZ = "auto_glz"
1230 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_LZ = "auto_lz"
1231 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_QUIC = "quic"
1232 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_GLZ = "glz"
1233 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_LZ = "lz"
1234 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_OFF = "off"
1236 HT_KVM_SPICE_VALID_LOSSLESS_IMG_COMPR_OPTIONS = frozenset([
1237 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_GLZ,
1238 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_LZ,
1239 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_QUIC,
1240 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_GLZ,
1241 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_LZ,
1242 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_OFF,
1245 # SPICE lossy image compression options (valid for both jpeg and zlib-glz)
1246 HT_KVM_SPICE_LOSSY_IMG_COMPR_AUTO = "auto"
1247 HT_KVM_SPICE_LOSSY_IMG_COMPR_NEVER = "never"
1248 HT_KVM_SPICE_LOSSY_IMG_COMPR_ALWAYS = "always"
1250 HT_KVM_SPICE_VALID_LOSSY_IMG_COMPR_OPTIONS = frozenset([
1251 HT_KVM_SPICE_LOSSY_IMG_COMPR_AUTO,
1252 HT_KVM_SPICE_LOSSY_IMG_COMPR_NEVER,
1253 HT_KVM_SPICE_LOSSY_IMG_COMPR_ALWAYS,
1256 # SPICE video stream detection
1257 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_OFF = "off"
1258 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_ALL = "all"
1259 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_FILTER = "filter"
1261 HT_KVM_SPICE_VALID_VIDEO_STREAM_DETECTION_OPTIONS = frozenset([
1262 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_OFF,
1263 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_ALL,
1264 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_FILTER,
1272 HT_KVM_VALID_SM_TYPES = frozenset([HT_SM_NONE, HT_SM_USER, HT_SM_POOL])
1275 HT_KVM_ENABLED = "enabled"
1276 HT_KVM_DISABLED = "disabled"
1278 HT_KVM_FLAG_VALUES = frozenset([HT_KVM_ENABLED, HT_KVM_DISABLED])
1281 HT_MIGRATION_LIVE = "live"
1282 HT_MIGRATION_NONLIVE = "non-live"
1283 HT_MIGRATION_MODES = frozenset([HT_MIGRATION_LIVE, HT_MIGRATION_NONLIVE])
1285 # Cluster Verify steps
1286 VERIFY_NPLUSONE_MEM = "nplusone_mem"
1287 VERIFY_OPTIONAL_CHECKS = frozenset([VERIFY_NPLUSONE_MEM])
1289 # Cluster Verify error classes
1290 CV_TCLUSTER = "cluster"
1292 CV_TINSTANCE = "instance"
1294 # Cluster Verify error codes and documentation
1296 (CV_TCLUSTER, "ECLUSTERCFG", "Cluster configuration verification failure")
1298 (CV_TCLUSTER, "ECLUSTERCERT",
1299 "Cluster certificate files verification failure")
1300 CV_ECLUSTERFILECHECK = \
1301 (CV_TCLUSTER, "ECLUSTERFILECHECK",
1302 "Cluster configuration verification failure")
1303 CV_ECLUSTERDANGLINGNODES = \
1304 (CV_TNODE, "ECLUSTERDANGLINGNODES",
1305 "Some nodes belong to non-existing groups")
1306 CV_ECLUSTERDANGLINGINST = \
1307 (CV_TNODE, "ECLUSTERDANGLINGINST",
1308 "Some instances have a non-existing primary node")
1309 CV_EINSTANCEBADNODE = \
1310 (CV_TINSTANCE, "EINSTANCEBADNODE",
1311 "Instance marked as running lives on an offline node")
1312 CV_EINSTANCEDOWN = \
1313 (CV_TINSTANCE, "EINSTANCEDOWN", "Instance not running on its primary node")
1314 CV_EINSTANCELAYOUT = \
1315 (CV_TINSTANCE, "EINSTANCELAYOUT", "Instance has multiple secondary nodes")
1316 CV_EINSTANCEMISSINGDISK = \
1317 (CV_TINSTANCE, "EINSTANCEMISSINGDISK", "Missing volume on an instance")
1318 CV_EINSTANCEFAULTYDISK = \
1319 (CV_TINSTANCE, "EINSTANCEFAULTYDISK",
1320 "Impossible to retrieve status for a disk")
1321 CV_EINSTANCEWRONGNODE = \
1322 (CV_TINSTANCE, "EINSTANCEWRONGNODE", "Instance running on the wrong node")
1323 CV_EINSTANCESPLITGROUPS = \
1324 (CV_TINSTANCE, "EINSTANCESPLITGROUPS",
1325 "Instance with primary and secondary nodes in different groups")
1326 CV_EINSTANCEPOLICY = \
1327 (CV_TINSTANCE, "EINSTANCEPOLICY",
1328 "Instance does not meet policy")
1330 (CV_TNODE, "ENODEDRBD", "Error parsing the DRBD status file")
1331 CV_ENODEDRBDHELPER = \
1332 (CV_TNODE, "ENODEDRBDHELPER", "Error caused by the DRBD helper")
1333 CV_ENODEFILECHECK = \
1334 (CV_TNODE, "ENODEFILECHECK",
1335 "Error retrieving the checksum of the node files")
1337 (CV_TNODE, "ENODEHOOKS", "Communication failure in hooks execution")
1339 (CV_TNODE, "ENODEHV", "Hypervisor parameters verification failure")
1341 (CV_TNODE, "ENODELVM", "LVM-related node error")
1343 (CV_TNODE, "ENODEN1", "Not enough memory to accommodate instance failovers")
1345 (CV_TNODE, "ENODENET", "Network-related node error")
1347 (CV_TNODE, "ENODEOS", "OS-related node error")
1348 CV_ENODEORPHANINSTANCE = \
1349 (CV_TNODE, "ENODEORPHANINSTANCE", "Unknown intance running on a node")
1350 CV_ENODEORPHANLV = \
1351 (CV_TNODE, "ENODEORPHANLV", "Unknown LVM logical volume")
1353 (CV_TNODE, "ENODERPC",
1354 "Error during connection to the primary node of an instance")
1356 (CV_TNODE, "ENODESSH", "SSH-related node error")
1358 (CV_TNODE, "ENODEVERSION",
1359 "Protocol version mismatch or Ganeti version mismatch")
1361 (CV_TNODE, "ENODESETUP", "Node setup error")
1363 (CV_TNODE, "ENODETIME", "Node returned invalid time")
1365 (CV_TNODE, "ENODEOOBPATH", "Invalid Out Of Band path")
1366 CV_ENODEUSERSCRIPTS = \
1367 (CV_TNODE, "ENODEUSERSCRIPTS", "User scripts not present or not executable")
1369 CV_ALL_ECODES = frozenset([
1372 CV_ECLUSTERFILECHECK,
1373 CV_ECLUSTERDANGLINGNODES,
1374 CV_ECLUSTERDANGLINGINST,
1375 CV_EINSTANCEBADNODE,
1378 CV_EINSTANCEMISSINGDISK,
1379 CV_EINSTANCEFAULTYDISK,
1380 CV_EINSTANCEWRONGNODE,
1381 CV_EINSTANCESPLITGROUPS,
1392 CV_ENODEORPHANINSTANCE,
1400 CV_ENODEUSERSCRIPTS,
1403 CV_ALL_ECODES_STRINGS = frozenset(estr for (_, estr, _) in CV_ALL_ECODES)
1405 # Node verify constants
1406 NV_DRBDHELPER = "drbd-helper"
1407 NV_DRBDLIST = "drbd-list"
1408 NV_FILELIST = "filelist"
1409 NV_HVINFO = "hvinfo"
1410 NV_HYPERVISOR = "hypervisor"
1411 NV_HVPARAMS = "hvparms"
1412 NV_INSTANCELIST = "instancelist"
1413 NV_LVLIST = "lvlist"
1414 NV_MASTERIP = "master-ip"
1415 NV_NODELIST = "nodelist"
1416 NV_NODENETTEST = "node-net-test"
1417 NV_NODESETUP = "nodesetup"
1418 NV_OSLIST = "oslist"
1419 NV_PVLIST = "pvlist"
1421 NV_VERSION = "version"
1422 NV_VGLIST = "vglist"
1423 NV_VMNODES = "vmnodes"
1424 NV_OOB_PATHS = "oob-paths"
1425 NV_BRIDGES = "bridges"
1426 NV_USERSCRIPTS = "user-scripts"
1429 INSTST_RUNNING = "running"
1430 INSTST_ADMINDOWN = "ADMIN_down"
1431 INSTST_ADMINOFFLINE = "ADMIN_offline"
1432 INSTST_NODEOFFLINE = "ERROR_nodeoffline"
1433 INSTST_NODEDOWN = "ERROR_nodedown"
1434 INSTST_WRONGNODE = "ERROR_wrongnode"
1435 INSTST_ERRORUP = "ERROR_up"
1436 INSTST_ERRORDOWN = "ERROR_down"
1437 INSTST_ALL = frozenset([
1440 INSTST_ADMINOFFLINE,
1450 ADMINST_DOWN = "down"
1451 ADMINST_OFFLINE = "offline"
1452 ADMINST_ALL = frozenset([
1464 NR_ALL = frozenset([
1472 # SSL certificate check constants (in days)
1473 SSL_CERT_EXPIRATION_WARN = 30
1474 SSL_CERT_EXPIRATION_ERROR = 7
1476 # Allocator framework constants
1477 IALLOCATOR_VERSION = 2
1478 IALLOCATOR_DIR_IN = "in"
1479 IALLOCATOR_DIR_OUT = "out"
1480 VALID_IALLOCATOR_DIRECTIONS = frozenset([
1484 IALLOCATOR_MODE_ALLOC = "allocate"
1485 IALLOCATOR_MODE_RELOC = "relocate"
1486 IALLOCATOR_MODE_CHG_GROUP = "change-group"
1487 IALLOCATOR_MODE_NODE_EVAC = "node-evacuate"
1488 VALID_IALLOCATOR_MODES = frozenset([
1489 IALLOCATOR_MODE_ALLOC,
1490 IALLOCATOR_MODE_RELOC,
1491 IALLOCATOR_MODE_CHG_GROUP,
1492 IALLOCATOR_MODE_NODE_EVAC,
1494 IALLOCATOR_SEARCH_PATH = _autoconf.IALLOCATOR_SEARCH_PATH
1496 IALLOCATOR_NEVAC_PRI = "primary-only"
1497 IALLOCATOR_NEVAC_SEC = "secondary-only"
1498 IALLOCATOR_NEVAC_ALL = "all"
1499 IALLOCATOR_NEVAC_MODES = frozenset([
1500 IALLOCATOR_NEVAC_PRI,
1501 IALLOCATOR_NEVAC_SEC,
1502 IALLOCATOR_NEVAC_ALL,
1506 NODE_EVAC_PRI = "primary-only"
1507 NODE_EVAC_SEC = "secondary-only"
1508 NODE_EVAC_ALL = "all"
1509 NODE_EVAC_MODES = frozenset([
1516 JOB_QUEUE_VERSION = 1
1517 JOB_QUEUE_LOCK_FILE = QUEUE_DIR + "/lock"
1518 JOB_QUEUE_VERSION_FILE = QUEUE_DIR + "/version"
1519 JOB_QUEUE_SERIAL_FILE = QUEUE_DIR + "/serial"
1520 JOB_QUEUE_ARCHIVE_DIR = QUEUE_DIR + "/archive"
1521 JOB_QUEUE_DRAIN_FILE = QUEUE_DIR + "/drain"
1522 JOB_QUEUE_SIZE_HARD_LIMIT = 5000
1523 JOB_QUEUE_DIRS = [QUEUE_DIR, JOB_QUEUE_ARCHIVE_DIR]
1524 JOB_QUEUE_DIRS_MODE = SECURE_DIR_MODE
1526 JOB_ID_TEMPLATE = r"\d+"
1527 JOB_FILE_RE = re.compile(r"^job-(%s)$" % JOB_ID_TEMPLATE)
1529 # unchanged job return
1530 JOB_NOTCHANGED = "nochange"
1533 JOB_STATUS_QUEUED = "queued"
1534 JOB_STATUS_WAITING = "waiting"
1535 JOB_STATUS_CANCELING = "canceling"
1536 JOB_STATUS_RUNNING = "running"
1537 JOB_STATUS_CANCELED = "canceled"
1538 JOB_STATUS_SUCCESS = "success"
1539 JOB_STATUS_ERROR = "error"
1540 JOBS_FINALIZED = frozenset([
1541 JOB_STATUS_CANCELED,
1545 JOB_STATUS_ALL = frozenset([
1548 JOB_STATUS_CANCELING,
1554 OP_STATUS_QUEUED = "queued"
1555 OP_STATUS_WAITING = "waiting"
1556 OP_STATUS_CANCELING = "canceling"
1557 OP_STATUS_RUNNING = "running"
1559 OP_STATUS_CANCELED = "canceled"
1560 OP_STATUS_SUCCESS = "success"
1561 OP_STATUS_ERROR = "error"
1562 OPS_FINALIZED = frozenset([
1569 OP_PRIO_LOWEST = +19
1570 OP_PRIO_HIGHEST = -20
1576 OP_PRIO_SUBMIT_VALID = frozenset([
1582 OP_PRIO_DEFAULT = OP_PRIO_NORMAL
1584 # Execution log types
1585 ELOG_MESSAGE = "message"
1586 ELOG_PROGRESS = "progress"
1587 ELOG_REMOTE_IMPORT = "remote-import"
1588 ELOG_JQUEUE_TEST = "jqueue-test"
1590 # /etc/hosts modification
1591 ETC_HOSTS_ADD = "add"
1592 ETC_HOSTS_REMOVE = "remove"
1595 JQT_MSGPREFIX = "TESTMSG="
1596 JQT_EXPANDNAMES = "expandnames"
1598 JQT_LOGMSG = "logmsg"
1599 JQT_STARTMSG = "startmsg"
1600 JQT_ALL = frozenset([
1608 QR_INSTANCE = "instance"
1614 #: List of resources which can be queried using L{opcodes.OpQuery}
1615 QR_VIA_OP = frozenset([QR_INSTANCE, QR_NODE, QR_GROUP, QR_OS])
1617 #: List of resources which can be queried using Local UniX Interface
1618 QR_VIA_LUXI = QR_VIA_OP.union([
1622 #: List of resources which can be queried using RAPI
1623 QR_VIA_RAPI = QR_VIA_LUXI
1626 QFT_UNKNOWN = "unknown"
1629 QFT_NUMBER = "number"
1631 QFT_TIMESTAMP = "timestamp"
1634 #: All query field types
1635 QFT_ALL = frozenset([
1645 # Query result field status (don't change or reuse values as they're used by
1647 #: Normal field status
1651 #: No data (e.g. RPC error), can be used instead of L{RS_OFFLINE}
1653 #: Value unavailable/unsupported for item; if this field is supported
1654 #: but we cannot get the data for the moment, RS_NODATA or
1655 #: RS_OFFLINE should be used
1657 #: Resource marked offline
1660 RS_ALL = frozenset([
1668 #: Dictionary with special field cases and their verbose/terse formatting
1670 RS_UNKNOWN: ("(unknown)", "??"),
1671 RS_NODATA: ("(nodata)", "?"),
1672 RS_OFFLINE: ("(offline)", "*"),
1673 RS_UNAVAIL: ("(unavail)", "-"),
1676 # max dynamic devices
1681 SS_CLUSTER_NAME = "cluster_name"
1682 SS_CLUSTER_TAGS = "cluster_tags"
1683 SS_FILE_STORAGE_DIR = "file_storage_dir"
1684 SS_SHARED_FILE_STORAGE_DIR = "shared_file_storage_dir"
1685 SS_MASTER_CANDIDATES = "master_candidates"
1686 SS_MASTER_CANDIDATES_IPS = "master_candidates_ips"
1687 SS_MASTER_IP = "master_ip"
1688 SS_MASTER_NETDEV = "master_netdev"
1689 SS_MASTER_NETMASK = "master_netmask"
1690 SS_MASTER_NODE = "master_node"
1691 SS_NODE_LIST = "node_list"
1692 SS_NODE_PRIMARY_IPS = "node_primary_ips"
1693 SS_NODE_SECONDARY_IPS = "node_secondary_ips"
1694 SS_OFFLINE_NODES = "offline_nodes"
1695 SS_ONLINE_NODES = "online_nodes"
1696 SS_PRIMARY_IP_FAMILY = "primary_ip_family"
1697 SS_INSTANCE_LIST = "instance_list"
1698 SS_RELEASE_VERSION = "release_version"
1699 SS_HYPERVISOR_LIST = "hypervisor_list"
1700 SS_MAINTAIN_NODE_HEALTH = "maintain_node_health"
1701 SS_UID_POOL = "uid_pool"
1702 SS_NODEGROUPS = "nodegroups"
1704 SS_FILE_PERMS = 0444
1706 # cluster wide default parameters
1707 DEFAULT_ENABLED_HYPERVISOR = HT_XEN_PVM
1711 HV_USE_BOOTLOADER: False,
1712 HV_BOOTLOADER_PATH: XEN_BOOTLOADER,
1713 HV_BOOTLOADER_ARGS: "",
1714 HV_KERNEL_PATH: "/boot/vmlinuz-2.6-xenU",
1716 HV_ROOT_PATH: "/dev/sda1",
1717 HV_KERNEL_ARGS: "ro",
1718 HV_MIGRATION_PORT: 8002,
1719 HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1720 HV_BLOCKDEV_PREFIX: "sd",
1721 HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1722 HV_CPU_MASK: CPU_PINNING_ALL,
1725 HV_BOOT_ORDER: "cd",
1726 HV_CDROM_IMAGE_PATH: "",
1727 HV_NIC_TYPE: HT_NIC_RTL8139,
1728 HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
1729 HV_VNC_BIND_ADDRESS: IP4_ADDRESS_ANY,
1730 HV_VNC_PASSWORD_FILE: VNC_PASSWORD_FILE,
1733 HV_KERNEL_PATH: "/usr/lib/xen/boot/hvmloader",
1734 HV_DEVICE_MODEL: "/usr/lib/xen/bin/qemu-dm",
1735 HV_MIGRATION_PORT: 8002,
1736 HV_MIGRATION_MODE: HT_MIGRATION_NONLIVE,
1737 HV_USE_LOCALTIME: False,
1738 HV_BLOCKDEV_PREFIX: "hd",
1739 HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1740 HV_CPU_MASK: CPU_PINNING_ALL,
1743 HV_KERNEL_PATH: "/boot/vmlinuz-2.6-kvmU",
1745 HV_KERNEL_ARGS: "ro",
1746 HV_ROOT_PATH: "/dev/vda1",
1748 HV_SERIAL_CONSOLE: True,
1749 HV_VNC_BIND_ADDRESS: "",
1752 HV_VNC_X509_VERIFY: False,
1753 HV_VNC_PASSWORD_FILE: "",
1754 HV_KVM_SPICE_BIND: "",
1755 HV_KVM_SPICE_IP_VERSION: IFACE_NO_IP_VERSION_SPECIFIED,
1756 HV_KVM_SPICE_PASSWORD_FILE: "",
1757 HV_KVM_SPICE_LOSSLESS_IMG_COMPR: "",
1758 HV_KVM_SPICE_JPEG_IMG_COMPR: "",
1759 HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR: "",
1760 HV_KVM_SPICE_STREAMING_VIDEO_DETECTION: "",
1761 HV_KVM_SPICE_AUDIO_COMPR: True,
1762 HV_KVM_SPICE_USE_TLS: False,
1763 HV_KVM_SPICE_TLS_CIPHERS: OPENSSL_CIPHERS,
1764 HV_KVM_SPICE_USE_VDAGENT: True,
1765 HV_KVM_FLOPPY_IMAGE_PATH: "",
1766 HV_CDROM_IMAGE_PATH: "",
1767 HV_KVM_CDROM2_IMAGE_PATH: "",
1768 HV_BOOT_ORDER: HT_BO_DISK,
1769 HV_NIC_TYPE: HT_NIC_PARAVIRTUAL,
1770 HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
1771 HV_KVM_CDROM_DISK_TYPE: "",
1774 HV_MIGRATION_PORT: 8102,
1775 HV_MIGRATION_BANDWIDTH: 32, # MiB/s
1776 HV_MIGRATION_DOWNTIME: 30, # ms
1777 HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1778 HV_USE_LOCALTIME: False,
1779 HV_DISK_CACHE: HT_CACHE_DEFAULT,
1780 HV_SECURITY_MODEL: HT_SM_NONE,
1781 HV_SECURITY_DOMAIN: "",
1783 HV_VHOST_NET: False,
1784 HV_KVM_USE_CHROOT: False,
1786 HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1787 HV_CPU_MASK: CPU_PINNING_ALL,
1792 HV_INIT_SCRIPT: "/ganeti-chroot",
1799 HVC_GLOBALS = frozenset([
1801 HV_MIGRATION_BANDWIDTH,
1809 BE_AUTO_BALANCE: True,
1810 BE_ALWAYS_FAILOVER: False,
1814 ND_OOB_PROGRAM: None,
1817 DISK_LD_DEFAULTS = {
1819 LDP_RESYNC_RATE: CLASSIC_DRBD_SYNC_SPEED,
1820 LDP_BARRIERS: _autoconf.DRBD_BARRIERS,
1821 LDP_NO_META_FLUSH: _autoconf.DRBD_NO_META_FLUSH,
1822 LDP_DEFAULT_METAVG: DEFAULT_VG,
1823 LDP_DISK_CUSTOM: "",
1825 LDP_DYNAMIC_RESYNC: False,
1827 # The default values for the DRBD dynamic resync speed algorithm are taken
1828 # from the drbsetup 8.3.11 man page, except for c-plan-ahead (that we
1829 # don't need to set to 0, because we have a separate option to enable it)
1830 # and for c-max-rate, that we cap to the default value for the static resync
1832 LDP_PLAN_AHEAD: 20, # ds
1833 LDP_FILL_TARGET: 0, # sectors
1834 LDP_DELAY_TARGET: 1, # ds
1835 LDP_MAX_RATE: CLASSIC_DRBD_SYNC_SPEED, # KiB/s
1836 LDP_MIN_RATE: 4 * 1024, # KiB/s
1839 LDP_STRIPES: _autoconf.LVM_STRIPECOUNT
1850 # readability shortcuts
1851 _LV_DEFAULTS = DISK_LD_DEFAULTS[LD_LV]
1852 _DRBD_DEFAULTS = DISK_LD_DEFAULTS[LD_DRBD8]
1854 DISK_DT_DEFAULTS = {
1856 LV_STRIPES: DISK_LD_DEFAULTS[LD_LV][LDP_STRIPES],
1859 DRBD_RESYNC_RATE: _DRBD_DEFAULTS[LDP_RESYNC_RATE],
1860 DRBD_DATA_STRIPES: _LV_DEFAULTS[LDP_STRIPES],
1861 DRBD_META_STRIPES: _LV_DEFAULTS[LDP_STRIPES],
1862 DRBD_DISK_BARRIERS: _DRBD_DEFAULTS[LDP_BARRIERS],
1863 DRBD_META_BARRIERS: _DRBD_DEFAULTS[LDP_NO_META_FLUSH],
1864 DRBD_DEFAULT_METAVG: _DRBD_DEFAULTS[LDP_DEFAULT_METAVG],
1865 DRBD_DISK_CUSTOM: _DRBD_DEFAULTS[LDP_DISK_CUSTOM],
1866 DRBD_NET_CUSTOM: _DRBD_DEFAULTS[LDP_NET_CUSTOM],
1867 DRBD_DYNAMIC_RESYNC: _DRBD_DEFAULTS[LDP_DYNAMIC_RESYNC],
1868 DRBD_PLAN_AHEAD: _DRBD_DEFAULTS[LDP_PLAN_AHEAD],
1869 DRBD_FILL_TARGET: _DRBD_DEFAULTS[LDP_FILL_TARGET],
1870 DRBD_DELAY_TARGET: _DRBD_DEFAULTS[LDP_DELAY_TARGET],
1871 DRBD_MAX_RATE: _DRBD_DEFAULTS[LDP_MAX_RATE],
1872 DRBD_MIN_RATE: _DRBD_DEFAULTS[LDP_MIN_RATE],
1883 RBD_POOL: DISK_LD_DEFAULTS[LD_RBD][LDP_POOL]
1887 # we don't want to export the shortcuts
1888 del _LV_DEFAULTS, _DRBD_DEFAULTS
1891 NIC_MODE: NIC_MODE_BRIDGED,
1892 NIC_LINK: DEFAULT_BRIDGE,
1895 IPOLICY_DEFAULTS = {
1897 ISPEC_MEM_SIZE: 128,
1899 ISPEC_DISK_COUNT: 1,
1900 ISPEC_DISK_SIZE: 1024,
1904 ISPEC_MEM_SIZE: 32768,
1906 ISPEC_DISK_COUNT: MAX_DISKS,
1907 ISPEC_DISK_SIZE: 1024 * 1024,
1908 ISPEC_NIC_COUNT: MAX_NICS,
1911 ISPEC_MEM_SIZE: 128,
1913 ISPEC_DISK_COUNT: 1,
1914 ISPEC_DISK_SIZE: 1024,
1917 IPOLICY_DTS: DISK_TEMPLATES,
1918 IPOLICY_VCPU_RATIO: 4.0,
1921 MASTER_POOL_SIZE_DEFAULT = 10
1923 CONFD_PROTOCOL_VERSION = 1
1926 CONFD_REQ_NODE_ROLE_BYNAME = 1
1927 CONFD_REQ_NODE_PIP_BY_INSTANCE_IP = 2
1928 CONFD_REQ_CLUSTER_MASTER = 3
1929 CONFD_REQ_NODE_PIP_LIST = 4
1930 CONFD_REQ_MC_PIP_LIST = 5
1931 CONFD_REQ_INSTANCES_IPS_LIST = 6
1933 # Confd request query fields. These are used to narrow down queries.
1934 # These must be strings rather than integers, because json-encoding
1935 # converts them to strings anyway, as they're used as dict-keys.
1936 CONFD_REQQ_LINK = "0"
1938 CONFD_REQQ_IPLIST = "2"
1939 CONFD_REQQ_FIELDS = "3"
1941 CONFD_REQFIELD_NAME = "0"
1942 CONFD_REQFIELD_IP = "1"
1943 CONFD_REQFIELD_MNODE_PIP = "2"
1945 CONFD_REQS = frozenset([
1947 CONFD_REQ_NODE_ROLE_BYNAME,
1948 CONFD_REQ_NODE_PIP_BY_INSTANCE_IP,
1949 CONFD_REQ_CLUSTER_MASTER,
1950 CONFD_REQ_NODE_PIP_LIST,
1951 CONFD_REQ_MC_PIP_LIST,
1952 CONFD_REQ_INSTANCES_IPS_LIST,
1955 CONFD_REPL_STATUS_OK = 0
1956 CONFD_REPL_STATUS_ERROR = 1
1957 CONFD_REPL_STATUS_NOTIMPLEMENTED = 2
1959 CONFD_REPL_STATUSES = frozenset([
1960 CONFD_REPL_STATUS_OK,
1961 CONFD_REPL_STATUS_ERROR,
1962 CONFD_REPL_STATUS_NOTIMPLEMENTED,
1965 (CONFD_NODE_ROLE_MASTER,
1966 CONFD_NODE_ROLE_CANDIDATE,
1967 CONFD_NODE_ROLE_OFFLINE,
1968 CONFD_NODE_ROLE_DRAINED,
1969 CONFD_NODE_ROLE_REGULAR,
1972 # A few common errors for confd
1973 CONFD_ERROR_UNKNOWN_ENTRY = 1
1974 CONFD_ERROR_INTERNAL = 2
1975 CONFD_ERROR_ARGUMENT = 3
1977 # Each request is "salted" by the current timestamp.
1978 # This constants decides how many seconds of skew to accept.
1979 # TODO: make this a default and allow the value to be more configurable
1980 CONFD_MAX_CLOCK_SKEW = 2 * NODE_MAX_CLOCK_SKEW
1982 # When we haven't reloaded the config for more than this amount of seconds, we
1983 # force a test to see if inotify is betraying us.
1984 CONFD_CONFIG_RELOAD_TIMEOUT = 60
1986 # If we receive more than one update in this amount of seconds, we move to
1987 # polling every RATELIMIT seconds, rather than relying on inotify, to be able
1988 # to serve more requests.
1989 CONFD_CONFIG_RELOAD_RATELIMIT = 2
1991 # Magic number prepended to all confd queries.
1992 # This allows us to distinguish different types of confd protocols and handle
1993 # them. For example by changing this we can move the whole payload to be
1994 # compressed, or move away from json.
1995 CONFD_MAGIC_FOURCC = "plj0"
1997 # By default a confd request is sent to the minimum between this number and all
1998 # MCs. 6 was chosen because even in the case of a disastrous 50% response rate,
1999 # we should have enough answers to be able to compare more than one.
2000 CONFD_DEFAULT_REQ_COVERAGE = 6
2002 # Timeout in seconds to expire pending query request in the confd client
2003 # library. We don't actually expect any answer more than 10 seconds after we
2005 CONFD_CLIENT_EXPIRE_TIMEOUT = 10
2007 # Maximum UDP datagram size.
2008 # On IPv4: 64K - 20 (ip header size) - 8 (udp header size) = 65507
2009 # On IPv6: 64K - 40 (ip6 header size) - 8 (udp header size) = 65487
2010 # (assuming we can't use jumbo frames)
2011 # We just set this to 60K, which should be enough
2012 MAX_UDP_DATA_SIZE = 61440
2014 # User-id pool minimum/maximum acceptable user-ids.
2016 UIDPOOL_UID_MAX = 2 ** 32 - 1 # Assuming 32 bit user-ids
2018 # Name or path of the pgrep command
2021 # Name of the node group that gets created at cluster init or upgrade
2022 INITIAL_NODE_GROUP_NAME = "default"
2024 # Possible values for NodeGroup.alloc_policy
2025 ALLOC_POLICY_PREFERRED = "preferred"
2026 ALLOC_POLICY_LAST_RESORT = "last_resort"
2027 ALLOC_POLICY_UNALLOCABLE = "unallocable"
2028 VALID_ALLOC_POLICIES = [
2029 ALLOC_POLICY_PREFERRED,
2030 ALLOC_POLICY_LAST_RESORT,
2031 ALLOC_POLICY_UNALLOCABLE,
2034 # Temporary external/shared storage parameters
2035 BLOCKDEV_DRIVER_MANUAL = "manual"
2037 # qemu-img path, required for ovfconverter
2038 QEMUIMG_PATH = _autoconf.QEMUIMG_PATH
2040 # Whether htools was enabled at compilation time
2041 HTOOLS = _autoconf.HTOOLS
2042 # The hail iallocator
2043 IALLOC_HAIL = "hail"
2045 # Fake opcodes for functions that have hooks attached to them via
2046 # backend.RunLocalHooks
2047 FAKE_OP_MASTER_TURNUP = "OP_CLUSTER_IP_TURNUP"
2048 FAKE_OP_MASTER_TURNDOWN = "OP_CLUSTER_IP_TURNDOWN"
2050 # Do not re-export imported modules
2051 del re, _vcsversion, _autoconf