Statistics
| Branch: | Tag: | Revision:

root / lib / constants.py @ ea1518af

History | View | Annotate | Download (16.3 kB)

1
#
2
#
3

    
4
# Copyright (C) 2006, 2007 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
from ganeti import _autoconf
25

    
26
# various versions
27
PROTOCOL_VERSION = 20
28
RELEASE_VERSION = _autoconf.PACKAGE_VERSION
29
OS_API_V10 = 10
30
OS_API_V15 = 15
31
OS_API_VERSIONS = frozenset([OS_API_V10, OS_API_V15])
32
EXPORT_VERSION = 0
33
RAPI_VERSION = 2
34

    
35

    
36
# Format for CONFIG_VERSION:
37
#   01 03 0123 = 01030123
38
#   ^^ ^^ ^^^^
39
#   |  |  + Configuration version/revision
40
#   |  + Minor version
41
#   + Major version
42
#
43
# It stored as an integer. Make sure not to write an octal number.
44

    
45
# BuildVersion and SplitVersion must be in here because we can't import other
46
# modules. The cfgupgrade tool must be able to read and write version numbers
47
# and thus requires these functions. To avoid code duplication, they're kept in
48
# here.
49

    
50
def BuildVersion(major, minor, revision):
51
  """Calculates int version number from major, minor and revision numbers.
52

53
  Returns: int representing version number
54

55
  """
56
  assert isinstance(major, int)
57
  assert isinstance(minor, int)
58
  assert isinstance(revision, int)
59
  return (1000000 * major +
60
            10000 * minor +
61
                1 * revision)
62

    
63

    
64
def SplitVersion(version):
65
  """Splits version number stored in an int.
66

67
  Returns: tuple; (major, minor, revision)
68

69
  """
70
  assert isinstance(version, int)
71

    
72
  (major, remainder) = divmod(version, 1000000)
73
  (minor, revision) = divmod(remainder, 10000)
74

    
75
  return (major, minor, revision)
