Statistics
| Branch: | Tag: | Revision:

root / lib / constants.py @ 04520998

History | View | Annotate | Download (52.6 kB)

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
import socket
26

    
27
from ganeti import _autoconf
28
from ganeti import _vcsversion
29
from ganeti import pathutils
30

    
31

    
32
# various versions
33
RELEASE_VERSION = _autoconf.PACKAGE_VERSION
34
OS_API_V10 = 10
35
OS_API_V15 = 15
36
OS_API_V20 = 20
37
OS_API_VERSIONS = frozenset([OS_API_V10, OS_API_V15, OS_API_V20])
38
VCS_VERSION = _vcsversion.VCS_VERSION
39
EXPORT_VERSION = 0
40
RAPI_VERSION = 2
41

    
42

    
43
# Format for CONFIG_VERSION:
44
#   01 03 0123 = 01030123
45
#   ^^ ^^ ^^^^
46
#   |  |  + Configuration version/revision
47
#   |  + Minor version
48
#   + Major version
49
#
50
# It is stored as an integer. Make sure not to write an octal number.
51

    
52
# BuildVersion and SplitVersion must be in here because we can't import other
53
# modules. The cfgupgrade tool must be able to read and write version numbers
54
# and thus requires these functions. To avoid code duplication, they're kept in
55
# here.
56

    
57
def BuildVersion(major, minor, revision):
58
  """Calculates int version number from major, minor and revision numbers.
59

60
  Returns: int representing version number
61

62
  """
63
  assert isinstance(major, int)
64
  assert isinstance(minor, int)
65
  assert isinstance(revision, int)
66
  return (1000000 * major +
67
            10000 * minor +
68
                1 * revision)
69

    
70

    
71
def SplitVersion(version):
72
  """Splits version number stored in an int.
73

74
  Returns: tuple; (major, minor, revision)
75

76
  """
77
  assert isinstance(version, int)
78

    
79
  (major, remainder) = divmod(version, 1000000)
80
  (minor, revision) = divmod(remainder, 10000)
81

    
82
  return (major, minor, revision)
83

    
84

    
85
CONFIG_MAJOR = int(_autoconf.VERSION_MAJOR)
86
CONFIG_MINOR = int(_autoconf.VERSION_MINOR)
87
CONFIG_REVISION = 0
88
CONFIG_VERSION = BuildVersion(CONFIG_MAJOR, CONFIG_MINOR, CONFIG_REVISION)
89

    
90
#: RPC protocol version
91
PROTOCOL_VERSION = BuildVersion(CONFIG_MAJOR, CONFIG_MINOR, 0)
92

    
93
# user separation
94
DAEMONS_GROUP = _autoconf.DAEMONS_GROUP
95
ADMIN_GROUP = _autoconf.ADMIN_GROUP
96
MASTERD_USER = _autoconf.MASTERD_USER
97
MASTERD_GROUP = _autoconf.MASTERD_GROUP
98
RAPI_USER = _autoconf.RAPI_USER
99
RAPI_GROUP = _autoconf.RAPI_GROUP
100
CONFD_USER = _autoconf.CONFD_USER
101
CONFD_GROUP = _autoconf.CONFD_GROUP
102
NODED_USER = _autoconf.NODED_USER
103
NODED_GROUP = _autoconf.NODED_GROUP
104
SSH_LOGIN_USER = _autoconf.SSH_LOGIN_USER
105
SSH_CONSOLE_USER = _autoconf.SSH_CONSOLE_USER
106

    
107
# cpu pinning separators and constants
108
CPU_PINNING_SEP = ":"
109
CPU_PINNING_ALL = "all"
110
# internal representation of "all"
111
CPU_PINNING_ALL_VAL = -1
112
# one "all" entry in a CPU list means CPU pinning is off
113
CPU_PINNING_OFF = [CPU_PINNING_ALL_VAL]
114

    
115
# A Xen-specific implementation detail - there is no way to actually say
116
# "use any cpu for pinning" in a Xen configuration file, as opposed to the
117
# command line, where you can say "xm vcpu-pin <domain> <vcpu> all".
118
# The workaround used in Xen is "0-63" (see source code function
119
# xm_vcpu_pin in <xen-source>/tools/python/xen/xm/main.py).
120
# To support future changes, the following constant is treated as a
121
# blackbox string that simply means use-any-cpu-for-pinning-under-xen.
122
CPU_PINNING_ALL_XEN = "0-63"
123

    
124
# A KVM-specific implementation detail - the following value is used
125
# to set CPU affinity to all processors (#0 through #31), per taskset
126
# man page.
127
# FIXME: This only works for machines with up to 32 CPU cores
128
CPU_PINNING_ALL_KVM = 0xFFFFFFFF
129

    
130
# Wipe
131
DD_CMD = "dd"
132
WIPE_BLOCK_SIZE = 1024 ** 2
133
MAX_WIPE_CHUNK = 1024 # 1GB
134
MIN_WIPE_CHUNK_PERCENT = 10
135

    
136
RUN_DIRS_MODE = 0775
137
SECURE_DIR_MODE = 0700
138
SECURE_FILE_MODE = 0600
139
ADOPTABLE_BLOCKDEV_ROOT = "/dev/disk/"
140
ETC_HOSTS = "/etc/hosts"
141
ENABLE_FILE_STORAGE = _autoconf.ENABLE_FILE_STORAGE
142
ENABLE_SHARED_FILE_STORAGE = _autoconf.ENABLE_SHARED_FILE_STORAGE
143
ENABLE_CONFD = _autoconf.ENABLE_CONFD
144
ENABLE_SPLIT_QUERY = _autoconf.ENABLE_SPLIT_QUERY
145

    
146
NODED = "ganeti-noded"
147
CONFD = "ganeti-confd"
148
RAPI = "ganeti-rapi"
149
MASTERD = "ganeti-masterd"
150
# used in the ganeti-nbma project
151
NLD = "ganeti-nld"
152

    
153
DAEMONS_PORTS = {
154
  # daemon-name: ("proto", "default-port")
155
  NODED: ("tcp", 1811),
156
  CONFD: ("udp", 1814),
157
  RAPI: ("tcp", 5080),
158
  "ssh": ("tcp", 22),
159
  # used in the ganeti-nbma project
160
  NLD: ("udp", 1816),
161
}
162
DEFAULT_NODED_PORT = DAEMONS_PORTS[NODED][1]
163
DEFAULT_CONFD_PORT = DAEMONS_PORTS[CONFD][1]
164
DEFAULT_RAPI_PORT = DAEMONS_PORTS[RAPI][1]
165
# used in the ganeti-nbma project
166
DEFAULT_NLD_PORT = DAEMONS_PORTS[NLD][1]
167

    
168
FIRST_DRBD_PORT = 11000
169
LAST_DRBD_PORT = 14999
170

    
171
DAEMONS_LOGFILES = {
172
  NODED: pathutils.GetLogFilename("node-daemon"),
173
  CONFD: pathutils.GetLogFilename("conf-daemon"),
174
  RAPI: pathutils.GetLogFilename("rapi-daemon"),
175
  MASTERD: pathutils.GetLogFilename("master-daemon"),
176
  }
177

    
178
DEV_CONSOLE = "/dev/console"
179

    
180
PROC_MOUNTS = "/proc/mounts"
181

    
182
# Local UniX Interface related constants
183
LUXI_EOM = "\3"
184
LUXI_VERSION = CONFIG_VERSION
185

    
186
# one of "no", "yes", "only"
187
SYSLOG_USAGE = _autoconf.SYSLOG_USAGE
188
SYSLOG_NO = "no"
189
SYSLOG_YES = "yes"
190
SYSLOG_ONLY = "only"
191
SYSLOG_SOCKET = "/dev/log"
192

    
193
EXPORT_CONF_FILE = "config.ini"
194

    
195
XEN_BOOTLOADER = _autoconf.XEN_BOOTLOADER
196
XEN_KERNEL = _autoconf.XEN_KERNEL
197
XEN_INITRD = _autoconf.XEN_INITRD
198
XEN_CMD_XM = "xm"
199
XEN_CMD_XL = "xl"
200
# FIXME: This will be made configurable using hvparams in Ganeti 2.7
201
XEN_CMD = _autoconf.XEN_CMD
202

    
203
KVM_PATH = _autoconf.KVM_PATH
204
KVM_KERNEL = _autoconf.KVM_KERNEL
205
SOCAT_PATH = _autoconf.SOCAT_PATH
206
SOCAT_USE_ESCAPE = _autoconf.SOCAT_USE_ESCAPE
207
SOCAT_USE_COMPRESS = _autoconf.SOCAT_USE_COMPRESS
208
SOCAT_ESCAPE_CODE = "0x1d"
209

    
210
#: Console as SSH command
211
CONS_SSH = "ssh"
212

    
213
#: Console as VNC server
214
CONS_VNC = "vnc"
215

    
216
#: Console as SPICE server
217
CONS_SPICE = "spice"
218

    
219
#: Display a message for console access
220
CONS_MESSAGE = "msg"
221

    
222
#: All console types
223
CONS_ALL = frozenset([CONS_SSH, CONS_VNC, CONS_SPICE, CONS_MESSAGE])
224

    
225
# For RSA keys more bits are better, but they also make operations more
226
# expensive. NIST SP 800-131 recommends a minimum of 2048 bits from the year
227
# 2010 on.
228
RSA_KEY_BITS = 2048
229

    
230
# Ciphers allowed for SSL connections. For the format, see ciphers(1). A better
231
# way to disable ciphers would be to use the exclamation mark (!), but socat
232
# versions below 1.5 can't parse exclamation marks in options properly. When
233
# modifying the ciphers, ensure not to accidentially add something after it's
234
# been removed. Use the "openssl" utility to check the allowed ciphers, e.g.
235
# "openssl ciphers -v HIGH:-DES".
236
OPENSSL_CIPHERS = "HIGH:-DES:-3DES:-EXPORT:-ADH"
237

    
238
# Digest used to sign certificates ("openssl x509" uses SHA1 by default)
239
X509_CERT_SIGN_DIGEST = "SHA1"
240

    
241
# Default validity of certificates in days
242
X509_CERT_DEFAULT_VALIDITY = 365 * 5
243

    
244
# commonName (CN) used in certificates
245
X509_CERT_CN = "ganeti.example.com"
246

    
247
X509_CERT_SIGNATURE_HEADER = "X-Ganeti-Signature"
248

    
249
# Import/export daemon mode
250
IEM_IMPORT = "import"
251
IEM_EXPORT = "export"
252

    
253
# Import/export transport compression
254
IEC_NONE = "none"
255
IEC_GZIP = "gzip"
256
IEC_ALL = frozenset([
257
  IEC_NONE,
258
  IEC_GZIP,
259
  ])
260

    
261
IE_CUSTOM_SIZE = "fd"
262

    
263
IE_MAGIC_RE = re.compile(r"^[-_.a-zA-Z0-9]{5,100}$")
264

    
265
# Import/export I/O
266
# Direct file I/O, equivalent to a shell's I/O redirection using '<' or '>'
267
IEIO_FILE = "file"
268
# Raw block device I/O using "dd"
269
IEIO_RAW_DISK = "raw"
270
# OS definition import/export script
271
IEIO_SCRIPT = "script"
272

    
273
VALUE_DEFAULT = "default"
274
VALUE_AUTO = "auto"
275
VALUE_GENERATE = "generate"
276
VALUE_NONE = "none"
277
VALUE_TRUE = "true"
278
VALUE_FALSE = "false"
279

    
280
# External script validation mask
281
EXT_PLUGIN_MASK = re.compile("^[a-zA-Z0-9_-]+$")
282

    
283
# hooks-related constants
284
HOOKS_PHASE_PRE = "pre"
285
HOOKS_PHASE_POST = "post"
286
HOOKS_NAME_CFGUPDATE = "config-update"
287
HOOKS_NAME_WATCHER = "watcher"
288
HOOKS_VERSION = 2
289
HOOKS_PATH = "/sbin:/bin:/usr/sbin:/usr/bin"
290

    
291
# hooks subject type (what object type does the LU deal with)
292
HTYPE_CLUSTER = "CLUSTER"
293
HTYPE_NODE = "NODE"
294
HTYPE_GROUP = "GROUP"
295
HTYPE_INSTANCE = "INSTANCE"
296

    
297
HKR_SKIP = 0
298
HKR_FAIL = 1
299
HKR_SUCCESS = 2
300

    
301
# Storage types
302
ST_FILE = "file"
303
ST_LVM_PV = "lvm-pv"
304
ST_LVM_VG = "lvm-vg"
305

    
306
# Storage fields
307
# first two are valid in LU context only, not passed to backend
308
SF_NODE = "node"
309
SF_TYPE = "type"
310
# and the rest are valid in backend
311
SF_NAME = "name"
312
SF_SIZE = "size"
313
SF_FREE = "free"
314
SF_USED = "used"
315
SF_ALLOCATABLE = "allocatable"
316

    
317
# Storage operations
318
SO_FIX_CONSISTENCY = "fix-consistency"
319

    
320
# Available fields per storage type
321
VALID_STORAGE_FIELDS = frozenset([
322
  SF_NAME,
323
  SF_TYPE,
324
  SF_SIZE,
325
  SF_USED,
326
  SF_FREE,
327
  SF_ALLOCATABLE
328
  ])
