1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 """Module holding different constants."""
23
24 import re
25
26 from ganeti import _autoconf
27 from ganeti import _vcsversion
28
29
30 RELEASE_VERSION = _autoconf.PACKAGE_VERSION
31 OS_API_V10 = 10
32 OS_API_V15 = 15
33 OS_API_V20 = 20
34 OS_API_VERSIONS = frozenset([OS_API_V10, OS_API_V15, OS_API_V20])
35 VCS_VERSION = _vcsversion.VCS_VERSION
36 EXPORT_VERSION = 0
37 RAPI_VERSION = 2
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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
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
88 PROTOCOL_VERSION = BuildVersion(CONFIG_MAJOR, CONFIG_MINOR, 0)
89
90
91 DAEMONS_GROUP = _autoconf.DAEMONS_GROUP
92 ADMIN_GROUP = _autoconf.ADMIN_GROUP
93 MASTERD_USER = _autoconf.MASTERD_USER
94 MASTERD_GROUP = _autoconf.MASTERD_GROUP
95 RAPI_USER = _autoconf.RAPI_USER
96 RAPI_GROUP = _autoconf.RAPI_GROUP
97 CONFD_USER = _autoconf.CONFD_USER
98 CONFD_GROUP = _autoconf.CONFD_GROUP
99 NODED_USER = _autoconf.NODED_USER
100 NODED_GROUP = _autoconf.NODED_GROUP
101
102
103
104 DD_CMD = "dd"
105 WIPE_BLOCK_SIZE = 1024 ** 2
106 MAX_WIPE_CHUNK = 1024
107 MIN_WIPE_CHUNK_PERCENT = 10
108
109
110
111 DATA_DIR = _autoconf.LOCALSTATEDIR + "/lib/ganeti"
112 RUN_DIR = _autoconf.LOCALSTATEDIR + "/run"
113 RUN_GANETI_DIR = RUN_DIR + "/ganeti"
114 BDEV_CACHE_DIR = RUN_GANETI_DIR + "/bdev-cache"
115 DISK_LINKS_DIR = RUN_GANETI_DIR + "/instance-disks"
116 RUN_DIRS_MODE = 0775
117 SOCKET_DIR = RUN_GANETI_DIR + "/socket"
118 SECURE_DIR_MODE = 0700
119 SECURE_FILE_MODE = 0600
120 SOCKET_DIR_MODE = 0750
121 CRYPTO_KEYS_DIR = RUN_GANETI_DIR + "/crypto"
122 CRYPTO_KEYS_DIR_MODE = SECURE_DIR_MODE
123 IMPORT_EXPORT_DIR = RUN_GANETI_DIR + "/import-export"
124 IMPORT_EXPORT_DIR_MODE = 0755
125 ADOPTABLE_BLOCKDEV_ROOT = "/dev/disk/"
126
127
128 SUB_RUN_DIRS = [
129 RUN_GANETI_DIR,
130 BDEV_CACHE_DIR,
131 DISK_LINKS_DIR,
132 ]
133 LOCK_DIR = _autoconf.LOCALSTATEDIR + "/lock"
134 SSCONF_LOCK_FILE = LOCK_DIR + "/ganeti-ssconf.lock"
135
136
137 UIDPOOL_LOCKDIR = RUN_GANETI_DIR + "/uid-pool"
138 CLUSTER_CONF_FILE = DATA_DIR + "/config.data"
139 NODED_CERT_FILE = DATA_DIR + "/server.pem"
140 RAPI_CERT_FILE = DATA_DIR + "/rapi.pem"
141 CONFD_HMAC_KEY = DATA_DIR + "/hmac.key"
142 CLUSTER_DOMAIN_SECRET_FILE = DATA_DIR + "/cluster-domain-secret"
143 INSTANCE_STATUS_FILE = RUN_GANETI_DIR + "/instance-status"
144 SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts"
145 RAPI_USERS_FILE = DATA_DIR + "/rapi/users"
146 QUEUE_DIR = DATA_DIR + "/queue"
147 DAEMON_UTIL = _autoconf.PKGLIBDIR + "/daemon-util"
148 SETUP_SSH = _autoconf.TOOLSDIR + "/setup-ssh"
149 KVM_IFUP = _autoconf.PKGLIBDIR + "/kvm-ifup"
150 KVM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/kvm-console-wrapper"
151 XM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/xm-console-wrapper"
152 ETC_HOSTS = "/etc/hosts"
153 DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR
154 DEFAULT_SHARED_FILE_STORAGE_DIR = _autoconf.SHARED_FILE_STORAGE_DIR
155 ENABLE_FILE_STORAGE = _autoconf.ENABLE_FILE_STORAGE
156 ENABLE_SHARED_FILE_STORAGE = _autoconf.ENABLE_SHARED_FILE_STORAGE
157 SYSCONFDIR = _autoconf.SYSCONFDIR
158 TOOLSDIR = _autoconf.TOOLSDIR
159 CONF_DIR = SYSCONFDIR + "/ganeti"
160
161
162
163 WATCHER_LOCK_FILE = LOCK_DIR + "/ganeti-watcher.lock"
164
165
166 WATCHER_GROUP_STATE_FILE = DATA_DIR + "/watcher.%s.data"
167
168
169
170 WATCHER_GROUP_INSTANCE_STATUS_FILE = DATA_DIR + "/watcher.%s.instance-status"
171
172
173 WATCHER_PAUSEFILE = DATA_DIR + "/watcher.pause"
174
175 ALL_CERT_FILES = frozenset([NODED_CERT_FILE, RAPI_CERT_FILE])
176
177 MASTER_SOCKET = SOCKET_DIR + "/ganeti-master"
178
179 NODED = "ganeti-noded"
180 CONFD = "ganeti-confd"
181 RAPI = "ganeti-rapi"
182 MASTERD = "ganeti-masterd"
183
184 NLD = "ganeti-nld"
185
186 DAEMONS_PORTS = {
187
188 NODED: ("tcp", 1811),
189 CONFD: ("udp", 1814),
190 RAPI: ("tcp", 5080),
191 "ssh": ("tcp", 22),
192
193 NLD: ("udp", 1816),
194 }
195 DEFAULT_NODED_PORT = DAEMONS_PORTS[NODED][1]
196 DEFAULT_CONFD_PORT = DAEMONS_PORTS[CONFD][1]
197 DEFAULT_RAPI_PORT = DAEMONS_PORTS[RAPI][1]
198
199 DEFAULT_NLD_PORT = DAEMONS_PORTS[NLD][1]
200
201 FIRST_DRBD_PORT = 11000
202 LAST_DRBD_PORT = 14999
203 MASTER_SCRIPT = "ganeti-master"
204
205 LOG_DIR = _autoconf.LOCALSTATEDIR + "/log/ganeti/"
206 DAEMONS_LOGFILES = {
207
208 NODED: LOG_DIR + "node-daemon.log",
209 CONFD: LOG_DIR + "conf-daemon.log",
210 RAPI: LOG_DIR + "rapi-daemon.log",
211 MASTERD: LOG_DIR + "master-daemon.log",
212
213 NLD: LOG_DIR + "nl-daemon.log",
214 }
215
216 LOG_OS_DIR = LOG_DIR + "os"
217 LOG_WATCHER = LOG_DIR + "watcher.log"
218 LOG_COMMANDS = LOG_DIR + "commands.log"
219 LOG_BURNIN = LOG_DIR + "burnin.log"
220 LOG_SETUP_SSH = LOG_DIR + "setup-ssh.log"
221
222 DEV_CONSOLE = "/dev/console"
223
224 PROC_MOUNTS = "/proc/mounts"
225
226
227 LUXI_EOM = "\3"
228 LUXI_VERSION = CONFIG_VERSION
229
230
231 SYSLOG_USAGE = _autoconf.SYSLOG_USAGE
232 SYSLOG_NO = "no"
233 SYSLOG_YES = "yes"
234 SYSLOG_ONLY = "only"
235 SYSLOG_SOCKET = "/dev/log"
236
237 OS_SEARCH_PATH = _autoconf.OS_SEARCH_PATH
238 EXPORT_DIR = _autoconf.EXPORT_DIR
239
240 EXPORT_CONF_FILE = "config.ini"
241
242 XEN_BOOTLOADER = _autoconf.XEN_BOOTLOADER
243 XEN_KERNEL = _autoconf.XEN_KERNEL
244 XEN_INITRD = _autoconf.XEN_INITRD
245
246 KVM_PATH = _autoconf.KVM_PATH
247 SOCAT_PATH = _autoconf.SOCAT_PATH
248 SOCAT_USE_ESCAPE = _autoconf.SOCAT_USE_ESCAPE
249 SOCAT_USE_COMPRESS = _autoconf.SOCAT_USE_COMPRESS
250 SOCAT_ESCAPE_CODE = "0x1d"
251
252
253 CONS_SSH = "ssh"
254
255
256 CONS_VNC = "vnc"
257
258
259 CONS_MESSAGE = "msg"
260
261
262 CONS_ALL = frozenset([CONS_SSH, CONS_VNC, CONS_MESSAGE])
263
264
265
266
267 RSA_KEY_BITS = 2048
268
269
270
271
272
273
274
275 OPENSSL_CIPHERS = "HIGH:-DES:-3DES:-EXPORT:-ADH"
276
277
278 X509_CERT_SIGN_DIGEST = "SHA1"
279
280
281 X509_CERT_DEFAULT_VALIDITY = 365 * 5
282
283
284 X509_CERT_CN = "ganeti.example.com"
285
286 X509_CERT_SIGNATURE_HEADER = "X-Ganeti-Signature"
287
288 IMPORT_EXPORT_DAEMON = _autoconf.PKGLIBDIR + "/import-export"
289
290
291 IEM_IMPORT = "import"
292 IEM_EXPORT = "export"
293
294
295 IEC_NONE = "none"
296 IEC_GZIP = "gzip"
297 IEC_ALL = frozenset([
298 IEC_NONE,
299 IEC_GZIP,
300 ])
301
302 IE_CUSTOM_SIZE = "fd"
303
304 IE_MAGIC_RE = re.compile(r"^[-_.a-zA-Z0-9]{5,100}$")
305
306
307
308 IEIO_FILE = "file"
309
310 IEIO_RAW_DISK = "raw"
311
312 IEIO_SCRIPT = "script"
313
314 VALUE_DEFAULT = "default"
315 VALUE_AUTO = "auto"
316 VALUE_GENERATE = "generate"
317 VALUE_NONE = "none"
318 VALUE_TRUE = "true"
319 VALUE_FALSE = "false"
320
321
322 EXT_PLUGIN_MASK = re.compile("^[a-zA-Z0-9_-]+$")
323
324
325 HOOKS_BASE_DIR = CONF_DIR + "/hooks"
326 HOOKS_PHASE_PRE = "pre"
327 HOOKS_PHASE_POST = "post"
328 HOOKS_NAME_CFGUPDATE = "config-update"
329 HOOKS_NAME_WATCHER = "watcher"
330 HOOKS_VERSION = 2
331 HOOKS_PATH = "/sbin:/bin:/usr/sbin:/usr/bin"
332
333
334 HTYPE_CLUSTER = "CLUSTER"
335 HTYPE_NODE = "NODE"
336 HTYPE_GROUP = "GROUP"
337 HTYPE_INSTANCE = "INSTANCE"
338
339 HKR_SKIP = 0
340 HKR_FAIL = 1
341 HKR_SUCCESS = 2
342
343
344 ST_FILE = "file"
345 ST_LVM_PV = "lvm-pv"
346 ST_LVM_VG = "lvm-vg"
347
348
349
350 SF_NODE = "node"
351 SF_TYPE = "type"
352
353 SF_NAME = "name"
354 SF_SIZE = "size"
355 SF_FREE = "free"
356 SF_USED = "used"
357 SF_ALLOCATABLE = "allocatable"
358
359
360 SO_FIX_CONSISTENCY = "fix-consistency"
361
362
363 VALID_STORAGE_FIELDS = frozenset([
364 SF_NAME,
365 SF_TYPE,
366 SF_SIZE,
367 SF_USED,
368 SF_FREE,
369 SF_ALLOCATABLE
370 ])
371
372 VALID_STORAGE_TYPES = frozenset([ST_FILE, ST_LVM_PV, ST_LVM_VG])
373
374 MODIFIABLE_STORAGE_FIELDS = {
375 ST_LVM_PV: frozenset([SF_ALLOCATABLE]),
376 }
377
378 VALID_STORAGE_OPERATIONS = {
379 ST_LVM_VG: frozenset([SO_FIX_CONSISTENCY]),
380 }
381
382
383
384 (LDS_OKAY,
385 LDS_UNKNOWN,
386 LDS_FAULTY) = range(1, 4)
387
388
389 DT_DISKLESS = "diskless"
390 DT_PLAIN = "plain"
391 DT_DRBD8 = "drbd"
392 DT_FILE = "file"
393 DT_SHARED_FILE = "sharedfile"
394 DT_BLOCK = "blockdev"
395
396
397 DTS_INT_MIRROR = frozenset([DT_DRBD8])
398
399
400 DTS_EXT_MIRROR = frozenset([DT_SHARED_FILE, DT_BLOCK])
401
402
403 DTS_NOT_LVM = frozenset([DT_DISKLESS, DT_FILE, DT_SHARED_FILE, DT_BLOCK])
404
405
406 DTS_GROWABLE = frozenset([DT_PLAIN, DT_DRBD8, DT_FILE, DT_SHARED_FILE])
407
408
409 DTS_MAY_ADOPT = frozenset([DT_PLAIN, DT_BLOCK])
410
411
412 DTS_MUST_ADOPT = frozenset([DT_BLOCK])
413
414
415 DTS_MIRRORED = frozenset.union(DTS_INT_MIRROR, DTS_EXT_MIRROR)
416
417
418 DTS_FILEBASED = frozenset([DT_FILE, DT_SHARED_FILE])
419
420
421 LD_LV = "lvm"
422 LD_DRBD8 = "drbd8"
423 LD_FILE = "file"
424 LD_BLOCKDEV = "blockdev"
425 LDS_BLOCK = frozenset([LD_LV, LD_DRBD8, LD_BLOCKDEV])
426
427
428 DRBD_HMAC_ALG = "md5"
429 DRBD_NET_PROTOCOL = "C"
430 DRBD_BARRIERS = _autoconf.DRBD_BARRIERS
431
432
433 FD_LOOP = "loop"
434 FD_BLKTAP = "blktap"
435
436
437 LDS_DRBD = frozenset([LD_DRBD8])
438
439
440 DISK_RDONLY = "ro"
441 DISK_RDWR = "rw"
442 DISK_ACCESS_SET = frozenset([DISK_RDONLY, DISK_RDWR])
443
444
445 REPLACE_DISK_PRI = "replace_on_primary"
446 REPLACE_DISK_SEC = "replace_on_secondary"
447 REPLACE_DISK_CHG = "replace_new_secondary"
448 REPLACE_DISK_AUTO = "replace_auto"
449 REPLACE_MODES = frozenset([
450 REPLACE_DISK_PRI,
451 REPLACE_DISK_SEC,
452 REPLACE_DISK_CHG,
453 REPLACE_DISK_AUTO,
454 ])
455
456
457 EXPORT_MODE_LOCAL = "local"
458 EXPORT_MODE_REMOTE = "remote"
459 EXPORT_MODES = frozenset([
460 EXPORT_MODE_LOCAL,
461 EXPORT_MODE_REMOTE,
462 ])
463
464
465 LOCKS_REPLACE = "replace"
466 LOCKS_APPEND = "append"
467
468
469
470
471
472 LOCK_ATTEMPTS_TIMEOUT = 10 * 3600 / 20.0
473 LOCK_ATTEMPTS_MAXWAIT = 15.0
474 LOCK_ATTEMPTS_MINWAIT = 1.0
475
476
477 INSTANCE_CREATE = "create"
478 INSTANCE_IMPORT = "import"
479 INSTANCE_REMOTE_IMPORT = "remote-import"
480 INSTANCE_CREATE_MODES = frozenset([
481 INSTANCE_CREATE,
482 INSTANCE_IMPORT,
483 INSTANCE_REMOTE_IMPORT,
484 ])
485
486
487 RIE_VERSION = 0
488 RIE_HANDSHAKE = "Hi, I'm Ganeti"
489
490
491 RIE_CERT_VALIDITY = 24 * 60 * 60
492
493
494 RIE_CONNECT_TIMEOUT = 180
495
496
497 RIE_CONNECT_ATTEMPT_TIMEOUT = 20
498
499
500 RIE_CONNECT_RETRIES = 10
501
502
503 CHILD_LINGER_TIMEOUT = 5.0
504
505 DISK_TEMPLATES = frozenset([
506 DT_DISKLESS,
507 DT_PLAIN,
508 DT_DRBD8,
509 DT_FILE,
510 DT_SHARED_FILE,
511 DT_BLOCK
512 ])
513
514 FILE_DRIVER = frozenset([FD_LOOP, FD_BLKTAP])
515
516
517 INISECT_EXP = "export"
518 INISECT_INS = "instance"
519 INISECT_HYP = "hypervisor"
520 INISECT_BEP = "backend"
521 INISECT_OSP = "os"
522
523
524 DDM_ADD = "add"
525 DDM_REMOVE = "remove"
526 DDMS_VALUES = frozenset([DDM_ADD, DDM_REMOVE])
527
528
529 EXIT_SUCCESS = 0
530 EXIT_FAILURE = 1
531 EXIT_NOTCLUSTER = 5
532 EXIT_NOTMASTER = 11
533 EXIT_NODESETUP_ERROR = 12
534 EXIT_CONFIRMATION = 13
535
536
537 EXIT_UNKNOWN_FIELD = 14
538
539
540 TAG_CLUSTER = "cluster"
541 TAG_NODEGROUP = "nodegroup"
542 TAG_NODE = "node"
543 TAG_INSTANCE = "instance"
544 VALID_TAG_TYPES = frozenset([
545 TAG_CLUSTER,
546 TAG_NODEGROUP,
547 TAG_NODE,
548 TAG_INSTANCE,
549 ])
550 MAX_TAG_LEN = 128
551 MAX_TAGS_PER_OBJ = 4096
552
553
554 DEFAULT_BRIDGE = "xen-br0"
555 SYNC_SPEED = 60 * 1024
556 IP4_ADDRESS_LOCALHOST = "127.0.0.1"
557 IP4_ADDRESS_ANY = "0.0.0.0"
558 IP6_ADDRESS_LOCALHOST = "::1"
559 IP6_ADDRESS_ANY = "::"
560 IP4_VERSION = 4
561 IP6_VERSION = 6
562 VALID_IP_VERSIONS = frozenset([IP4_VERSION, IP6_VERSION])
563 TCP_PING_TIMEOUT = 10
564 GANETI_RUNAS = "root"
565 DEFAULT_VG = "xenvg"
566 DEFAULT_DRBD_HELPER = "/bin/true"
567 MIN_VG_SIZE = 20480
568 DEFAULT_MAC_PREFIX = "aa:00:00"
569 LVM_STRIPECOUNT = _autoconf.LVM_STRIPECOUNT
570
571 DEFAULT_SHUTDOWN_TIMEOUT = 120
572 NODE_MAX_CLOCK_SKEW = 150
573
574 DISK_TRANSFER_CONNECT_TIMEOUT = 60
575
576 DISK_SEPARATOR = _autoconf.DISK_SEPARATOR
577 IP_COMMAND_PATH = _autoconf.IP_PATH
578
579
580 JOB_IDS_KEY = "jobs"
581
582
583 (RUNPARTS_SKIP,
584 RUNPARTS_RUN,
585 RUNPARTS_ERR) = range(3)
586
587 RUNPARTS_STATUS = frozenset([RUNPARTS_SKIP, RUNPARTS_RUN, RUNPARTS_ERR])
588
589
590 (RPC_ENCODING_NONE,
591 RPC_ENCODING_ZLIB_BASE64) = range(2)
592
593
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
615 SSH_CONFIG_DIR = _autoconf.SSH_CONFIG_DIR
616 SSH_HOST_DSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_dsa_key"
617 SSH_HOST_DSA_PUB = SSH_HOST_DSA_PRIV + ".pub"
618 SSH_HOST_RSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_rsa_key"
619 SSH_HOST_RSA_PUB = SSH_HOST_RSA_PRIV + ".pub"
620 SSH = "ssh"
621 SCP = "scp"
622
623
624 INSTANCE_REBOOT_SOFT = "soft"
625 INSTANCE_REBOOT_HARD = "hard"
626 INSTANCE_REBOOT_FULL = "full"
627
628 REBOOT_TYPES = frozenset([
629 INSTANCE_REBOOT_SOFT,
630 INSTANCE_REBOOT_HARD,
631 INSTANCE_REBOOT_FULL
632 ])
633
634
635 INSTANCE_REBOOT_ALLOWED = "reboot"
636 INSTANCE_REBOOT_EXIT = "exit"
637
638 REBOOT_BEHAVIORS = frozenset([
639 INSTANCE_REBOOT_ALLOWED,
640 INSTANCE_REBOOT_EXIT
641 ])
642
643 VTYPE_STRING = "string"
644 VTYPE_MAYBE_STRING = "maybe-string"
645 VTYPE_BOOL = "bool"
646 VTYPE_SIZE = "size"
647 VTYPE_INT = "int"
648 ENFORCEABLE_TYPES = frozenset([
649 VTYPE_STRING,
650 VTYPE_MAYBE_STRING,
651 VTYPE_BOOL,
652 VTYPE_SIZE,
653 VTYPE_INT,
654 ])
655
656
657 IFACE_NO_IP_VERSION_SPECIFIED = 0
658
659
660 HV_BOOT_ORDER = "boot_order"
661 HV_CDROM_IMAGE_PATH = "cdrom_image_path"
662 HV_KVM_CDROM2_IMAGE_PATH = "cdrom2_image_path"
663 HV_KVM_FLOPPY_IMAGE_PATH = "floppy_image_path"
664 HV_NIC_TYPE = "nic_type"
665 HV_DISK_TYPE = "disk_type"
666 HV_KVM_CDROM_DISK_TYPE = "cdrom_disk_type"
667 HV_VNC_BIND_ADDRESS = "vnc_bind_address"
668 HV_VNC_PASSWORD_FILE = "vnc_password_file"
669 HV_VNC_TLS = "vnc_tls"
670 HV_VNC_X509 = "vnc_x509_path"
671 HV_VNC_X509_VERIFY = "vnc_x509_verify"
672 HV_KVM_SPICE_BIND = "spice_bind"
673 HV_KVM_SPICE_IP_VERSION = "spice_ip_version"
674 HV_ACPI = "acpi"
675 HV_PAE = "pae"
676 HV_USE_BOOTLOADER = "use_bootloader"
677 HV_BOOTLOADER_ARGS = "bootloader_args"
678 HV_BOOTLOADER_PATH = "bootloader_path"
679 HV_KERNEL_ARGS = "kernel_args"
680 HV_KERNEL_PATH = "kernel_path"
681 HV_INITRD_PATH = "initrd_path"
682 HV_ROOT_PATH = "root_path"
683 HV_SERIAL_CONSOLE = "serial_console"
684 HV_USB_MOUSE = "usb_mouse"
685 HV_KEYMAP = "keymap"
686 HV_DEVICE_MODEL = "device_model"
687 HV_INIT_SCRIPT = "init_script"
688 HV_MIGRATION_PORT = "migration_port"
689 HV_MIGRATION_BANDWIDTH = "migration_bandwidth"
690 HV_MIGRATION_DOWNTIME = "migration_downtime"
691 HV_MIGRATION_MODE = "migration_mode"
692 HV_USE_LOCALTIME = "use_localtime"
693 HV_DISK_CACHE = "disk_cache"
694 HV_SECURITY_MODEL = "security_model"
695 HV_SECURITY_DOMAIN = "security_domain"
696 HV_KVM_FLAG = "kvm_flag"
697 HV_VHOST_NET = "vhost_net"
698 HV_KVM_USE_CHROOT = "use_chroot"
699 HV_CPU_MASK = "cpu_mask"
700 HV_MEM_PATH = "mem_path"
701 HV_BLOCKDEV_PREFIX = "blockdev_prefix"
702 HV_REBOOT_BEHAVIOR = "reboot_behavior"
703
704 HVS_PARAMETER_TYPES = {
705 HV_BOOT_ORDER: VTYPE_STRING,
706 HV_KVM_FLOPPY_IMAGE_PATH: VTYPE_STRING,
707 HV_CDROM_IMAGE_PATH: VTYPE_STRING,
708 HV_KVM_CDROM2_IMAGE_PATH: VTYPE_STRING,
709 HV_NIC_TYPE: VTYPE_STRING,
710 HV_DISK_TYPE: VTYPE_STRING,
711 HV_KVM_CDROM_DISK_TYPE: VTYPE_STRING,
712 HV_VNC_PASSWORD_FILE: VTYPE_STRING,
713 HV_VNC_BIND_ADDRESS: VTYPE_STRING,
714 HV_VNC_TLS: VTYPE_BOOL,
715 HV_VNC_X509: VTYPE_STRING,
716 HV_VNC_X509_VERIFY: VTYPE_BOOL,
717 HV_KVM_SPICE_BIND: VTYPE_STRING,
718 HV_KVM_SPICE_IP_VERSION: VTYPE_INT,
719 HV_ACPI: VTYPE_BOOL,
720 HV_PAE: VTYPE_BOOL,
721 HV_USE_BOOTLOADER: VTYPE_BOOL,
722 HV_BOOTLOADER_PATH: VTYPE_STRING,
723 HV_BOOTLOADER_ARGS: VTYPE_STRING,
724 HV_KERNEL_PATH: VTYPE_STRING,
725 HV_KERNEL_ARGS: VTYPE_STRING,
726 HV_INITRD_PATH: VTYPE_STRING,
727 HV_ROOT_PATH: VTYPE_MAYBE_STRING,
728 HV_SERIAL_CONSOLE: VTYPE_BOOL,
729 HV_USB_MOUSE: VTYPE_STRING,
730 HV_KEYMAP: VTYPE_STRING,
731 HV_DEVICE_MODEL: VTYPE_STRING,
732 HV_INIT_SCRIPT: VTYPE_STRING,
733 HV_MIGRATION_PORT: VTYPE_INT,
734 HV_MIGRATION_BANDWIDTH: VTYPE_INT,
735 HV_MIGRATION_DOWNTIME: VTYPE_INT,
736 HV_MIGRATION_MODE: VTYPE_STRING,
737 HV_USE_LOCALTIME: VTYPE_BOOL,
738 HV_DISK_CACHE: VTYPE_STRING,
739 HV_SECURITY_MODEL: VTYPE_STRING,
740 HV_SECURITY_DOMAIN: VTYPE_STRING,
741 HV_KVM_FLAG: VTYPE_STRING,
742 HV_VHOST_NET: VTYPE_BOOL,
743 HV_KVM_USE_CHROOT: VTYPE_BOOL,
744 HV_CPU_MASK: VTYPE_STRING,
745 HV_MEM_PATH: VTYPE_STRING,
746 HV_BLOCKDEV_PREFIX: VTYPE_STRING,
747 HV_REBOOT_BEHAVIOR: VTYPE_STRING,
748 }
749
750 HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
751
752
753 BE_MEMORY = "memory"
754 BE_VCPUS = "vcpus"
755 BE_AUTO_BALANCE = "auto_balance"
756
757 BES_PARAMETER_TYPES = {
758 BE_MEMORY: VTYPE_SIZE,
759 BE_VCPUS: VTYPE_INT,
760 BE_AUTO_BALANCE: VTYPE_BOOL,
761 }
762
763 BES_PARAMETERS = frozenset(BES_PARAMETER_TYPES.keys())
764
765
766 ND_OOB_PROGRAM = "oob_program"
767
768 NDS_PARAMETER_TYPES = {
769 ND_OOB_PROGRAM: VTYPE_MAYBE_STRING,
770 }
771
772 NDS_PARAMETERS = frozenset(NDS_PARAMETER_TYPES.keys())
773
774
775 OOB_POWER_ON = "power-on"
776 OOB_POWER_OFF = "power-off"
777 OOB_POWER_CYCLE = "power-cycle"
778 OOB_POWER_STATUS = "power-status"
779 OOB_HEALTH = "health"
780
781 OOB_COMMANDS = frozenset([
782 OOB_POWER_ON,
783 OOB_POWER_OFF,
784 OOB_POWER_CYCLE,
785 OOB_POWER_STATUS,
786 OOB_HEALTH
787 ])
788
789 OOB_POWER_STATUS_POWERED = "powered"
790
791 OOB_TIMEOUT = 60
792 OOB_POWER_DELAY = 2.0
793
794 OOB_STATUS_OK = "OK"
795 OOB_STATUS_WARNING = "WARNING"
796 OOB_STATUS_CRITICAL = "CRITICAL"
797 OOB_STATUS_UNKNOWN = "UNKNOWN"
798
799 OOB_STATUSES = frozenset([
800 OOB_STATUS_OK,
801 OOB_STATUS_WARNING,
802 OOB_STATUS_CRITICAL,
803 OOB_STATUS_UNKNOWN,
804 ])
805
806
807 PP_DEFAULT = "default"
808
809
810 NIC_MODE = "mode"
811 NIC_LINK = "link"
812
813 NIC_MODE_BRIDGED = "bridged"
814 NIC_MODE_ROUTED = "routed"
815
816 NIC_VALID_MODES = frozenset([NIC_MODE_BRIDGED, NIC_MODE_ROUTED])
817
818 NICS_PARAMETER_TYPES = {
819 NIC_MODE: VTYPE_STRING,
820 NIC_LINK: VTYPE_STRING,
821 }
822
823 NICS_PARAMETERS = frozenset(NICS_PARAMETER_TYPES.keys())
824
825
826 IDISK_SIZE = "size"
827 IDISK_MODE = "mode"
828 IDISK_ADOPT = "adopt"
829 IDISK_VG = "vg"
830 IDISK_METAVG = "metavg"
831 IDISK_PARAMS_TYPES = {
832 IDISK_SIZE: VTYPE_SIZE,
833 IDISK_MODE: VTYPE_STRING,
834 IDISK_ADOPT: VTYPE_STRING,
835 IDISK_VG: VTYPE_STRING,
836 IDISK_METAVG: VTYPE_STRING,
837 }
838 IDISK_PARAMS = frozenset(IDISK_PARAMS_TYPES.keys())
839
840
841 INIC_MAC = "mac"
842 INIC_IP = "ip"
843 INIC_MODE = "mode"
844 INIC_LINK = "link"
845 INIC_PARAMS_TYPES = {
846 INIC_IP: VTYPE_MAYBE_STRING,
847 INIC_LINK: VTYPE_STRING,
848 INIC_MAC: VTYPE_STRING,
849 INIC_MODE: VTYPE_STRING,
850 }
851 INIC_PARAMS = frozenset(INIC_PARAMS_TYPES.keys())
852
853
854 HT_XEN_PVM = "xen-pvm"
855 HT_FAKE = "fake"
856 HT_XEN_HVM = "xen-hvm"
857 HT_KVM = "kvm"
858 HT_CHROOT = "chroot"
859 HT_LXC = "lxc"
860 HYPER_TYPES = frozenset([
861 HT_XEN_PVM,
862 HT_FAKE,
863 HT_XEN_HVM,
864 HT_KVM,
865 HT_CHROOT,
866 HT_LXC,
867 ])
868 HTS_REQ_PORT = frozenset([HT_XEN_HVM, HT_KVM])
869
870 VNC_BASE_PORT = 5900
871 VNC_PASSWORD_FILE = CONF_DIR + "/vnc-cluster-password"
872 VNC_DEFAULT_BIND_ADDRESS = IP4_ADDRESS_ANY
873
874
875 HT_NIC_RTL8139 = "rtl8139"
876 HT_NIC_NE2K_PCI = "ne2k_pci"
877 HT_NIC_NE2K_ISA = "ne2k_isa"
878 HT_NIC_I82551 = "i82551"
879 HT_NIC_I85557B = "i82557b"
880 HT_NIC_I8259ER = "i82559er"
881 HT_NIC_PCNET = "pcnet"
882 HT_NIC_E1000 = "e1000"
883 HT_NIC_PARAVIRTUAL = HT_DISK_PARAVIRTUAL = "paravirtual"
884
885 HT_HVM_VALID_NIC_TYPES = frozenset([
886 HT_NIC_RTL8139,
887 HT_NIC_NE2K_PCI,
888 HT_NIC_E1000,
889 HT_NIC_NE2K_ISA,
890 HT_NIC_PARAVIRTUAL
891 ])
892 HT_KVM_VALID_NIC_TYPES = frozenset([
893 HT_NIC_RTL8139,
894 HT_NIC_NE2K_PCI,
895 HT_NIC_NE2K_ISA,
896 HT_NIC_I82551,
897 HT_NIC_I85557B,
898 HT_NIC_I8259ER,
899 HT_NIC_PCNET,
900 HT_NIC_E1000,
901 HT_NIC_PARAVIRTUAL
902 ])
903
904
905 HT_DISK_IOEMU = "ioemu"
906 HT_DISK_IDE = "ide"
907 HT_DISK_SCSI = "scsi"
908 HT_DISK_SD = "sd"
909 HT_DISK_MTD = "mtd"
910 HT_DISK_PFLASH = "pflash"
911
912 HT_CACHE_DEFAULT = "default"
913 HT_CACHE_NONE = "none"
914 HT_CACHE_WTHROUGH = "writethrough"
915 HT_CACHE_WBACK = "writeback"
916 HT_VALID_CACHE_TYPES = frozenset([
917 HT_CACHE_DEFAULT,
918 HT_CACHE_NONE,
919 HT_CACHE_WTHROUGH,
920 HT_CACHE_WBACK
921 ])
922
923 HT_HVM_VALID_DISK_TYPES = frozenset([HT_DISK_PARAVIRTUAL, HT_DISK_IOEMU])
924 HT_KVM_VALID_DISK_TYPES = frozenset([
925 HT_DISK_PARAVIRTUAL,
926 HT_DISK_IDE,
927 HT_DISK_SCSI,
928 HT_DISK_SD,
929 HT_DISK_MTD,
930 HT_DISK_PFLASH
931 ])
932
933
934 HT_MOUSE_MOUSE = "mouse"
935 HT_MOUSE_TABLET = "tablet"
936
937 HT_KVM_VALID_MOUSE_TYPES = frozenset([HT_MOUSE_MOUSE, HT_MOUSE_TABLET])
938
939
940 HT_BO_FLOPPY = "floppy"
941 HT_BO_CDROM = "cdrom"
942 HT_BO_DISK = "disk"
943 HT_BO_NETWORK = "network"
944
945 HT_KVM_VALID_BO_TYPES = frozenset([
946 HT_BO_FLOPPY,
947 HT_BO_CDROM,
948 HT_BO_DISK,
949 HT_BO_NETWORK
950 ])
951
952
953 HT_SM_NONE = "none"
954 HT_SM_USER = "user"
955 HT_SM_POOL = "pool"
956
957 HT_KVM_VALID_SM_TYPES = frozenset([HT_SM_NONE, HT_SM_USER, HT_SM_POOL])
958
959
960 HT_KVM_ENABLED = "enabled"
961 HT_KVM_DISABLED = "disabled"
962
963 HT_KVM_FLAG_VALUES = frozenset([HT_KVM_ENABLED, HT_KVM_DISABLED])
964
965
966 HT_MIGRATION_LIVE = "live"
967 HT_MIGRATION_NONLIVE = "non-live"
968 HT_MIGRATION_MODES = frozenset([HT_MIGRATION_LIVE, HT_MIGRATION_NONLIVE])
969
970
971 VERIFY_NPLUSONE_MEM = "nplusone_mem"
972 VERIFY_OPTIONAL_CHECKS = frozenset([VERIFY_NPLUSONE_MEM])
973
974
975 NV_DRBDHELPER = "drbd-helper"
976 NV_DRBDLIST = "drbd-list"
977 NV_FILELIST = "filelist"
978 NV_HVINFO = "hvinfo"
979 NV_HYPERVISOR = "hypervisor"
980 NV_HVPARAMS = "hvparms"
981 NV_INSTANCELIST = "instancelist"
982 NV_LVLIST = "lvlist"
983 NV_MASTERIP = "master-ip"
984 NV_NODELIST = "nodelist"
985 NV_NODENETTEST = "node-net-test"
986 NV_NODESETUP = "nodesetup"
987 NV_OSLIST = "oslist"
988 NV_PVLIST = "pvlist"
989 NV_TIME = "time"
990 NV_VERSION = "version"
991 NV_VGLIST = "vglist"
992 NV_VMNODES = "vmnodes"
993 NV_OOB_PATHS = "oob-paths"
994 NV_BRIDGES = "bridges"
995
996
997 INSTST_RUNNING = "running"
998 INSTST_ADMINDOWN = "ADMIN_down"
999 INSTST_NODEOFFLINE = "ERROR_nodeoffline"
1000 INSTST_NODEDOWN = "ERROR_nodedown"
1001 INSTST_WRONGNODE = "ERROR_wrongnode"
1002 INSTST_ERRORUP = "ERROR_up"
1003 INSTST_ERRORDOWN = "ERROR_down"
1004 INSTST_ALL = frozenset([
1005 INSTST_RUNNING,
1006 INSTST_ADMINDOWN,
1007 INSTST_NODEOFFLINE,
1008 INSTST_NODEDOWN,
1009 INSTST_WRONGNODE,
1010 INSTST_ERRORUP,
1011 INSTST_ERRORDOWN,
1012 ])
1013
1014
1015 NR_REGULAR = "R"
1016 NR_MASTER = "M"
1017 NR_MCANDIDATE = "C"
1018 NR_DRAINED = "D"
1019 NR_OFFLINE = "O"
1020 NR_ALL = frozenset([
1021 NR_REGULAR,
1022 NR_MASTER,
1023 NR_MCANDIDATE,
1024 NR_DRAINED,
1025 NR_OFFLINE,
1026 ])
1027
1028
1029 SSL_CERT_EXPIRATION_WARN = 30
1030 SSL_CERT_EXPIRATION_ERROR = 7
1031
1032
1033 IALLOCATOR_VERSION = 2
1034 IALLOCATOR_DIR_IN = "in"
1035 IALLOCATOR_DIR_OUT = "out"
1036 VALID_IALLOCATOR_DIRECTIONS = frozenset([
1037 IALLOCATOR_DIR_IN,
1038 IALLOCATOR_DIR_OUT,
1039 ])
1040 IALLOCATOR_MODE_ALLOC = "allocate"
1041 IALLOCATOR_MODE_RELOC = "relocate"
1042 IALLOCATOR_MODE_CHG_GROUP = "change-group"
1043 IALLOCATOR_MODE_NODE_EVAC = "node-evacuate"
1044 VALID_IALLOCATOR_MODES = frozenset([
1045 IALLOCATOR_MODE_ALLOC,
1046 IALLOCATOR_MODE_RELOC,
1047 IALLOCATOR_MODE_CHG_GROUP,
1048 IALLOCATOR_MODE_NODE_EVAC,
1049 ])
1050 IALLOCATOR_SEARCH_PATH = _autoconf.IALLOCATOR_SEARCH_PATH
1051
1052 IALLOCATOR_NEVAC_PRI = "primary-only"
1053 IALLOCATOR_NEVAC_SEC = "secondary-only"
1054 IALLOCATOR_NEVAC_ALL = "all"
1055 IALLOCATOR_NEVAC_MODES = frozenset([
1056 IALLOCATOR_NEVAC_PRI,
1057 IALLOCATOR_NEVAC_SEC,
1058 IALLOCATOR_NEVAC_ALL,
1059 ])
1060
1061
1062 JOB_QUEUE_VERSION = 1
1063 JOB_QUEUE_LOCK_FILE = QUEUE_DIR + "/lock"
1064 JOB_QUEUE_VERSION_FILE = QUEUE_DIR + "/version"
1065 JOB_QUEUE_SERIAL_FILE = QUEUE_DIR + "/serial"
1066 JOB_QUEUE_ARCHIVE_DIR = QUEUE_DIR + "/archive"
1067 JOB_QUEUE_DRAIN_FILE = QUEUE_DIR + "/drain"
1068 JOB_QUEUE_SIZE_HARD_LIMIT = 5000
1069 JOB_QUEUE_DIRS = [QUEUE_DIR, JOB_QUEUE_ARCHIVE_DIR]
1070 JOB_QUEUE_DIRS_MODE = SECURE_DIR_MODE
1071
1072 JOB_ID_TEMPLATE = r"\d+"
1073 JOB_FILE_RE = re.compile(r"^job-(%s)$" % JOB_ID_TEMPLATE)
1074
1075
1076 JOB_NOTCHANGED = "nochange"
1077
1078
1079 JOB_STATUS_QUEUED = "queued"
1080 JOB_STATUS_WAITING = "waiting"
1081 JOB_STATUS_CANCELING = "canceling"
1082 JOB_STATUS_RUNNING = "running"
1083 JOB_STATUS_CANCELED = "canceled"
1084 JOB_STATUS_SUCCESS = "success"
1085 JOB_STATUS_ERROR = "error"
1086 JOBS_FINALIZED = frozenset([
1087 JOB_STATUS_CANCELED,
1088 JOB_STATUS_SUCCESS,
1089 JOB_STATUS_ERROR,
1090 ])
1091 JOB_STATUS_ALL = frozenset([
1092 JOB_STATUS_QUEUED,
1093 JOB_STATUS_WAITING,
1094 JOB_STATUS_CANCELING,
1095 JOB_STATUS_RUNNING,
1096 ]) | JOBS_FINALIZED
1097
1098
1099
1100 OP_STATUS_QUEUED = "queued"
1101 OP_STATUS_WAITING = "waiting"
1102 OP_STATUS_CANCELING = "canceling"
1103 OP_STATUS_RUNNING = "running"
1104
1105 OP_STATUS_CANCELED = "canceled"
1106 OP_STATUS_SUCCESS = "success"
1107 OP_STATUS_ERROR = "error"
1108 OPS_FINALIZED = frozenset([
1109 OP_STATUS_CANCELED,
1110 OP_STATUS_SUCCESS,
1111 OP_STATUS_ERROR
1112 ])
1113
1114
1115 OP_PRIO_LOWEST = +19
1116 OP_PRIO_HIGHEST = -20
1117
1118 OP_PRIO_LOW = +10
1119 OP_PRIO_NORMAL = 0
1120 OP_PRIO_HIGH = -10
1121
1122 OP_PRIO_SUBMIT_VALID = frozenset([
1123 OP_PRIO_LOW,
1124 OP_PRIO_NORMAL,
1125 OP_PRIO_HIGH,
1126 ])
1127
1128 OP_PRIO_DEFAULT = OP_PRIO_NORMAL
1129
1130
1131 ELOG_MESSAGE = "message"
1132 ELOG_PROGRESS = "progress"
1133 ELOG_REMOTE_IMPORT = "remote-import"
1134 ELOG_JQUEUE_TEST = "jqueue-test"
1135
1136
1137 ETC_HOSTS_ADD = "add"
1138 ETC_HOSTS_REMOVE = "remove"
1139
1140
1141 JQT_MSGPREFIX = "TESTMSG="
1142 JQT_EXPANDNAMES = "expandnames"
1143 JQT_EXEC = "exec"
1144 JQT_LOGMSG = "logmsg"
1145 JQT_STARTMSG = "startmsg"
1146 JQT_ALL = frozenset([
1147 JQT_EXPANDNAMES,
1148 JQT_EXEC,
1149 JQT_LOGMSG,
1150 JQT_STARTMSG,
1151 ])
1152
1153
1154 QR_INSTANCE = "instance"
1155 QR_NODE = "node"
1156 QR_LOCK = "lock"
1157 QR_GROUP = "group"
1158 QR_OS = "os"
1159
1160
1161 QR_VIA_OP = frozenset([QR_INSTANCE, QR_NODE, QR_GROUP, QR_OS])
1162
1163
1164 QR_VIA_LUXI = QR_VIA_OP.union([
1165 QR_LOCK,
1166 ])
1167
1168
1169 QR_VIA_RAPI = QR_VIA_LUXI
1170
1171
1172 QFT_UNKNOWN = "unknown"
1173 QFT_TEXT = "text"
1174 QFT_BOOL = "bool"
1175 QFT_NUMBER = "number"
1176 QFT_UNIT = "unit"
1177 QFT_TIMESTAMP = "timestamp"
1178 QFT_OTHER = "other"
1179
1180
1181 QFT_ALL = frozenset([
1182 QFT_UNKNOWN,
1183 QFT_TEXT,
1184 QFT_BOOL,
1185 QFT_NUMBER,
1186 QFT_UNIT,
1187 QFT_TIMESTAMP,
1188 QFT_OTHER,
1189 ])
1190
1191
1192
1193
1194 RS_NORMAL = 0
1195
1196 RS_UNKNOWN = 1
1197
1198 RS_NODATA = 2
1199
1200
1201
1202 RS_UNAVAIL = 3
1203
1204 RS_OFFLINE = 4
1205
1206 RS_ALL = frozenset([
1207 RS_NORMAL,
1208 RS_UNKNOWN,
1209 RS_NODATA,
1210 RS_UNAVAIL,
1211 RS_OFFLINE,
1212 ])
1213
1214
1215 RSS_DESCRIPTION = {
1216 RS_UNKNOWN: ("(unknown)", "??"),
1217 RS_NODATA: ("(nodata)", "?"),
1218 RS_OFFLINE: ("(offline)", "*"),
1219 RS_UNAVAIL: ("(unavail)", "-"),
1220 }
1221
1222
1223 MAX_NICS = 8
1224 MAX_DISKS = 16
1225
1226
1227 SS_CLUSTER_NAME = "cluster_name"
1228 SS_CLUSTER_TAGS = "cluster_tags"
1229 SS_FILE_STORAGE_DIR = "file_storage_dir"
1230 SS_SHARED_FILE_STORAGE_DIR = "shared_file_storage_dir"
1231 SS_MASTER_CANDIDATES = "master_candidates"
1232 SS_MASTER_CANDIDATES_IPS = "master_candidates_ips"
1233 SS_MASTER_IP = "master_ip"
1234 SS_MASTER_NETDEV = "master_netdev"
1235 SS_MASTER_NODE = "master_node"
1236 SS_NODE_LIST = "node_list"
1237 SS_NODE_PRIMARY_IPS = "node_primary_ips"
1238 SS_NODE_SECONDARY_IPS = "node_secondary_ips"
1239 SS_OFFLINE_NODES = "offline_nodes"
1240 SS_ONLINE_NODES = "online_nodes"
1241 SS_PRIMARY_IP_FAMILY = "primary_ip_family"
1242 SS_INSTANCE_LIST = "instance_list"
1243 SS_RELEASE_VERSION = "release_version"
1244 SS_HYPERVISOR_LIST = "hypervisor_list"
1245 SS_MAINTAIN_NODE_HEALTH = "maintain_node_health"
1246 SS_UID_POOL = "uid_pool"
1247 SS_NODEGROUPS = "nodegroups"
1248
1249 SS_FILE_PERMS = 0444
1250
1251
1252 DEFAULT_ENABLED_HYPERVISOR = HT_XEN_PVM
1253
1254 HVC_DEFAULTS = {
1255 HT_XEN_PVM: {
1256 HV_USE_BOOTLOADER: False,
1257 HV_BOOTLOADER_PATH: XEN_BOOTLOADER,
1258 HV_BOOTLOADER_ARGS: "",
1259 HV_KERNEL_PATH: XEN_KERNEL,
1260 HV_INITRD_PATH: "",
1261 HV_ROOT_PATH: "/dev/sda1",
1262 HV_KERNEL_ARGS: "ro",
1263 HV_MIGRATION_PORT: 8002,
1264 HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1265 HV_BLOCKDEV_PREFIX: "sd",
1266 HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1267 },
1268 HT_XEN_HVM: {
1269 HV_BOOT_ORDER: "cd",
1270 HV_CDROM_IMAGE_PATH: "",
1271 HV_NIC_TYPE: HT_NIC_RTL8139,
1272 HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
1273 HV_VNC_BIND_ADDRESS: IP4_ADDRESS_ANY,
1274 HV_VNC_PASSWORD_FILE: VNC_PASSWORD_FILE,
1275 HV_ACPI: True,
1276 HV_PAE: True,
1277 HV_KERNEL_PATH: "/usr/lib/xen/boot/hvmloader",
1278 HV_DEVICE_MODEL: "/usr/lib/xen/bin/qemu-dm",
1279 HV_MIGRATION_PORT: 8002,
1280 HV_MIGRATION_MODE: HT_MIGRATION_NONLIVE,
1281 HV_USE_LOCALTIME: False,
1282 HV_BLOCKDEV_PREFIX: "hd",
1283 HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1284 },
1285 HT_KVM: {
1286 HV_KERNEL_PATH: "/boot/vmlinuz-2.6-kvmU",
1287 HV_INITRD_PATH: "",
1288 HV_KERNEL_ARGS: "ro",
1289 HV_ROOT_PATH: "/dev/vda1",
1290 HV_ACPI: True,
1291 HV_SERIAL_CONSOLE: True,
1292 HV_VNC_BIND_ADDRESS: "",
1293 HV_VNC_TLS: False,
1294 HV_VNC_X509: "",
1295 HV_VNC_X509_VERIFY: False,
1296 HV_VNC_PASSWORD_FILE: "",
1297 HV_KVM_SPICE_BIND: "",
1298 HV_KVM_SPICE_IP_VERSION: IFACE_NO_IP_VERSION_SPECIFIED,
1299 HV_KVM_FLOPPY_IMAGE_PATH: "",
1300 HV_CDROM_IMAGE_PATH: "",
1301 HV_KVM_CDROM2_IMAGE_PATH: "",
1302 HV_BOOT_ORDER: HT_BO_DISK,
1303 HV_NIC_TYPE: HT_NIC_PARAVIRTUAL,
1304 HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
1305 HV_KVM_CDROM_DISK_TYPE: "",
1306 HV_USB_MOUSE: "",
1307 HV_KEYMAP: "",
1308 HV_MIGRATION_PORT: 8102,
1309 HV_MIGRATION_BANDWIDTH: 32,
1310 HV_MIGRATION_DOWNTIME: 30,
1311 HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1312 HV_USE_LOCALTIME: False,
1313 HV_DISK_CACHE: HT_CACHE_DEFAULT,
1314 HV_SECURITY_MODEL: HT_SM_NONE,
1315 HV_SECURITY_DOMAIN: "",
1316 HV_KVM_FLAG: "",
1317 HV_VHOST_NET: False,
1318 HV_KVM_USE_CHROOT: False,
1319 HV_MEM_PATH: "",
1320 HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1321 },
1322 HT_FAKE: {
1323 },
1324 HT_CHROOT: {
1325 HV_INIT_SCRIPT: "/ganeti-chroot",
1326 },
1327 HT_LXC: {
1328 HV_CPU_MASK: "",
1329 },
1330 }
1331
1332 HVC_GLOBALS = frozenset([
1333 HV_MIGRATION_PORT,
1334 HV_MIGRATION_BANDWIDTH,
1335 HV_MIGRATION_MODE,
1336 ])
1337
1338 BEC_DEFAULTS = {
1339 BE_MEMORY: 128,
1340 BE_VCPUS: 1,
1341 BE_AUTO_BALANCE: True,
1342 }
1343
1344 NDC_DEFAULTS = {
1345 ND_OOB_PROGRAM: None,
1346 }
1347
1348 NICC_DEFAULTS = {
1349 NIC_MODE: NIC_MODE_BRIDGED,
1350 NIC_LINK: DEFAULT_BRIDGE,
1351 }
1352
1353 MASTER_POOL_SIZE_DEFAULT = 10
1354
1355 CONFD_PROTOCOL_VERSION = 1
1356
1357 CONFD_REQ_PING = 0
1358 CONFD_REQ_NODE_ROLE_BYNAME = 1
1359 CONFD_REQ_NODE_PIP_BY_INSTANCE_IP = 2
1360 CONFD_REQ_CLUSTER_MASTER = 3
1361 CONFD_REQ_NODE_PIP_LIST = 4
1362 CONFD_REQ_MC_PIP_LIST = 5
1363 CONFD_REQ_INSTANCES_IPS_LIST = 6
1364
1365
1366
1367
1368 CONFD_REQQ_LINK = "0"
1369 CONFD_REQQ_IP = "1"
1370 CONFD_REQQ_IPLIST = "2"
1371 CONFD_REQQ_FIELDS = "3"
1372
1373 CONFD_REQFIELD_NAME = "0"
1374 CONFD_REQFIELD_IP = "1"
1375 CONFD_REQFIELD_MNODE_PIP = "2"
1376
1377 CONFD_REQS = frozenset([
1378 CONFD_REQ_PING,
1379 CONFD_REQ_NODE_ROLE_BYNAME,
1380 CONFD_REQ_NODE_PIP_BY_INSTANCE_IP,
1381 CONFD_REQ_CLUSTER_MASTER,
1382 CONFD_REQ_NODE_PIP_LIST,
1383 CONFD_REQ_MC_PIP_LIST,
1384 CONFD_REQ_INSTANCES_IPS_LIST,
1385 ])
1386
1387 CONFD_REPL_STATUS_OK = 0
1388 CONFD_REPL_STATUS_ERROR = 1
1389 CONFD_REPL_STATUS_NOTIMPLEMENTED = 2
1390
1391 CONFD_REPL_STATUSES = frozenset([
1392 CONFD_REPL_STATUS_OK,
1393 CONFD_REPL_STATUS_ERROR,
1394 CONFD_REPL_STATUS_NOTIMPLEMENTED,
1395 ])
1396
1397 (CONFD_NODE_ROLE_MASTER,
1398 CONFD_NODE_ROLE_CANDIDATE,
1399 CONFD_NODE_ROLE_OFFLINE,
1400 CONFD_NODE_ROLE_DRAINED,
1401 CONFD_NODE_ROLE_REGULAR,
1402 ) = range(5)
1403
1404
1405 CONFD_ERROR_UNKNOWN_ENTRY = 1
1406 CONFD_ERROR_INTERNAL = 2
1407 CONFD_ERROR_ARGUMENT = 3
1408
1409
1410
1411
1412 CONFD_MAX_CLOCK_SKEW = 2 * NODE_MAX_CLOCK_SKEW
1413
1414
1415
1416 CONFD_CONFIG_RELOAD_TIMEOUT = 60
1417
1418
1419
1420
1421 CONFD_CONFIG_RELOAD_RATELIMIT = 2
1422
1423
1424
1425
1426
1427 CONFD_MAGIC_FOURCC = "plj0"
1428
1429
1430
1431
1432 CONFD_DEFAULT_REQ_COVERAGE = 6
1433
1434
1435
1436
1437 CONFD_CLIENT_EXPIRE_TIMEOUT = 10
1438
1439
1440
1441
1442
1443
1444 MAX_UDP_DATA_SIZE = 61440
1445
1446
1447 UIDPOOL_UID_MIN = 0
1448 UIDPOOL_UID_MAX = 2 ** 32 - 1
1449
1450
1451 PGREP = "pgrep"
1452
1453
1454 INITIAL_NODE_GROUP_NAME = "default"
1455
1456
1457 ALLOC_POLICY_PREFERRED = "preferred"
1458 ALLOC_POLICY_LAST_RESORT = "last_resort"
1459 ALLOC_POLICY_UNALLOCABLE = "unallocable"
1460 VALID_ALLOC_POLICIES = [
1461 ALLOC_POLICY_PREFERRED,
1462 ALLOC_POLICY_LAST_RESORT,
1463 ALLOC_POLICY_UNALLOCABLE,
1464 ]
1465
1466
1467 BLOCKDEV_DRIVER_MANUAL = "manual"
1468
1469
1470 HTOOLS = _autoconf.HTOOLS
1471
1472 IALLOC_HAIL = "hail"
1473