76

    
77

    
78
CONFIG_MAJOR = int(_autoconf.VERSION_MAJOR)
79
CONFIG_MINOR = int(_autoconf.VERSION_MINOR)
80
CONFIG_REVISION = 0
81
CONFIG_VERSION = BuildVersion(CONFIG_MAJOR, CONFIG_MINOR, CONFIG_REVISION)
82

    
83
# file paths
84
DATA_DIR = _autoconf.LOCALSTATEDIR + "/lib/ganeti"
85
RUN_DIR = _autoconf.LOCALSTATEDIR + "/run"
86
RUN_GANETI_DIR = RUN_DIR + "/ganeti"
87
BDEV_CACHE_DIR = RUN_GANETI_DIR + "/bdev-cache"
88
DISK_LINKS_DIR = RUN_GANETI_DIR + "/instance-disks"
89
RUN_DIRS_MODE = 0755
90
SOCKET_DIR = RUN_GANETI_DIR + "/socket"
91
SOCKET_DIR_MODE = 0700
92
# keep RUN_GANETI_DIR first here, to make sure all get created when the node
93
# daemon is started (this takes care of RUN_DIR being tmpfs)
94
SUB_RUN_DIRS = [ RUN_GANETI_DIR, BDEV_CACHE_DIR, DISK_LINKS_DIR ]
95
LOCK_DIR = _autoconf.LOCALSTATEDIR + "/lock"
96
SSCONF_LOCK_FILE = LOCK_DIR + "/ganeti-ssconf.lock"
97
CLUSTER_CONF_FILE = DATA_DIR + "/config.data"
98
SSL_CERT_FILE = DATA_DIR + "/server.pem"
99
RAPI_CERT_FILE = DATA_DIR + "/rapi.pem"
100
HMAC_CLUSTER_KEY = DATA_DIR + "/hmac.key"
101
WATCHER_STATEFILE = DATA_DIR + "/watcher.data"
102
INSTANCE_UPFILE = RUN_GANETI_DIR + "/instance-status"
103
SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts"
104
RAPI_USERS_FILE = DATA_DIR + "/rapi_users"
105
QUEUE_DIR = DATA_DIR + "/queue"
106
ETC_HOSTS = "/etc/hosts"
107
DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR
108
SYSCONFDIR = _autoconf.SYSCONFDIR
109

    
110
MASTER_SOCKET = SOCKET_DIR + "/ganeti-master"
111

    
112
NODE_INITD_SCRIPT = _autoconf.SYSCONFDIR + "/init.d/ganeti"
113

    
114
NODED = "ganeti-noded"
115
RAPI = "ganeti-rapi"
116
MASTERD = "ganeti-masterd"
117

    
118
MULTITHREADED_DAEMONS = frozenset([MASTERD])
119

    
120
DAEMONS_SSL = {
121
  # daemon-name: (default-cert-path, default-key-path)
122
  NODED: (SSL_CERT_FILE, SSL_CERT_FILE),
123
  RAPI: (RAPI_CERT_FILE, RAPI_CERT_FILE),
124
}
125

    
126
DAEMONS_PORTS = {
127
  # daemon-name: ("proto", "default-port")
128
  NODED: ("tcp", 1811),
129
  RAPI: ("tcp", 5080),
130
}
131
DEFAULT_NODED_PORT = DAEMONS_PORTS[NODED][1]
132
DEFAULT_RAPI_PORT = DAEMONS_PORTS[RAPI][1]
133

    
134
FIRST_DRBD_PORT = 11000
135
LAST_DRBD_PORT = 14999
136
MASTER_SCRIPT = "ganeti-master"
137

    
138
LOG_DIR = _autoconf.LOCALSTATEDIR + "/log/ganeti/"
139
DAEMONS_LOGFILES = {
140
 # "daemon-name": "logfile"
141
 NODED: LOG_DIR + "node-daemon.log",
142
 RAPI: LOG_DIR + "rapi-daemon.log",
143
 MASTERD: LOG_DIR + "master-daemon.log",
144
}
145
LOG_OS_DIR = LOG_DIR + "os"
146
LOG_WATCHER = LOG_DIR + "watcher.log"
147
LOG_COMMANDS = LOG_DIR + "commands.log"
148
LOG_BURNIN = LOG_DIR + "burnin.log"
149

    
150
OS_SEARCH_PATH = _autoconf.OS_SEARCH_PATH
151
EXPORT_DIR = _autoconf.EXPORT_DIR
152

    
153
EXPORT_CONF_FILE = "config.ini"
154

    
155
XEN_KERNEL = _autoconf.XEN_KERNEL
156
XEN_INITRD = _autoconf.XEN_INITRD
157

    
158
KVM_PATH = _autoconf.KVM_PATH
159
SOCAT_PATH = _autoconf.SOCAT_PATH
160
KVM_MIGRATION_PORT = _autoconf.KVM_MIGRATION_PORT
161

    
162
VALUE_DEFAULT = "default"
163
VALUE_AUTO = "auto"
164
VALUE_GENERATE = "generate"
165
VALUE_NONE = "none"
166
VALUE_TRUE = "true"
167
VALUE_FALSE = "false"
168

    
169
# hooks-related constants
170
HOOKS_BASE_DIR = _autoconf.SYSCONFDIR + "/ganeti/hooks"
171
HOOKS_PHASE_PRE = "pre"
172
HOOKS_PHASE_POST = "post"
173
HOOKS_NAME_CFGUPDATE = "config-update"
174
HOOKS_VERSION = 2
175

    
176
# hooks subject type (what object type does the LU deal with)
177
HTYPE_CLUSTER = "CLUSTER"
178
HTYPE_NODE = "NODE"
179
HTYPE_INSTANCE = "INSTANCE"
180

    
181
HKR_SKIP = 0
182
HKR_FAIL = 1
183
HKR_SUCCESS = 2
184

    
185
# Storage types
186
ST_FILE = "file"
187
ST_LVM_PV = "lvm-pv"
188
ST_LVM_VG = "lvm-vg"
189

    
190
# Storage fields
191
SF_NAME = "name"
192
SF_SIZE = "size"
193
SF_FREE = "free"
194
SF_USED = "used"
195
SF_ALLOCATABLE = "allocatable"
196

    
197
# Available fields per storage type
198
VALID_STORAGE_FIELDS = {
199
  ST_FILE: frozenset([SF_NAME, SF_USED, SF_FREE]),
200
  ST_LVM_PV: frozenset([SF_NAME, SF_SIZE, SF_USED, SF_FREE, SF_ALLOCATABLE]),
201
  ST_LVM_VG: frozenset([SF_NAME, SF_SIZE]),
202
  }
