cmdlib: De-duplicate code in _GenerateDiskTemplate
[ganeti-local] / lib / constants.py
1 #
2 #
3
4 # Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
5 #
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.
10 #
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.
15 #
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
19 # 02110-1301, USA.
20
21
22 """Module holding different constants."""
23
24 import re
25
26 from ganeti import _autoconf
27 from ganeti import _vcsversion
28
29 # various versions
30 RELEASE_VERSION = _autoconf.PACKAGE_VERSION
31 OS_API_V10 = 10
32 OS_API_V15 = 15
33 OS_API_V20 = 20
34 OS_API_VERSIONS = frozenset([OS_API_V10, OS_API_V15, OS_API_V20])
35 VCS_VERSION = _vcsversion.VCS_VERSION
36 EXPORT_VERSION = 0
37 RAPI_VERSION = 2
38
39
40 # Format for CONFIG_VERSION:
41 #   01 03 0123 = 01030123
42 #   ^^ ^^ ^^^^
43 #   |  |  + Configuration version/revision
44 #   |  + Minor version
45 #   + Major version
46 #
47 # It stored as an integer. Make sure not to write an octal number.
48
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
52 # here.
53
54 def BuildVersion(major, minor, revision):
55   """Calculates int version number from major, minor and revision numbers.
56
57   Returns: int representing version number
58
59   """
60   assert isinstance(major, int)
61   assert isinstance(minor, int)
62   assert isinstance(revision, int)
63   return (1000000 * major +
64             10000 * minor +
65                 1 * revision)
66
67
68 def SplitVersion(version):
69   """Splits version number stored in an int.
70
71   Returns: tuple; (major, minor, revision)
72
73   """
74   assert isinstance(version, int)
75
76   (major, remainder) = divmod(version, 1000000)
77   (minor, revision) = divmod(remainder, 10000)
78
79   return (major, minor, revision)
80
81
82 CONFIG_MAJOR = int(_autoconf.VERSION_MAJOR)
83 CONFIG_MINOR = int(_autoconf.VERSION_MINOR)
84 CONFIG_REVISION = 0
85 CONFIG_VERSION = BuildVersion(CONFIG_MAJOR, CONFIG_MINOR, CONFIG_REVISION)
86
87 #: RPC protocol version
88 PROTOCOL_VERSION = BuildVersion(CONFIG_MAJOR, CONFIG_MINOR, 0)
89
90 # user separation
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
101
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]
109
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"
118
119 # A KVM-specific implementation detail - the following value is used
120 # to set CPU affinity to all processors (#0 through #31), per taskset
121 # man page.
122 CPU_PINNING_ALL_KVM = 0xFFFFFFFF
123
124 # Wipe
125 DD_CMD = "dd"
126 WIPE_BLOCK_SIZE = 1024 ** 2
127 MAX_WIPE_CHUNK = 1024 # 1GB
128 MIN_WIPE_CHUNK_PERCENT = 10
129
130
131 # file paths
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"
137 RUN_DIRS_MODE = 0775
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)
149 SUB_RUN_DIRS = [
150   RUN_GANETI_DIR,
151   BDEV_CACHE_DIR,
152   DISK_LINKS_DIR,
153   ]
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
185
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"
189
190 #: Status file for per-group watcher, locked in exclusive mode by watcher
191 WATCHER_GROUP_STATE_FILE = DATA_DIR + "/watcher.%s.data"
192
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"
196
197 #: File containing Unix timestamp until which watcher should be paused
198 WATCHER_PAUSEFILE = DATA_DIR + "/watcher.pause"
199
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"
203
204 ALL_CERT_FILES = frozenset([
205   NODED_CERT_FILE,
206   RAPI_CERT_FILE,
207   SPICE_CERT_FILE,
208   SPICE_CACERT_FILE,
209   ])
210
211 MASTER_SOCKET = SOCKET_DIR + "/ganeti-master"
212
213 NODED = "ganeti-noded"
214 CONFD = "ganeti-confd"
215 RAPI = "ganeti-rapi"
216 MASTERD = "ganeti-masterd"
217 # used in the ganeti-nbma project
218 NLD = "ganeti-nld"
219
220 DAEMONS_PORTS = {
221   # daemon-name: ("proto", "default-port")
222   NODED: ("tcp", 1811),
223   CONFD: ("udp", 1814),
224   RAPI: ("tcp", 5080),
225   "ssh": ("tcp", 22),
226   # used in the ganeti-nbma project
227   NLD: ("udp", 1816),
228 }
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]
234
235 FIRST_DRBD_PORT = 11000
236 LAST_DRBD_PORT = 14999
237 MASTER_SCRIPT = "ganeti-master"
238
239 LOG_DIR = _autoconf.LOCALSTATEDIR + "/log/ganeti/"
240 DAEMONS_LOGFILES = {
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",
248   }
249
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"
255
256 DEV_CONSOLE = "/dev/console"
257
258 PROC_MOUNTS = "/proc/mounts"
259
260 # Local UniX Interface related constants
261 LUXI_EOM = "\3"
262 LUXI_VERSION = CONFIG_VERSION
263
264 # one of "no", "yes", "only"
265 SYSLOG_USAGE = _autoconf.SYSLOG_USAGE
266 SYSLOG_NO = "no"
267 SYSLOG_YES = "yes"
268 SYSLOG_ONLY = "only"
269 SYSLOG_SOCKET = "/dev/log"
270
271 OS_SEARCH_PATH = _autoconf.OS_SEARCH_PATH
272 EXPORT_DIR = _autoconf.EXPORT_DIR
273
274 EXPORT_CONF_FILE = "config.ini"
275
276 XEN_BOOTLOADER = _autoconf.XEN_BOOTLOADER
277 XEN_KERNEL = _autoconf.XEN_KERNEL
278 XEN_INITRD = _autoconf.XEN_INITRD
279 XEN_CMD = "xm"
280
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"
286
287 #: Console as SSH command
288 CONS_SSH = "ssh"
289
290 #: Console as VNC server
291 CONS_VNC = "vnc"
292
293 #: Console as SPICE server
294 CONS_SPICE = "spice"
295
296 #: Display a message for console access
297 CONS_MESSAGE = "msg"
298
299 #: All console types
300 CONS_ALL = frozenset([CONS_SSH, CONS_VNC, CONS_SPICE, CONS_MESSAGE])
301
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
304 # 2010 on.
305 RSA_KEY_BITS = 2048
306
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"
314
315 # Digest used to sign certificates ("openssl x509" uses SHA1 by default)
316 X509_CERT_SIGN_DIGEST = "SHA1"
317
318 # Default validity of certificates in days
319 X509_CERT_DEFAULT_VALIDITY = 365 * 5
320
321 # commonName (CN) used in certificates
322 X509_CERT_CN = "ganeti.example.com"
323
324 X509_CERT_SIGNATURE_HEADER = "X-Ganeti-Signature"
325
326 IMPORT_EXPORT_DAEMON = _autoconf.PKGLIBDIR + "/import-export"
327
328 # Import/export daemon mode
329 IEM_IMPORT = "import"
330 IEM_EXPORT = "export"
331
332 # Import/export transport compression
333 IEC_NONE = "none"
334 IEC_GZIP = "gzip"
335 IEC_ALL = frozenset([
336   IEC_NONE,
337   IEC_GZIP,
338   ])
339
340 IE_CUSTOM_SIZE = "fd"
341
342 IE_MAGIC_RE = re.compile(r"^[-_.a-zA-Z0-9]{5,100}$")
343
344 # Import/export I/O
345 # Direct file I/O, equivalent to a shell's I/O redirection using '<' or '>'
346 IEIO_FILE = "file"
347 # Raw block device I/O using "dd"
348 IEIO_RAW_DISK = "raw"
349 # OS definition import/export script
350 IEIO_SCRIPT = "script"
351
352 VALUE_DEFAULT = "default"
353 VALUE_AUTO = "auto"
354 VALUE_GENERATE = "generate"
355 VALUE_NONE = "none"
356 VALUE_TRUE = "true"
357 VALUE_FALSE = "false"
358
359 # External script validation mask
360 EXT_PLUGIN_MASK = re.compile("^[a-zA-Z0-9_-]+$")
361
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"
368 HOOKS_VERSION = 2
369 HOOKS_PATH = "/sbin:/bin:/usr/sbin:/usr/bin"
370
371 # hooks subject type (what object type does the LU deal with)
372 HTYPE_CLUSTER = "CLUSTER"
373 HTYPE_NODE = "NODE"
374 HTYPE_GROUP = "GROUP"
375 HTYPE_INSTANCE = "INSTANCE"
376
377 HKR_SKIP = 0
378 HKR_FAIL = 1
379 HKR_SUCCESS = 2
380
381 # Storage types
382 ST_FILE = "file"
383 ST_LVM_PV = "lvm-pv"
384 ST_LVM_VG = "lvm-vg"
385
386 # Storage fields
387 # first two are valid in LU context only, not passed to backend
388 SF_NODE = "node"
389 SF_TYPE = "type"
390 # and the rest are valid in backend
391 SF_NAME = "name"
392 SF_SIZE = "size"
393 SF_FREE = "free"
394 SF_USED = "used"
395 SF_ALLOCATABLE = "allocatable"
396
397 # Storage operations
398 SO_FIX_CONSISTENCY = "fix-consistency"
399
400 # Available fields per storage type
401 VALID_STORAGE_FIELDS = frozenset([
402   SF_NAME,
403   SF_TYPE,
404   SF_SIZE,
405   SF_USED,
406   SF_FREE,
407   SF_ALLOCATABLE
408   ])
409
410 VALID_STORAGE_TYPES = frozenset([ST_FILE, ST_LVM_PV, ST_LVM_VG])
411
412 MODIFIABLE_STORAGE_FIELDS = {
413   ST_LVM_PV: frozenset([SF_ALLOCATABLE]),
414   }
415
416 VALID_STORAGE_OPERATIONS = {
417   ST_LVM_VG: frozenset([SO_FIX_CONSISTENCY]),
418   }
419
420 # Local disk status
421 # Note: Code depends on LDS_OKAY < LDS_UNKNOWN < LDS_FAULTY
422 (LDS_OKAY,
423  LDS_UNKNOWN,
424  LDS_FAULTY) = range(1, 4)
425
426 # disk template types
427 DT_DISKLESS = "diskless"
428 DT_PLAIN = "plain"
429 DT_DRBD8 = "drbd"
430 DT_FILE = "file"
431 DT_SHARED_FILE = "sharedfile"
432 DT_BLOCK = "blockdev"
433 DT_RBD = "rbd"
434
435 # the set of network-mirrored disk templates
436 DTS_INT_MIRROR = frozenset([DT_DRBD8])
437
438 # the set of externally-mirrored disk templates (e.g. SAN, NAS)
439 DTS_EXT_MIRROR = frozenset([DT_SHARED_FILE, DT_BLOCK, DT_RBD])
440
441 # the set of non-lvm-based disk templates
442 DTS_NOT_LVM = frozenset([DT_DISKLESS, DT_FILE, DT_SHARED_FILE,
443                          DT_BLOCK, DT_RBD])
444
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])
447
448 # the set of disk templates that allow adoption
449 DTS_MAY_ADOPT = frozenset([DT_PLAIN, DT_BLOCK])
450
451 # the set of disk templates that *must* use adoption
452 DTS_MUST_ADOPT = frozenset([DT_BLOCK])
453
454 # the set of disk templates that allow migrations
455 DTS_MIRRORED = frozenset.union(DTS_INT_MIRROR, DTS_EXT_MIRROR)
456
457 # the set of file based disk templates
458 DTS_FILEBASED = frozenset([DT_FILE, DT_SHARED_FILE])
459
460 # logical disk types
461 LD_LV = "lvm"
462 LD_DRBD8 = "drbd8"
463 LD_FILE = "file"
464 LD_BLOCKDEV = "blockdev"
465 LD_RBD = "rbd"
466 LOGICAL_DISK_TYPES = frozenset([
467   LD_LV,
468   LD_DRBD8,
469   LD_FILE,
470   LD_BLOCKDEV,
471   LD_RBD,
472   ])
473
474 LDS_BLOCK = frozenset([LD_LV, LD_DRBD8, LD_BLOCKDEV, LD_RBD])
475
476 # drbd constants
477 DRBD_HMAC_ALG = "md5"
478 DRBD_NET_PROTOCOL = "C"
479
480 # drbd barrier types
481 DRBD_B_NONE = "n"
482 DRBD_B_DISK_BARRIERS = "b"
483 DRBD_B_DISK_DRAIN = "d"
484 DRBD_B_DISK_FLUSH = "f"
485
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]),
497   ])
498
499 # rbd tool command
500 RBD_CMD = "rbd"
501
502 # file backend driver
503 FD_LOOP = "loop"
504 FD_BLKTAP = "blktap"
505
506 # the set of drbd-like disk types
507 LDS_DRBD = frozenset([LD_DRBD8])
508
509 # disk access mode
510 DISK_RDONLY = "ro"
511 DISK_RDWR = "rw"
512 DISK_ACCESS_SET = frozenset([DISK_RDONLY, DISK_RDWR])
513
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([
520   REPLACE_DISK_PRI,
521   REPLACE_DISK_SEC,
522   REPLACE_DISK_CHG,
523   REPLACE_DISK_AUTO,
524   ])
525
526 # Instance export mode
527 EXPORT_MODE_LOCAL = "local"
528 EXPORT_MODE_REMOTE = "remote"
529 EXPORT_MODES = frozenset([
530   EXPORT_MODE_LOCAL,
531   EXPORT_MODE_REMOTE,
532   ])
533
534 # Lock recalculate mode
535 LOCKS_REPLACE = "replace"
536 LOCKS_APPEND = "append"
537
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
545
546 # instance creation modes
547 INSTANCE_CREATE = "create"
548 INSTANCE_IMPORT = "import"
549 INSTANCE_REMOTE_IMPORT = "remote-import"
550 INSTANCE_CREATE_MODES = frozenset([
551   INSTANCE_CREATE,
552   INSTANCE_IMPORT,
553   INSTANCE_REMOTE_IMPORT,
554   ])
555
556 # Remote import/export handshake message and version
557 RIE_VERSION = 0
558 RIE_HANDSHAKE = "Hi, I'm Ganeti"
559
560 # Remote import/export certificate validity in seconds
561 RIE_CERT_VALIDITY = 24 * 60 * 60
562
563 # Overall timeout for establishing connection
564 RIE_CONNECT_TIMEOUT = 180
565
566 # Export only: how long to wait per connection attempt (seconds)
567 RIE_CONNECT_ATTEMPT_TIMEOUT = 20
568
569 # Export only: number of attempts to connect
570 RIE_CONNECT_RETRIES = 10
571
572 #: Give child process up to 5 seconds to exit after sending a signal
573 CHILD_LINGER_TIMEOUT = 5.0
574
575 DISK_TEMPLATES = frozenset([
576   DT_DISKLESS,
577   DT_PLAIN,
578   DT_DRBD8,
579   DT_FILE,
580   DT_SHARED_FILE,
581   DT_BLOCK,
582   DT_RBD
583   ])
584
585 FILE_DRIVER = frozenset([FD_LOOP, FD_BLKTAP])
586
587 # import/export config options
588 INISECT_EXP = "export"
589 INISECT_INS = "instance"
590 INISECT_HYP = "hypervisor"
591 INISECT_BEP = "backend"
592 INISECT_OSP = "os"
593
594 # dynamic device modification
595 DDM_ADD = "add"
596 DDM_MODIFY = "modify"
597 DDM_REMOVE = "remove"
598 DDMS_VALUES = frozenset([DDM_ADD, DDM_REMOVE])
599 DDMS_VALUES_WITH_MODIFY = (DDMS_VALUES | frozenset([
600   DDM_MODIFY,
601   ]))
602 # TODO: DDM_SWAP, DDM_MOVE?
603
604 # common exit codes
605 EXIT_SUCCESS = 0
606 EXIT_FAILURE = 1
607 EXIT_NOTCLUSTER = 5
608 EXIT_NOTMASTER = 11
609 EXIT_NODESETUP_ERROR = 12
610 EXIT_CONFIRMATION = 13 # need user confirmation
611
612 #: Exit code for query operations with unknown fields
613 EXIT_UNKNOWN_FIELD = 14
614
615 # tags
616 TAG_CLUSTER = "cluster"
617 TAG_NODEGROUP = "nodegroup"
618 TAG_NODE = "node"
619 TAG_INSTANCE = "instance"
620 VALID_TAG_TYPES = frozenset([
621   TAG_CLUSTER,
622   TAG_NODEGROUP,
623   TAG_NODE,
624   TAG_INSTANCE,
625   ])
626 MAX_TAG_LEN = 128
627 MAX_TAGS_PER_OBJ = 4096
628
629 # others
630 DEFAULT_BRIDGE = "xen-br0"
631 CLASSIC_DRBD_SYNC_SPEED = 60 * 1024  # 60 MiB, expressed in KiB
632 IP4_ADDRESS_LOCALHOST = "127.0.0.1"
633 IP4_ADDRESS_ANY = "0.0.0.0"
634 IP6_ADDRESS_LOCALHOST = "::1"
635 IP6_ADDRESS_ANY = "::"
636 IP4_VERSION = 4
637 IP6_VERSION = 6
638 VALID_IP_VERSIONS = frozenset([IP4_VERSION, IP6_VERSION])
639 TCP_PING_TIMEOUT = 10
640 GANETI_RUNAS = "root"
641 DEFAULT_VG = "xenvg"
642 DEFAULT_DRBD_HELPER = "/bin/true"
643 MIN_VG_SIZE = 20480
644 DEFAULT_MAC_PREFIX = "aa:00:00"
645 # default maximum instance wait time, in seconds.
646 DEFAULT_SHUTDOWN_TIMEOUT = 120
647 NODE_MAX_CLOCK_SKEW = 150
648 # Time for an intra-cluster disk transfer to wait for a connection
649 DISK_TRANSFER_CONNECT_TIMEOUT = 60
650 # Disk index separator
651 DISK_SEPARATOR = _autoconf.DISK_SEPARATOR
652 IP_COMMAND_PATH = _autoconf.IP_PATH
653
654 #: Key for job IDs in opcode result
655 JOB_IDS_KEY = "jobs"
656
657 # runparts results
658 (RUNPARTS_SKIP,
659  RUNPARTS_RUN,
660  RUNPARTS_ERR) = range(3)
661
662 RUNPARTS_STATUS = frozenset([RUNPARTS_SKIP, RUNPARTS_RUN, RUNPARTS_ERR])
663
664 # RPC constants
665 (RPC_ENCODING_NONE,
666  RPC_ENCODING_ZLIB_BASE64) = range(2)
667
668 # os related constants
669 OS_SCRIPT_CREATE = "create"
670 OS_SCRIPT_IMPORT = "import"
671 OS_SCRIPT_EXPORT = "export"
672 OS_SCRIPT_RENAME = "rename"
673 OS_SCRIPT_VERIFY = "verify"
674 OS_SCRIPTS = frozenset([
675   OS_SCRIPT_CREATE,
676   OS_SCRIPT_IMPORT,
677   OS_SCRIPT_EXPORT,
678   OS_SCRIPT_RENAME,
679   OS_SCRIPT_VERIFY
680   ])
681
682 OS_API_FILE = "ganeti_api_version"
683 OS_VARIANTS_FILE = "variants.list"
684 OS_PARAMETERS_FILE = "parameters.list"
685
686 OS_VALIDATE_PARAMETERS = "parameters"
687 OS_VALIDATE_CALLS = frozenset([OS_VALIDATE_PARAMETERS])
688
689 # ssh constants
690 SSH_CONFIG_DIR = _autoconf.SSH_CONFIG_DIR
691 SSH_HOST_DSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_dsa_key"
692 SSH_HOST_DSA_PUB = SSH_HOST_DSA_PRIV + ".pub"
693 SSH_HOST_RSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_rsa_key"
694 SSH_HOST_RSA_PUB = SSH_HOST_RSA_PRIV + ".pub"
695 SSH = "ssh"
696 SCP = "scp"
697
698 # reboot types
699 INSTANCE_REBOOT_SOFT = "soft"
700 INSTANCE_REBOOT_HARD = "hard"
701 INSTANCE_REBOOT_FULL = "full"
702
703 REBOOT_TYPES = frozenset([
704   INSTANCE_REBOOT_SOFT,
705   INSTANCE_REBOOT_HARD,
706   INSTANCE_REBOOT_FULL
707   ])
708
709 # instance reboot behaviors
710 INSTANCE_REBOOT_ALLOWED = "reboot"
711 INSTANCE_REBOOT_EXIT = "exit"
712
713 REBOOT_BEHAVIORS = frozenset([
714   INSTANCE_REBOOT_ALLOWED,
715   INSTANCE_REBOOT_EXIT
716   ])
717
718 VTYPE_STRING = "string"
719 VTYPE_MAYBE_STRING = "maybe-string"
720 VTYPE_BOOL = "bool"
721 VTYPE_SIZE = "size" # size, in MiBs
722 VTYPE_INT = "int"
723 ENFORCEABLE_TYPES = frozenset([
724   VTYPE_STRING,
725   VTYPE_MAYBE_STRING,
726   VTYPE_BOOL,
727   VTYPE_SIZE,
728   VTYPE_INT,
729   ])
730
731 # Constant representing that the user does not specify any IP version
732 IFACE_NO_IP_VERSION_SPECIFIED = 0
733
734 # HV parameter names (global namespace)
735 HV_BOOT_ORDER = "boot_order"
736 HV_CDROM_IMAGE_PATH = "cdrom_image_path"
737 HV_KVM_CDROM2_IMAGE_PATH = "cdrom2_image_path"
738 HV_KVM_FLOPPY_IMAGE_PATH = "floppy_image_path"
739 HV_NIC_TYPE = "nic_type"
740 HV_DISK_TYPE = "disk_type"
741 HV_KVM_CDROM_DISK_TYPE = "cdrom_disk_type"
742 HV_VNC_BIND_ADDRESS = "vnc_bind_address"
743 HV_VNC_PASSWORD_FILE = "vnc_password_file"
744 HV_VNC_TLS = "vnc_tls"
745 HV_VNC_X509 = "vnc_x509_path"
746 HV_VNC_X509_VERIFY = "vnc_x509_verify"
747 HV_KVM_SPICE_BIND = "spice_bind"
748 HV_KVM_SPICE_IP_VERSION = "spice_ip_version"
749 HV_KVM_SPICE_PASSWORD_FILE = "spice_password_file"
750 HV_KVM_SPICE_LOSSLESS_IMG_COMPR = "spice_image_compression"
751 HV_KVM_SPICE_JPEG_IMG_COMPR = "spice_jpeg_wan_compression"
752 HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR = "spice_zlib_glz_wan_compression"
753 HV_KVM_SPICE_STREAMING_VIDEO_DETECTION = "spice_streaming_video"
754 HV_KVM_SPICE_AUDIO_COMPR = "spice_playback_compression"
755 HV_KVM_SPICE_USE_TLS = "spice_use_tls"
756 HV_KVM_SPICE_TLS_CIPHERS = "spice_tls_ciphers"
757 HV_KVM_SPICE_USE_VDAGENT = "spice_use_vdagent"
758 HV_ACPI = "acpi"
759 HV_PAE = "pae"
760 HV_USE_BOOTLOADER = "use_bootloader"
761 HV_BOOTLOADER_ARGS = "bootloader_args"
762 HV_BOOTLOADER_PATH = "bootloader_path"
763 HV_KERNEL_ARGS = "kernel_args"
764 HV_KERNEL_PATH = "kernel_path"
765 HV_INITRD_PATH = "initrd_path"
766 HV_ROOT_PATH = "root_path"
767 HV_SERIAL_CONSOLE = "serial_console"
768 HV_USB_MOUSE = "usb_mouse"
769 HV_KEYMAP = "keymap"
770 HV_DEVICE_MODEL = "device_model"
771 HV_INIT_SCRIPT = "init_script"
772 HV_MIGRATION_PORT = "migration_port"
773 HV_MIGRATION_BANDWIDTH = "migration_bandwidth"
774 HV_MIGRATION_DOWNTIME = "migration_downtime"
775 HV_MIGRATION_MODE = "migration_mode"
776 HV_USE_LOCALTIME = "use_localtime"
777 HV_DISK_CACHE = "disk_cache"
778 HV_SECURITY_MODEL = "security_model"
779 HV_SECURITY_DOMAIN = "security_domain"
780 HV_KVM_FLAG = "kvm_flag"
781 HV_VHOST_NET = "vhost_net"
782 HV_KVM_USE_CHROOT = "use_chroot"
783 HV_CPU_MASK = "cpu_mask"
784 HV_MEM_PATH = "mem_path"
785 HV_BLOCKDEV_PREFIX = "blockdev_prefix"
786 HV_REBOOT_BEHAVIOR = "reboot_behavior"
787
788 HVS_PARAMETER_TYPES = {
789   HV_BOOT_ORDER: VTYPE_STRING,
790   HV_KVM_FLOPPY_IMAGE_PATH: VTYPE_STRING,
791   HV_CDROM_IMAGE_PATH: VTYPE_STRING,
792   HV_KVM_CDROM2_IMAGE_PATH: VTYPE_STRING,
793   HV_NIC_TYPE: VTYPE_STRING,
794   HV_DISK_TYPE: VTYPE_STRING,
795   HV_KVM_CDROM_DISK_TYPE: VTYPE_STRING,
796   HV_VNC_PASSWORD_FILE: VTYPE_STRING,
797   HV_VNC_BIND_ADDRESS: VTYPE_STRING,
798   HV_VNC_TLS: VTYPE_BOOL,
799   HV_VNC_X509: VTYPE_STRING,
800   HV_VNC_X509_VERIFY: VTYPE_BOOL,
801   HV_KVM_SPICE_BIND: VTYPE_STRING,
802   HV_KVM_SPICE_IP_VERSION: VTYPE_INT,
803   HV_KVM_SPICE_PASSWORD_FILE: VTYPE_STRING,
804   HV_KVM_SPICE_LOSSLESS_IMG_COMPR: VTYPE_STRING,
805   HV_KVM_SPICE_JPEG_IMG_COMPR: VTYPE_STRING,
806   HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR: VTYPE_STRING,
807   HV_KVM_SPICE_STREAMING_VIDEO_DETECTION: VTYPE_STRING,
808   HV_KVM_SPICE_AUDIO_COMPR: VTYPE_BOOL,
809   HV_KVM_SPICE_USE_TLS: VTYPE_BOOL,
810   HV_KVM_SPICE_TLS_CIPHERS: VTYPE_STRING,
811   HV_KVM_SPICE_USE_VDAGENT: VTYPE_BOOL,
812   HV_ACPI: VTYPE_BOOL,
813   HV_PAE: VTYPE_BOOL,
814   HV_USE_BOOTLOADER: VTYPE_BOOL,
815   HV_BOOTLOADER_PATH: VTYPE_STRING,
816   HV_BOOTLOADER_ARGS: VTYPE_STRING,
817   HV_KERNEL_PATH: VTYPE_STRING,
818   HV_KERNEL_ARGS: VTYPE_STRING,
819   HV_INITRD_PATH: VTYPE_STRING,
820   HV_ROOT_PATH: VTYPE_MAYBE_STRING,
821   HV_SERIAL_CONSOLE: VTYPE_BOOL,
822   HV_USB_MOUSE: VTYPE_STRING,
823   HV_KEYMAP: VTYPE_STRING,
824   HV_DEVICE_MODEL: VTYPE_STRING,
825   HV_INIT_SCRIPT: VTYPE_STRING,
826   HV_MIGRATION_PORT: VTYPE_INT,
827   HV_MIGRATION_BANDWIDTH: VTYPE_INT,
828   HV_MIGRATION_DOWNTIME: VTYPE_INT,
829   HV_MIGRATION_MODE: VTYPE_STRING,
830   HV_USE_LOCALTIME: VTYPE_BOOL,
831   HV_DISK_CACHE: VTYPE_STRING,
832   HV_SECURITY_MODEL: VTYPE_STRING,
833   HV_SECURITY_DOMAIN: VTYPE_STRING,
834   HV_KVM_FLAG: VTYPE_STRING,
835   HV_VHOST_NET: VTYPE_BOOL,
836   HV_KVM_USE_CHROOT: VTYPE_BOOL,
837   HV_CPU_MASK: VTYPE_STRING,
838   HV_MEM_PATH: VTYPE_STRING,
839   HV_BLOCKDEV_PREFIX: VTYPE_STRING,
840   HV_REBOOT_BEHAVIOR: VTYPE_STRING,
841   }
842
843 HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
844
845 # Migration statuses
846 HV_MIGRATION_COMPLETED = "completed"
847 HV_MIGRATION_ACTIVE = "active"
848 HV_MIGRATION_FAILED = "failed"
849 HV_MIGRATION_CANCELLED = "cancelled"
850
851 HV_MIGRATION_VALID_STATUSES = frozenset([
852   HV_MIGRATION_COMPLETED,
853   HV_MIGRATION_ACTIVE,
854   HV_MIGRATION_FAILED,
855   HV_MIGRATION_CANCELLED,
856   ])
857
858 HV_MIGRATION_FAILED_STATUSES = frozenset([
859   HV_MIGRATION_FAILED,
860   HV_MIGRATION_CANCELLED,
861   ])
862
863 # KVM-specific statuses
864 HV_KVM_MIGRATION_VALID_STATUSES = HV_MIGRATION_VALID_STATUSES
865
866 # Node info keys
867 HV_NODEINFO_KEY_VERSION = "hv_version"
868
869 # Hypervisor state
870 HVST_MEMORY_TOTAL = "mem_total"
871 HVST_MEMORY_NODE = "mem_node"
872 HVST_MEMORY_HV = "mem_hv"
873 HVST_CPU_TOTAL = "cpu_total"
874 HVST_CPU_NODE = "cpu_node"
875
876 HVST_DEFAULTS = {
877   HVST_MEMORY_TOTAL: 0,
878   HVST_MEMORY_NODE: 0,
879   HVST_MEMORY_HV: 0,
880   HVST_CPU_TOTAL: 1,
881   HVST_CPU_NODE: 1,
882   }
883
884 HVSTS_PARAMETER_TYPES = {
885   HVST_MEMORY_TOTAL: VTYPE_INT,
886   HVST_MEMORY_NODE: VTYPE_INT,
887   HVST_MEMORY_HV: VTYPE_INT,
888   HVST_CPU_TOTAL: VTYPE_INT,
889   HVST_CPU_NODE: VTYPE_INT,
890   }
891
892 HVSTS_PARAMETERS = frozenset(HVSTS_PARAMETER_TYPES.keys())
893
894 # Disk state
895 DS_DISK_TOTAL = "disk_total"
896 DS_DISK_RESERVED = "disk_reserved"
897 DS_DISK_OVERHEAD = "disk_overhead"
898
899 DS_DEFAULTS = {
900   DS_DISK_TOTAL: 0,
901   DS_DISK_RESERVED: 0,
902   DS_DISK_OVERHEAD: 0,
903   }
904
905 DSS_PARAMETER_TYPES = {
906   DS_DISK_TOTAL: VTYPE_INT,
907   DS_DISK_RESERVED: VTYPE_INT,
908   DS_DISK_OVERHEAD: VTYPE_INT,
909   }
910
911 DSS_PARAMETERS = frozenset(DSS_PARAMETER_TYPES.keys())
912 DS_VALID_TYPES = frozenset([LD_LV])
913
914 # Backend parameter names
915 BE_MEMORY = "memory" # deprecated and replaced by max and min mem
916 BE_MAXMEM = "maxmem"
917 BE_MINMEM = "minmem"
918 BE_VCPUS = "vcpus"
919 BE_AUTO_BALANCE = "auto_balance"
920 BE_ALWAYS_FAILOVER = "always_failover"
921
922 BES_PARAMETER_TYPES = {
923   BE_MAXMEM: VTYPE_SIZE,
924   BE_MINMEM: VTYPE_SIZE,
925   BE_VCPUS: VTYPE_INT,
926   BE_AUTO_BALANCE: VTYPE_BOOL,
927   BE_ALWAYS_FAILOVER: VTYPE_BOOL,
928   }
929
930 BES_PARAMETER_COMPAT = {
931   BE_MEMORY: VTYPE_SIZE,
932   }
933 BES_PARAMETER_COMPAT.update(BES_PARAMETER_TYPES)
934
935 BES_PARAMETERS = frozenset(BES_PARAMETER_TYPES.keys())
936
937 # instance specs
938 ISPEC_MEM_SIZE = "memory-size"
939 ISPEC_CPU_COUNT = "cpu-count"
940 ISPEC_DISK_COUNT = "disk-count"
941 ISPEC_DISK_SIZE = "disk-size"
942 ISPEC_NIC_COUNT = "nic-count"
943
944 ISPECS_PARAMETER_TYPES = {
945   ISPEC_MEM_SIZE: VTYPE_INT,
946   ISPEC_CPU_COUNT: VTYPE_INT,
947   ISPEC_DISK_COUNT: VTYPE_INT,
948   ISPEC_DISK_SIZE: VTYPE_INT,
949   ISPEC_NIC_COUNT: VTYPE_INT,
950   }
951
952 ISPECS_PARAMETERS = frozenset(ISPECS_PARAMETER_TYPES.keys())
953
954 ISPECS_MIN = "min"
955 ISPECS_MAX = "max"
956 ISPECS_STD = "std"
957 IPOLICY_DTS = "disk-templates"
958 IPOLICY_VCPU_RATIO = "vcpu-ratio"
959
960 IPOLICY_ISPECS = frozenset([
961   ISPECS_MIN,
962   ISPECS_MAX,
963   ISPECS_STD,
964   ])
965
966 IPOLICY_PARAMETERS = frozenset([
967   IPOLICY_VCPU_RATIO,
968   ])
969
970 IPOLICY_ALL_KEYS = (IPOLICY_ISPECS |
971                     IPOLICY_PARAMETERS |
972                     frozenset([IPOLICY_DTS]))
973
974 # Node parameter names
975 ND_OOB_PROGRAM = "oob_program"
976
977 NDS_PARAMETER_TYPES = {
978   ND_OOB_PROGRAM: VTYPE_MAYBE_STRING,
979   }
980
981 NDS_PARAMETERS = frozenset(NDS_PARAMETER_TYPES.keys())
982
983 # Logical Disks parameters
984 LDP_RESYNC_RATE = "resync-rate"
985 LDP_STRIPES = "stripes"
986 LDP_BARRIERS = "disabled-barriers"
987 LDP_NO_META_FLUSH = "disable-meta-flush"
988 LDP_DEFAULT_METAVG = "default-metavg"
989 LDP_DISK_CUSTOM = "disk-custom"
990 LDP_NET_CUSTOM = "net-custom"
991 LDP_DYNAMIC_RESYNC = "dynamic-resync"
992 LDP_PLAN_AHEAD = "c-plan-ahead"
993 LDP_FILL_TARGET = "c-fill-target"
994 LDP_DELAY_TARGET = "c-delay-target"
995 LDP_MAX_RATE = "c-max-rate"
996 LDP_MIN_RATE = "c-min-rate"
997 LDP_POOL = "pool"
998 DISK_LD_TYPES = {
999   LDP_RESYNC_RATE: VTYPE_INT,
1000   LDP_STRIPES: VTYPE_INT,
1001   LDP_BARRIERS: VTYPE_STRING,
1002   LDP_NO_META_FLUSH: VTYPE_BOOL,
1003   LDP_DEFAULT_METAVG: VTYPE_STRING,
1004   LDP_DISK_CUSTOM: VTYPE_STRING,
1005   LDP_NET_CUSTOM: VTYPE_STRING,
1006   LDP_DYNAMIC_RESYNC: VTYPE_BOOL,
1007   LDP_PLAN_AHEAD: VTYPE_INT,
1008   LDP_FILL_TARGET: VTYPE_INT,
1009   LDP_DELAY_TARGET: VTYPE_INT,
1010   LDP_MAX_RATE: VTYPE_INT,
1011   LDP_MIN_RATE: VTYPE_INT,
1012   LDP_POOL: VTYPE_STRING,
1013   }
1014 DISK_LD_PARAMETERS = frozenset(DISK_LD_TYPES.keys())
1015
1016 # Disk template parameters (can be set/changed by the user via gnt-cluster and
1017 # gnt-group)
1018 DRBD_RESYNC_RATE = "resync-rate"
1019 DRBD_DATA_STRIPES = "data-stripes"
1020 DRBD_META_STRIPES = "meta-stripes"
1021 DRBD_DISK_BARRIERS = "disk-barriers"
1022 DRBD_META_BARRIERS = "meta-barriers"
1023 DRBD_DEFAULT_METAVG = "metavg"
1024 DRBD_DISK_CUSTOM = "disk-custom"
1025 DRBD_NET_CUSTOM = "net-custom"
1026 DRBD_DYNAMIC_RESYNC = "dynamic-resync"
1027 DRBD_PLAN_AHEAD = "c-plan-ahead"
1028 DRBD_FILL_TARGET = "c-fill-target"
1029 DRBD_DELAY_TARGET = "c-delay-target"
1030 DRBD_MAX_RATE = "c-max-rate"
1031 DRBD_MIN_RATE = "c-min-rate"
1032 LV_STRIPES = "stripes"
1033 RBD_POOL = "pool"
1034 DISK_DT_TYPES = {
1035   DRBD_RESYNC_RATE: VTYPE_INT,
1036   DRBD_DATA_STRIPES: VTYPE_INT,
1037   DRBD_META_STRIPES: VTYPE_INT,
1038   DRBD_DISK_BARRIERS: VTYPE_STRING,
1039   DRBD_META_BARRIERS: VTYPE_BOOL,
1040   DRBD_DEFAULT_METAVG: VTYPE_STRING,
1041   DRBD_DISK_CUSTOM: VTYPE_STRING,
1042   DRBD_NET_CUSTOM: VTYPE_STRING,
1043   DRBD_DYNAMIC_RESYNC: VTYPE_BOOL,
1044   DRBD_PLAN_AHEAD: VTYPE_INT,
1045   DRBD_FILL_TARGET: VTYPE_INT,
1046   DRBD_DELAY_TARGET: VTYPE_INT,
1047   DRBD_MAX_RATE: VTYPE_INT,
1048   DRBD_MIN_RATE: VTYPE_INT,
1049   LV_STRIPES: VTYPE_INT,
1050   RBD_POOL: VTYPE_STRING,
1051   }
1052
1053 DISK_DT_PARAMETERS = frozenset(DISK_DT_TYPES.keys())
1054
1055 # OOB supported commands
1056 OOB_POWER_ON = "power-on"
1057 OOB_POWER_OFF = "power-off"
1058 OOB_POWER_CYCLE = "power-cycle"
1059 OOB_POWER_STATUS = "power-status"
1060 OOB_HEALTH = "health"
1061
1062 OOB_COMMANDS = frozenset([
1063   OOB_POWER_ON,
1064   OOB_POWER_OFF,
1065   OOB_POWER_CYCLE,
1066   OOB_POWER_STATUS,
1067   OOB_HEALTH
1068   ])
1069
1070 OOB_POWER_STATUS_POWERED = "powered"
1071
1072 OOB_TIMEOUT = 60 # 60 seconds
1073 OOB_POWER_DELAY = 2.0 # 2 seconds
1074
1075 OOB_STATUS_OK = "OK"
1076 OOB_STATUS_WARNING = "WARNING"
1077 OOB_STATUS_CRITICAL = "CRITICAL"
1078 OOB_STATUS_UNKNOWN = "UNKNOWN"
1079
1080 OOB_STATUSES = frozenset([
1081   OOB_STATUS_OK,
1082   OOB_STATUS_WARNING,
1083   OOB_STATUS_CRITICAL,
1084   OOB_STATUS_UNKNOWN,
1085   ])
1086
1087 # Instance Parameters Profile
1088 PP_DEFAULT = "default"
1089
1090 # NIC_* constants are used inside the ganeti config
1091 NIC_MODE = "mode"
1092 NIC_LINK = "link"
1093
1094 NIC_MODE_BRIDGED = "bridged"
1095 NIC_MODE_ROUTED = "routed"
1096
1097 NIC_VALID_MODES = frozenset([NIC_MODE_BRIDGED, NIC_MODE_ROUTED])
1098
1099 NICS_PARAMETER_TYPES = {
1100   NIC_MODE: VTYPE_STRING,
1101   NIC_LINK: VTYPE_STRING,
1102   }
1103
1104 NICS_PARAMETERS = frozenset(NICS_PARAMETER_TYPES.keys())
1105
1106 # IDISK_* constants are used in opcodes, to create/change disks
1107 IDISK_SIZE = "size"
1108 IDISK_MODE = "mode"
1109 IDISK_ADOPT = "adopt"
1110 IDISK_VG = "vg"
1111 IDISK_METAVG = "metavg"
1112 IDISK_PARAMS_TYPES = {
1113   IDISK_SIZE: VTYPE_SIZE,
1114   IDISK_MODE: VTYPE_STRING,
1115   IDISK_ADOPT: VTYPE_STRING,
1116   IDISK_VG: VTYPE_STRING,
1117   IDISK_METAVG: VTYPE_STRING,
1118   }
1119 IDISK_PARAMS = frozenset(IDISK_PARAMS_TYPES.keys())
1120
1121 # INIC_* constants are used in opcodes, to create/change nics
1122 INIC_MAC = "mac"
1123 INIC_IP = "ip"
1124 INIC_MODE = "mode"
1125 INIC_LINK = "link"
1126 INIC_PARAMS_TYPES = {
1127   INIC_IP: VTYPE_MAYBE_STRING,
1128   INIC_LINK: VTYPE_STRING,
1129   INIC_MAC: VTYPE_STRING,
1130   INIC_MODE: VTYPE_STRING,
1131   }
1132 INIC_PARAMS = frozenset(INIC_PARAMS_TYPES.keys())
1133
1134 # Hypervisor constants
1135 HT_XEN_PVM = "xen-pvm"
1136 HT_FAKE = "fake"
1137 HT_XEN_HVM = "xen-hvm"
1138 HT_KVM = "kvm"
1139 HT_CHROOT = "chroot"
1140 HT_LXC = "lxc"
1141 HYPER_TYPES = frozenset([
1142   HT_XEN_PVM,
1143   HT_FAKE,
1144   HT_XEN_HVM,
1145   HT_KVM,
1146   HT_CHROOT,
1147   HT_LXC,
1148   ])
1149 HTS_REQ_PORT = frozenset([HT_XEN_HVM, HT_KVM])
1150
1151 VNC_BASE_PORT = 5900
1152 VNC_PASSWORD_FILE = CONF_DIR + "/vnc-cluster-password"
1153 VNC_DEFAULT_BIND_ADDRESS = IP4_ADDRESS_ANY
1154
1155 # NIC types
1156 HT_NIC_RTL8139 = "rtl8139"
1157 HT_NIC_NE2K_PCI = "ne2k_pci"
1158 HT_NIC_NE2K_ISA = "ne2k_isa"
1159 HT_NIC_I82551 = "i82551"
1160 HT_NIC_I85557B = "i82557b"
1161 HT_NIC_I8259ER = "i82559er"
1162 HT_NIC_PCNET = "pcnet"
1163 HT_NIC_E1000 = "e1000"
1164 HT_NIC_PARAVIRTUAL = HT_DISK_PARAVIRTUAL = "paravirtual"
1165
1166 HT_HVM_VALID_NIC_TYPES = frozenset([
1167   HT_NIC_RTL8139,
1168   HT_NIC_NE2K_PCI,
1169   HT_NIC_E1000,
1170   HT_NIC_NE2K_ISA,
1171   HT_NIC_PARAVIRTUAL
1172   ])
1173 HT_KVM_VALID_NIC_TYPES = frozenset([
1174   HT_NIC_RTL8139,
1175   HT_NIC_NE2K_PCI,
1176   HT_NIC_NE2K_ISA,
1177   HT_NIC_I82551,
1178   HT_NIC_I85557B,
1179   HT_NIC_I8259ER,
1180   HT_NIC_PCNET,
1181   HT_NIC_E1000,
1182   HT_NIC_PARAVIRTUAL
1183   ])
1184
1185 # Disk types
1186 HT_DISK_IOEMU = "ioemu"
1187 HT_DISK_IDE = "ide"
1188 HT_DISK_SCSI = "scsi"
1189 HT_DISK_SD = "sd"
1190 HT_DISK_MTD = "mtd"
1191 HT_DISK_PFLASH = "pflash"
1192
1193 HT_CACHE_DEFAULT = "default"
1194 HT_CACHE_NONE = "none"
1195 HT_CACHE_WTHROUGH = "writethrough"
1196 HT_CACHE_WBACK = "writeback"
1197 HT_VALID_CACHE_TYPES = frozenset([
1198   HT_CACHE_DEFAULT,
1199   HT_CACHE_NONE,
1200   HT_CACHE_WTHROUGH,
1201   HT_CACHE_WBACK
1202   ])
1203
1204 HT_HVM_VALID_DISK_TYPES = frozenset([HT_DISK_PARAVIRTUAL, HT_DISK_IOEMU])
1205 HT_KVM_VALID_DISK_TYPES = frozenset([
1206   HT_DISK_PARAVIRTUAL,
1207   HT_DISK_IDE,
1208   HT_DISK_SCSI,
1209   HT_DISK_SD,
1210   HT_DISK_MTD,
1211   HT_DISK_PFLASH
1212   ])
1213
1214 # Mouse types:
1215 HT_MOUSE_MOUSE = "mouse"
1216 HT_MOUSE_TABLET = "tablet"
1217
1218 HT_KVM_VALID_MOUSE_TYPES = frozenset([HT_MOUSE_MOUSE, HT_MOUSE_TABLET])
1219
1220 # Boot order
1221 HT_BO_FLOPPY = "floppy"
1222 HT_BO_CDROM = "cdrom"
1223 HT_BO_DISK = "disk"
1224 HT_BO_NETWORK = "network"
1225
1226 HT_KVM_VALID_BO_TYPES = frozenset([
1227   HT_BO_FLOPPY,
1228   HT_BO_CDROM,
1229   HT_BO_DISK,
1230   HT_BO_NETWORK
1231   ])
1232
1233 # SPICE lossless image compression options
1234 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_GLZ = "auto_glz"
1235 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_LZ = "auto_lz"
1236 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_QUIC = "quic"
1237 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_GLZ = "glz"
1238 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_LZ = "lz"
1239 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_OFF = "off"
1240
1241 HT_KVM_SPICE_VALID_LOSSLESS_IMG_COMPR_OPTIONS = frozenset([
1242   HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_GLZ,
1243   HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_LZ,
1244   HT_KVM_SPICE_LOSSLESS_IMG_COMPR_QUIC,
1245   HT_KVM_SPICE_LOSSLESS_IMG_COMPR_GLZ,
1246   HT_KVM_SPICE_LOSSLESS_IMG_COMPR_LZ,
1247   HT_KVM_SPICE_LOSSLESS_IMG_COMPR_OFF,
1248   ])
1249
1250 # SPICE lossy image compression options (valid for both jpeg and zlib-glz)
1251 HT_KVM_SPICE_LOSSY_IMG_COMPR_AUTO = "auto"
1252 HT_KVM_SPICE_LOSSY_IMG_COMPR_NEVER = "never"
1253 HT_KVM_SPICE_LOSSY_IMG_COMPR_ALWAYS = "always"
1254
1255 HT_KVM_SPICE_VALID_LOSSY_IMG_COMPR_OPTIONS = frozenset([
1256   HT_KVM_SPICE_LOSSY_IMG_COMPR_AUTO,
1257   HT_KVM_SPICE_LOSSY_IMG_COMPR_NEVER,
1258   HT_KVM_SPICE_LOSSY_IMG_COMPR_ALWAYS,
1259   ])
1260
1261 # SPICE video stream detection
1262 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_OFF = "off"
1263 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_ALL = "all"
1264 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_FILTER = "filter"
1265
1266 HT_KVM_SPICE_VALID_VIDEO_STREAM_DETECTION_OPTIONS = frozenset([
1267   HT_KVM_SPICE_VIDEO_STREAM_DETECTION_OFF,
1268   HT_KVM_SPICE_VIDEO_STREAM_DETECTION_ALL,
1269   HT_KVM_SPICE_VIDEO_STREAM_DETECTION_FILTER,
1270   ])
1271
1272 # Security models
1273 HT_SM_NONE = "none"
1274 HT_SM_USER = "user"
1275 HT_SM_POOL = "pool"
1276
1277 HT_KVM_VALID_SM_TYPES = frozenset([HT_SM_NONE, HT_SM_USER, HT_SM_POOL])
1278
1279 # Kvm flag values
1280 HT_KVM_ENABLED = "enabled"
1281 HT_KVM_DISABLED = "disabled"
1282
1283 HT_KVM_FLAG_VALUES = frozenset([HT_KVM_ENABLED, HT_KVM_DISABLED])
1284
1285 # Migration type
1286 HT_MIGRATION_LIVE = "live"
1287 HT_MIGRATION_NONLIVE = "non-live"
1288 HT_MIGRATION_MODES = frozenset([HT_MIGRATION_LIVE, HT_MIGRATION_NONLIVE])
1289
1290 # Cluster Verify steps
1291 VERIFY_NPLUSONE_MEM = "nplusone_mem"
1292 VERIFY_OPTIONAL_CHECKS = frozenset([VERIFY_NPLUSONE_MEM])
1293
1294 # Cluster Verify error classes
1295 CV_TCLUSTER = "cluster"
1296 CV_TNODE = "node"
1297 CV_TINSTANCE = "instance"
1298
1299 # Cluster Verify error codes and documentation
1300 CV_ECLUSTERCFG = \
1301   (CV_TCLUSTER, "ECLUSTERCFG", "Cluster configuration verification failure")
1302 CV_ECLUSTERCERT = \
1303   (CV_TCLUSTER, "ECLUSTERCERT",
1304    "Cluster certificate files verification failure")
1305 CV_ECLUSTERFILECHECK = \
1306   (CV_TCLUSTER, "ECLUSTERFILECHECK",
1307    "Cluster configuration verification failure")
1308 CV_ECLUSTERDANGLINGNODES = \
1309   (CV_TNODE, "ECLUSTERDANGLINGNODES",
1310    "Some nodes belong to non-existing groups")
1311 CV_ECLUSTERDANGLINGINST = \
1312   (CV_TNODE, "ECLUSTERDANGLINGINST",
1313    "Some instances have a non-existing primary node")
1314 CV_EINSTANCEBADNODE = \
1315   (CV_TINSTANCE, "EINSTANCEBADNODE",
1316    "Instance marked as running lives on an offline node")
1317 CV_EINSTANCEDOWN = \
1318   (CV_TINSTANCE, "EINSTANCEDOWN", "Instance not running on its primary node")
1319 CV_EINSTANCELAYOUT = \
1320   (CV_TINSTANCE, "EINSTANCELAYOUT", "Instance has multiple secondary nodes")
1321 CV_EINSTANCEMISSINGDISK = \
1322   (CV_TINSTANCE, "EINSTANCEMISSINGDISK", "Missing volume on an instance")
1323 CV_EINSTANCEFAULTYDISK = \
1324   (CV_TINSTANCE, "EINSTANCEFAULTYDISK",
1325    "Impossible to retrieve status for a disk")
1326 CV_EINSTANCEWRONGNODE = \
1327   (CV_TINSTANCE, "EINSTANCEWRONGNODE", "Instance running on the wrong node")
1328 CV_EINSTANCESPLITGROUPS = \
1329   (CV_TINSTANCE, "EINSTANCESPLITGROUPS",
1330    "Instance with primary and secondary nodes in different groups")
1331 CV_EINSTANCEPOLICY = \
1332   (CV_TINSTANCE, "EINSTANCEPOLICY",
1333    "Instance does not meet policy")
1334 CV_ENODEDRBD = \
1335   (CV_TNODE, "ENODEDRBD", "Error parsing the DRBD status file")
1336 CV_ENODEDRBDHELPER = \
1337   (CV_TNODE, "ENODEDRBDHELPER", "Error caused by the DRBD helper")
1338 CV_ENODEFILECHECK = \
1339   (CV_TNODE, "ENODEFILECHECK",
1340    "Error retrieving the checksum of the node files")
1341 CV_ENODEHOOKS = \
1342   (CV_TNODE, "ENODEHOOKS", "Communication failure in hooks execution")
1343 CV_ENODEHV = \
1344   (CV_TNODE, "ENODEHV", "Hypervisor parameters verification failure")
1345 CV_ENODELVM = \
1346   (CV_TNODE, "ENODELVM", "LVM-related node error")
1347 CV_ENODEN1 = \
1348   (CV_TNODE, "ENODEN1", "Not enough memory to accommodate instance failovers")
1349 CV_ENODENET = \
1350   (CV_TNODE, "ENODENET", "Network-related node error")
1351 CV_ENODEOS = \
1352   (CV_TNODE, "ENODEOS", "OS-related node error")
1353 CV_ENODEORPHANINSTANCE = \
1354   (CV_TNODE, "ENODEORPHANINSTANCE", "Unknown intance running on a node")
1355 CV_ENODEORPHANLV = \
1356   (CV_TNODE, "ENODEORPHANLV", "Unknown LVM logical volume")
1357 CV_ENODERPC = \
1358   (CV_TNODE, "ENODERPC",
1359    "Error during connection to the primary node of an instance")
1360 CV_ENODESSH = \
1361   (CV_TNODE, "ENODESSH", "SSH-related node error")
1362 CV_ENODEVERSION = \
1363   (CV_TNODE, "ENODEVERSION",
1364    "Protocol version mismatch or Ganeti version mismatch")
1365 CV_ENODESETUP = \
1366   (CV_TNODE, "ENODESETUP", "Node setup error")
1367 CV_ENODETIME = \
1368   (CV_TNODE, "ENODETIME", "Node returned invalid time")
1369 CV_ENODEOOBPATH = \
1370   (CV_TNODE, "ENODEOOBPATH", "Invalid Out Of Band path")
1371 CV_ENODEUSERSCRIPTS = \
1372   (CV_TNODE, "ENODEUSERSCRIPTS", "User scripts not present or not executable")
1373
1374 CV_ALL_ECODES = frozenset([
1375   CV_ECLUSTERCFG,
1376   CV_ECLUSTERCERT,
1377   CV_ECLUSTERFILECHECK,
1378   CV_ECLUSTERDANGLINGNODES,
1379   CV_ECLUSTERDANGLINGINST,
1380   CV_EINSTANCEBADNODE,
1381   CV_EINSTANCEDOWN,
1382   CV_EINSTANCELAYOUT,
1383   CV_EINSTANCEMISSINGDISK,
1384   CV_EINSTANCEFAULTYDISK,
1385   CV_EINSTANCEWRONGNODE,
1386   CV_EINSTANCESPLITGROUPS,
1387   CV_EINSTANCEPOLICY,
1388   CV_ENODEDRBD,
1389   CV_ENODEDRBDHELPER,
1390   CV_ENODEFILECHECK,
1391   CV_ENODEHOOKS,
1392   CV_ENODEHV,
1393   CV_ENODELVM,
1394   CV_ENODEN1,
1395   CV_ENODENET,
1396   CV_ENODEOS,
1397   CV_ENODEORPHANINSTANCE,
1398   CV_ENODEORPHANLV,
1399   CV_ENODERPC,
1400   CV_ENODESSH,
1401   CV_ENODEVERSION,
1402   CV_ENODESETUP,
1403   CV_ENODETIME,
1404   CV_ENODEOOBPATH,
1405   CV_ENODEUSERSCRIPTS,
1406   ])
1407
1408 CV_ALL_ECODES_STRINGS = frozenset(estr for (_, estr, _) in CV_ALL_ECODES)
1409
1410 # Node verify constants
1411 NV_DRBDHELPER = "drbd-helper"
1412 NV_DRBDLIST = "drbd-list"
1413 NV_FILELIST = "filelist"
1414 NV_HVINFO = "hvinfo"
1415 NV_HYPERVISOR = "hypervisor"
1416 NV_HVPARAMS = "hvparms"
1417 NV_INSTANCELIST = "instancelist"
1418 NV_LVLIST = "lvlist"
1419 NV_MASTERIP = "master-ip"
1420 NV_NODELIST = "nodelist"
1421 NV_NODENETTEST = "node-net-test"
1422 NV_NODESETUP = "nodesetup"
1423 NV_OSLIST = "oslist"
1424 NV_PVLIST = "pvlist"
1425 NV_TIME = "time"
1426 NV_VERSION = "version"
1427 NV_VGLIST = "vglist"
1428 NV_VMNODES = "vmnodes"
1429 NV_OOB_PATHS = "oob-paths"
1430 NV_BRIDGES = "bridges"
1431 NV_USERSCRIPTS = "user-scripts"
1432
1433 # Instance status
1434 INSTST_RUNNING = "running"
1435 INSTST_ADMINDOWN = "ADMIN_down"
1436 INSTST_ADMINOFFLINE = "ADMIN_offline"
1437 INSTST_NODEOFFLINE = "ERROR_nodeoffline"
1438 INSTST_NODEDOWN = "ERROR_nodedown"
1439 INSTST_WRONGNODE = "ERROR_wrongnode"
1440 INSTST_ERRORUP = "ERROR_up"
1441 INSTST_ERRORDOWN = "ERROR_down"
1442 INSTST_ALL = frozenset([
1443   INSTST_RUNNING,
1444   INSTST_ADMINDOWN,
1445   INSTST_ADMINOFFLINE,
1446   INSTST_NODEOFFLINE,
1447   INSTST_NODEDOWN,
1448   INSTST_WRONGNODE,
1449   INSTST_ERRORUP,
1450   INSTST_ERRORDOWN,
1451   ])
1452
1453 # Admin states
1454 ADMINST_UP = "up"
1455 ADMINST_DOWN = "down"
1456 ADMINST_OFFLINE = "offline"
1457 ADMINST_ALL = frozenset([
1458   ADMINST_UP,
1459   ADMINST_DOWN,
1460   ADMINST_OFFLINE,
1461   ])
1462
1463 # Node roles
1464 NR_REGULAR = "R"
1465 NR_MASTER = "M"
1466 NR_MCANDIDATE = "C"
1467 NR_DRAINED = "D"
1468 NR_OFFLINE = "O"
1469 NR_ALL = frozenset([
1470   NR_REGULAR,
1471   NR_MASTER,
1472   NR_MCANDIDATE,
1473   NR_DRAINED,
1474   NR_OFFLINE,
1475   ])
1476
1477 # SSL certificate check constants (in days)
1478 SSL_CERT_EXPIRATION_WARN = 30
1479 SSL_CERT_EXPIRATION_ERROR = 7
1480
1481 # Allocator framework constants
1482 IALLOCATOR_VERSION = 2
1483 IALLOCATOR_DIR_IN = "in"
1484 IALLOCATOR_DIR_OUT = "out"
1485 VALID_IALLOCATOR_DIRECTIONS = frozenset([
1486   IALLOCATOR_DIR_IN,
1487   IALLOCATOR_DIR_OUT,
1488   ])
1489 IALLOCATOR_MODE_ALLOC = "allocate"
1490 IALLOCATOR_MODE_RELOC = "relocate"
1491 IALLOCATOR_MODE_CHG_GROUP = "change-group"
1492 IALLOCATOR_MODE_NODE_EVAC = "node-evacuate"
1493 VALID_IALLOCATOR_MODES = frozenset([
1494   IALLOCATOR_MODE_ALLOC,
1495   IALLOCATOR_MODE_RELOC,
1496   IALLOCATOR_MODE_CHG_GROUP,
1497   IALLOCATOR_MODE_NODE_EVAC,
1498   ])
1499 IALLOCATOR_SEARCH_PATH = _autoconf.IALLOCATOR_SEARCH_PATH
1500
1501 IALLOCATOR_NEVAC_PRI = "primary-only"
1502 IALLOCATOR_NEVAC_SEC = "secondary-only"
1503 IALLOCATOR_NEVAC_ALL = "all"
1504 IALLOCATOR_NEVAC_MODES = frozenset([
1505   IALLOCATOR_NEVAC_PRI,
1506   IALLOCATOR_NEVAC_SEC,
1507   IALLOCATOR_NEVAC_ALL,
1508   ])
1509
1510 # Node evacuation
1511 NODE_EVAC_PRI = "primary-only"
1512 NODE_EVAC_SEC = "secondary-only"
1513 NODE_EVAC_ALL = "all"
1514 NODE_EVAC_MODES = frozenset([
1515   NODE_EVAC_PRI,
1516   NODE_EVAC_SEC,
1517   NODE_EVAC_ALL,
1518   ])
1519
1520 # Job queue
1521 JOB_QUEUE_VERSION = 1
1522 JOB_QUEUE_LOCK_FILE = QUEUE_DIR + "/lock"
1523 JOB_QUEUE_VERSION_FILE = QUEUE_DIR + "/version"
1524 JOB_QUEUE_SERIAL_FILE = QUEUE_DIR + "/serial"
1525 JOB_QUEUE_ARCHIVE_DIR = QUEUE_DIR + "/archive"
1526 JOB_QUEUE_DRAIN_FILE = QUEUE_DIR + "/drain"
1527 JOB_QUEUE_SIZE_HARD_LIMIT = 5000
1528 JOB_QUEUE_DIRS = [QUEUE_DIR, JOB_QUEUE_ARCHIVE_DIR]
1529 JOB_QUEUE_DIRS_MODE = SECURE_DIR_MODE
1530
1531 JOB_ID_TEMPLATE = r"\d+"
1532 JOB_FILE_RE = re.compile(r"^job-(%s)$" % JOB_ID_TEMPLATE)
1533
1534 # unchanged job return
1535 JOB_NOTCHANGED = "nochange"
1536
1537 # Job status
1538 JOB_STATUS_QUEUED = "queued"
1539 JOB_STATUS_WAITING = "waiting"
1540 JOB_STATUS_CANCELING = "canceling"
1541 JOB_STATUS_RUNNING = "running"
1542 JOB_STATUS_CANCELED = "canceled"
1543 JOB_STATUS_SUCCESS = "success"
1544 JOB_STATUS_ERROR = "error"
1545 JOBS_FINALIZED = frozenset([
1546   JOB_STATUS_CANCELED,
1547   JOB_STATUS_SUCCESS,
1548   JOB_STATUS_ERROR,
1549   ])
1550 JOB_STATUS_ALL = frozenset([
1551   JOB_STATUS_QUEUED,
1552   JOB_STATUS_WAITING,
1553   JOB_STATUS_CANCELING,
1554   JOB_STATUS_RUNNING,
1555   ]) | JOBS_FINALIZED
1556
1557 # OpCode status
1558 # not yet finalized
1559 OP_STATUS_QUEUED = "queued"
1560 OP_STATUS_WAITING = "waiting"
1561 OP_STATUS_CANCELING = "canceling"
1562 OP_STATUS_RUNNING = "running"
1563 # finalized
1564 OP_STATUS_CANCELED = "canceled"
1565 OP_STATUS_SUCCESS = "success"
1566 OP_STATUS_ERROR = "error"
1567 OPS_FINALIZED = frozenset([
1568   OP_STATUS_CANCELED,
1569   OP_STATUS_SUCCESS,
1570   OP_STATUS_ERROR
1571   ])
1572
1573 # OpCode priority
1574 OP_PRIO_LOWEST = +19
1575 OP_PRIO_HIGHEST = -20
1576
1577 OP_PRIO_LOW = +10
1578 OP_PRIO_NORMAL = 0
1579 OP_PRIO_HIGH = -10
1580
1581 OP_PRIO_SUBMIT_VALID = frozenset([
1582   OP_PRIO_LOW,
1583   OP_PRIO_NORMAL,
1584   OP_PRIO_HIGH,
1585   ])
1586
1587 OP_PRIO_DEFAULT = OP_PRIO_NORMAL
1588
1589 # Execution log types
1590 ELOG_MESSAGE = "message"
1591 ELOG_PROGRESS = "progress"
1592 ELOG_REMOTE_IMPORT = "remote-import"
1593 ELOG_JQUEUE_TEST = "jqueue-test"
1594
1595 # /etc/hosts modification
1596 ETC_HOSTS_ADD = "add"
1597 ETC_HOSTS_REMOVE = "remove"
1598
1599 # Job queue test
1600 JQT_MSGPREFIX = "TESTMSG="
1601 JQT_EXPANDNAMES = "expandnames"
1602 JQT_EXEC = "exec"
1603 JQT_LOGMSG = "logmsg"
1604 JQT_STARTMSG = "startmsg"
1605 JQT_ALL = frozenset([
1606   JQT_EXPANDNAMES,
1607   JQT_EXEC,
1608   JQT_LOGMSG,
1609   JQT_STARTMSG,
1610   ])
1611
1612 # Query resources
1613 QR_INSTANCE = "instance"
1614 QR_NODE = "node"
1615 QR_LOCK = "lock"
1616 QR_GROUP = "group"
1617 QR_OS = "os"
1618
1619 #: List of resources which can be queried using L{opcodes.OpQuery}
1620 QR_VIA_OP = frozenset([QR_INSTANCE, QR_NODE, QR_GROUP, QR_OS])
1621
1622 #: List of resources which can be queried using Local UniX Interface
1623 QR_VIA_LUXI = QR_VIA_OP.union([
1624   QR_LOCK,
1625   ])
1626
1627 #: List of resources which can be queried using RAPI
1628 QR_VIA_RAPI = QR_VIA_LUXI
1629
1630 # Query field types
1631 QFT_UNKNOWN = "unknown"
1632 QFT_TEXT = "text"
1633 QFT_BOOL = "bool"
1634 QFT_NUMBER = "number"
1635 QFT_UNIT = "unit"
1636 QFT_TIMESTAMP = "timestamp"
1637 QFT_OTHER = "other"
1638
1639 #: All query field types
1640 QFT_ALL = frozenset([
1641   QFT_UNKNOWN,
1642   QFT_TEXT,
1643   QFT_BOOL,
1644   QFT_NUMBER,
1645   QFT_UNIT,
1646   QFT_TIMESTAMP,
1647   QFT_OTHER,
1648   ])
1649
1650 # Query result field status (don't change or reuse values as they're used by
1651 # clients)
1652 #: Normal field status
1653 RS_NORMAL = 0
1654 #: Unknown field
1655 RS_UNKNOWN = 1
1656 #: No data (e.g. RPC error), can be used instead of L{RS_OFFLINE}
1657 RS_NODATA = 2
1658 #: Value unavailable/unsupported for item; if this field is supported
1659 #: but we cannot get the data for the moment, RS_NODATA or
1660 #: RS_OFFLINE should be used
1661 RS_UNAVAIL = 3
1662 #: Resource marked offline
1663 RS_OFFLINE = 4
1664
1665 RS_ALL = frozenset([
1666   RS_NORMAL,
1667   RS_UNKNOWN,
1668   RS_NODATA,
1669   RS_UNAVAIL,
1670   RS_OFFLINE,
1671   ])
1672
1673 #: Dictionary with special field cases and their verbose/terse formatting
1674 RSS_DESCRIPTION = {
1675   RS_UNKNOWN: ("(unknown)", "??"),
1676   RS_NODATA: ("(nodata)", "?"),
1677   RS_OFFLINE: ("(offline)", "*"),
1678   RS_UNAVAIL: ("(unavail)", "-"),
1679   }
1680
1681 # max dynamic devices
1682 MAX_NICS = 8
1683 MAX_DISKS = 16
1684
1685 # SSCONF keys
1686 SS_CLUSTER_NAME = "cluster_name"
1687 SS_CLUSTER_TAGS = "cluster_tags"
1688 SS_FILE_STORAGE_DIR = "file_storage_dir"
1689 SS_SHARED_FILE_STORAGE_DIR = "shared_file_storage_dir"
1690 SS_MASTER_CANDIDATES = "master_candidates"
1691 SS_MASTER_CANDIDATES_IPS = "master_candidates_ips"
1692 SS_MASTER_IP = "master_ip"
1693 SS_MASTER_NETDEV = "master_netdev"
1694 SS_MASTER_NETMASK = "master_netmask"
1695 SS_MASTER_NODE = "master_node"
1696 SS_NODE_LIST = "node_list"
1697 SS_NODE_PRIMARY_IPS = "node_primary_ips"
1698 SS_NODE_SECONDARY_IPS = "node_secondary_ips"
1699 SS_OFFLINE_NODES = "offline_nodes"
1700 SS_ONLINE_NODES = "online_nodes"
1701 SS_PRIMARY_IP_FAMILY = "primary_ip_family"
1702 SS_INSTANCE_LIST = "instance_list"
1703 SS_RELEASE_VERSION = "release_version"
1704 SS_HYPERVISOR_LIST = "hypervisor_list"
1705 SS_MAINTAIN_NODE_HEALTH = "maintain_node_health"
1706 SS_UID_POOL = "uid_pool"
1707 SS_NODEGROUPS = "nodegroups"
1708
1709 SS_FILE_PERMS = 0444
1710
1711 # cluster wide default parameters
1712 DEFAULT_ENABLED_HYPERVISOR = HT_XEN_PVM
1713
1714 HVC_DEFAULTS = {
1715   HT_XEN_PVM: {
1716     HV_USE_BOOTLOADER: False,
1717     HV_BOOTLOADER_PATH: XEN_BOOTLOADER,
1718     HV_BOOTLOADER_ARGS: "",
1719     HV_KERNEL_PATH: "/boot/vmlinuz-2.6-xenU",
1720     HV_INITRD_PATH: "",
1721     HV_ROOT_PATH: "/dev/sda1",
1722     HV_KERNEL_ARGS: "ro",
1723     HV_MIGRATION_PORT: 8002,
1724     HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1725     HV_BLOCKDEV_PREFIX: "sd",
1726     HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1727     HV_CPU_MASK: CPU_PINNING_ALL,
1728     },
1729   HT_XEN_HVM: {
1730     HV_BOOT_ORDER: "cd",
1731     HV_CDROM_IMAGE_PATH: "",
1732     HV_NIC_TYPE: HT_NIC_RTL8139,
1733     HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
1734     HV_VNC_BIND_ADDRESS: IP4_ADDRESS_ANY,
1735     HV_VNC_PASSWORD_FILE: VNC_PASSWORD_FILE,
1736     HV_ACPI: True,
1737     HV_PAE: True,
1738     HV_KERNEL_PATH: "/usr/lib/xen/boot/hvmloader",
1739     HV_DEVICE_MODEL: "/usr/lib/xen/bin/qemu-dm",
1740     HV_MIGRATION_PORT: 8002,
1741     HV_MIGRATION_MODE: HT_MIGRATION_NONLIVE,
1742     HV_USE_LOCALTIME: False,
1743     HV_BLOCKDEV_PREFIX: "hd",
1744     HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1745     HV_CPU_MASK: CPU_PINNING_ALL,
1746     },
1747   HT_KVM: {
1748     HV_KERNEL_PATH: "/boot/vmlinuz-2.6-kvmU",
1749     HV_INITRD_PATH: "",
1750     HV_KERNEL_ARGS: "ro",
1751     HV_ROOT_PATH: "/dev/vda1",
1752     HV_ACPI: True,
1753     HV_SERIAL_CONSOLE: True,
1754     HV_VNC_BIND_ADDRESS: "",
1755     HV_VNC_TLS: False,
1756     HV_VNC_X509: "",
1757     HV_VNC_X509_VERIFY: False,
1758     HV_VNC_PASSWORD_FILE: "",
1759     HV_KVM_SPICE_BIND: "",
1760     HV_KVM_SPICE_IP_VERSION: IFACE_NO_IP_VERSION_SPECIFIED,
1761     HV_KVM_SPICE_PASSWORD_FILE: "",
1762     HV_KVM_SPICE_LOSSLESS_IMG_COMPR: "",
1763     HV_KVM_SPICE_JPEG_IMG_COMPR: "",
1764     HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR: "",
1765     HV_KVM_SPICE_STREAMING_VIDEO_DETECTION: "",
1766     HV_KVM_SPICE_AUDIO_COMPR: True,
1767     HV_KVM_SPICE_USE_TLS: False,
1768     HV_KVM_SPICE_TLS_CIPHERS: OPENSSL_CIPHERS,
1769     HV_KVM_SPICE_USE_VDAGENT: True,
1770     HV_KVM_FLOPPY_IMAGE_PATH: "",
1771     HV_CDROM_IMAGE_PATH: "",
1772     HV_KVM_CDROM2_IMAGE_PATH: "",
1773     HV_BOOT_ORDER: HT_BO_DISK,
1774     HV_NIC_TYPE: HT_NIC_PARAVIRTUAL,
1775     HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
1776     HV_KVM_CDROM_DISK_TYPE: "",
1777     HV_USB_MOUSE: "",
1778     HV_KEYMAP: "",
1779     HV_MIGRATION_PORT: 8102,
1780     HV_MIGRATION_BANDWIDTH: 32, # MiB/s
1781     HV_MIGRATION_DOWNTIME: 30,  # ms
1782     HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1783     HV_USE_LOCALTIME: False,
1784     HV_DISK_CACHE: HT_CACHE_DEFAULT,
1785     HV_SECURITY_MODEL: HT_SM_NONE,
1786     HV_SECURITY_DOMAIN: "",
1787     HV_KVM_FLAG: "",
1788     HV_VHOST_NET: False,
1789     HV_KVM_USE_CHROOT: False,
1790     HV_MEM_PATH: "",
1791     HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1792     HV_CPU_MASK: CPU_PINNING_ALL,
1793     },
1794   HT_FAKE: {
1795     },
1796   HT_CHROOT: {
1797     HV_INIT_SCRIPT: "/ganeti-chroot",
1798     },
1799   HT_LXC: {
1800     HV_CPU_MASK: "",
1801     },
1802   }
1803
1804 HVC_GLOBALS = frozenset([
1805   HV_MIGRATION_PORT,
1806   HV_MIGRATION_BANDWIDTH,
1807   HV_MIGRATION_MODE,
1808   ])
1809
1810 BEC_DEFAULTS = {
1811   BE_MINMEM: 128,
1812   BE_MAXMEM: 128,
1813   BE_VCPUS: 1,
1814   BE_AUTO_BALANCE: True,
1815   BE_ALWAYS_FAILOVER: False,
1816   }
1817
1818 NDC_DEFAULTS = {
1819   ND_OOB_PROGRAM: None,
1820   }
1821
1822 DISK_LD_DEFAULTS = {
1823   LD_DRBD8: {
1824     LDP_RESYNC_RATE: CLASSIC_DRBD_SYNC_SPEED,
1825     LDP_BARRIERS: _autoconf.DRBD_BARRIERS,
1826     LDP_NO_META_FLUSH: _autoconf.DRBD_NO_META_FLUSH,
1827     LDP_DEFAULT_METAVG: DEFAULT_VG,
1828     LDP_DISK_CUSTOM: "",
1829     LDP_NET_CUSTOM: "",
1830     LDP_DYNAMIC_RESYNC: False,
1831
1832     # The default values for the DRBD dynamic resync speed algorithm are taken
1833     # from the drbsetup 8.3.11 man page, except for c-plan-ahead (that we
1834     # don't need to set to 0, because we have a separate option to enable it)
1835     # and for c-max-rate, that we cap to the default value for the static resync
1836     # rate.
1837     LDP_PLAN_AHEAD: 20, # ds
1838     LDP_FILL_TARGET: 0, # sectors
1839     LDP_DELAY_TARGET: 1, # ds
1840     LDP_MAX_RATE: CLASSIC_DRBD_SYNC_SPEED, # KiB/s
1841     LDP_MIN_RATE: 4 * 1024, # KiB/s
1842     },
1843   LD_LV: {
1844     LDP_STRIPES: _autoconf.LVM_STRIPECOUNT
1845     },
1846   LD_FILE: {
1847     },
1848   LD_BLOCKDEV: {
1849     },
1850   LD_RBD: {
1851     LDP_POOL: "rbd"
1852     },
1853   }
1854
1855 # readability shortcuts
1856 _LV_DEFAULTS = DISK_LD_DEFAULTS[LD_LV]
1857 _DRBD_DEFAULTS = DISK_LD_DEFAULTS[LD_DRBD8]
1858
1859 DISK_DT_DEFAULTS = {
1860   DT_PLAIN: {
1861     LV_STRIPES: DISK_LD_DEFAULTS[LD_LV][LDP_STRIPES],
1862     },
1863   DT_DRBD8: {
1864     DRBD_RESYNC_RATE: _DRBD_DEFAULTS[LDP_RESYNC_RATE],
1865     DRBD_DATA_STRIPES: _LV_DEFAULTS[LDP_STRIPES],
1866     DRBD_META_STRIPES: _LV_DEFAULTS[LDP_STRIPES],
1867     DRBD_DISK_BARRIERS: _DRBD_DEFAULTS[LDP_BARRIERS],
1868     DRBD_META_BARRIERS: _DRBD_DEFAULTS[LDP_NO_META_FLUSH],
1869     DRBD_DEFAULT_METAVG: _DRBD_DEFAULTS[LDP_DEFAULT_METAVG],
1870     DRBD_DISK_CUSTOM: _DRBD_DEFAULTS[LDP_DISK_CUSTOM],
1871     DRBD_NET_CUSTOM: _DRBD_DEFAULTS[LDP_NET_CUSTOM],
1872     DRBD_DYNAMIC_RESYNC: _DRBD_DEFAULTS[LDP_DYNAMIC_RESYNC],
1873     DRBD_PLAN_AHEAD: _DRBD_DEFAULTS[LDP_PLAN_AHEAD],
1874     DRBD_FILL_TARGET: _DRBD_DEFAULTS[LDP_FILL_TARGET],
1875     DRBD_DELAY_TARGET: _DRBD_DEFAULTS[LDP_DELAY_TARGET],
1876     DRBD_MAX_RATE: _DRBD_DEFAULTS[LDP_MAX_RATE],
1877     DRBD_MIN_RATE: _DRBD_DEFAULTS[LDP_MIN_RATE],
1878     },
1879   DT_DISKLESS: {
1880     },
1881   DT_FILE: {
1882     },
1883   DT_SHARED_FILE: {
1884     },
1885   DT_BLOCK: {
1886     },
1887   DT_RBD: {
1888     RBD_POOL: DISK_LD_DEFAULTS[LD_RBD][LDP_POOL]
1889     },
1890   }
1891
1892 # we don't want to export the shortcuts
1893 del _LV_DEFAULTS, _DRBD_DEFAULTS
1894
1895 NICC_DEFAULTS = {
1896   NIC_MODE: NIC_MODE_BRIDGED,
1897   NIC_LINK: DEFAULT_BRIDGE,
1898   }
1899
1900 IPOLICY_DEFAULTS = {
1901   ISPECS_MIN: {
1902     ISPEC_MEM_SIZE: 128,
1903     ISPEC_CPU_COUNT: 1,
1904     ISPEC_DISK_COUNT: 1,
1905     ISPEC_DISK_SIZE: 1024,
1906     ISPEC_NIC_COUNT: 1,
1907     },
1908   ISPECS_MAX: {
1909     ISPEC_MEM_SIZE: 32768,
1910     ISPEC_CPU_COUNT: 8,
1911     ISPEC_DISK_COUNT: MAX_DISKS,
1912     ISPEC_DISK_SIZE: 1024 * 1024,
1913     ISPEC_NIC_COUNT: MAX_NICS,
1914     },
1915   ISPECS_STD: {
1916     ISPEC_MEM_SIZE: 128,
1917     ISPEC_CPU_COUNT: 1,
1918     ISPEC_DISK_COUNT: 1,
1919     ISPEC_DISK_SIZE: 1024,
1920     ISPEC_NIC_COUNT: 1,
1921     },
1922   IPOLICY_DTS: DISK_TEMPLATES,
1923   IPOLICY_VCPU_RATIO: 4.0,
1924   }
1925
1926 MASTER_POOL_SIZE_DEFAULT = 10
1927
1928 CONFD_PROTOCOL_VERSION = 1
1929
1930 CONFD_REQ_PING = 0
1931 CONFD_REQ_NODE_ROLE_BYNAME = 1
1932 CONFD_REQ_NODE_PIP_BY_INSTANCE_IP = 2
1933 CONFD_REQ_CLUSTER_MASTER = 3
1934 CONFD_REQ_NODE_PIP_LIST = 4
1935 CONFD_REQ_MC_PIP_LIST = 5
1936 CONFD_REQ_INSTANCES_IPS_LIST = 6
1937
1938 # Confd request query fields. These are used to narrow down queries.
1939 # These must be strings rather than integers, because json-encoding
1940 # converts them to strings anyway, as they're used as dict-keys.
1941 CONFD_REQQ_LINK = "0"
1942 CONFD_REQQ_IP = "1"
1943 CONFD_REQQ_IPLIST = "2"
1944 CONFD_REQQ_FIELDS = "3"
1945
1946 CONFD_REQFIELD_NAME = "0"
1947 CONFD_REQFIELD_IP = "1"
1948 CONFD_REQFIELD_MNODE_PIP = "2"
1949
1950 CONFD_REQS = frozenset([
1951   CONFD_REQ_PING,
1952   CONFD_REQ_NODE_ROLE_BYNAME,
1953   CONFD_REQ_NODE_PIP_BY_INSTANCE_IP,
1954   CONFD_REQ_CLUSTER_MASTER,
1955   CONFD_REQ_NODE_PIP_LIST,
1956   CONFD_REQ_MC_PIP_LIST,
1957   CONFD_REQ_INSTANCES_IPS_LIST,
1958   ])
1959
1960 CONFD_REPL_STATUS_OK = 0
1961 CONFD_REPL_STATUS_ERROR = 1
1962 CONFD_REPL_STATUS_NOTIMPLEMENTED = 2
1963
1964 CONFD_REPL_STATUSES = frozenset([
1965   CONFD_REPL_STATUS_OK,
1966   CONFD_REPL_STATUS_ERROR,
1967   CONFD_REPL_STATUS_NOTIMPLEMENTED,
1968   ])
1969
1970 (CONFD_NODE_ROLE_MASTER,
1971  CONFD_NODE_ROLE_CANDIDATE,
1972  CONFD_NODE_ROLE_OFFLINE,
1973  CONFD_NODE_ROLE_DRAINED,
1974  CONFD_NODE_ROLE_REGULAR,
1975  ) = range(5)
1976
1977 # A few common errors for confd
1978 CONFD_ERROR_UNKNOWN_ENTRY = 1
1979 CONFD_ERROR_INTERNAL = 2
1980 CONFD_ERROR_ARGUMENT = 3
1981
1982 # Each request is "salted" by the current timestamp.
1983 # This constants decides how many seconds of skew to accept.
1984 # TODO: make this a default and allow the value to be more configurable
1985 CONFD_MAX_CLOCK_SKEW = 2 * NODE_MAX_CLOCK_SKEW
1986
1987 # When we haven't reloaded the config for more than this amount of seconds, we
1988 # force a test to see if inotify is betraying us.
1989 CONFD_CONFIG_RELOAD_TIMEOUT = 60
1990
1991 # If we receive more than one update in this amount of seconds, we move to
1992 # polling every RATELIMIT seconds, rather than relying on inotify, to be able
1993 # to serve more requests.
1994 CONFD_CONFIG_RELOAD_RATELIMIT = 2
1995
1996 # Magic number prepended to all confd queries.
1997 # This allows us to distinguish different types of confd protocols and handle
1998 # them. For example by changing this we can move the whole payload to be
1999 # compressed, or move away from json.
2000 CONFD_MAGIC_FOURCC = "plj0"
2001
2002 # By default a confd request is sent to the minimum between this number and all
2003 # MCs. 6 was chosen because even in the case of a disastrous 50% response rate,
2004 # we should have enough answers to be able to compare more than one.
2005 CONFD_DEFAULT_REQ_COVERAGE = 6
2006
2007 # Timeout in seconds to expire pending query request in the confd client
2008 # library. We don't actually expect any answer more than 10 seconds after we
2009 # sent a request.
2010 CONFD_CLIENT_EXPIRE_TIMEOUT = 10
2011
2012 # Maximum UDP datagram size.
2013 # On IPv4: 64K - 20 (ip header size) - 8 (udp header size) = 65507
2014 # On IPv6: 64K - 40 (ip6 header size) - 8 (udp header size) = 65487
2015 #   (assuming we can't use jumbo frames)
2016 # We just set this to 60K, which should be enough
2017 MAX_UDP_DATA_SIZE = 61440
2018
2019 # User-id pool minimum/maximum acceptable user-ids.
2020 UIDPOOL_UID_MIN = 0
2021 UIDPOOL_UID_MAX = 2 ** 32 - 1 # Assuming 32 bit user-ids
2022
2023 # Name or path of the pgrep command
2024 PGREP = "pgrep"
2025
2026 # Name of the node group that gets created at cluster init or upgrade
2027 INITIAL_NODE_GROUP_NAME = "default"
2028
2029 # Possible values for NodeGroup.alloc_policy
2030 ALLOC_POLICY_PREFERRED = "preferred"
2031 ALLOC_POLICY_LAST_RESORT = "last_resort"
2032 ALLOC_POLICY_UNALLOCABLE = "unallocable"
2033 VALID_ALLOC_POLICIES = [
2034   ALLOC_POLICY_PREFERRED,
2035   ALLOC_POLICY_LAST_RESORT,
2036   ALLOC_POLICY_UNALLOCABLE,
2037   ]
2038
2039 # Temporary external/shared storage parameters
2040 BLOCKDEV_DRIVER_MANUAL = "manual"
2041
2042 # qemu-img path, required for ovfconverter
2043 QEMUIMG_PATH = _autoconf.QEMUIMG_PATH
2044
2045 # Whether htools was enabled at compilation time
2046 HTOOLS = _autoconf.HTOOLS
2047 # The hail iallocator
2048 IALLOC_HAIL = "hail"
2049
2050 # Fake opcodes for functions that have hooks attached to them via
2051 # backend.RunLocalHooks
2052 FAKE_OP_MASTER_TURNUP = "OP_CLUSTER_IP_TURNUP"
2053 FAKE_OP_MASTER_TURNDOWN = "OP_CLUSTER_IP_TURNDOWN"
2054
2055 # Do not re-export imported modules
2056 del re, _vcsversion, _autoconf