329

    
330
VALID_STORAGE_TYPES = frozenset([ST_FILE, ST_LVM_PV, ST_LVM_VG])
331

    
332
MODIFIABLE_STORAGE_FIELDS = {
333
  ST_LVM_PV: frozenset([SF_ALLOCATABLE]),
334
  }
335

    
336
VALID_STORAGE_OPERATIONS = {
337
  ST_LVM_VG: frozenset([SO_FIX_CONSISTENCY]),
338
  }
339

    
340
# Local disk status
341
# Note: Code depends on LDS_OKAY < LDS_UNKNOWN < LDS_FAULTY
342
(LDS_OKAY,
343
 LDS_UNKNOWN,
344
 LDS_FAULTY) = range(1, 4)
345

    
346
# disk template types
347
DT_DISKLESS = "diskless"
348
DT_PLAIN = "plain"
349
DT_DRBD8 = "drbd"
350
DT_FILE = "file"
351
DT_SHARED_FILE = "sharedfile"
352
DT_BLOCK = "blockdev"
353
DT_RBD = "rbd"
354

    
355
# the set of network-mirrored disk templates
356
DTS_INT_MIRROR = frozenset([DT_DRBD8])
357

    
358
# the set of externally-mirrored disk templates (e.g. SAN, NAS)
359
DTS_EXT_MIRROR = frozenset([DT_SHARED_FILE, DT_BLOCK, DT_RBD])
360

    
361
# the set of non-lvm-based disk templates
362
DTS_NOT_LVM = frozenset([DT_DISKLESS, DT_FILE, DT_SHARED_FILE,
363
                         DT_BLOCK, DT_RBD])
364

    
365
# the set of disk templates which can be grown
366
DTS_GROWABLE = frozenset([DT_PLAIN, DT_DRBD8, DT_FILE, DT_SHARED_FILE, DT_RBD])
367

    
368
# the set of disk templates that allow adoption
369
DTS_MAY_ADOPT = frozenset([DT_PLAIN, DT_BLOCK])
370

    
371
# the set of disk templates that *must* use adoption
372
DTS_MUST_ADOPT = frozenset([DT_BLOCK])
373

    
374
# the set of disk templates that allow migrations
375
DTS_MIRRORED = frozenset.union(DTS_INT_MIRROR, DTS_EXT_MIRROR)
376

    
377
# the set of file based disk templates
378
DTS_FILEBASED = frozenset([DT_FILE, DT_SHARED_FILE])
379

    
380
# logical disk types
381
LD_LV = "lvm"
382
LD_DRBD8 = "drbd8"
383
LD_FILE = "file"
384
LD_BLOCKDEV = "blockdev"
385
LD_RBD = "rbd"
386
LOGICAL_DISK_TYPES = frozenset([
387
  LD_LV,
388
  LD_DRBD8,
389
  LD_FILE,
390
  LD_BLOCKDEV,
391
  LD_RBD,
392
  ])
393

    
394
LDS_BLOCK = frozenset([LD_LV, LD_DRBD8, LD_BLOCKDEV, LD_RBD])
395

    
396
# drbd constants
397
DRBD_HMAC_ALG = "md5"
398
DRBD_NET_PROTOCOL = "C"
399

    
400
#: Size of DRBD meta block device
401
DRBD_META_SIZE = 128
402

    
403
# drbd barrier types
404
DRBD_B_NONE = "n"
405
DRBD_B_DISK_BARRIERS = "b"
406
DRBD_B_DISK_DRAIN = "d"
407
DRBD_B_DISK_FLUSH = "f"
408

    
409
# Valid barrier combinations: "n" or any non-null subset of "bfd"
410
DRBD_VALID_BARRIER_OPT = frozenset([
411
  frozenset([DRBD_B_NONE]),
412
  frozenset([DRBD_B_DISK_BARRIERS]),
413
  frozenset([DRBD_B_DISK_DRAIN]),
414
  frozenset([DRBD_B_DISK_FLUSH]),
415
  frozenset([DRBD_B_DISK_DRAIN, DRBD_B_DISK_FLUSH]),
416
  frozenset([DRBD_B_DISK_DRAIN, DRBD_B_DISK_FLUSH]),
417
  frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_DRAIN]),
418
  frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_FLUSH]),
419
  frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_FLUSH, DRBD_B_DISK_DRAIN]),
420
  ])
421

    
422
# rbd tool command
423
RBD_CMD = "rbd"
424

    
425
# file backend driver
426
FD_LOOP = "loop"
427
FD_BLKTAP = "blktap"
428

    
429
# the set of drbd-like disk types
430
LDS_DRBD = frozenset([LD_DRBD8])
431

    
432
# disk access mode
433
DISK_RDONLY = "ro"
434
DISK_RDWR = "rw"
435
DISK_ACCESS_SET = frozenset([DISK_RDONLY, DISK_RDWR])
436

    
437
# disk replacement mode
438
REPLACE_DISK_PRI = "replace_on_primary"    # replace disks on primary
439
REPLACE_DISK_SEC = "replace_on_secondary"  # replace disks on secondary
440
REPLACE_DISK_CHG = "replace_new_secondary" # change secondary node
441
REPLACE_DISK_AUTO = "replace_auto"
442
REPLACE_MODES = frozenset([
443
  REPLACE_DISK_PRI,
444
  REPLACE_DISK_SEC,
445
  REPLACE_DISK_CHG,
446
  REPLACE_DISK_AUTO,
447
  ])
448

    
449
# Instance export mode
450
EXPORT_MODE_LOCAL = "local"
451
EXPORT_MODE_REMOTE = "remote"
452
EXPORT_MODES = frozenset([
453
  EXPORT_MODE_LOCAL,
454
  EXPORT_MODE_REMOTE,
455
  ])
456

    
457
# instance creation modes
458
INSTANCE_CREATE = "create"
459
INSTANCE_IMPORT = "import"
460
INSTANCE_REMOTE_IMPORT = "remote-import"
461
INSTANCE_CREATE_MODES = frozenset([
462
  INSTANCE_CREATE,
463
  INSTANCE_IMPORT,
464
  INSTANCE_REMOTE_IMPORT,
465
  ])
466

    
467
# Remote import/export handshake message and version
468
RIE_VERSION = 0
469
RIE_HANDSHAKE = "Hi, I'm Ganeti"
470

    
471
# Remote import/export certificate validity in seconds
472
RIE_CERT_VALIDITY = 24 * 60 * 60
473

    
474
# Overall timeout for establishing connection
475
RIE_CONNECT_TIMEOUT = 180
476

    
477
# Export only: how long to wait per connection attempt (seconds)
478
RIE_CONNECT_ATTEMPT_TIMEOUT = 20
479

    
480
# Export only: number of attempts to connect
481
RIE_CONNECT_RETRIES = 10
482

    
483
#: Give child process up to 5 seconds to exit after sending a signal
484
CHILD_LINGER_TIMEOUT = 5.0
485

    
486
DISK_TEMPLATES = frozenset([
487
  DT_DISKLESS,
488
  DT_PLAIN,
489
  DT_DRBD8,
490
  DT_FILE,
491
  DT_SHARED_FILE,
492
  DT_BLOCK,
493
  DT_RBD
494
  ])
495

    
496
FILE_DRIVER = frozenset([FD_LOOP, FD_BLKTAP])
497

    
498
# import/export config options
499
INISECT_EXP = "export"
500
INISECT_INS = "instance"
501
INISECT_HYP = "hypervisor"
502
INISECT_BEP = "backend"
503
INISECT_OSP = "os"
504

    
505
# dynamic device modification
506
DDM_ADD = "add"
507
DDM_MODIFY = "modify"
508
DDM_REMOVE = "remove"
509
DDMS_VALUES = frozenset([DDM_ADD, DDM_REMOVE])
510
DDMS_VALUES_WITH_MODIFY = (DDMS_VALUES | frozenset([
511
  DDM_MODIFY,
512
  ]))
513
# TODO: DDM_SWAP, DDM_MOVE?
514

    
515
# common exit codes
516
EXIT_SUCCESS = 0
517
EXIT_FAILURE = 1
518
EXIT_NOTCLUSTER = 5
519
EXIT_NOTMASTER = 11
520
EXIT_NODESETUP_ERROR = 12
521
EXIT_CONFIRMATION = 13 # need user confirmation
522

    
523
#: Exit code for query operations with unknown fields
524
EXIT_UNKNOWN_FIELD = 14
525

    
526
# tags
527
TAG_CLUSTER = "cluster"
528
TAG_NODEGROUP = "nodegroup"
529
TAG_NODE = "node"
530
TAG_INSTANCE = "instance"
531
VALID_TAG_TYPES = frozenset([
532
  TAG_CLUSTER,
533
  TAG_NODEGROUP,
534
  TAG_NODE,
535
  TAG_INSTANCE,
536
  ])
537
MAX_TAG_LEN = 128
538
MAX_TAGS_PER_OBJ = 4096
539

    
540
# others
541
DEFAULT_BRIDGE = "xen-br0"
542
CLASSIC_DRBD_SYNC_SPEED = 60 * 1024  # 60 MiB, expressed in KiB
543
IP4_ADDRESS_LOCALHOST = "127.0.0.1"
544
IP4_ADDRESS_ANY = "0.0.0.0"
545
IP6_ADDRESS_LOCALHOST = "::1"
546
IP6_ADDRESS_ANY = "::"
547
IP4_VERSION = 4
548
IP6_VERSION = 6
549
VALID_IP_VERSIONS = frozenset([IP4_VERSION, IP6_VERSION])
550
# for export to htools
551
IP4_FAMILY = socket.AF_INET
552
IP6_FAMILY = socket.AF_INET6
553

    
554
TCP_PING_TIMEOUT = 10
555
DEFAULT_VG = "xenvg"
556
DEFAULT_DRBD_HELPER = "/bin/true"
557
MIN_VG_SIZE = 20480
558
DEFAULT_MAC_PREFIX = "aa:00:00"
559
# default maximum instance wait time, in seconds.
560
DEFAULT_SHUTDOWN_TIMEOUT = 120
561
NODE_MAX_CLOCK_SKEW = 150
562
# Time for an intra-cluster disk transfer to wait for a connection
563
DISK_TRANSFER_CONNECT_TIMEOUT = 60
564
# Disk index separator
565
DISK_SEPARATOR = _autoconf.DISK_SEPARATOR
566
IP_COMMAND_PATH = _autoconf.IP_PATH
567

    
568
#: Key for job IDs in opcode result
569
JOB_IDS_KEY = "jobs"
570

    
571
# runparts results
572
(RUNPARTS_SKIP,
573
 RUNPARTS_RUN,
574
 RUNPARTS_ERR) = range(3)
575

    
576
RUNPARTS_STATUS = frozenset([RUNPARTS_SKIP, RUNPARTS_RUN, RUNPARTS_ERR])
577

    
578
# RPC constants
579
(RPC_ENCODING_NONE,
580
 RPC_ENCODING_ZLIB_BASE64) = range(2)
