Statistics
| Branch: | Tag: | Revision:

root / lib / constants.py @ 2f20d07b

History | View | Annotate | Download (28.5 kB)

1
#
2
#
3

    
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010 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

    
28
# various versions
29
PROTOCOL_VERSION = 40
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 = _autoconf.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
# user separation
88
DAEMONS_GROUP = _autoconf.DAEMONS_GROUP
89
MASTERD_USER = _autoconf.MASTERD_USER
90
RAPI_USER = _autoconf.RAPI_USER
91

    
92
# file paths
93
DATA_DIR = _autoconf.LOCALSTATEDIR + "/lib/ganeti"
94
RUN_DIR = _autoconf.LOCALSTATEDIR + "/run"
95
RUN_GANETI_DIR = RUN_DIR + "/ganeti"
96
BDEV_CACHE_DIR = RUN_GANETI_DIR + "/bdev-cache"
97
DISK_LINKS_DIR = RUN_GANETI_DIR + "/instance-disks"
98
RUN_DIRS_MODE = 0775
99
SOCKET_DIR = RUN_GANETI_DIR + "/socket"
100
SECURE_DIR_MODE = 0700
101
SECURE_FILE_MODE = 0600
102
SOCKET_DIR_MODE = 0750
103
CRYPTO_KEYS_DIR = RUN_GANETI_DIR + "/crypto"
104
CRYPTO_KEYS_DIR_MODE = SECURE_DIR_MODE
105
IMPORT_EXPORT_DIR = RUN_GANETI_DIR + "/import-export"
106
IMPORT_EXPORT_DIR_MODE = 0755
107
# keep RUN_GANETI_DIR first here, to make sure all get created when the node
108
# daemon is started (this takes care of RUN_DIR being tmpfs)
109
SUB_RUN_DIRS = [ RUN_GANETI_DIR, BDEV_CACHE_DIR, DISK_LINKS_DIR ]
110
LOCK_DIR = _autoconf.LOCALSTATEDIR + "/lock"
111
SSCONF_LOCK_FILE = LOCK_DIR + "/ganeti-ssconf.lock"
112
# User-id pool lock directory
113
# The user-ids that are in use have a corresponding lock file in this directory
114
UIDPOOL_LOCKDIR = RUN_GANETI_DIR + "/uid-pool"
115
CLUSTER_CONF_FILE = DATA_DIR + "/config.data"
116
NODED_CERT_FILE = DATA_DIR + "/server.pem"
117
RAPI_CERT_FILE = DATA_DIR + "/rapi.pem"
118
CONFD_HMAC_KEY = DATA_DIR + "/hmac.key"
119
CLUSTER_DOMAIN_SECRET_FILE = DATA_DIR + "/cluster-domain-secret"
120
WATCHER_STATEFILE = DATA_DIR + "/watcher.data"
121
WATCHER_PAUSEFILE = DATA_DIR + "/watcher.pause"
122
INSTANCE_UPFILE = RUN_GANETI_DIR + "/instance-status"
123
SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts"
124
RAPI_USERS_FILE = DATA_DIR + "/rapi_users"
125
QUEUE_DIR = DATA_DIR + "/queue"
126
DAEMON_UTIL = _autoconf.PKGLIBDIR + "/daemon-util"
127
ETC_HOSTS = "/etc/hosts"
128
DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR
129
ENABLE_FILE_STORAGE = _autoconf.ENABLE_FILE_STORAGE
130
SYSCONFDIR = _autoconf.SYSCONFDIR
131
TOOLSDIR = _autoconf.TOOLSDIR
132
CONF_DIR = SYSCONFDIR + "/ganeti"
133

    
134
ALL_CERT_FILES = frozenset([NODED_CERT_FILE, RAPI_CERT_FILE])
135

    
136
MASTER_SOCKET = SOCKET_DIR + "/ganeti-master"
137

    
138
NODED = "ganeti-noded"
139
CONFD = "ganeti-confd"
140
RAPI = "ganeti-rapi"
141
MASTERD = "ganeti-masterd"
142
# used in the ganeti-nbma project
143
NLD = "ganeti-nld"
144

    
145
DAEMONS_PORTS = {
146
  # daemon-name: ("proto", "default-port")
147
  NODED: ("tcp", 1811),
148
  CONFD: ("udp", 1814),
149
  RAPI: ("tcp", 5080),
150
  "ssh": ("tcp", 22),
151
  # used in the ganeti-nbma project
152
  NLD: ("udp", 1816),
153
}
154
DEFAULT_NODED_PORT = DAEMONS_PORTS[NODED][1]
155
DEFAULT_CONFD_PORT = DAEMONS_PORTS[CONFD][1]
156
DEFAULT_RAPI_PORT = DAEMONS_PORTS[RAPI][1]
157
# used in the ganeti-nbma project
158
DEFAULT_NLD_PORT = DAEMONS_PORTS[NLD][1]
159

    
160
FIRST_DRBD_PORT = 11000
161
LAST_DRBD_PORT = 14999
162
MASTER_SCRIPT = "ganeti-master"
163

    
164
LOG_DIR = _autoconf.LOCALSTATEDIR + "/log/ganeti/"
165
DAEMONS_LOGFILES = {
166
  # "daemon-name": "logfile"
167
  NODED: LOG_DIR + "node-daemon.log",
168
  CONFD: LOG_DIR + "conf-daemon.log",
169
  RAPI: LOG_DIR + "rapi-daemon.log",
170
  MASTERD: LOG_DIR + "master-daemon.log",
171
  # used in the ganeti-nbma project
172
  NLD: LOG_DIR + "nl-daemon.log",
173
  }