203

    
204
MODIFIABLE_STORAGE_FIELDS = {
205
  ST_LVM_PV: frozenset([SF_ALLOCATABLE]),
206
  }
207

    
208
# Local disk status
209
# Note: Code depends on LDS_OKAY < LDS_UNKNOWN < LDS_FAULTY
210
(LDS_OKAY,
211
 LDS_UNKNOWN,
212
 LDS_FAULTY) = range(1, 4)
213

    
214
# disk template types
215
DT_DISKLESS = "diskless"
216
DT_PLAIN = "plain"
217
DT_DRBD8 = "drbd"
218
DT_FILE = "file"
219

    
220
# the set of network-mirrored disk templates
221
DTS_NET_MIRROR = frozenset([DT_DRBD8])
222

    
223
# the set of non-lvm-based disk templates
224
DTS_NOT_LVM = frozenset([DT_DISKLESS, DT_FILE])
225

    
226
# logical disk types
227
LD_LV = "lvm"
228
LD_DRBD8 = "drbd8"
229
LD_FILE = "file"
230
LDS_BLOCK = frozenset([LD_LV, LD_DRBD8])
231

    
232
# drbd constants
233
DRBD_HMAC_ALG = "md5"
234
DRBD_NET_PROTOCOL = "C"
235

    
236
# file backend driver
237
FD_LOOP = "loop"
238
FD_BLKTAP = "blktap"
239

    
240
# the set of drbd-like disk types
241
LDS_DRBD = frozenset([LD_DRBD8])
242

    
243
# disk access mode
244
DISK_RDONLY = "ro"
245
DISK_RDWR = "rw"
246
DISK_ACCESS_SET = frozenset([DISK_RDONLY, DISK_RDWR])
247

    
248
# disk replacement mode
249
REPLACE_DISK_PRI = "replace_on_primary"    # replace disks on primary
250
REPLACE_DISK_SEC = "replace_on_secondary"  # replace disks on secondary
251
REPLACE_DISK_CHG = "replace_new_secondary" # change secondary node
252

    
253
# lock recalculate mode
254
LOCKS_REPLACE = 'replace'
255
LOCKS_APPEND = 'append'
256

    
257
# instance creation modes
258
INSTANCE_CREATE = "create"
259
INSTANCE_IMPORT = "import"
260

    
261
DISK_TEMPLATES = frozenset([DT_DISKLESS, DT_PLAIN,
262
                            DT_DRBD8, DT_FILE])
263

    
264
FILE_DRIVER = frozenset([FD_LOOP, FD_BLKTAP])
265

    
266
# import/export config options
267
INISECT_EXP = "export"
268
INISECT_INS = "instance"
269

    
270
# dynamic device modification
271

    
272
DDM_ADD = 'add'
273
DDM_REMOVE = 'remove'
274

    
275
# common exit codes
276
EXIT_SUCCESS = 0
277
EXIT_FAILURE = 1
278
EXIT_NOTCLUSTER = 5
279
EXIT_NOTMASTER = 11
280
EXIT_NODESETUP_ERROR = 12
281
EXIT_CONFIRMATION = 13 # need user confirmation
282
EXIT_NOTCANDIDATE = 14
283

    
284
# tags
285
TAG_CLUSTER = "cluster"
286
TAG_NODE = "node"
287
TAG_INSTANCE = "instance"
288
MAX_TAG_LEN = 128
289
MAX_TAGS_PER_OBJ = 4096
290

    
291
# others
292
DEFAULT_BRIDGE = "xen-br0"
293
SYNC_SPEED = 60 * 1024
294
LOCALHOST_IP_ADDRESS = "127.0.0.1"
295
TCP_PING_TIMEOUT = 10
296
GANETI_RUNAS = "root"
297
DEFAULT_VG = "xenvg"
298
BIND_ADDRESS_GLOBAL = "0.0.0.0"
299
MIN_VG_SIZE = 20480
300
DEFAULT_MAC_PREFIX = "aa:00:00"
301
LVM_STRIPECOUNT = _autoconf.LVM_STRIPECOUNT
302

    
303
# RPC constants
304
(RPC_ENCODING_NONE,
305
 RPC_ENCODING_ZLIB_BASE64) = range(2)