581

    
582
# Various time constants for the timeout table
583
RPC_TMO_URGENT = 60 # one minute
584
RPC_TMO_FAST = 5 * 60 # five minutes
585
RPC_TMO_NORMAL = 15 * 60 # 15 minutes
586
RPC_TMO_SLOW = 3600 # one hour
587
RPC_TMO_4HRS = 4 * 3600
588
RPC_TMO_1DAY = 86400
589

    
590
# Timeout for connecting to nodes (seconds)
591
RPC_CONNECT_TIMEOUT = 5
592

    
593
# os related constants
594
OS_SCRIPT_CREATE = "create"
595
OS_SCRIPT_IMPORT = "import"
596
OS_SCRIPT_EXPORT = "export"
597
OS_SCRIPT_RENAME = "rename"
598
OS_SCRIPT_VERIFY = "verify"
599
OS_SCRIPTS = frozenset([
600
  OS_SCRIPT_CREATE,
601
  OS_SCRIPT_IMPORT,
602
  OS_SCRIPT_EXPORT,
603
  OS_SCRIPT_RENAME,
604
  OS_SCRIPT_VERIFY
605
  ])
606

    
607
OS_API_FILE = "ganeti_api_version"
608
OS_VARIANTS_FILE = "variants.list"
609
OS_PARAMETERS_FILE = "parameters.list"
610

    
611
OS_VALIDATE_PARAMETERS = "parameters"
612
OS_VALIDATE_CALLS = frozenset([OS_VALIDATE_PARAMETERS])
613

    
614
# ssh constants
615
SSH = "ssh"
616
SCP = "scp"
617

    
618
# reboot types
619
INSTANCE_REBOOT_SOFT = "soft"
620
INSTANCE_REBOOT_HARD = "hard"
621
INSTANCE_REBOOT_FULL = "full"
622

    
623
REBOOT_TYPES = frozenset([
624
  INSTANCE_REBOOT_SOFT,
625
  INSTANCE_REBOOT_HARD,
626
  INSTANCE_REBOOT_FULL
627
  ])
628

    
629
# instance reboot behaviors
630
INSTANCE_REBOOT_ALLOWED = "reboot"
631
INSTANCE_REBOOT_EXIT = "exit"
632

    
633
REBOOT_BEHAVIORS = frozenset([
634
  INSTANCE_REBOOT_ALLOWED,
635
  INSTANCE_REBOOT_EXIT
636
  ])
637

    
638
VTYPE_STRING = "string"
639
VTYPE_MAYBE_STRING = "maybe-string"
640
VTYPE_BOOL = "bool"
641
VTYPE_SIZE = "size" # size, in MiBs
642
VTYPE_INT = "int"
643
ENFORCEABLE_TYPES = frozenset([
644
  VTYPE_STRING,
645
  VTYPE_MAYBE_STRING,
646
  VTYPE_BOOL,
647
  VTYPE_SIZE,
648
  VTYPE_INT,
649
  ])
650

    
651
# Constant representing that the user does not specify any IP version
652
IFACE_NO_IP_VERSION_SPECIFIED = 0
653

    
654
# HV parameter names (global namespace)
655
HV_BOOT_ORDER = "boot_order"
656
HV_CDROM_IMAGE_PATH = "cdrom_image_path"
657
HV_KVM_CDROM2_IMAGE_PATH = "cdrom2_image_path"
658
HV_KVM_FLOPPY_IMAGE_PATH = "floppy_image_path"
659
HV_NIC_TYPE = "nic_type"
660
HV_DISK_TYPE = "disk_type"
661
HV_KVM_CDROM_DISK_TYPE = "cdrom_disk_type"
662
HV_VNC_BIND_ADDRESS = "vnc_bind_address"
663
HV_VNC_PASSWORD_FILE = "vnc_password_file"
664
HV_VNC_TLS = "vnc_tls"
665
HV_VNC_X509 = "vnc_x509_path"
666
HV_VNC_X509_VERIFY = "vnc_x509_verify"
667
HV_KVM_SPICE_BIND = "spice_bind"
668
HV_KVM_SPICE_IP_VERSION = "spice_ip_version"
669
HV_KVM_SPICE_PASSWORD_FILE = "spice_password_file"
670
HV_KVM_SPICE_LOSSLESS_IMG_COMPR = "spice_image_compression"
671
HV_KVM_SPICE_JPEG_IMG_COMPR = "spice_jpeg_wan_compression"
672
HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR = "spice_zlib_glz_wan_compression"
673
HV_KVM_SPICE_STREAMING_VIDEO_DETECTION = "spice_streaming_video"
674
HV_KVM_SPICE_AUDIO_COMPR = "spice_playback_compression"
675
HV_KVM_SPICE_USE_TLS = "spice_use_tls"
676
HV_KVM_SPICE_TLS_CIPHERS = "spice_tls_ciphers"
677
HV_KVM_SPICE_USE_VDAGENT = "spice_use_vdagent"
678
HV_ACPI = "acpi"
679
HV_PAE = "pae"
680
HV_USE_BOOTLOADER = "use_bootloader"
681
HV_BOOTLOADER_ARGS = "bootloader_args"
682
HV_BOOTLOADER_PATH = "bootloader_path"
683
HV_KERNEL_ARGS = "kernel_args"
684
HV_KERNEL_PATH = "kernel_path"
685
HV_INITRD_PATH = "initrd_path"
686
HV_ROOT_PATH = "root_path"
687
HV_SERIAL_CONSOLE = "serial_console"
688
HV_USB_MOUSE = "usb_mouse"
689
HV_KEYMAP = "keymap"
690
HV_DEVICE_MODEL = "device_model"
691
HV_INIT_SCRIPT = "init_script"
692
HV_MIGRATION_PORT = "migration_port"
693
HV_MIGRATION_BANDWIDTH = "migration_bandwidth"
694
HV_MIGRATION_DOWNTIME = "migration_downtime"
695
HV_MIGRATION_MODE = "migration_mode"
696
HV_USE_LOCALTIME = "use_localtime"
697
HV_DISK_CACHE = "disk_cache"
698
HV_SECURITY_MODEL = "security_model"
699
HV_SECURITY_DOMAIN = "security_domain"
700
HV_KVM_FLAG = "kvm_flag"
701
HV_VHOST_NET = "vhost_net"
702
HV_KVM_USE_CHROOT = "use_chroot"
703
HV_CPU_MASK = "cpu_mask"
704
HV_MEM_PATH = "mem_path"
705
HV_PASSTHROUGH = "pci_pass"
706
HV_BLOCKDEV_PREFIX = "blockdev_prefix"
707
HV_REBOOT_BEHAVIOR = "reboot_behavior"
708
HV_CPU_TYPE = "cpu_type"
709

    
710
HVS_PARAMETER_TYPES = {
711
  HV_BOOT_ORDER: VTYPE_STRING,
712
  HV_KVM_FLOPPY_IMAGE_PATH: VTYPE_STRING,
713
  HV_CDROM_IMAGE_PATH: VTYPE_STRING,
714
  HV_KVM_CDROM2_IMAGE_PATH: VTYPE_STRING,
715
  HV_NIC_TYPE: VTYPE_STRING,
716
  HV_DISK_TYPE: VTYPE_STRING,
717
  HV_KVM_CDROM_DISK_TYPE: VTYPE_STRING,
718
  HV_VNC_PASSWORD_FILE: VTYPE_STRING,
719
  HV_VNC_BIND_ADDRESS: VTYPE_STRING,
720
  HV_VNC_TLS: VTYPE_BOOL,
721
  HV_VNC_X509: VTYPE_STRING,
722
  HV_VNC_X509_VERIFY: VTYPE_BOOL,
723
  HV_KVM_SPICE_BIND: VTYPE_STRING,
724
  HV_KVM_SPICE_IP_VERSION: VTYPE_INT,
725
  HV_KVM_SPICE_PASSWORD_FILE: VTYPE_STRING,
726
  HV_KVM_SPICE_LOSSLESS_IMG_COMPR: VTYPE_STRING,
727
  HV_KVM_SPICE_JPEG_IMG_COMPR: VTYPE_STRING,
728
  HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR: VTYPE_STRING,
729
  HV_KVM_SPICE_STREAMING_VIDEO_DETECTION: VTYPE_STRING,
730
  HV_KVM_SPICE_AUDIO_COMPR: VTYPE_BOOL,
731
  HV_KVM_SPICE_USE_TLS: VTYPE_BOOL,
732
  HV_KVM_SPICE_TLS_CIPHERS: VTYPE_STRING,
733
  HV_KVM_SPICE_USE_VDAGENT: VTYPE_BOOL,
734
  HV_ACPI: VTYPE_BOOL,
735
  HV_PAE: VTYPE_BOOL,
736
  HV_USE_BOOTLOADER: VTYPE_BOOL,
737
  HV_BOOTLOADER_PATH: VTYPE_STRING,
738
  HV_BOOTLOADER_ARGS: VTYPE_STRING,
739
  HV_KERNEL_PATH: VTYPE_STRING,
740
  HV_KERNEL_ARGS: VTYPE_STRING,
741
  HV_INITRD_PATH: VTYPE_STRING,
742
  HV_ROOT_PATH: VTYPE_MAYBE_STRING,
743
  HV_SERIAL_CONSOLE: VTYPE_BOOL,
744
  HV_USB_MOUSE: VTYPE_STRING,
745
  HV_KEYMAP: VTYPE_STRING,
746
  HV_DEVICE_MODEL: VTYPE_STRING,
747
  HV_INIT_SCRIPT: VTYPE_STRING,
748
  HV_MIGRATION_PORT: VTYPE_INT,
749
  HV_MIGRATION_BANDWIDTH: VTYPE_INT,
750
  HV_MIGRATION_DOWNTIME: VTYPE_INT,
751
  HV_MIGRATION_MODE: VTYPE_STRING,
752
  HV_USE_LOCALTIME: VTYPE_BOOL,
753
  HV_DISK_CACHE: VTYPE_STRING,
754
  HV_SECURITY_MODEL: VTYPE_STRING,
755
  HV_SECURITY_DOMAIN: VTYPE_STRING,
756
  HV_KVM_FLAG: VTYPE_STRING,
757
  HV_VHOST_NET: VTYPE_BOOL,
758
  HV_KVM_USE_CHROOT: VTYPE_BOOL,
759
  HV_CPU_MASK: VTYPE_STRING,
760
  HV_MEM_PATH: VTYPE_STRING,
761
  HV_PASSTHROUGH: VTYPE_STRING,
762
  HV_BLOCKDEV_PREFIX: VTYPE_STRING,
763
  HV_REBOOT_BEHAVIOR: VTYPE_STRING,
764
  HV_CPU_TYPE: VTYPE_STRING,
765
  }
766

    
767
HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
768

    
769
HVS_PARAMETER_TITLES = {
770
  HV_ACPI: "ACPI",
771
  HV_BOOT_ORDER: "Boot_order",
772
  HV_CDROM_IMAGE_PATH: "CDROM_image_path",
773
  HV_DISK_TYPE: "Disk_type",
774
  HV_INITRD_PATH: "Initrd_path",
775
  HV_KERNEL_PATH: "Kernel_path",
776
  HV_NIC_TYPE: "NIC_type",
777
  HV_PAE: "PAE",
778
  HV_VNC_BIND_ADDRESS: "VNC_bind_address",
779
  HV_PASSTHROUGH: "pci_pass",
780
  HV_CPU_TYPE: "cpu_type",
781
  }
782

    
783
# Migration statuses
784
HV_MIGRATION_COMPLETED = "completed"
785
HV_MIGRATION_ACTIVE = "active"
786
HV_MIGRATION_FAILED = "failed"
787
HV_MIGRATION_CANCELLED = "cancelled"
788

    
789
HV_MIGRATION_VALID_STATUSES = frozenset([
790
  HV_MIGRATION_COMPLETED,
791
  HV_MIGRATION_ACTIVE,
792
  HV_MIGRATION_FAILED,
793
  HV_MIGRATION_CANCELLED,
794
  ])
795

    
796
HV_MIGRATION_FAILED_STATUSES = frozenset([
797
  HV_MIGRATION_FAILED,
798
  HV_MIGRATION_CANCELLED,
799
  ])
800

    
801
# KVM-specific statuses
802
HV_KVM_MIGRATION_VALID_STATUSES = HV_MIGRATION_VALID_STATUSES
803

    
804
# Node info keys
805
HV_NODEINFO_KEY_VERSION = "hv_version"
806

    
807
# Hypervisor state
808
HVST_MEMORY_TOTAL = "mem_total"
809
HVST_MEMORY_NODE = "mem_node"
810
HVST_MEMORY_HV = "mem_hv"
811
HVST_CPU_TOTAL = "cpu_total"
812
HVST_CPU_NODE = "cpu_node"
813

    
814
HVST_DEFAULTS = {
815
  HVST_MEMORY_TOTAL: 0,
816
  HVST_MEMORY_NODE: 0,
817
  HVST_MEMORY_HV: 0,
818
  HVST_CPU_TOTAL: 1,
819
  HVST_CPU_NODE: 1,
820
  }