174

    
175
LOG_OS_DIR = LOG_DIR + "os"
176
LOG_WATCHER = LOG_DIR + "watcher.log"
177
LOG_COMMANDS = LOG_DIR + "commands.log"
178
LOG_BURNIN = LOG_DIR + "burnin.log"
179
LOG_SETUP_SSH = LOG_DIR + "setup-ssh.log"
180

    
181
DEV_CONSOLE = "/dev/console"
182

    
183
PROC_MOUNTS = "/proc/mounts"
184

    
185
# luxi related constants
186
LUXI_EOM = "\3"
187

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

    
195
OS_SEARCH_PATH = _autoconf.OS_SEARCH_PATH
196
EXPORT_DIR = _autoconf.EXPORT_DIR
197

    
198
EXPORT_CONF_FILE = "config.ini"
199

    
200
XEN_BOOTLOADER = _autoconf.XEN_BOOTLOADER
201
XEN_KERNEL = _autoconf.XEN_KERNEL
202
XEN_INITRD = _autoconf.XEN_INITRD
203

    
204
KVM_PATH = _autoconf.KVM_PATH
205
SOCAT_PATH = _autoconf.SOCAT_PATH
206
SOCAT_USE_ESCAPE = _autoconf.SOCAT_USE_ESCAPE
207
SOCAT_ESCAPE_CODE = "0x1d"
208

    
209
# For RSA keys more bits are better, but they also make operations more
210
# expensive. NIST SP 800-131 recommends a minimum of 2048 bits from the year
211
# 2010 on.
212
RSA_KEY_BITS = 2048
213

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

    
222
# Digest used to sign certificates ("openssl x509" uses SHA1 by default)
223
X509_CERT_SIGN_DIGEST = "SHA1"
224

    
225
# Default validity of certificates in days
226
X509_CERT_DEFAULT_VALIDITY = 365 * 5
227

    
228
# commonName (CN) used in certificates
229
X509_CERT_CN = "ganeti.example.com"
230

    
231
X509_CERT_SIGNATURE_HEADER = "X-Ganeti-Signature"
232

    
233
IMPORT_EXPORT_DAEMON = _autoconf.PKGLIBDIR + "/import-export"
234

    
235
# Import/export daemon mode
236
IEM_IMPORT = "import"
237
IEM_EXPORT = "export"
238

    
239
# Import/export transport compression
240
IEC_NONE = "none"
241
IEC_GZIP = "gzip"
242
IEC_ALL = frozenset([
243
  IEC_NONE,
244
  IEC_GZIP,
245
  ])
246

    
247
IE_CUSTOM_SIZE = "fd"
248

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

    
251
# Import/export I/O
252
# Direct file I/O, equivalent to a shell's I/O redirection using '<' or '>'
253
IEIO_FILE = "file"
254
# Raw block device I/O using "dd"
255
IEIO_RAW_DISK = "raw"
256
# OS definition import/export script
257
IEIO_SCRIPT = "script"
258

    
259
VALUE_DEFAULT = "default"
260
VALUE_AUTO = "auto"
261
VALUE_GENERATE = "generate"
262
VALUE_NONE = "none"
263
VALUE_TRUE = "true"
264
VALUE_FALSE = "false"
265

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

    
269
# hooks-related constants
270
HOOKS_BASE_DIR = CONF_DIR + "/hooks"
271
HOOKS_PHASE_PRE = "pre"
272
HOOKS_PHASE_POST = "post"
273
HOOKS_NAME_CFGUPDATE = "config-update"
274
HOOKS_NAME_WATCHER = "watcher"
275
HOOKS_VERSION = 2
276

    
277
# hooks subject type (what object type does the LU deal with)
278
HTYPE_CLUSTER = "CLUSTER"
279
HTYPE_NODE = "NODE"
280
HTYPE_INSTANCE = "INSTANCE"
281

    
282
HKR_SKIP = 0
283
HKR_FAIL = 1
284
HKR_SUCCESS = 2
285

    
286
# Storage types
287
ST_FILE = "file"
288
ST_LVM_PV = "lvm-pv"
289
ST_LVM_VG = "lvm-vg"
290

    
291
# Storage fields
292
# first two are valid in LU context only, not passed to backend
293
SF_NODE = "node"
294
SF_TYPE = "type"
295
# and the rest are valid in backend
296
SF_NAME = "name"
297
SF_SIZE = "size"
298
SF_FREE = "free"
299
SF_USED = "used"
300
SF_ALLOCATABLE = "allocatable"
301

    
302
# Storage operations
303
SO_FIX_CONSISTENCY = "fix-consistency"
304

    
305
# Available fields per storage type
306
VALID_STORAGE_FIELDS = frozenset([SF_NAME, SF_TYPE, SF_SIZE,
307
                                  SF_USED, SF_FREE, SF_ALLOCATABLE])
308

    
309
VALID_STORAGE_TYPES = frozenset([ST_FILE, ST_LVM_PV, ST_LVM_VG])
310

    
311
MODIFIABLE_STORAGE_FIELDS = {
312
  ST_LVM_PV: frozenset([SF_ALLOCATABLE]),
313
  }
314

    
315
VALID_STORAGE_OPERATIONS = {
316
  ST_LVM_VG: frozenset([SO_FIX_CONSISTENCY]),
317
  }
318

    
319
# Local disk status
320
# Note: Code depends on LDS_OKAY < LDS_UNKNOWN < LDS_FAULTY
321
(LDS_OKAY,
322
 LDS_UNKNOWN,
323
 LDS_FAULTY) = range(1, 4)