306

    
307
# os related constants
308
OS_SCRIPT_CREATE = 'create'
309
OS_SCRIPT_IMPORT = 'import'
310
OS_SCRIPT_EXPORT = 'export'
311
OS_SCRIPT_RENAME = 'rename'
312
OS_SCRIPTS = frozenset([OS_SCRIPT_CREATE, OS_SCRIPT_IMPORT,
313
                        OS_SCRIPT_EXPORT, OS_SCRIPT_RENAME])
314

    
315
# ssh constants
316
SSH_INITD_SCRIPT = _autoconf.SSH_INITD_SCRIPT
317
SSH_CONFIG_DIR = "/etc/ssh/"
318
SSH_HOST_DSA_PRIV = SSH_CONFIG_DIR + "ssh_host_dsa_key"
319
SSH_HOST_DSA_PUB = SSH_HOST_DSA_PRIV + ".pub"
320
SSH_HOST_RSA_PRIV = SSH_CONFIG_DIR + "ssh_host_rsa_key"
321
SSH_HOST_RSA_PUB = SSH_HOST_RSA_PRIV + ".pub"
322
SSH = "ssh"
323
SCP = "scp"
324

    
325
# reboot types
326
INSTANCE_REBOOT_SOFT = "soft"
327
INSTANCE_REBOOT_HARD = "hard"
328
INSTANCE_REBOOT_FULL = "full"
329

    
330
REBOOT_TYPES = frozenset([INSTANCE_REBOOT_SOFT,
331
                          INSTANCE_REBOOT_HARD,
332
                          INSTANCE_REBOOT_FULL])
333

    
334
VTYPE_STRING = 'string'
335
VTYPE_BOOL = 'bool'
336
VTYPE_SIZE = 'size' # size, in MiBs
337
VTYPE_INT = 'int'
338
ENFORCEABLE_TYPES = frozenset([
339
                      VTYPE_STRING,
340
                      VTYPE_BOOL,
341
                      VTYPE_SIZE,
342
                      VTYPE_INT,
343
                      ])
344

    
345
# HV parameter names (global namespace)
346
HV_BOOT_ORDER = "boot_order"
347
HV_CDROM_IMAGE_PATH = "cdrom_image_path"
348
HV_NIC_TYPE = "nic_type"
349
HV_DISK_TYPE = "disk_type"
350
HV_VNC_BIND_ADDRESS = "vnc_bind_address"
351
HV_VNC_TLS = "vnc_tls"
352
HV_VNC_X509 = "vnc_x509_path"
353
HV_VNC_X509_VERIFY = "vnc_x509_verify"
354
HV_ACPI = "acpi"
355
HV_PAE = "pae"
356
HV_KERNEL_ARGS = "kernel_args"
357
HV_KERNEL_PATH = "kernel_path"
358
HV_INITRD_PATH = "initrd_path"
359
HV_ROOT_PATH = "root_path"
360
HV_SERIAL_CONSOLE = "serial_console"
361
HV_USB_MOUSE = "usb_mouse"
362
HV_DEVICE_MODEL = "device_model"
363
HV_INIT_SCRIPT = "init_script"
364

    
365
HVS_PARAMETER_TYPES = {
366
  HV_BOOT_ORDER: VTYPE_STRING,
367
  HV_CDROM_IMAGE_PATH: VTYPE_STRING,
368
  HV_NIC_TYPE: VTYPE_STRING,
369
  HV_DISK_TYPE: VTYPE_STRING,
370
  HV_VNC_BIND_ADDRESS: VTYPE_STRING,
371
  HV_VNC_TLS: VTYPE_BOOL,
372
  HV_VNC_X509: VTYPE_STRING,
373
  HV_VNC_X509_VERIFY: VTYPE_BOOL,
374
  HV_ACPI: VTYPE_BOOL,
375
  HV_PAE: VTYPE_BOOL,
376
  HV_KERNEL_PATH: VTYPE_STRING,
377
  HV_KERNEL_ARGS: VTYPE_STRING,
378
  HV_INITRD_PATH: VTYPE_STRING,
379
  HV_ROOT_PATH: VTYPE_STRING,
380
  HV_SERIAL_CONSOLE: VTYPE_BOOL,
381
  HV_USB_MOUSE: VTYPE_STRING,
382
  HV_DEVICE_MODEL: VTYPE_STRING,
383
  HV_INIT_SCRIPT: VTYPE_STRING,
384
  }