821

    
822
HVSTS_PARAMETER_TYPES = {
823
  HVST_MEMORY_TOTAL: VTYPE_INT,
824
  HVST_MEMORY_NODE: VTYPE_INT,
825
  HVST_MEMORY_HV: VTYPE_INT,
826
  HVST_CPU_TOTAL: VTYPE_INT,
827
  HVST_CPU_NODE: VTYPE_INT,
828
  }
829

    
830
HVSTS_PARAMETERS = frozenset(HVSTS_PARAMETER_TYPES.keys())
831

    
832
# Disk state
833
DS_DISK_TOTAL = "disk_total"
834
DS_DISK_RESERVED = "disk_reserved"
835
DS_DISK_OVERHEAD = "disk_overhead"
836

    
837
DS_DEFAULTS = {
838
  DS_DISK_TOTAL: 0,
839
  DS_DISK_RESERVED: 0,
840
  DS_DISK_OVERHEAD: 0,
841
  }
842

    
843
DSS_PARAMETER_TYPES = {
844
  DS_DISK_TOTAL: VTYPE_INT,
845
  DS_DISK_RESERVED: VTYPE_INT,
846
  DS_DISK_OVERHEAD: VTYPE_INT,
847
  }
848

    
849
DSS_PARAMETERS = frozenset(DSS_PARAMETER_TYPES.keys())
850
DS_VALID_TYPES = frozenset([LD_LV])
851

    
852
# Backend parameter names
853
BE_MEMORY = "memory" # deprecated and replaced by max and min mem
854
BE_MAXMEM = "maxmem"
855
BE_MINMEM = "minmem"
856
BE_VCPUS = "vcpus"
857
BE_AUTO_BALANCE = "auto_balance"
858
BE_ALWAYS_FAILOVER = "always_failover"
859
BE_SPINDLE_USE = "spindle_use"
860

    
861
BES_PARAMETER_TYPES = {
862
  BE_MAXMEM: VTYPE_SIZE,
863
  BE_MINMEM: VTYPE_SIZE,
864
  BE_VCPUS: VTYPE_INT,
865
  BE_AUTO_BALANCE: VTYPE_BOOL,
866
  BE_ALWAYS_FAILOVER: VTYPE_BOOL,
867
  BE_SPINDLE_USE: VTYPE_INT,
868
  }
869

    
870
BES_PARAMETER_TITLES = {
871
  BE_AUTO_BALANCE: "Auto_balance",
872
  BE_MAXMEM: "ConfigMaxMem",
873
  BE_MINMEM: "ConfigMinMem",
874
  BE_VCPUS: "ConfigVCPUs",
875
  }
876

    
877
BES_PARAMETER_COMPAT = {
878
  BE_MEMORY: VTYPE_SIZE,
879
  }
880
BES_PARAMETER_COMPAT.update(BES_PARAMETER_TYPES)
881

    
882
BES_PARAMETERS = frozenset(BES_PARAMETER_TYPES.keys())
883

    
884
# instance specs
885
ISPEC_MEM_SIZE = "memory-size"
886
ISPEC_CPU_COUNT = "cpu-count"
887
ISPEC_DISK_COUNT = "disk-count"
888
ISPEC_DISK_SIZE = "disk-size"
889
ISPEC_NIC_COUNT = "nic-count"
890
ISPEC_SPINDLE_USE = "spindle-use"
891

    
892
ISPECS_PARAMETER_TYPES = {
893
  ISPEC_MEM_SIZE: VTYPE_INT,
894
  ISPEC_CPU_COUNT: VTYPE_INT,
895
  ISPEC_DISK_COUNT: VTYPE_INT,
896
  ISPEC_DISK_SIZE: VTYPE_INT,
897
  ISPEC_NIC_COUNT: VTYPE_INT,
898
  ISPEC_SPINDLE_USE: VTYPE_INT,
899
  }
900

    
901
ISPECS_PARAMETERS = frozenset(ISPECS_PARAMETER_TYPES.keys())
902

    
903
ISPECS_MIN = "min"
904
ISPECS_MAX = "max"
905
ISPECS_STD = "std"
906
IPOLICY_DTS = "disk-templates"
907
IPOLICY_VCPU_RATIO = "vcpu-ratio"
908
IPOLICY_SPINDLE_RATIO = "spindle-ratio"
909

    
910
IPOLICY_ISPECS = frozenset([
911
  ISPECS_MIN,
912
  ISPECS_MAX,
913
  ISPECS_STD,
914
  ])
915

    
916
IPOLICY_PARAMETERS = frozenset([
917
  IPOLICY_VCPU_RATIO,
918
  IPOLICY_SPINDLE_RATIO,
919
  ])
920

    
921
IPOLICY_ALL_KEYS = (IPOLICY_ISPECS |
922
                    IPOLICY_PARAMETERS |
923
                    frozenset([IPOLICY_DTS]))
924

    
925
# Node parameter names
926
ND_OOB_PROGRAM = "oob_program"
927
ND_SPINDLE_COUNT = "spindle_count"
928

    
929
NDS_PARAMETER_TYPES = {
930
  ND_OOB_PROGRAM: VTYPE_STRING,
931
  ND_SPINDLE_COUNT: VTYPE_INT,
932
  }
933

    
934
NDS_PARAMETERS = frozenset(NDS_PARAMETER_TYPES.keys())
935

    
936
NDS_PARAMETER_TITLES = {
937
  ND_OOB_PROGRAM: "OutOfBandProgram",
938
  ND_SPINDLE_COUNT: "SpindleCount",
939
  }
940

    
941
# Logical Disks parameters
942
LDP_RESYNC_RATE = "resync-rate"
943
LDP_STRIPES = "stripes"
944
LDP_BARRIERS = "disabled-barriers"
945
LDP_NO_META_FLUSH = "disable-meta-flush"
946
LDP_DEFAULT_METAVG = "default-metavg"
947
LDP_DISK_CUSTOM = "disk-custom"
948
LDP_NET_CUSTOM = "net-custom"
949
LDP_DYNAMIC_RESYNC = "dynamic-resync"
950
LDP_PLAN_AHEAD = "c-plan-ahead"
951
LDP_FILL_TARGET = "c-fill-target"
952
LDP_DELAY_TARGET = "c-delay-target"
953
LDP_MAX_RATE = "c-max-rate"
954
LDP_MIN_RATE = "c-min-rate"
955
LDP_POOL = "pool"
956
DISK_LD_TYPES = {
957
  LDP_RESYNC_RATE: VTYPE_INT,
958
  LDP_STRIPES: VTYPE_INT,
959
  LDP_BARRIERS: VTYPE_STRING,
960
  LDP_NO_META_FLUSH: VTYPE_BOOL,
961
  LDP_DEFAULT_METAVG: VTYPE_STRING,
962
  LDP_DISK_CUSTOM: VTYPE_STRING,
963
  LDP_NET_CUSTOM: VTYPE_STRING,
964
  LDP_DYNAMIC_RESYNC: VTYPE_BOOL,
965
  LDP_PLAN_AHEAD: VTYPE_INT,
966
  LDP_FILL_TARGET: VTYPE_INT,
967
  LDP_DELAY_TARGET: VTYPE_INT,
968
  LDP_MAX_RATE: VTYPE_INT,
969
  LDP_MIN_RATE: VTYPE_INT,
970
  LDP_POOL: VTYPE_STRING,
971
  }
972
DISK_LD_PARAMETERS = frozenset(DISK_LD_TYPES.keys())
973

    
974
# Disk template parameters (can be set/changed by the user via gnt-cluster and
975
# gnt-group)
976
DRBD_RESYNC_RATE = "resync-rate"
977
DRBD_DATA_STRIPES = "data-stripes"
978
DRBD_META_STRIPES = "meta-stripes"
979
DRBD_DISK_BARRIERS = "disk-barriers"
980
DRBD_META_BARRIERS = "meta-barriers"
981
DRBD_DEFAULT_METAVG = "metavg"
982
DRBD_DISK_CUSTOM = "disk-custom"
983
DRBD_NET_CUSTOM = "net-custom"
984
DRBD_DYNAMIC_RESYNC = "dynamic-resync"
985
DRBD_PLAN_AHEAD = "c-plan-ahead"
986
DRBD_FILL_TARGET = "c-fill-target"
987
DRBD_DELAY_TARGET = "c-delay-target"
988
DRBD_MAX_RATE = "c-max-rate"
989
DRBD_MIN_RATE = "c-min-rate"
990
LV_STRIPES = "stripes"
991
RBD_POOL = "pool"
992
DISK_DT_TYPES = {
993
  DRBD_RESYNC_RATE: VTYPE_INT,
994
  DRBD_DATA_STRIPES: VTYPE_INT,
995
  DRBD_META_STRIPES: VTYPE_INT,
996
  DRBD_DISK_BARRIERS: VTYPE_STRING,
997
  DRBD_META_BARRIERS: VTYPE_BOOL,
998
  DRBD_DEFAULT_METAVG: VTYPE_STRING,
999
  DRBD_DISK_CUSTOM: VTYPE_STRING,
1000
  DRBD_NET_CUSTOM: VTYPE_STRING,
1001
  DRBD_DYNAMIC_RESYNC: VTYPE_BOOL,
1002
  DRBD_PLAN_AHEAD: VTYPE_INT,
1003
  DRBD_FILL_TARGET: VTYPE_INT,
1004
  DRBD_DELAY_TARGET: VTYPE_INT,
1005
  DRBD_MAX_RATE: VTYPE_INT,
1006
  DRBD_MIN_RATE: VTYPE_INT,
1007
  LV_STRIPES: VTYPE_INT,
1008
  RBD_POOL: VTYPE_STRING,
1009
  }
1010

    
1011
DISK_DT_PARAMETERS = frozenset(DISK_DT_TYPES.keys())
1012

    
1013
# OOB supported commands
1014
OOB_POWER_ON = "power-on"
1015
OOB_POWER_OFF = "power-off"
1016
OOB_POWER_CYCLE = "power-cycle"
1017
OOB_POWER_STATUS = "power-status"
1018
OOB_HEALTH = "health"
1019

    
1020
OOB_COMMANDS = frozenset([
1021
  OOB_POWER_ON,
1022
  OOB_POWER_OFF,
1023
  OOB_POWER_CYCLE,
1024
  OOB_POWER_STATUS,
1025
  OOB_HEALTH
1026
  ])
1027

    
1028
OOB_POWER_STATUS_POWERED = "powered"
1029

    
1030
OOB_TIMEOUT = 60 # 60 seconds
1031
OOB_POWER_DELAY = 2.0 # 2 seconds
1032

    
1033
OOB_STATUS_OK = "OK"
1034
OOB_STATUS_WARNING = "WARNING"
1035
OOB_STATUS_CRITICAL = "CRITICAL"
1036
OOB_STATUS_UNKNOWN = "UNKNOWN"
1037

    
1038
OOB_STATUSES = frozenset([
1039
  OOB_STATUS_OK,
1040
  OOB_STATUS_WARNING,
1041
  OOB_STATUS_CRITICAL,
1042
  OOB_STATUS_UNKNOWN,
1043
  ])
1044

    
1045
# Instance Parameters Profile
1046
PP_DEFAULT = "default"
1047

    
1048
# NIC_* constants are used inside the ganeti config
1049
NIC_MODE = "mode"
1050
NIC_LINK = "link"
1051

    
1052
NIC_MODE_BRIDGED = "bridged"
1053
NIC_MODE_ROUTED = "routed"
1054

    
1055
NIC_VALID_MODES = frozenset([NIC_MODE_BRIDGED, NIC_MODE_ROUTED])
1056

    
1057
NICS_PARAMETER_TYPES = {
1058
  NIC_MODE: VTYPE_STRING,
1059
  NIC_LINK: VTYPE_STRING,
1060
  }