324

    
325
# disk template types
326
DT_DISKLESS = "diskless"
327
DT_PLAIN = "plain"
328
DT_DRBD8 = "drbd"
329
DT_FILE = "file"
330

    
331
# the set of network-mirrored disk templates
332
DTS_NET_MIRROR = frozenset([DT_DRBD8])
333

    
334
# the set of non-lvm-based disk templates
335
DTS_NOT_LVM = frozenset([DT_DISKLESS, DT_FILE])
336

    
337
# the set of disk templates which can be grown
338
DTS_GROWABLE = frozenset([DT_PLAIN, DT_DRBD8, DT_FILE])
339

    
340
# the set of disk templates that allow adoption
341
DTS_MAY_ADOPT = frozenset([DT_PLAIN])
342

    
343
# logical disk types
344
LD_LV = "lvm"
345
LD_DRBD8 = "drbd8"
346
LD_FILE = "file"
347
LDS_BLOCK = frozenset([LD_LV, LD_DRBD8])
348

    
349
# drbd constants
350
DRBD_HMAC_ALG = "md5"
351
DRBD_NET_PROTOCOL = "C"
352
DRBD_BARRIERS = _autoconf.DRBD_BARRIERS
353

    
354
# file backend driver
355
FD_LOOP = "loop"
356
FD_BLKTAP = "blktap"
357

    
358
# the set of drbd-like disk types
359
LDS_DRBD = frozenset([LD_DRBD8])
360

    
361
# disk access mode
362
DISK_RDONLY = "ro"
363
DISK_RDWR = "rw"
364
DISK_ACCESS_SET = frozenset([DISK_RDONLY, DISK_RDWR])
365

    
366
# disk replacement mode
367
REPLACE_DISK_PRI = "replace_on_primary"    # replace disks on primary
368
REPLACE_DISK_SEC = "replace_on_secondary"  # replace disks on secondary
369
REPLACE_DISK_CHG = "replace_new_secondary" # change secondary node
370
REPLACE_DISK_AUTO = "replace_auto"
371
REPLACE_MODES = frozenset([
372
  REPLACE_DISK_PRI,
373
  REPLACE_DISK_SEC,
374
  REPLACE_DISK_CHG,
375
  REPLACE_DISK_AUTO,
376
  ])
377

    
378
# Instance export mode
379
EXPORT_MODE_LOCAL = "local"
380
EXPORT_MODE_REMOTE = "remote"
381
EXPORT_MODES = frozenset([
382
  EXPORT_MODE_LOCAL,
383
  EXPORT_MODE_REMOTE,
384
  ])
385

    
386
# lock recalculate mode
387
LOCKS_REPLACE = 'replace'
388
LOCKS_APPEND = 'append'
389

    
390
# instance creation modes
391
INSTANCE_CREATE = "create"
392
INSTANCE_IMPORT = "import"
393
INSTANCE_REMOTE_IMPORT = "remote-import"
394
INSTANCE_CREATE_MODES = frozenset([
395
  INSTANCE_CREATE,
396
  INSTANCE_IMPORT,
397
  INSTANCE_REMOTE_IMPORT,
398
  ])
399

    
400
# Remote import/export handshake message and version
401
RIE_VERSION = 0
402
RIE_HANDSHAKE = "Hi, I'm Ganeti"
403

    
404
# Remote import/export certificate validity in seconds
405
RIE_CERT_VALIDITY = 24 * 60 * 60
406

    
407
# Remote import/export connect timeout for socat
408
RIE_CONNECT_TIMEOUT = 60
409

    
410
DISK_TEMPLATES = frozenset([DT_DISKLESS, DT_PLAIN,
411
                            DT_DRBD8, DT_FILE])
412

    
413
FILE_DRIVER = frozenset([FD_LOOP, FD_BLKTAP])
414

    
415
# import/export config options
416
INISECT_EXP = "export"
417
INISECT_INS = "instance"
418
INISECT_HYP = "hypervisor"
419
INISECT_BEP = "backend"
420
INISECT_OSP = "os"
421

    
422
# dynamic device modification
423
DDM_ADD = 'add'
424
DDM_REMOVE = 'remove'
425

    
426
# common exit codes
427
EXIT_SUCCESS = 0
428
EXIT_FAILURE = 1
429
EXIT_NOTCLUSTER = 5
430
EXIT_NOTMASTER = 11
431
EXIT_NODESETUP_ERROR = 12
432
EXIT_CONFIRMATION = 13 # need user confirmation
433

    
434
# tags
435
TAG_CLUSTER = "cluster"
436
TAG_NODE = "node"
437
TAG_INSTANCE = "instance"
438
VALID_TAG_TYPES = frozenset([
439
  TAG_CLUSTER,
440
  TAG_NODE,
441
  TAG_INSTANCE,
442
  ])
443
MAX_TAG_LEN = 128
444
MAX_TAGS_PER_OBJ = 4096
445

    
446
# others
447
DEFAULT_BRIDGE = "xen-br0"
448
SYNC_SPEED = 60 * 1024
449
IP4_ADDRESS_LOCALHOST = "127.0.0.1"
450
IP4_ADDRESS_ANY = "0.0.0.0"
451
IP6_ADDRESS_LOCALHOST = "::1"
452
IP6_ADDRESS_ANY = "::"
453
IP4_VERSION = 4
454
IP6_VERSION = 6
455
TCP_PING_TIMEOUT = 10
456
GANETI_RUNAS = "root"
457
DEFAULT_VG = "xenvg"
458
DEFAULT_DRBD_HELPER = "/bin/true"
459
MIN_VG_SIZE = 20480
460
DEFAULT_MAC_PREFIX = "aa:00:00"
461
LVM_STRIPECOUNT = _autoconf.LVM_STRIPECOUNT
462
# default maximum instance wait time, in seconds.
463
DEFAULT_SHUTDOWN_TIMEOUT = 120
464
NODE_MAX_CLOCK_SKEW = 150
465
# Time for an intra-cluster disk transfer to wait for a connection
466
DISK_TRANSFER_CONNECT_TIMEOUT = 30
467

    
468
# runparts results
469
(RUNPARTS_SKIP,
470
 RUNPARTS_RUN,
471
 RUNPARTS_ERR) = range(3)
472

    
473
RUNPARTS_STATUS = frozenset([RUNPARTS_SKIP, RUNPARTS_RUN, RUNPARTS_ERR])
474

    
475
# RPC constants
476
(RPC_ENCODING_NONE,
477
 RPC_ENCODING_ZLIB_BASE64) = range(2)