385

    
386
HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
387

    
388
# BE parameter names
389
BE_MEMORY = "memory"
390
BE_VCPUS = "vcpus"
391
BE_AUTO_BALANCE = "auto_balance"
392

    
393
BES_PARAMETER_TYPES = {
394
    BE_MEMORY: VTYPE_SIZE,
395
    BE_VCPUS: VTYPE_INT,
396
    BE_AUTO_BALANCE: VTYPE_BOOL,
397
    }
398

    
399
BES_PARAMETERS = frozenset(BES_PARAMETER_TYPES.keys())
400

    
401
# Instance Parameters Profile
402
PP_DEFAULT = "default"
403

    
404
NIC_MODE = "mode"
405
NIC_LINK = "link"
406

    
407
NIC_MODE_BRIDGED = "bridged"
408
NIC_MODE_ROUTED = "routed"
409

    
410
NIC_VALID_MODES = frozenset([NIC_MODE_BRIDGED, NIC_MODE_ROUTED])
411

    
412
NICS_PARAMETER_TYPES = {
413
    NIC_MODE: VTYPE_STRING,
414
    NIC_LINK: VTYPE_STRING,
415
    }
416

    
417
NICS_PARAMETERS = frozenset(NICS_PARAMETER_TYPES.keys())
418

    
419
# Hypervisor constants
420
HT_XEN_PVM = "xen-pvm"
421
HT_FAKE = "fake"
422
HT_XEN_HVM = "xen-hvm"
423
HT_KVM = "kvm"
424
HT_CHROOT = "chroot"
425
HYPER_TYPES = frozenset([HT_XEN_PVM, HT_FAKE, HT_XEN_HVM, HT_KVM, HT_CHROOT])
426
HTS_REQ_PORT = frozenset([HT_XEN_HVM, HT_KVM])
427

    
428
VNC_BASE_PORT = 5900
429
VNC_PASSWORD_FILE = _autoconf.SYSCONFDIR + "/ganeti/vnc-cluster-password"
430
VNC_DEFAULT_BIND_ADDRESS = '0.0.0.0'
431

    
432
# NIC types
433
HT_NIC_RTL8139 = "rtl8139"
434
HT_NIC_NE2K_PCI = "ne2k_pci"
435
HT_NIC_NE2K_ISA = "ne2k_isa"
436
HT_NIC_I82551 = "i82551"
437
HT_NIC_I85557B = "i82557b"
438
HT_NIC_I8259ER = "i82559er"
439
HT_NIC_PCNET = "pcnet"
440
HT_NIC_E1000 = "e1000"
441
HT_NIC_PARAVIRTUAL = HT_DISK_PARAVIRTUAL = "paravirtual"
442

    
443
HT_HVM_VALID_NIC_TYPES = frozenset([HT_NIC_RTL8139, HT_NIC_NE2K_PCI,
444
                                    HT_NIC_NE2K_ISA, HT_NIC_PARAVIRTUAL])
445
HT_KVM_VALID_NIC_TYPES = frozenset([HT_NIC_RTL8139, HT_NIC_NE2K_PCI,
446
                                    HT_NIC_NE2K_ISA, HT_NIC_I82551,
447
                                    HT_NIC_I85557B, HT_NIC_I8259ER,
448
                                    HT_NIC_PCNET, HT_NIC_E1000,
449
                                    HT_NIC_PARAVIRTUAL])
450
# Disk types
451
HT_DISK_IOEMU = "ioemu"
452
HT_DISK_IDE = "ide"
453
HT_DISK_SCSI = "scsi"
454
HT_DISK_SD = "sd"
455
HT_DISK_MTD = "mtd"
456
HT_DISK_PFLASH = "pflash"
457

    
458
HT_HVM_VALID_DISK_TYPES = frozenset([HT_DISK_PARAVIRTUAL, HT_DISK_IOEMU])
459
HT_KVM_VALID_DISK_TYPES = frozenset([HT_DISK_PARAVIRTUAL, HT_DISK_IDE,
460
                                     HT_DISK_SCSI, HT_DISK_SD, HT_DISK_MTD,
461
                                     HT_DISK_PFLASH])