1061

    
1062
NICS_PARAMETERS = frozenset(NICS_PARAMETER_TYPES.keys())
1063

    
1064
# IDISK_* constants are used in opcodes, to create/change disks
1065
IDISK_SIZE = "size"
1066
IDISK_MODE = "mode"
1067
IDISK_ADOPT = "adopt"
1068
IDISK_VG = "vg"
1069
IDISK_METAVG = "metavg"
1070
IDISK_PARAMS_TYPES = {
1071
  IDISK_SIZE: VTYPE_SIZE,
1072
  IDISK_MODE: VTYPE_STRING,
1073
  IDISK_ADOPT: VTYPE_STRING,
1074
  IDISK_VG: VTYPE_STRING,
1075
  IDISK_METAVG: VTYPE_STRING,
1076
  }
1077
IDISK_PARAMS = frozenset(IDISK_PARAMS_TYPES.keys())
1078

    
1079
# INIC_* constants are used in opcodes, to create/change nics
1080
INIC_MAC = "mac"
1081
INIC_IP = "ip"
1082
INIC_MODE = "mode"
1083
INIC_LINK = "link"
1084
INIC_PARAMS_TYPES = {
1085
  INIC_IP: VTYPE_MAYBE_STRING,
1086
  INIC_LINK: VTYPE_STRING,
1087
  INIC_MAC: VTYPE_STRING,
1088
  INIC_MODE: VTYPE_STRING,
1089
  }
1090
INIC_PARAMS = frozenset(INIC_PARAMS_TYPES.keys())
1091

    
1092
# Hypervisor constants
1093
HT_XEN_PVM = "xen-pvm"
1094
HT_FAKE = "fake"
1095
HT_XEN_HVM = "xen-hvm"
1096
HT_KVM = "kvm"
1097
HT_CHROOT = "chroot"
1098
HT_LXC = "lxc"
1099
HYPER_TYPES = frozenset([
1100
  HT_XEN_PVM,
1101
  HT_FAKE,
1102
  HT_XEN_HVM,
1103
  HT_KVM,
1104
  HT_CHROOT,
1105
  HT_LXC,
1106
  ])
1107
HTS_REQ_PORT = frozenset([HT_XEN_HVM, HT_KVM])
1108

    
1109
VNC_BASE_PORT = 5900
1110
VNC_DEFAULT_BIND_ADDRESS = IP4_ADDRESS_ANY
1111

    
1112
# NIC types
1113
HT_NIC_RTL8139 = "rtl8139"
1114
HT_NIC_NE2K_PCI = "ne2k_pci"
1115
HT_NIC_NE2K_ISA = "ne2k_isa"
1116
HT_NIC_I82551 = "i82551"
1117
HT_NIC_I85557B = "i82557b"
1118
HT_NIC_I8259ER = "i82559er"
1119
HT_NIC_PCNET = "pcnet"
1120
HT_NIC_E1000 = "e1000"
1121
HT_NIC_PARAVIRTUAL = HT_DISK_PARAVIRTUAL = "paravirtual"
1122

    
1123
HT_HVM_VALID_NIC_TYPES = frozenset([
1124
  HT_NIC_RTL8139,
1125
  HT_NIC_NE2K_PCI,
1126
  HT_NIC_E1000,
1127
  HT_NIC_NE2K_ISA,
1128
  HT_NIC_PARAVIRTUAL
1129
  ])
1130
HT_KVM_VALID_NIC_TYPES = frozenset([
1131
  HT_NIC_RTL8139,
1132
  HT_NIC_NE2K_PCI,
1133
  HT_NIC_NE2K_ISA,
1134
  HT_NIC_I82551,
1135
  HT_NIC_I85557B,
1136
  HT_NIC_I8259ER,
1137
  HT_NIC_PCNET,
1138
  HT_NIC_E1000,
1139
  HT_NIC_PARAVIRTUAL
1140
  ])
1141

    
1142
# Disk types
1143
HT_DISK_IOEMU = "ioemu"
1144
HT_DISK_IDE = "ide"
1145
HT_DISK_SCSI = "scsi"
1146
HT_DISK_SD = "sd"
1147
HT_DISK_MTD = "mtd"
1148
HT_DISK_PFLASH = "pflash"
1149

    
1150
HT_CACHE_DEFAULT = "default"
1151
HT_CACHE_NONE = "none"
1152
HT_CACHE_WTHROUGH = "writethrough"
1153
HT_CACHE_WBACK = "writeback"
1154
HT_VALID_CACHE_TYPES = frozenset([
1155
  HT_CACHE_DEFAULT,
1156
  HT_CACHE_NONE,
1157
  HT_CACHE_WTHROUGH,
1158
  HT_CACHE_WBACK
1159
  ])
1160

    
1161
HT_HVM_VALID_DISK_TYPES = frozenset([HT_DISK_PARAVIRTUAL, HT_DISK_IOEMU])
1162
HT_KVM_VALID_DISK_TYPES = frozenset([
1163
  HT_DISK_PARAVIRTUAL,
1164
  HT_DISK_IDE,
1165
  HT_DISK_SCSI,
1166
  HT_DISK_SD,
1167
  HT_DISK_MTD,
1168
  HT_DISK_PFLASH
1169
  ])
1170

    
1171
# Mouse types:
1172
HT_MOUSE_MOUSE = "mouse"
1173
HT_MOUSE_TABLET = "tablet"
1174

    
1175
HT_KVM_VALID_MOUSE_TYPES = frozenset([HT_MOUSE_MOUSE, HT_MOUSE_TABLET])
1176

    
1177
# Boot order
1178
HT_BO_FLOPPY = "floppy"
1179
HT_BO_CDROM = "cdrom"
1180
HT_BO_DISK = "disk"
1181
HT_BO_NETWORK = "network"
1182

    
1183
HT_KVM_VALID_BO_TYPES = frozenset([
1184
  HT_BO_FLOPPY,
1185
  HT_BO_CDROM,
1186
  HT_BO_DISK,
1187
  HT_BO_NETWORK
1188
  ])
1189

    
1190
# SPICE lossless image compression options
1191
HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_GLZ = "auto_glz"
1192
HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_LZ = "auto_lz"
1193
HT_KVM_SPICE_LOSSLESS_IMG_COMPR_QUIC = "quic"
1194
HT_KVM_SPICE_LOSSLESS_IMG_COMPR_GLZ = "glz"
1195
HT_KVM_SPICE_LOSSLESS_IMG_COMPR_LZ = "lz"
1196
HT_KVM_SPICE_LOSSLESS_IMG_COMPR_OFF = "off"
1197

    
1198
HT_KVM_SPICE_VALID_LOSSLESS_IMG_COMPR_OPTIONS = frozenset([
1199
  HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_GLZ,
1200
  HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_LZ,
1201
  HT_KVM_SPICE_LOSSLESS_IMG_COMPR_QUIC,
1202
  HT_KVM_SPICE_LOSSLESS_IMG_COMPR_GLZ,
1203
  HT_KVM_SPICE_LOSSLESS_IMG_COMPR_LZ,
1204
  HT_KVM_SPICE_LOSSLESS_IMG_COMPR_OFF,
1205
  ])
1206

    
1207
# SPICE lossy image compression options (valid for both jpeg and zlib-glz)
1208
HT_KVM_SPICE_LOSSY_IMG_COMPR_AUTO = "auto"
1209
HT_KVM_SPICE_LOSSY_IMG_COMPR_NEVER = "never"
1210
HT_KVM_SPICE_LOSSY_IMG_COMPR_ALWAYS = "always"
1211

    
1212
HT_KVM_SPICE_VALID_LOSSY_IMG_COMPR_OPTIONS = frozenset([
1213
  HT_KVM_SPICE_LOSSY_IMG_COMPR_AUTO,
1214
  HT_KVM_SPICE_LOSSY_IMG_COMPR_NEVER,
1215
  HT_KVM_SPICE_LOSSY_IMG_COMPR_ALWAYS,
1216
  ])
1217

    
1218
# SPICE video stream detection
1219
HT_KVM_SPICE_VIDEO_STREAM_DETECTION_OFF = "off"
1220
HT_KVM_SPICE_VIDEO_STREAM_DETECTION_ALL = "all"
1221
HT_KVM_SPICE_VIDEO_STREAM_DETECTION_FILTER = "filter"
1222

    
1223
HT_KVM_SPICE_VALID_VIDEO_STREAM_DETECTION_OPTIONS = frozenset([
1224
  HT_KVM_SPICE_VIDEO_STREAM_DETECTION_OFF,
1225
  HT_KVM_SPICE_VIDEO_STREAM_DETECTION_ALL,
1226
  HT_KVM_SPICE_VIDEO_STREAM_DETECTION_FILTER,
1227
  ])
1228

    
1229
# Security models
1230
HT_SM_NONE = "none"
1231
HT_SM_USER = "user"
1232
HT_SM_POOL = "pool"
1233

    
1234
HT_KVM_VALID_SM_TYPES = frozenset([HT_SM_NONE, HT_SM_USER, HT_SM_POOL])
1235

    
1236
# Kvm flag values
1237
HT_KVM_ENABLED = "enabled"
1238
HT_KVM_DISABLED = "disabled"
1239

    
1240
HT_KVM_FLAG_VALUES = frozenset([HT_KVM_ENABLED, HT_KVM_DISABLED])
1241

    
1242
# Migration type
1243
HT_MIGRATION_LIVE = "live"
1244
HT_MIGRATION_NONLIVE = "non-live"
1245
HT_MIGRATION_MODES = frozenset([HT_MIGRATION_LIVE, HT_MIGRATION_NONLIVE])
1246

    
1247
# Cluster Verify steps
1248
VERIFY_NPLUSONE_MEM = "nplusone_mem"
1249
VERIFY_OPTIONAL_CHECKS = frozenset([VERIFY_NPLUSONE_MEM])
1250

    
1251
# Cluster Verify error classes
1252
CV_TCLUSTER = "cluster"
1253
CV_TNODE = "node"
1254
CV_TINSTANCE = "instance"
1255

    
1256
# Cluster Verify error codes and documentation
1257
CV_ECLUSTERCFG = \
1258
  (CV_TCLUSTER, "ECLUSTERCFG", "Cluster configuration verification failure")
1259
CV_ECLUSTERCERT = \
1260
  (CV_TCLUSTER, "ECLUSTERCERT",
1261
   "Cluster certificate files verification failure")
1262
CV_ECLUSTERFILECHECK = \
1263
  (CV_TCLUSTER, "ECLUSTERFILECHECK",
1264
   "Cluster configuration verification failure")
1265
CV_ECLUSTERDANGLINGNODES = \
1266
  (CV_TNODE, "ECLUSTERDANGLINGNODES",
1267
   "Some nodes belong to non-existing groups")
1268
CV_ECLUSTERDANGLINGINST = \
1269
  (CV_TNODE, "ECLUSTERDANGLINGINST",
1270
   "Some instances have a non-existing primary node")
1271
CV_EINSTANCEBADNODE = \
1272
  (CV_TINSTANCE, "EINSTANCEBADNODE",
1273
   "Instance marked as running lives on an offline node")
1274
CV_EINSTANCEDOWN = \
1275
  (CV_TINSTANCE, "EINSTANCEDOWN", "Instance not running on its primary node")
1276
CV_EINSTANCELAYOUT = \
1277
  (CV_TINSTANCE, "EINSTANCELAYOUT", "Instance has multiple secondary nodes")
1278
CV_EINSTANCEMISSINGDISK = \
1279
  (CV_TINSTANCE, "EINSTANCEMISSINGDISK", "Missing volume on an instance")
1280
CV_EINSTANCEFAULTYDISK = \
1281
  (CV_TINSTANCE, "EINSTANCEFAULTYDISK",
1282
   "Impossible to retrieve status for a disk")
1283
CV_EINSTANCEWRONGNODE = \
1284
  (CV_TINSTANCE, "EINSTANCEWRONGNODE", "Instance running on the wrong node")
1285
CV_EINSTANCESPLITGROUPS = \
1286
  (CV_TINSTANCE, "EINSTANCESPLITGROUPS",
1287
   "Instance with primary and secondary nodes in different groups")
1288
CV_EINSTANCEPOLICY = \
1289
  (CV_TINSTANCE, "EINSTANCEPOLICY",
1290
   "Instance does not meet policy")
1291
CV_ENODEDRBD = \
1292
  (CV_TNODE, "ENODEDRBD", "Error parsing the DRBD status file")
1293
CV_ENODEDRBDHELPER = \
1294
  (CV_TNODE, "ENODEDRBDHELPER", "Error caused by the DRBD helper")