478

    
479
# os related constants
480
OS_SCRIPT_CREATE = 'create'
481
OS_SCRIPT_IMPORT = 'import'
482
OS_SCRIPT_EXPORT = 'export'
483
OS_SCRIPT_RENAME = 'rename'
484
OS_SCRIPT_VERIFY = 'verify'
485
OS_SCRIPTS = frozenset([OS_SCRIPT_CREATE, OS_SCRIPT_IMPORT,
486
                        OS_SCRIPT_EXPORT, OS_SCRIPT_RENAME,
487
                        OS_SCRIPT_VERIFY])
488

    
489
OS_API_FILE = 'ganeti_api_version'
490
OS_VARIANTS_FILE = 'variants.list'
491
OS_PARAMETERS_FILE = 'parameters.list'
492

    
493
OS_VALIDATE_PARAMETERS = 'parameters'
494
OS_VALIDATE_CALLS = frozenset([OS_VALIDATE_PARAMETERS])
495

    
496
# ssh constants
497
SSH_CONFIG_DIR = _autoconf.SSH_CONFIG_DIR
498
SSH_HOST_DSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_dsa_key"
499
SSH_HOST_DSA_PUB = SSH_HOST_DSA_PRIV + ".pub"
500
SSH_HOST_RSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_rsa_key"
501
SSH_HOST_RSA_PUB = SSH_HOST_RSA_PRIV + ".pub"
502
SSH = "ssh"
503
SCP = "scp"
504

    
505
# reboot types
506
INSTANCE_REBOOT_SOFT = "soft"
507
INSTANCE_REBOOT_HARD = "hard"
508
INSTANCE_REBOOT_FULL = "full"
509

    
510
REBOOT_TYPES = frozenset([INSTANCE_REBOOT_SOFT,
511
                          INSTANCE_REBOOT_HARD,
512
                          INSTANCE_REBOOT_FULL])
513

    
514
VTYPE_STRING = 'string'
515
VTYPE_MAYBE_STRING = "maybe-string"
516
VTYPE_BOOL = 'bool'
517
VTYPE_SIZE = 'size' # size, in MiBs
518
VTYPE_INT = 'int'
519
ENFORCEABLE_TYPES = frozenset([
520
                      VTYPE_STRING,
521
                      VTYPE_MAYBE_STRING,
522
                      VTYPE_BOOL,
523
                      VTYPE_SIZE,
524
                      VTYPE_INT,
525
                      ])
526

    
527
# HV parameter names (global namespace)
528
HV_BOOT_ORDER = "boot_order"
529
HV_CDROM_IMAGE_PATH = "cdrom_image_path"
530
HV_NIC_TYPE = "nic_type"
531
HV_DISK_TYPE = "disk_type"
532
HV_VNC_BIND_ADDRESS = "vnc_bind_address"
533
HV_VNC_PASSWORD_FILE = "vnc_password_file"
534
HV_VNC_TLS = "vnc_tls"
535
HV_VNC_X509 = "vnc_x509_path"
536
HV_VNC_X509_VERIFY = "vnc_x509_verify"
537
HV_ACPI = "acpi"
538
HV_PAE = "pae"
539
HV_USE_BOOTLOADER = "use_bootloader"
540
HV_BOOTLOADER_ARGS = "bootloader_args"
541
HV_BOOTLOADER_PATH = "bootloader_path"
542
HV_KERNEL_ARGS = "kernel_args"
543
HV_KERNEL_PATH = "kernel_path"
544
HV_INITRD_PATH = "initrd_path"
545
HV_ROOT_PATH = "root_path"
546
HV_SERIAL_CONSOLE = "serial_console"
547
HV_USB_MOUSE = "usb_mouse"
548
HV_DEVICE_MODEL = "device_model"
549
HV_INIT_SCRIPT = "init_script"
550
HV_MIGRATION_PORT = "migration_port"
551
HV_MIGRATION_BANDWIDTH = "migration_bandwidth"
552
HV_MIGRATION_DOWNTIME = "migration_downtime"
553
HV_MIGRATION_MODE = "migration_mode"
554
HV_USE_LOCALTIME = "use_localtime"
555
HV_DISK_CACHE = "disk_cache"
556
HV_SECURITY_MODEL = "security_model"
557
HV_SECURITY_DOMAIN = "security_domain"
558
HV_KVM_FLAG = "kvm_flag"
559
HV_VHOST_NET = "vhost_net"
560
HV_KVM_USE_CHROOT = "use_chroot"
561
HV_CPU_MASK = "cpu_mask"
562

    
563
HVS_PARAMETER_TYPES = {
564
  HV_BOOT_ORDER: VTYPE_STRING,
565
  HV_CDROM_IMAGE_PATH: VTYPE_STRING,
566
  HV_NIC_TYPE: VTYPE_STRING,
567
  HV_DISK_TYPE: VTYPE_STRING,
568
  HV_VNC_PASSWORD_FILE: VTYPE_STRING,
569
  HV_VNC_BIND_ADDRESS: VTYPE_STRING,
570
  HV_VNC_TLS: VTYPE_BOOL,
571
  HV_VNC_X509: VTYPE_STRING,
572
  HV_VNC_X509_VERIFY: VTYPE_BOOL,
573
  HV_ACPI: VTYPE_BOOL,
574
  HV_PAE: VTYPE_BOOL,
575
  HV_USE_BOOTLOADER: VTYPE_BOOL,
576
  HV_BOOTLOADER_PATH: VTYPE_STRING,
577
  HV_BOOTLOADER_ARGS: VTYPE_STRING,
578
  HV_KERNEL_PATH: VTYPE_STRING,
579
  HV_KERNEL_ARGS: VTYPE_STRING,
580
  HV_INITRD_PATH: VTYPE_STRING,
581
  HV_ROOT_PATH: VTYPE_STRING,
582
  HV_SERIAL_CONSOLE: VTYPE_BOOL,
583
  HV_USB_MOUSE: VTYPE_STRING,
584
  HV_DEVICE_MODEL: VTYPE_STRING,
585
  HV_INIT_SCRIPT: VTYPE_STRING,
586
  HV_MIGRATION_PORT: VTYPE_INT,
587
  HV_MIGRATION_BANDWIDTH: VTYPE_INT,
588
  HV_MIGRATION_DOWNTIME: VTYPE_INT,
589
  HV_MIGRATION_MODE: VTYPE_STRING,
590
  HV_USE_LOCALTIME: VTYPE_BOOL,
591
  HV_DISK_CACHE: VTYPE_STRING,
592
  HV_SECURITY_MODEL: VTYPE_STRING,
593
  HV_SECURITY_DOMAIN: VTYPE_STRING,
594
  HV_KVM_FLAG: VTYPE_STRING,
595
  HV_VHOST_NET: VTYPE_BOOL,
596
  HV_KVM_USE_CHROOT: VTYPE_BOOL,
597
  HV_CPU_MASK: VTYPE_STRING,
598
  }