462

    
463
# Mouse types:
464
HT_MOUSE_MOUSE = "mouse"
465
HT_MOUSE_TABLET = "tablet"
466

    
467
HT_KVM_VALID_MOUSE_TYPES = frozenset([HT_MOUSE_MOUSE, HT_MOUSE_TABLET])
468

    
469
# Boot order
470
HT_BO_CDROM = "cdrom"
471
HT_BO_DISK = "disk"
472
HT_BO_NETWORK = "network"
473

    
474
HT_KVM_VALID_BO_TYPES = frozenset([HT_BO_CDROM, HT_BO_DISK, HT_BO_NETWORK])
475

    
476
# Cluster Verify steps
477
VERIFY_NPLUSONE_MEM = 'nplusone_mem'
478
VERIFY_OPTIONAL_CHECKS = frozenset([VERIFY_NPLUSONE_MEM])
479

    
480
# Node verify constants
481
NV_FILELIST = "filelist"
482
NV_HVINFO = "hvinfo"
483
NV_HYPERVISOR = "hypervisor"
484
NV_INSTANCELIST = "instancelist"
485
NV_LVLIST = "lvlist"
486
NV_NODELIST = "nodelist"
487
NV_NODENETTEST = "node-net-test"
488
NV_VERSION = "version"
489
NV_VGLIST = "vglist"
490
NV_DRBDLIST = "drbd-list"
491

    
492
# Allocator framework constants
493
IALLOCATOR_VERSION = 2
494
IALLOCATOR_DIR_IN = "in"
495
IALLOCATOR_DIR_OUT = "out"
496
IALLOCATOR_MODE_ALLOC = "allocate"
497
IALLOCATOR_MODE_RELOC = "relocate"
498
IALLOCATOR_SEARCH_PATH = _autoconf.IALLOCATOR_SEARCH_PATH
499

    
500
# Job queue
501
JOB_QUEUE_VERSION = 1
502
JOB_QUEUE_LOCK_FILE = QUEUE_DIR + "/lock"
503
JOB_QUEUE_VERSION_FILE = QUEUE_DIR + "/version"
504
JOB_QUEUE_SERIAL_FILE = QUEUE_DIR + "/serial"
505
JOB_QUEUE_ARCHIVE_DIR = QUEUE_DIR + "/archive"
506
JOB_QUEUE_DRAIN_FILE = QUEUE_DIR + "/drain"
507
JOB_QUEUE_SIZE_HARD_LIMIT = 5000
508
JOB_QUEUE_SIZE_SOFT_LIMIT = JOB_QUEUE_SIZE_HARD_LIMIT * 0.8
509

    
510
JOB_ID_TEMPLATE = r"\d+"
511

    
512
# unchanged job return
513
JOB_NOTCHANGED = "nochange"
514

    
515
# Job status
516
JOB_STATUS_QUEUED = "queued"
517
JOB_STATUS_WAITLOCK = "waiting"
518
JOB_STATUS_CANCELING = "canceling"
519
JOB_STATUS_RUNNING = "running"
520
JOB_STATUS_CANCELED = "canceled"
521
JOB_STATUS_SUCCESS = "success"
522
JOB_STATUS_ERROR = "error"
523

    
524
# OpCode status
525
# not yet finalized
526
OP_STATUS_QUEUED = "queued"
527
OP_STATUS_WAITLOCK = "waiting"
528
OP_STATUS_CANCELING = "canceling"
529
OP_STATUS_RUNNING = "running"
530
# finalized
531
OP_STATUS_CANCELED = "canceled"
532
OP_STATUS_SUCCESS = "success"
533
OP_STATUS_ERROR = "error"
534
OPS_FINALIZED = frozenset([OP_STATUS_CANCELED,
535
                           OP_STATUS_SUCCESS,
536
                           OP_STATUS_ERROR])