1295
CV_ENODEFILECHECK = \
1296
  (CV_TNODE, "ENODEFILECHECK",
1297
   "Error retrieving the checksum of the node files")
1298
CV_ENODEHOOKS = \
1299
  (CV_TNODE, "ENODEHOOKS", "Communication failure in hooks execution")
1300
CV_ENODEHV = \
1301
  (CV_TNODE, "ENODEHV", "Hypervisor parameters verification failure")
1302
CV_ENODELVM = \
1303
  (CV_TNODE, "ENODELVM", "LVM-related node error")
1304
CV_ENODEN1 = \
1305
  (CV_TNODE, "ENODEN1", "Not enough memory to accommodate instance failovers")
1306
CV_ENODENET = \
1307
  (CV_TNODE, "ENODENET", "Network-related node error")
1308
CV_ENODEOS = \
1309
  (CV_TNODE, "ENODEOS", "OS-related node error")
1310
CV_ENODEORPHANINSTANCE = \
1311
  (CV_TNODE, "ENODEORPHANINSTANCE", "Unknown intance running on a node")
1312
CV_ENODEORPHANLV = \
1313
  (CV_TNODE, "ENODEORPHANLV", "Unknown LVM logical volume")
1314
CV_ENODERPC = \
1315
  (CV_TNODE, "ENODERPC",
1316
   "Error during connection to the primary node of an instance")
1317
CV_ENODESSH = \
1318
  (CV_TNODE, "ENODESSH", "SSH-related node error")
1319
CV_ENODEVERSION = \
1320
  (CV_TNODE, "ENODEVERSION",
1321
   "Protocol version mismatch or Ganeti version mismatch")
1322
CV_ENODESETUP = \
1323
  (CV_TNODE, "ENODESETUP", "Node setup error")
1324
CV_ENODETIME = \
1325
  (CV_TNODE, "ENODETIME", "Node returned invalid time")
1326
CV_ENODEOOBPATH = \
1327
  (CV_TNODE, "ENODEOOBPATH", "Invalid Out Of Band path")
1328
CV_ENODEUSERSCRIPTS = \
1329
  (CV_TNODE, "ENODEUSERSCRIPTS", "User scripts not present or not executable")
1330

    
1331
CV_ALL_ECODES = frozenset([
1332
  CV_ECLUSTERCFG,
1333
  CV_ECLUSTERCERT,
1334
  CV_ECLUSTERFILECHECK,
1335
  CV_ECLUSTERDANGLINGNODES,
1336
  CV_ECLUSTERDANGLINGINST,
1337
  CV_EINSTANCEBADNODE,
1338
  CV_EINSTANCEDOWN,
1339
  CV_EINSTANCELAYOUT,
1340
  CV_EINSTANCEMISSINGDISK,
1341
  CV_EINSTANCEFAULTYDISK,
1342
  CV_EINSTANCEWRONGNODE,
1343
  CV_EINSTANCESPLITGROUPS,
1344
  CV_EINSTANCEPOLICY,
1345
  CV_ENODEDRBD,
1346
  CV_ENODEDRBDHELPER,
1347
  CV_ENODEFILECHECK,
1348
  CV_ENODEHOOKS,
1349
  CV_ENODEHV,
1350
  CV_ENODELVM,
1351
  CV_ENODEN1,
1352
  CV_ENODENET,
1353
  CV_ENODEOS,
1354
  CV_ENODEORPHANINSTANCE,
1355
  CV_ENODEORPHANLV,
1356
  CV_ENODERPC,
1357
  CV_ENODESSH,
1358
  CV_ENODEVERSION,
1359
  CV_ENODESETUP,
1360
  CV_ENODETIME,
1361
  CV_ENODEOOBPATH,
1362
  CV_ENODEUSERSCRIPTS,
1363
  ])
1364

    
1365
CV_ALL_ECODES_STRINGS = frozenset(estr for (_, estr, _) in CV_ALL_ECODES)
1366

    
1367
# Node verify constants
1368
NV_DRBDHELPER = "drbd-helper"
1369
NV_DRBDLIST = "drbd-list"
1370
NV_FILELIST = "filelist"
1371
NV_HVINFO = "hvinfo"
1372
NV_HYPERVISOR = "hypervisor"
1373
NV_HVPARAMS = "hvparms"
1374
NV_INSTANCELIST = "instancelist"
1375
NV_LVLIST = "lvlist"
1376
NV_MASTERIP = "master-ip"
1377
NV_NODELIST = "nodelist"
1378
NV_NODENETTEST = "node-net-test"
1379
NV_NODESETUP = "nodesetup"
1380
NV_OSLIST = "oslist"
1381
NV_PVLIST = "pvlist"
1382
NV_TIME = "time"
1383
NV_VERSION = "version"
1384
NV_VGLIST = "vglist"
1385
NV_VMNODES = "vmnodes"
1386
NV_OOB_PATHS = "oob-paths"
1387
NV_BRIDGES = "bridges"
1388
NV_USERSCRIPTS = "user-scripts"
1389

    
1390
# Instance status
1391
INSTST_RUNNING = "running"
1392
INSTST_ADMINDOWN = "ADMIN_down"
1393
INSTST_ADMINOFFLINE = "ADMIN_offline"
1394
INSTST_NODEOFFLINE = "ERROR_nodeoffline"
1395
INSTST_NODEDOWN = "ERROR_nodedown"
1396
INSTST_WRONGNODE = "ERROR_wrongnode"
1397
INSTST_ERRORUP = "ERROR_up"
1398
INSTST_ERRORDOWN = "ERROR_down"
1399
INSTST_ALL = frozenset([
1400
  INSTST_RUNNING,
1401
  INSTST_ADMINDOWN,
1402
  INSTST_ADMINOFFLINE,
1403
  INSTST_NODEOFFLINE,
1404
  INSTST_NODEDOWN,
1405
  INSTST_WRONGNODE,
1406
  INSTST_ERRORUP,
1407
  INSTST_ERRORDOWN,
1408
  ])
1409

    
1410
# Admin states
1411
ADMINST_UP = "up"
1412
ADMINST_DOWN = "down"
1413
ADMINST_OFFLINE = "offline"
1414
ADMINST_ALL = frozenset([
1415
  ADMINST_UP,
1416
  ADMINST_DOWN,
1417
  ADMINST_OFFLINE,
1418
  ])
1419

    
1420
# Node roles
1421
NR_REGULAR = "R"
1422
NR_MASTER = "M"
1423
NR_MCANDIDATE = "C"
1424
NR_DRAINED = "D"
1425
NR_OFFLINE = "O"
1426
NR_ALL = frozenset([
1427
  NR_REGULAR,
1428
  NR_MASTER,
1429
  NR_MCANDIDATE,
1430
  NR_DRAINED,
1431
  NR_OFFLINE,
1432
  ])
1433

    
1434
# SSL certificate check constants (in days)
1435
SSL_CERT_EXPIRATION_WARN = 30
1436
SSL_CERT_EXPIRATION_ERROR = 7
1437

    
1438
# Allocator framework constants
1439
IALLOCATOR_VERSION = 2
1440
IALLOCATOR_DIR_IN = "in"
1441
IALLOCATOR_DIR_OUT = "out"
1442
VALID_IALLOCATOR_DIRECTIONS = frozenset([
1443
  IALLOCATOR_DIR_IN,
1444
  IALLOCATOR_DIR_OUT,
1445
  ])
1446
IALLOCATOR_MODE_ALLOC = "allocate"
1447
IALLOCATOR_MODE_RELOC = "relocate"
1448
IALLOCATOR_MODE_CHG_GROUP = "change-group"
1449
IALLOCATOR_MODE_NODE_EVAC = "node-evacuate"
1450
IALLOCATOR_MODE_MULTI_ALLOC = "multi-allocate"
1451
VALID_IALLOCATOR_MODES = frozenset([
1452
  IALLOCATOR_MODE_ALLOC,
1453
  IALLOCATOR_MODE_RELOC,
1454
  IALLOCATOR_MODE_CHG_GROUP,
1455
  IALLOCATOR_MODE_NODE_EVAC,
1456
  IALLOCATOR_MODE_MULTI_ALLOC,
1457
  ])
1458
IALLOCATOR_SEARCH_PATH = _autoconf.IALLOCATOR_SEARCH_PATH
1459

    
1460
IALLOCATOR_NEVAC_PRI = "primary-only"
1461
IALLOCATOR_NEVAC_SEC = "secondary-only"
1462
IALLOCATOR_NEVAC_ALL = "all"
1463
IALLOCATOR_NEVAC_MODES = frozenset([
1464
  IALLOCATOR_NEVAC_PRI,
1465
  IALLOCATOR_NEVAC_SEC,
1466
  IALLOCATOR_NEVAC_ALL,
1467
  ])
1468

    
1469
# Node evacuation
1470
NODE_EVAC_PRI = "primary-only"
1471
NODE_EVAC_SEC = "secondary-only"
1472
NODE_EVAC_ALL = "all"
1473
NODE_EVAC_MODES = frozenset([
1474
  NODE_EVAC_PRI,
1475
  NODE_EVAC_SEC,
1476
  NODE_EVAC_ALL,
1477
  ])
1478

    
1479
# Job queue
1480
JOB_QUEUE_VERSION = 1
1481
JOB_QUEUE_SIZE_HARD_LIMIT = 5000
1482

    
1483
JOB_ID_TEMPLATE = r"\d+"
1484
JOB_FILE_RE = re.compile(r"^job-(%s)$" % JOB_ID_TEMPLATE)
1485

    
1486
# unchanged job return
1487
JOB_NOTCHANGED = "nochange"
1488

    
1489
# Job status
1490
JOB_STATUS_QUEUED = "queued"
1491
JOB_STATUS_WAITING = "waiting"
1492
JOB_STATUS_CANCELING = "canceling"
1493
JOB_STATUS_RUNNING = "running"
1494
JOB_STATUS_CANCELED = "canceled"
1495
JOB_STATUS_SUCCESS = "success"
1496
JOB_STATUS_ERROR = "error"
1497
JOBS_FINALIZED = frozenset([
1498
  JOB_STATUS_CANCELED,
1499
  JOB_STATUS_SUCCESS,
1500
  JOB_STATUS_ERROR,
1501
  ])
1502
JOB_STATUS_ALL = frozenset([
1503
  JOB_STATUS_QUEUED,
1504
  JOB_STATUS_WAITING,
1505
  JOB_STATUS_CANCELING,
1506
  JOB_STATUS_RUNNING,
1507
  ]) | JOBS_FINALIZED
1508

    
1509
# OpCode status
1510
# not yet finalized
1511
OP_STATUS_QUEUED = "queued"
1512
OP_STATUS_WAITING = "waiting"
1513
OP_STATUS_CANCELING = "canceling"
1514
OP_STATUS_RUNNING = "running"
1515
# finalized
1516
OP_STATUS_CANCELED = "canceled"
1517
OP_STATUS_SUCCESS = "success"
1518
OP_STATUS_ERROR = "error"
1519
OPS_FINALIZED = frozenset([
1520
  OP_STATUS_CANCELED,
1521
  OP_STATUS_SUCCESS,
1522
  OP_STATUS_ERROR
1523
  ])
1524

    
1525
# OpCode priority
1526
OP_PRIO_LOWEST = +19
1527
OP_PRIO_HIGHEST = -20
1528

    
1529
OP_PRIO_LOW = +10
1530
OP_PRIO_NORMAL = 0
1531
OP_PRIO_HIGH = -10
1532

    
1533
OP_PRIO_SUBMIT_VALID = frozenset([
1534
  OP_PRIO_LOW,
1535
  OP_PRIO_NORMAL,
1536
  OP_PRIO_HIGH,
1537
  ])