599

    
600
HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
601

    
602
# BE parameter names
603
BE_MEMORY = "memory"
604
BE_VCPUS = "vcpus"
605
BE_AUTO_BALANCE = "auto_balance"
606

    
607
BES_PARAMETER_TYPES = {
608
    BE_MEMORY: VTYPE_SIZE,
609
    BE_VCPUS: VTYPE_INT,
610
    BE_AUTO_BALANCE: VTYPE_BOOL,
611
    }
612

    
613
BES_PARAMETERS = frozenset(BES_PARAMETER_TYPES.keys())
614

    
615
# Instance Parameters Profile
616
PP_DEFAULT = "default"
617

    
618
NIC_MODE = "mode"
619
NIC_LINK = "link"
620

    
621
NIC_MODE_BRIDGED = "bridged"
622
NIC_MODE_ROUTED = "routed"
623

    
624
NIC_VALID_MODES = frozenset([NIC_MODE_BRIDGED, NIC_MODE_ROUTED])
625

    
626
NICS_PARAMETER_TYPES = {
627
    NIC_MODE: VTYPE_STRING,
628
    NIC_LINK: VTYPE_STRING,
629
    }
630

    
631
NICS_PARAMETERS = frozenset(NICS_PARAMETER_TYPES.keys())
632

    
633
IDISK_SIZE = "size"
634
IDISK_MODE = "mode"
635
IDISK_ADOPT = "adopt"
636
IDISK_PARAMS_TYPES = {
637
  IDISK_SIZE: VTYPE_SIZE,
638
  IDISK_MODE: VTYPE_STRING,
639
  IDISK_ADOPT: VTYPE_STRING,
640
  }
641
IDISK_PARAMS = frozenset(IDISK_PARAMS_TYPES.keys())
642

    
643
INIC_MAC = "mac"
644
INIC_IP = "ip"
645
INIC_MODE = "mode"
646
INIC_LINK = "link"
647
INIC_BRIDGE = "bridge"
648
INIC_PARAMS_TYPES = {
649
  INIC_BRIDGE: VTYPE_STRING,
650
  INIC_IP: VTYPE_MAYBE_STRING,
651
  INIC_LINK: VTYPE_STRING,
652
  INIC_MAC: VTYPE_STRING,
653
  INIC_MODE: VTYPE_STRING,
654
  }
655
INIC_PARAMS = frozenset(INIC_PARAMS_TYPES.keys())
656

    
657
# Hypervisor constants
658
HT_XEN_PVM = "xen-pvm"
659
HT_FAKE = "fake"
660
HT_XEN_HVM = "xen-hvm"
661
HT_KVM = "kvm"
662
HT_CHROOT = "chroot"
663
HT_LXC = "lxc"
664
HYPER_TYPES = frozenset([
665
  HT_XEN_PVM,
666
  HT_FAKE,
667
  HT_XEN_HVM,
668
  HT_KVM,
669
  HT_CHROOT,
670
  HT_LXC,
671
  ])
672
HTS_REQ_PORT = frozenset([HT_XEN_HVM, HT_KVM])
673

    
674
VNC_BASE_PORT = 5900
675
VNC_PASSWORD_FILE = CONF_DIR + "/vnc-cluster-password"
676
VNC_DEFAULT_BIND_ADDRESS = IP4_ADDRESS_ANY
677

    
678
# NIC types
679
HT_NIC_RTL8139 = "rtl8139"
680
HT_NIC_NE2K_PCI = "ne2k_pci"
681
HT_NIC_NE2K_ISA = "ne2k_isa"
682
HT_NIC_I82551 = "i82551"
683
HT_NIC_I85557B = "i82557b"
684
HT_NIC_I8259ER = "i82559er"
685
HT_NIC_PCNET = "pcnet"
686
HT_NIC_E1000 = "e1000"
687
HT_NIC_PARAVIRTUAL = HT_DISK_PARAVIRTUAL = "paravirtual"
688

    
689
HT_HVM_VALID_NIC_TYPES = frozenset([HT_NIC_RTL8139, HT_NIC_NE2K_PCI,
690
                                    HT_NIC_NE2K_ISA, HT_NIC_PARAVIRTUAL])
691
HT_KVM_VALID_NIC_TYPES = frozenset([HT_NIC_RTL8139, HT_NIC_NE2K_PCI,
692
                                    HT_NIC_NE2K_ISA, HT_NIC_I82551,
693
                                    HT_NIC_I85557B, HT_NIC_I8259ER,
694
                                    HT_NIC_PCNET, HT_NIC_E1000,
695
                                    HT_NIC_PARAVIRTUAL])