537

    
538
# Execution log types
539
ELOG_MESSAGE = "message"
540
ELOG_PROGRESS = "progress"
541

    
542
# max dynamic devices
543
MAX_NICS = 8
544
MAX_DISKS = 16
545

    
546
# SSCONF keys
547
SS_CLUSTER_NAME = "cluster_name"
548
SS_CLUSTER_TAGS = "cluster_tags"
549
SS_FILE_STORAGE_DIR = "file_storage_dir"
550
SS_MASTER_CANDIDATES = "master_candidates"
551
SS_MASTER_CANDIDATES_IPS = "master_candidates_ips"
552
SS_MASTER_IP = "master_ip"
553
SS_MASTER_NETDEV = "master_netdev"
554
SS_MASTER_NODE = "master_node"
555
SS_NODE_LIST = "node_list"
556
SS_NODE_PRIMARY_IPS = "node_primary_ips"
557
SS_NODE_SECONDARY_IPS = "node_secondary_ips"
558
SS_OFFLINE_NODES = "offline_nodes"
559
SS_ONLINE_NODES = "online_nodes"
560
SS_INSTANCE_LIST = "instance_list"
561
SS_RELEASE_VERSION = "release_version"
562

    
563
# cluster wide default parameters
564
DEFAULT_ENABLED_HYPERVISOR = HT_XEN_PVM
565

    
566
HVC_DEFAULTS = {
567
  HT_XEN_PVM: {
568
    HV_KERNEL_PATH: "/boot/vmlinuz-2.6-xenU",
569
    HV_INITRD_PATH: '',
570
    HV_ROOT_PATH: '/dev/sda1',
571
    HV_KERNEL_ARGS: 'ro',
572
    },
573
  HT_XEN_HVM: {
574
    HV_BOOT_ORDER: "cd",
575
    HV_CDROM_IMAGE_PATH: '',
576
    HV_NIC_TYPE: HT_NIC_RTL8139,
577
    HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
578
    HV_VNC_BIND_ADDRESS: '0.0.0.0',
579
    HV_ACPI: True,
580
    HV_PAE: True,
581
    HV_KERNEL_PATH: "/usr/lib/xen/boot/hvmloader",
582
    HV_DEVICE_MODEL: "/usr/lib/xen/bin/qemu-dm",
583
    },
584
  HT_KVM: {
585
    HV_KERNEL_PATH: "/boot/vmlinuz-2.6-kvmU",
586
    HV_INITRD_PATH: '',
587
    HV_KERNEL_ARGS: 'ro',
588
    HV_ROOT_PATH: '/dev/vda1',
589
    HV_ACPI: True,
590
    HV_SERIAL_CONSOLE: True,
591
    HV_VNC_BIND_ADDRESS: '',
592
    HV_VNC_TLS: False,
593
    HV_VNC_X509: '',
594
    HV_VNC_X509_VERIFY: False,
595
    HV_CDROM_IMAGE_PATH: '',
596
    HV_BOOT_ORDER: HT_BO_DISK,
597
    HV_NIC_TYPE: HT_NIC_PARAVIRTUAL,
598
    HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
599
    HV_USB_MOUSE: '',
600
    },
601
  HT_FAKE: {
602
    },
603
  HT_CHROOT: {
604
    HV_INIT_SCRIPT: "/ganeti-chroot",
605
    },
606
  }
607

    
608
BEC_DEFAULTS = {
609
  BE_MEMORY: 128,
610
  BE_VCPUS: 1,
611
  BE_AUTO_BALANCE: True,
612
  }
613

    
614
NICC_DEFAULTS = {
615
  NIC_MODE: NIC_MODE_BRIDGED,
616
  NIC_LINK: DEFAULT_BRIDGE,
617
  }
618

    
619
MASTER_POOL_SIZE_DEFAULT = 10
620

    
621
CONFD_PROTOCOL_VERSION = 1
622

    
623
CONFD_REQ_NODE_ROLE_BYNAME = 1
624
CONFD_REQ_NODE_PIP_BY_INSTANCE_IP = 2
625

    
626
CONFD_REQS = frozenset([
627
  CONFD_REQ_NODE_ROLE_BYNAME,
628
  CONFD_REQ_NODE_PIP_BY_INSTANCE_IP,
629
  ])
630