1538

    
1539
OP_PRIO_DEFAULT = OP_PRIO_NORMAL
1540

    
1541
# Lock recalculate mode
1542
LOCKS_REPLACE = "replace"
1543
LOCKS_APPEND = "append"
1544

    
1545
# Lock timeout (sum) before we should go into blocking acquire (still
1546
# can be reset by priority change); computed as max time (10 hours)
1547
# before we should actually go into blocking acquire given that we
1548
# start from default priority level; in seconds
1549
# TODO
1550
LOCK_ATTEMPTS_TIMEOUT = 10 * 3600 / (OP_PRIO_DEFAULT - OP_PRIO_HIGHEST)
1551
LOCK_ATTEMPTS_MAXWAIT = 15.0
1552
LOCK_ATTEMPTS_MINWAIT = 1.0
1553

    
1554
# Execution log types
1555
ELOG_MESSAGE = "message"
1556
ELOG_REMOTE_IMPORT = "remote-import"
1557
ELOG_JQUEUE_TEST = "jqueue-test"
1558

    
1559
# /etc/hosts modification
1560
ETC_HOSTS_ADD = "add"
1561
ETC_HOSTS_REMOVE = "remove"
1562

    
1563
# Job queue test
1564
JQT_MSGPREFIX = "TESTMSG="
1565
JQT_EXPANDNAMES = "expandnames"
1566
JQT_EXEC = "exec"
1567
JQT_LOGMSG = "logmsg"
1568
JQT_STARTMSG = "startmsg"
1569
JQT_ALL = frozenset([
1570
  JQT_EXPANDNAMES,
1571
  JQT_EXEC,
1572
  JQT_LOGMSG,
1573
  JQT_STARTMSG,
1574
  ])
1575

    
1576
# Query resources
1577
QR_CLUSTER = "cluster"
1578
QR_INSTANCE = "instance"
1579
QR_NODE = "node"
1580
QR_LOCK = "lock"
1581
QR_GROUP = "group"
1582
QR_OS = "os"
1583
QR_JOB = "job"
1584
QR_EXPORT = "export"
1585

    
1586
#: List of resources which can be queried using L{opcodes.OpQuery}
1587
QR_VIA_OP = frozenset([
1588
  QR_CLUSTER,
1589
  QR_INSTANCE,
1590
  QR_NODE,
1591
  QR_GROUP,
1592
  QR_OS,
1593
  QR_EXPORT,
1594
  ])
1595

    
1596
#: List of resources which can be queried using Local UniX Interface
1597
QR_VIA_LUXI = QR_VIA_OP.union([
1598
  QR_LOCK,
1599
  QR_JOB,
1600
  ])
1601

    
1602
#: List of resources which can be queried using RAPI
1603
QR_VIA_RAPI = QR_VIA_LUXI
1604

    
1605
# Query field types
1606
QFT_UNKNOWN = "unknown"
1607
QFT_TEXT = "text"
1608
QFT_BOOL = "bool"
1609
QFT_NUMBER = "number"
1610
QFT_UNIT = "unit"
1611
QFT_TIMESTAMP = "timestamp"
1612
QFT_OTHER = "other"
1613

    
1614
#: All query field types
1615
QFT_ALL = frozenset([
1616
  QFT_UNKNOWN,
1617
  QFT_TEXT,
1618
  QFT_BOOL,
1619
  QFT_NUMBER,
1620
  QFT_UNIT,
1621
  QFT_TIMESTAMP,
1622
  QFT_OTHER,
1623
  ])
1624

    
1625
# Query result field status (don't change or reuse values as they're used by
1626
# clients)
1627
#: Normal field status
1628
RS_NORMAL = 0
1629
#: Unknown field
1630
RS_UNKNOWN = 1
1631
#: No data (e.g. RPC error), can be used instead of L{RS_OFFLINE}
1632
RS_NODATA = 2
1633
#: Value unavailable/unsupported for item; if this field is supported
1634
#: but we cannot get the data for the moment, RS_NODATA or
1635
#: RS_OFFLINE should be used
1636
RS_UNAVAIL = 3
1637
#: Resource marked offline
1638
RS_OFFLINE = 4
1639

    
1640
RS_ALL = frozenset([
1641
  RS_NORMAL,
1642
  RS_UNKNOWN,
1643
  RS_NODATA,
1644
  RS_UNAVAIL,
1645
  RS_OFFLINE,
1646
  ])
1647

    
1648
#: Dictionary with special field cases and their verbose/terse formatting
1649
RSS_DESCRIPTION = {
1650
  RS_UNKNOWN: ("(unknown)", "??"),
1651
  RS_NODATA: ("(nodata)", "?"),
1652
  RS_OFFLINE: ("(offline)", "*"),
1653
  RS_UNAVAIL: ("(unavail)", "-"),
1654
  }
1655

    
1656
# max dynamic devices
1657
MAX_NICS = 8
1658
MAX_DISKS = 16
1659

    
1660
# SSCONF file prefix
1661
SSCONF_FILEPREFIX = "ssconf_"
1662
# SSCONF keys
1663
SS_CLUSTER_NAME = "cluster_name"
1664
SS_CLUSTER_TAGS = "cluster_tags"
1665
SS_FILE_STORAGE_DIR = "file_storage_dir"
1666
SS_SHARED_FILE_STORAGE_DIR = "shared_file_storage_dir"
1667
SS_MASTER_CANDIDATES = "master_candidates"
1668
SS_MASTER_CANDIDATES_IPS = "master_candidates_ips"
1669
SS_MASTER_IP = "master_ip"
1670
SS_MASTER_NETDEV = "master_netdev"
1671
SS_MASTER_NETMASK = "master_netmask"
1672
SS_MASTER_NODE = "master_node"
1673
SS_NODE_LIST = "node_list"
1674
SS_NODE_PRIMARY_IPS = "node_primary_ips"
1675
SS_NODE_SECONDARY_IPS = "node_secondary_ips"
1676
SS_OFFLINE_NODES = "offline_nodes"
1677
SS_ONLINE_NODES = "online_nodes"
1678
SS_PRIMARY_IP_FAMILY = "primary_ip_family"
1679
SS_INSTANCE_LIST = "instance_list"
1680
SS_RELEASE_VERSION = "release_version"
1681
SS_HYPERVISOR_LIST = "hypervisor_list"
1682
SS_MAINTAIN_NODE_HEALTH = "maintain_node_health"
1683
SS_UID_POOL = "uid_pool"
1684
SS_NODEGROUPS = "nodegroups"
1685

    
1686
SS_FILE_PERMS = 0444
1687

    
1688
# cluster wide default parameters
1689
DEFAULT_ENABLED_HYPERVISOR = HT_XEN_PVM
1690

    
1691
HVC_DEFAULTS = {
1692
  HT_XEN_PVM: {
1693
    HV_USE_BOOTLOADER: False,
1694
    HV_BOOTLOADER_PATH: XEN_BOOTLOADER,
1695
    HV_BOOTLOADER_ARGS: "",
1696
    HV_KERNEL_PATH: XEN_KERNEL,
1697
    HV_INITRD_PATH: "",
1698
    HV_ROOT_PATH: "/dev/sda1",
1699
    HV_KERNEL_ARGS: "ro",
1700
    HV_MIGRATION_PORT: 8002,
1701
    HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1702
    HV_BLOCKDEV_PREFIX: "sd",
1703
    HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1704
    HV_CPU_MASK: CPU_PINNING_ALL,
1705
    },
1706
  HT_XEN_HVM: {
1707
    HV_BOOT_ORDER: "cd",
1708
    HV_CDROM_IMAGE_PATH: "",
1709
    HV_NIC_TYPE: HT_NIC_RTL8139,
1710
    HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
1711
    HV_VNC_BIND_ADDRESS: IP4_ADDRESS_ANY,
1712
    HV_VNC_PASSWORD_FILE: pathutils.VNC_PASSWORD_FILE,
1713
    HV_ACPI: True,
1714
    HV_PAE: True,
1715
    HV_KERNEL_PATH: "/usr/lib/xen/boot/hvmloader",
1716
    HV_DEVICE_MODEL: "/usr/lib/xen/bin/qemu-dm",
1717
    HV_MIGRATION_PORT: 8002,
1718
    HV_MIGRATION_MODE: HT_MIGRATION_NONLIVE,
1719
    HV_USE_LOCALTIME: False,
1720
    HV_BLOCKDEV_PREFIX: "hd",
1721
    HV_PASSTHROUGH: "",
1722
    HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1723
    HV_CPU_MASK: CPU_PINNING_ALL,
1724
    },
1725
  HT_KVM: {
1726
    HV_KERNEL_PATH: KVM_KERNEL,
1727
    HV_INITRD_PATH: "",
1728
    HV_KERNEL_ARGS: "ro",
1729
    HV_ROOT_PATH: "/dev/vda1",
1730
    HV_ACPI: True,
1731
    HV_SERIAL_CONSOLE: True,
1732
    HV_VNC_BIND_ADDRESS: "",
1733
    HV_VNC_TLS: False,
1734
    HV_VNC_X509: "",
1735
    HV_VNC_X509_VERIFY: False,
1736
    HV_VNC_PASSWORD_FILE: "",
1737
    HV_KVM_SPICE_BIND: "",
1738
    HV_KVM_SPICE_IP_VERSION: IFACE_NO_IP_VERSION_SPECIFIED,
1739
    HV_KVM_SPICE_PASSWORD_FILE: "",
1740
    HV_KVM_SPICE_LOSSLESS_IMG_COMPR: "",
1741
    HV_KVM_SPICE_JPEG_IMG_COMPR: "",
1742
    HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR: "",
1743
    HV_KVM_SPICE_STREAMING_VIDEO_DETECTION: "",
1744
    HV_KVM_SPICE_AUDIO_COMPR: True,
1745
    HV_KVM_SPICE_USE_TLS: False,
1746
    HV_KVM_SPICE_TLS_CIPHERS: OPENSSL_CIPHERS,
1747
    HV_KVM_SPICE_USE_VDAGENT: True,
1748
    HV_KVM_FLOPPY_IMAGE_PATH: "",
1749
    HV_CDROM_IMAGE_PATH: "",
1750
    HV_KVM_CDROM2_IMAGE_PATH: "",
1751
    HV_BOOT_ORDER: HT_BO_DISK,
1752
    HV_NIC_TYPE: HT_NIC_PARAVIRTUAL,
1753
    HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
1754
    HV_KVM_CDROM_DISK_TYPE: "",
1755
    HV_USB_MOUSE: "",
1756
    HV_KEYMAP: "",
1757
    HV_MIGRATION_PORT: 8102,
1758
    HV_MIGRATION_BANDWIDTH: 32, # MiB/s
1759
    HV_MIGRATION_DOWNTIME: 30,  # ms
1760
    HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1761
    HV_USE_LOCALTIME: False,
1762
    HV_DISK_CACHE: HT_CACHE_DEFAULT,
1763
    HV_SECURITY_MODEL: HT_SM_NONE,
1764
    HV_SECURITY_DOMAIN: "",
1765
    HV_KVM_FLAG: "",
1766
    HV_VHOST_NET: False,
1767
    HV_KVM_USE_CHROOT: False,
1768
    HV_MEM_PATH: "",
1769
    HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1770
    HV_CPU_MASK: CPU_PINNING_ALL,
1771
    HV_CPU_TYPE: "",
1772
    },
1773
  HT_FAKE: {},
1774
  HT_CHROOT: {
1775
    HV_INIT_SCRIPT: "/ganeti-chroot",
1776
    },
1777
  HT_LXC: {
1778
    HV_CPU_MASK: "",
1779
    },
1780
  }
1781

    
1782
HVC_GLOBALS = frozenset([
1783
  HV_MIGRATION_PORT,
1784
  HV_MIGRATION_BANDWIDTH,
1785
  HV_MIGRATION_MODE,
1786
  ])
1787

    
1788
BEC_DEFAULTS = {
1789
  BE_MINMEM: 128,
1790
  BE_MAXMEM: 128,
1791
  BE_VCPUS: 1,
1792
  BE_AUTO_BALANCE: True,
1793
  BE_ALWAYS_FAILOVER: False,
1794
  BE_SPINDLE_USE: 1,
1795
  }
1796

    
1797
NDC_DEFAULTS = {
1798
  ND_OOB_PROGRAM: "",
1799
  ND_SPINDLE_COUNT: 1,
1800
  }