696
# Disk types
697
HT_DISK_IOEMU = "ioemu"
698
HT_DISK_IDE = "ide"
699
HT_DISK_SCSI = "scsi"
700
HT_DISK_SD = "sd"
701
HT_DISK_MTD = "mtd"
702
HT_DISK_PFLASH = "pflash"
703

    
704
HT_CACHE_DEFAULT = "default"
705
HT_CACHE_NONE = "none"
706
HT_CACHE_WTHROUGH = "writethrough"
707
HT_CACHE_WBACK = "writeback"
708
HT_VALID_CACHE_TYPES = frozenset([HT_CACHE_DEFAULT,
709
                                  HT_CACHE_NONE,
710
                                  HT_CACHE_WTHROUGH,
711
                                  HT_CACHE_WBACK])
712

    
713
HT_HVM_VALID_DISK_TYPES = frozenset([HT_DISK_PARAVIRTUAL, HT_DISK_IOEMU])
714
HT_KVM_VALID_DISK_TYPES = frozenset([HT_DISK_PARAVIRTUAL, HT_DISK_IDE,
715
                                     HT_DISK_SCSI, HT_DISK_SD, HT_DISK_MTD,
716
                                     HT_DISK_PFLASH])
717

    
718
# Mouse types:
719
HT_MOUSE_MOUSE = "mouse"
720
HT_MOUSE_TABLET = "tablet"
721

    
722
HT_KVM_VALID_MOUSE_TYPES = frozenset([HT_MOUSE_MOUSE, HT_MOUSE_TABLET])
723

    
724
# Boot order
725
HT_BO_CDROM = "cdrom"
726
HT_BO_DISK = "disk"
727
HT_BO_NETWORK = "network"
728

    
729
HT_KVM_VALID_BO_TYPES = frozenset([HT_BO_CDROM, HT_BO_DISK, HT_BO_NETWORK])
730

    
731
# Security models
732
HT_SM_NONE = "none"
733
HT_SM_USER = "user"
734
HT_SM_POOL = "pool"
735

    
736
HT_KVM_VALID_SM_TYPES = frozenset([HT_SM_NONE, HT_SM_USER, HT_SM_POOL])
737

    
738
# Kvm flag values
739
HT_KVM_ENABLED = "enabled"
740
HT_KVM_DISABLED = "disabled"
741

    
742
HT_KVM_FLAG_VALUES = frozenset([HT_KVM_ENABLED, HT_KVM_DISABLED])
743

    
744
# Migration type
745
HT_MIGRATION_LIVE = "live"
746
HT_MIGRATION_NONLIVE = "non-live"
747
HT_MIGRATION_MODES = frozenset([HT_MIGRATION_LIVE, HT_MIGRATION_NONLIVE])
748

    
749
# Cluster Verify steps
750
VERIFY_NPLUSONE_MEM = 'nplusone_mem'
751
VERIFY_OPTIONAL_CHECKS = frozenset([VERIFY_NPLUSONE_MEM])
752

    
753
# Node verify constants
754
NV_DRBDHELPER = "drbd-helper"
755
NV_DRBDLIST = "drbd-list"
756
NV_FILELIST = "filelist"
757
NV_HVINFO = "hvinfo"
758
NV_HYPERVISOR = "hypervisor"
759
NV_INSTANCELIST = "instancelist"
760
NV_LVLIST = "lvlist"
761
NV_MASTERIP = "master-ip"
762
NV_NODELIST = "nodelist"
763
NV_NODENETTEST = "node-net-test"
764
NV_NODESETUP = "nodesetup"
765
NV_OSLIST = "oslist"
766
NV_PVLIST = "pvlist"
767
NV_TIME = "time"
768
NV_VERSION = "version"
769
NV_VGLIST = "vglist"
770

    
771
# SSL certificate check constants (in days)
772
SSL_CERT_EXPIRATION_WARN = 30
773
SSL_CERT_EXPIRATION_ERROR = 7
774

    
775
# Allocator framework constants
776
IALLOCATOR_VERSION = 2
777
IALLOCATOR_DIR_IN = "in"
778
IALLOCATOR_DIR_OUT = "out"
779
VALID_IALLOCATOR_DIRECTIONS = frozenset([
780
  IALLOCATOR_DIR_IN,
781
  IALLOCATOR_DIR_OUT,
782
  ])
783
IALLOCATOR_MODE_ALLOC = "allocate"
784
IALLOCATOR_MODE_RELOC = "relocate"
785
IALLOCATOR_MODE_MEVAC = "multi-evacuate"
786
VALID_IALLOCATOR_MODES = frozenset([
787
  IALLOCATOR_MODE_ALLOC,
788
  IALLOCATOR_MODE_RELOC,
789
  IALLOCATOR_MODE_MEVAC,
790
  ])
791
IALLOCATOR_SEARCH_PATH = _autoconf.IALLOCATOR_SEARCH_PATH
792

    
793
# Job queue
794
JOB_QUEUE_VERSION = 1
795
JOB_QUEUE_LOCK_FILE = QUEUE_DIR + "/lock"
796
JOB_QUEUE_VERSION_FILE = QUEUE_DIR + "/version"
797
JOB_QUEUE_SERIAL_FILE = QUEUE_DIR + "/serial"
798
JOB_QUEUE_ARCHIVE_DIR = QUEUE_DIR + "/archive"
799
JOB_QUEUE_DRAIN_FILE = QUEUE_DIR + "/drain"
800
JOB_QUEUE_SIZE_HARD_LIMIT = 5000
801
JOB_QUEUE_DIRS = [QUEUE_DIR, JOB_QUEUE_ARCHIVE_DIR]
802
JOB_QUEUE_DIRS_MODE = SECURE_DIR_MODE
803

    
804
JOB_ID_TEMPLATE = r"\d+"
805

    
806
# unchanged job return
807
JOB_NOTCHANGED = "nochange"
808

    
809
# Job status
810
JOB_STATUS_QUEUED = "queued"
811
JOB_STATUS_WAITLOCK = "waiting"
812
JOB_STATUS_CANCELING = "canceling"
813
JOB_STATUS_RUNNING = "running"
814
JOB_STATUS_CANCELED = "canceled"
815
JOB_STATUS_SUCCESS = "success"
816
JOB_STATUS_ERROR = "error"
817
JOBS_FINALIZED = frozenset([
818
  JOB_STATUS_CANCELED,
819
  JOB_STATUS_SUCCESS,
820
  JOB_STATUS_ERROR,
821
  ])