1801

    
1802
DISK_LD_DEFAULTS = {
1803
  LD_DRBD8: {
1804
    LDP_RESYNC_RATE: CLASSIC_DRBD_SYNC_SPEED,
1805
    LDP_BARRIERS: _autoconf.DRBD_BARRIERS,
1806
    LDP_NO_META_FLUSH: _autoconf.DRBD_NO_META_FLUSH,
1807
    LDP_DEFAULT_METAVG: DEFAULT_VG,
1808
    LDP_DISK_CUSTOM: "",
1809
    LDP_NET_CUSTOM: "",
1810
    LDP_DYNAMIC_RESYNC: False,
1811

    
1812
    # The default values for the DRBD dynamic resync speed algorithm are taken
1813
    # from the drbsetup 8.3.11 man page, except for c-plan-ahead (that we
1814
    # don't need to set to 0, because we have a separate option to enable it)
1815
    # and for c-max-rate, that we cap to the default value for the static resync
1816
    # rate.
1817
    LDP_PLAN_AHEAD: 20, # ds
1818
    LDP_FILL_TARGET: 0, # sectors
1819
    LDP_DELAY_TARGET: 1, # ds
1820
    LDP_MAX_RATE: CLASSIC_DRBD_SYNC_SPEED, # KiB/s
1821
    LDP_MIN_RATE: 4 * 1024, # KiB/s
1822
    },
1823
  LD_LV: {
1824
    LDP_STRIPES: _autoconf.LVM_STRIPECOUNT
1825
    },
1826
  LD_FILE: {},
1827
  LD_BLOCKDEV: {},
1828
  LD_RBD: {
1829
    LDP_POOL: "rbd"
1830
    },
1831
  }
1832

    
1833
# readability shortcuts
1834
_LV_DEFAULTS = DISK_LD_DEFAULTS[LD_LV]
1835
_DRBD_DEFAULTS = DISK_LD_DEFAULTS[LD_DRBD8]
1836

    
1837
DISK_DT_DEFAULTS = {
1838
  DT_PLAIN: {
1839
    LV_STRIPES: DISK_LD_DEFAULTS[LD_LV][LDP_STRIPES],
1840
    },
1841
  DT_DRBD8: {
1842
    DRBD_RESYNC_RATE: _DRBD_DEFAULTS[LDP_RESYNC_RATE],
1843
    DRBD_DATA_STRIPES: _LV_DEFAULTS[LDP_STRIPES],
1844
    DRBD_META_STRIPES: _LV_DEFAULTS[LDP_STRIPES],
1845
    DRBD_DISK_BARRIERS: _DRBD_DEFAULTS[LDP_BARRIERS],
1846
    DRBD_META_BARRIERS: _DRBD_DEFAULTS[LDP_NO_META_FLUSH],
1847
    DRBD_DEFAULT_METAVG: _DRBD_DEFAULTS[LDP_DEFAULT_METAVG],
1848
    DRBD_DISK_CUSTOM: _DRBD_DEFAULTS[LDP_DISK_CUSTOM],
1849
    DRBD_NET_CUSTOM: _DRBD_DEFAULTS[LDP_NET_CUSTOM],
1850
    DRBD_DYNAMIC_RESYNC: _DRBD_DEFAULTS[LDP_DYNAMIC_RESYNC],
1851
    DRBD_PLAN_AHEAD: _DRBD_DEFAULTS[LDP_PLAN_AHEAD],
1852
    DRBD_FILL_TARGET: _DRBD_DEFAULTS[LDP_FILL_TARGET],
1853
    DRBD_DELAY_TARGET: _DRBD_DEFAULTS[LDP_DELAY_TARGET],
1854
    DRBD_MAX_RATE: _DRBD_DEFAULTS[LDP_MAX_RATE],
1855
    DRBD_MIN_RATE: _DRBD_DEFAULTS[LDP_MIN_RATE],
1856
    },
1857
  DT_DISKLESS: {},
1858
  DT_FILE: {},
1859
  DT_SHARED_FILE: {},
1860
  DT_BLOCK: {},
1861
  DT_RBD: {
1862
    RBD_POOL: DISK_LD_DEFAULTS[LD_RBD][LDP_POOL]
1863
    },
1864
  }
1865

    
1866
# we don't want to export the shortcuts
1867
del _LV_DEFAULTS, _DRBD_DEFAULTS
1868

    
1869
NICC_DEFAULTS = {
1870
  NIC_MODE: NIC_MODE_BRIDGED,
1871
  NIC_LINK: DEFAULT_BRIDGE,
1872
  }
1873

    
1874
# All of the following values are quite arbitrarily - there are no
1875
# "good" defaults, these must be customised per-site
1876
IPOLICY_DEFAULTS = {
1877
  ISPECS_MIN: {
1878
    ISPEC_MEM_SIZE: 128,
1879
    ISPEC_CPU_COUNT: 1,
1880
    ISPEC_DISK_COUNT: 1,
1881
    ISPEC_DISK_SIZE: 1024,
1882
    ISPEC_NIC_COUNT: 1,
1883
    ISPEC_SPINDLE_USE: 1,
1884
    },
1885
  ISPECS_MAX: {
1886
    ISPEC_MEM_SIZE: 32768,
1887
    ISPEC_CPU_COUNT: 8,
1888
    ISPEC_DISK_COUNT: MAX_DISKS,
1889
    ISPEC_DISK_SIZE: 1024 * 1024,
1890
    ISPEC_NIC_COUNT: MAX_NICS,
1891
    ISPEC_SPINDLE_USE: 12,
1892
    },
1893
  ISPECS_STD: {
1894
    ISPEC_MEM_SIZE: 128,
1895
    ISPEC_CPU_COUNT: 1,
1896
    ISPEC_DISK_COUNT: 1,
1897
    ISPEC_DISK_SIZE: 1024,
1898
    ISPEC_NIC_COUNT: 1,
1899
    ISPEC_SPINDLE_USE: 1,
1900
    },
1901
  IPOLICY_DTS: DISK_TEMPLATES,
1902
  IPOLICY_VCPU_RATIO: 4.0,
1903
  IPOLICY_SPINDLE_RATIO: 32.0,
1904
  }
1905

    
1906
MASTER_POOL_SIZE_DEFAULT = 10
1907

    
1908
CONFD_PROTOCOL_VERSION = 1
1909

    
1910
CONFD_REQ_PING = 0
1911
CONFD_REQ_NODE_ROLE_BYNAME = 1
1912
CONFD_REQ_NODE_PIP_BY_INSTANCE_IP = 2
1913
CONFD_REQ_CLUSTER_MASTER = 3
1914
CONFD_REQ_NODE_PIP_LIST = 4
1915
CONFD_REQ_MC_PIP_LIST = 5
1916
CONFD_REQ_INSTANCES_IPS_LIST = 6
1917
CONFD_REQ_NODE_DRBD = 7
1918

    
1919
# Confd request query fields. These are used to narrow down queries.
1920
# These must be strings rather than integers, because json-encoding
1921
# converts them to strings anyway, as they're used as dict-keys.
1922
CONFD_REQQ_LINK = "0"
1923
CONFD_REQQ_IP = "1"
1924
CONFD_REQQ_IPLIST = "2"
1925
CONFD_REQQ_FIELDS = "3"
1926

    
1927
CONFD_REQFIELD_NAME = "0"
1928
CONFD_REQFIELD_IP = "1"
1929
CONFD_REQFIELD_MNODE_PIP = "2"
1930

    
1931
CONFD_REQS = frozenset([
1932
  CONFD_REQ_PING,
1933
  CONFD_REQ_NODE_ROLE_BYNAME,
1934
  CONFD_REQ_NODE_PIP_BY_INSTANCE_IP,
1935
  CONFD_REQ_CLUSTER_MASTER,
1936
  CONFD_REQ_NODE_PIP_LIST,
1937
  CONFD_REQ_MC_PIP_LIST,
1938
  CONFD_REQ_INSTANCES_IPS_LIST,
1939
  CONFD_REQ_NODE_DRBD,
1940
  ])
1941

    
1942
CONFD_REPL_STATUS_OK = 0
1943
CONFD_REPL_STATUS_ERROR = 1
1944
CONFD_REPL_STATUS_NOTIMPLEMENTED = 2
1945

    
1946
CONFD_REPL_STATUSES = frozenset([
1947
  CONFD_REPL_STATUS_OK,
1948
  CONFD_REPL_STATUS_ERROR,
1949
  CONFD_REPL_STATUS_NOTIMPLEMENTED,
1950
  ])
1951

    
1952
(CONFD_NODE_ROLE_MASTER,
1953
 CONFD_NODE_ROLE_CANDIDATE,
1954
 CONFD_NODE_ROLE_OFFLINE,
1955
 CONFD_NODE_ROLE_DRAINED,
1956
 CONFD_NODE_ROLE_REGULAR,
1957
 ) = range(5)
1958

    
1959
# A few common errors for confd
1960
CONFD_ERROR_UNKNOWN_ENTRY = 1
1961
CONFD_ERROR_INTERNAL = 2
1962
CONFD_ERROR_ARGUMENT = 3
1963

    
1964
# Each request is "salted" by the current timestamp.
1965
# This constants decides how many seconds of skew to accept.
1966
# TODO: make this a default and allow the value to be more configurable
1967
CONFD_MAX_CLOCK_SKEW = 2 * NODE_MAX_CLOCK_SKEW
1968

    
1969
# When we haven't reloaded the config for more than this amount of seconds, we
1970
# force a test to see if inotify is betraying us.
1971
CONFD_CONFIG_RELOAD_TIMEOUT = 60
1972

    
1973
# If we receive more than one update in this amount of seconds, we move to
1974
# polling every RATELIMIT seconds, rather than relying on inotify, to be able
1975
# to serve more requests.
1976
CONFD_CONFIG_RELOAD_RATELIMIT = 2
1977

    
1978
# Magic number prepended to all confd queries.
1979
# This allows us to distinguish different types of confd protocols and handle
1980
# them. For example by changing this we can move the whole payload to be
1981
# compressed, or move away from json.
1982
CONFD_MAGIC_FOURCC = "plj0"
1983

    
1984
# By default a confd request is sent to the minimum between this number and all
1985
# MCs. 6 was chosen because even in the case of a disastrous 50% response rate,
1986
# we should have enough answers to be able to compare more than one.
1987
CONFD_DEFAULT_REQ_COVERAGE = 6
1988

    
1989
# Timeout in seconds to expire pending query request in the confd client
1990
# library. We don't actually expect any answer more than 10 seconds after we
1991
# sent a request.
1992
CONFD_CLIENT_EXPIRE_TIMEOUT = 10
1993

    
1994
# Maximum UDP datagram size.
1995
# On IPv4: 64K - 20 (ip header size) - 8 (udp header size) = 65507
1996
# On IPv6: 64K - 40 (ip6 header size) - 8 (udp header size) = 65487
1997
#   (assuming we can't use jumbo frames)
1998
# We just set this to 60K, which should be enough
1999
MAX_UDP_DATA_SIZE = 61440
2000

    
2001
# User-id pool minimum/maximum acceptable user-ids.
2002
UIDPOOL_UID_MIN = 0
2003
UIDPOOL_UID_MAX = 2 ** 32 - 1 # Assuming 32 bit user-ids
2004

    
2005
# Name or path of the pgrep command
2006
PGREP = "pgrep"
2007

    
2008
# Name of the node group that gets created at cluster init or upgrade
2009
INITIAL_NODE_GROUP_NAME = "default"
2010

    
2011
# Possible values for NodeGroup.alloc_policy
2012
ALLOC_POLICY_PREFERRED = "preferred"
2013
ALLOC_POLICY_LAST_RESORT = "last_resort"
2014
ALLOC_POLICY_UNALLOCABLE = "unallocable"
2015
VALID_ALLOC_POLICIES = [
2016
  ALLOC_POLICY_PREFERRED,
2017
  ALLOC_POLICY_LAST_RESORT,
2018
  ALLOC_POLICY_UNALLOCABLE,
2019
  ]
2020

    
2021
# Temporary external/shared storage parameters
2022
BLOCKDEV_DRIVER_MANUAL = "manual"
2023

    
2024
# qemu-img path, required for ovfconverter
2025
QEMUIMG_PATH = _autoconf.QEMUIMG_PATH
2026

    
2027
# Whether htools was enabled at compilation time
2028
HTOOLS = _autoconf.HTOOLS
2029
# The hail iallocator
2030
IALLOC_HAIL = "hail"
2031

    
2032
# Fake opcodes for functions that have hooks attached to them via
2033
# backend.RunLocalHooks
2034
FAKE_OP_MASTER_TURNUP = "OP_CLUSTER_IP_TURNUP"
2035
FAKE_OP_MASTER_TURNDOWN = "OP_CLUSTER_IP_TURNDOWN"
2036

    
2037
# Do not re-export imported modules
2038
del re, _vcsversion, _autoconf, socket, pathutils