822

    
823
# OpCode status
824
# not yet finalized
825
OP_STATUS_QUEUED = "queued"
826
OP_STATUS_WAITLOCK = "waiting"
827
OP_STATUS_CANCELING = "canceling"
828
OP_STATUS_RUNNING = "running"
829
# finalized
830
OP_STATUS_CANCELED = "canceled"
831
OP_STATUS_SUCCESS = "success"
832
OP_STATUS_ERROR = "error"
833
OPS_FINALIZED = frozenset([OP_STATUS_CANCELED,
834
                           OP_STATUS_SUCCESS,
835
                           OP_STATUS_ERROR])
836

    
837
# Execution log types
838
ELOG_MESSAGE = "message"
839
ELOG_PROGRESS = "progress"
840
ELOG_REMOTE_IMPORT = "remote-import"
841
ELOG_JQUEUE_TEST = "jqueue-test"
842

    
843
# Job queue test
844
JQT_MSGPREFIX = "TESTMSG="
845
JQT_EXPANDNAMES = "expandnames"
846
JQT_EXEC = "exec"
847
JQT_LOGMSG = "logmsg"
848
JQT_STARTMSG = "startmsg"
849
JQT_ALL = frozenset([
850
  JQT_EXPANDNAMES,
851
  JQT_EXEC,
852
  JQT_LOGMSG,
853
  JQT_STARTMSG,
854
  ])
855

    
856
# max dynamic devices
857
MAX_NICS = 8
858
MAX_DISKS = 16
859

    
860
# SSCONF keys
861
SS_CLUSTER_NAME = "cluster_name"
862
SS_CLUSTER_TAGS = "cluster_tags"
863
SS_FILE_STORAGE_DIR = "file_storage_dir"
864
SS_MASTER_CANDIDATES = "master_candidates"
865
SS_MASTER_CANDIDATES_IPS = "master_candidates_ips"
866
SS_MASTER_IP = "master_ip"
867
SS_MASTER_NETDEV = "master_netdev"
868
SS_MASTER_NODE = "master_node"
869
SS_NODE_LIST = "node_list"
870
SS_NODE_PRIMARY_IPS = "node_primary_ips"
871
SS_NODE_SECONDARY_IPS = "node_secondary_ips"
872
SS_OFFLINE_NODES = "offline_nodes"
873
SS_ONLINE_NODES = "online_nodes"
874
SS_INSTANCE_LIST = "instance_list"
875
SS_RELEASE_VERSION = "release_version"
876
SS_HYPERVISOR_LIST = "hypervisor_list"
877
SS_MAINTAIN_NODE_HEALTH = "maintain_node_health"
878
SS_UID_POOL = "uid_pool"
879

    
880
# cluster wide default parameters
881
DEFAULT_ENABLED_HYPERVISOR = HT_XEN_PVM
882

    
883
HVC_DEFAULTS = {
884
  HT_XEN_PVM: {
885
    HV_USE_BOOTLOADER: False,
886
    HV_BOOTLOADER_PATH: XEN_BOOTLOADER,
887
    HV_BOOTLOADER_ARGS: '',
888
    HV_KERNEL_PATH: "/boot/vmlinuz-2.6-xenU",
889
    HV_INITRD_PATH: '',
890
    HV_ROOT_PATH: '/dev/sda1',
891
    HV_KERNEL_ARGS: 'ro',
892
    HV_MIGRATION_PORT: 8002,
893
    HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
894
    },
895
  HT_XEN_HVM: {
896
    HV_BOOT_ORDER: "cd",
897
    HV_CDROM_IMAGE_PATH: '',
898
    HV_NIC_TYPE: HT_NIC_RTL8139,
899
    HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
900
    HV_VNC_BIND_ADDRESS: IP4_ADDRESS_ANY,
901
    HV_VNC_PASSWORD_FILE: VNC_PASSWORD_FILE,
902
    HV_ACPI: True,
903
    HV_PAE: True,
904
    HV_KERNEL_PATH: "/usr/lib/xen/boot/hvmloader",
905
    HV_DEVICE_MODEL: "/usr/lib/xen/bin/qemu-dm",
906
    HV_MIGRATION_PORT: 8002,
907
    HV_MIGRATION_MODE: HT_MIGRATION_NONLIVE,
908
    HV_USE_LOCALTIME: False,
909
    },
910
  HT_KVM: {
911
    HV_KERNEL_PATH: "/boot/vmlinuz-2.6-kvmU",
912
    HV_INITRD_PATH: '',
913
    HV_KERNEL_ARGS: 'ro',
914
    HV_ROOT_PATH: '/dev/vda1',
915
    HV_ACPI: True,
916
    HV_SERIAL_CONSOLE: True,
917
    HV_VNC_BIND_ADDRESS: '',
918
    HV_VNC_TLS: False,
919
    HV_VNC_X509: '',
920
    HV_VNC_X509_VERIFY: False,
921
    HV_VNC_PASSWORD_FILE: '',
922
    HV_CDROM_IMAGE_PATH: '',
923
    HV_BOOT_ORDER: HT_BO_DISK,
924
    HV_NIC_TYPE: HT_NIC_PARAVIRTUAL,
925
    HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
926
    HV_USB_MOUSE: '',
927
    HV_MIGRATION_PORT: 8102,
928
    HV_MIGRATION_BANDWIDTH: 32, # MiB/s
929
    HV_MIGRATION_DOWNTIME: 30,  # ms
930
    HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
931
    HV_USE_LOCALTIME: False,
932
    HV_DISK_CACHE: HT_CACHE_DEFAULT,
933
    HV_SECURITY_MODEL: HT_SM_NONE,
934
    HV_SECURITY_DOMAIN: '',
935
    HV_KVM_FLAG: "",
936
    HV_VHOST_NET: False,
937
    HV_KVM_USE_CHROOT: False,
938
    },
939
  HT_FAKE: {
940
    },
941
  HT_CHROOT: {
942
    HV_INIT_SCRIPT: "/ganeti-chroot",
943
    },
944
  HT_LXC: {
945
    HV_CPU_MASK: "",
946
    },
947
  }
948

    
949
HVC_GLOBALS = frozenset([
950
  HV_MIGRATION_PORT,
951
  HV_MIGRATION_BANDWIDTH,
952
  HV_MIGRATION_MODE,
953
  ])
954

    
955
BEC_DEFAULTS = {
956
  BE_MEMORY: 128,
957
  BE_VCPUS: 1,
958
  BE_AUTO_BALANCE: True,
959
  }
960

    
961
NICC_DEFAULTS = {
962
  NIC_MODE: NIC_MODE_BRIDGED,
963
  NIC_LINK: DEFAULT_BRIDGE,
964
  }
965

    
966
MASTER_POOL_SIZE_DEFAULT = 10
967

    
968
CONFD_PROTOCOL_VERSION = 1
969

    
970
CONFD_REQ_PING = 0
971
CONFD_REQ_NODE_ROLE_BYNAME = 1
972
CONFD_REQ_NODE_PIP_BY_INSTANCE_IP = 2
973
CONFD_REQ_CLUSTER_MASTER = 3
974
CONFD_REQ_NODE_PIP_LIST = 4
975
CONFD_REQ_MC_PIP_LIST = 5
976
CONFD_REQ_INSTANCES_IPS_LIST = 6
977

    
978
# Confd request query fields. These are used to narrow down queries.
979
# These must be strings rather than integers, because json-encoding
980
# converts them to strings anyway, as they're used as dict-keys.
981
CONFD_REQQ_LINK = "0"
982
CONFD_REQQ_IP = "1"
983
CONFD_REQQ_IPLIST = "2"
984
CONFD_REQQ_FIELDS = "3"
985

    
986
CONFD_REQFIELD_NAME = "0"
987
CONFD_REQFIELD_IP = "1"
988
CONFD_REQFIELD_MNODE_PIP = "2"
989

    
990
CONFD_REQS = frozenset([
991
  CONFD_REQ_PING,
992
  CONFD_REQ_NODE_ROLE_BYNAME,
993
  CONFD_REQ_NODE_PIP_BY_INSTANCE_IP,
994
  CONFD_REQ_CLUSTER_MASTER,
995
  CONFD_REQ_NODE_PIP_LIST,
996
  CONFD_REQ_MC_PIP_LIST,
997
  CONFD_REQ_INSTANCES_IPS_LIST,
998
  ])
999

    
1000
CONFD_REPL_STATUS_OK = 0
1001
CONFD_REPL_STATUS_ERROR = 1
1002
CONFD_REPL_STATUS_NOTIMPLEMENTED = 2
1003

    
1004
CONFD_REPL_STATUSES = frozenset([
1005
  CONFD_REPL_STATUS_OK,
1006
  CONFD_REPL_STATUS_ERROR,
1007
  CONFD_REPL_STATUS_NOTIMPLEMENTED,
1008
  ])
1009

    
1010
(CONFD_NODE_ROLE_MASTER,
1011
 CONFD_NODE_ROLE_CANDIDATE,
1012
 CONFD_NODE_ROLE_OFFLINE,
1013
 CONFD_NODE_ROLE_DRAINED,
1014
 CONFD_NODE_ROLE_REGULAR,
1015
 ) = range(5)
1016

    
1017
# A few common errors for confd
1018
CONFD_ERROR_UNKNOWN_ENTRY = 1
1019
CONFD_ERROR_INTERNAL = 2
1020
CONFD_ERROR_ARGUMENT = 3
1021

    
1022
# Each request is "salted" by the current timestamp.
1023
# This constants decides how many seconds of skew to accept.
1024
# TODO: make this a default and allow the value to be more configurable
1025
CONFD_MAX_CLOCK_SKEW = 2 * NODE_MAX_CLOCK_SKEW
1026

    
1027
# When we haven't reloaded the config for more than this amount of seconds, we
1028
# force a test to see if inotify is betraying us.
1029
CONFD_CONFIG_RELOAD_TIMEOUT = 60
1030

    
1031
# If we receive more than one update in this amount of seconds, we move to
1032
# polling every RATELIMIT seconds, rather than relying on inotify, to be able
1033
# to serve more requests.
1034
CONFD_CONFIG_RELOAD_RATELIMIT = 2
1035

    
1036
# Magic number prepended to all confd queries.
1037
# This allows us to distinguish different types of confd protocols and handle
1038
# them. For example by changing this we can move the whole payload to be
1039
# compressed, or move away from json.
1040
CONFD_MAGIC_FOURCC = 'plj0'
1041

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

    
1047
# Timeout in seconds to expire pending query request in the confd client
1048
# library. We don't actually expect any answer more than 10 seconds after we
1049
# sent a request.
1050
CONFD_CLIENT_EXPIRE_TIMEOUT = 10
1051

    
1052
# Maximum UDP datagram size.
1053
# On IPv4: 64K - 20 (ip header size) - 8 (udp header size) = 65507
1054
# On IPv6: 64K - 40 (ip6 header size) - 8 (udp header size) = 65487
1055
#   (assuming we can't use jumbo frames)
1056
# We just set this to 60K, which should be enough
1057
MAX_UDP_DATA_SIZE = 61440
1058

    
1059
# User-id pool minimum/maximum acceptable user-ids.
1060
UIDPOOL_UID_MIN = 0
1061
UIDPOOL_UID_MAX = 2**32-1 # Assuming 32 bit user-ids
1062

    
1063
# Name or path of the pgrep command
1064
PGREP = "pgrep"