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 import socket
26
27 from ganeti import _autoconf
28 from ganeti import _vcsversion
29 from ganeti import compat
30 from ganeti import pathutils
31
32
33
34 RELEASE_VERSION = _autoconf.PACKAGE_VERSION
35 OS_API_V10 = 10
36 OS_API_V15 = 15
37 OS_API_V20 = 20
38 OS_API_VERSIONS = compat.UniqueFrozenset([
39 OS_API_V10,
40 OS_API_V15,
41 OS_API_V20,
42 ])
43 VCS_VERSION = _vcsversion.VCS_VERSION
44 EXPORT_VERSION = 0
45 RAPI_VERSION = 2
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
63 """Calculates int version number from major, minor and revision numbers.
64
65 Returns: int representing version number
66
67 """
68 assert isinstance(major, int)
69 assert isinstance(minor, int)
70 assert isinstance(revision, int)
71 return (1000000 * major +
72 10000 * minor +
73 1 * revision)
74
75
77 """Splits version number stored in an int.
78
79 Returns: tuple; (major, minor, revision)
80
81 """
82 assert isinstance(version, int)
83
84 (major, remainder) = divmod(version, 1000000)
85 (minor, revision) = divmod(remainder, 10000)
86
87 return (major, minor, revision)
88
89
90 CONFIG_MAJOR = int(_autoconf.VERSION_MAJOR)
91 CONFIG_MINOR = int(_autoconf.VERSION_MINOR)
92 CONFIG_REVISION = 0
93 CONFIG_VERSION = BuildVersion(CONFIG_MAJOR, CONFIG_MINOR, CONFIG_REVISION)
94
95
96 PROTOCOL_VERSION = BuildVersion(CONFIG_MAJOR, CONFIG_MINOR, 0)
97
98
99 DAEMONS_GROUP = _autoconf.DAEMONS_GROUP
100 ADMIN_GROUP = _autoconf.ADMIN_GROUP
101 MASTERD_USER = _autoconf.MASTERD_USER
102 MASTERD_GROUP = _autoconf.MASTERD_GROUP
103 RAPI_USER = _autoconf.RAPI_USER
104 RAPI_GROUP = _autoconf.RAPI_GROUP
105 CONFD_USER = _autoconf.CONFD_USER
106 CONFD_GROUP = _autoconf.CONFD_GROUP
107 LUXID_USER = _autoconf.LUXID_USER
108 LUXID_GROUP = _autoconf.LUXID_GROUP
109 NODED_USER = _autoconf.NODED_USER
110 NODED_GROUP = _autoconf.NODED_GROUP
111 MOND_USER = _autoconf.MOND_USER
112 MOND_GROUP = _autoconf.MOND_GROUP
113 SSH_LOGIN_USER = _autoconf.SSH_LOGIN_USER
114 SSH_CONSOLE_USER = _autoconf.SSH_CONSOLE_USER
115
116
117 CPU_PINNING_SEP = ":"
118 CPU_PINNING_ALL = "all"
119
120 CPU_PINNING_ALL_VAL = -1
121
122 CPU_PINNING_OFF = [CPU_PINNING_ALL_VAL]
123
124
125
126
127
128
129
130
131 CPU_PINNING_ALL_XEN = "0-63"
132
133
134
135
136
137 CPU_PINNING_ALL_KVM = 0xFFFFFFFF
138
139
140 DD_CMD = "dd"
141 MAX_WIPE_CHUNK = 1024
142 MIN_WIPE_CHUNK_PERCENT = 10
143
144 RUN_DIRS_MODE = 0775
145 SECURE_DIR_MODE = 0700
146 SECURE_FILE_MODE = 0600
147 ADOPTABLE_BLOCKDEV_ROOT = "/dev/disk/"
148 ENABLE_FILE_STORAGE = _autoconf.ENABLE_FILE_STORAGE
149 ENABLE_SHARED_FILE_STORAGE = _autoconf.ENABLE_SHARED_FILE_STORAGE
150 ENABLE_CONFD = _autoconf.ENABLE_CONFD
151 ENABLE_MOND = _autoconf.ENABLE_MOND
152 ENABLE_SPLIT_QUERY = _autoconf.ENABLE_SPLIT_QUERY
153 ENABLE_RESTRICTED_COMMANDS = _autoconf.ENABLE_RESTRICTED_COMMANDS
154
155
156 SSH = "ssh"
157 SCP = "scp"
158
159 NODED = "ganeti-noded"
160 CONFD = "ganeti-confd"
161 LUXID = "ganeti-luxid"
162 RAPI = "ganeti-rapi"
163 MASTERD = "ganeti-masterd"
164 MOND = "ganeti-mond"
165
166 DAEMONS = compat.UniqueFrozenset([
167 NODED,
168 CONFD,
169 LUXID,
170 RAPI,
171 MASTERD,
172 MOND,
173 ])
174
175 DAEMONS_PORTS = {
176
177 NODED: ("tcp", 1811),
178 CONFD: ("udp", 1814),
179 MOND: ("tcp", 1815),
180 RAPI: ("tcp", 5080),
181 SSH: ("tcp", 22),
182 }
183
184 DEFAULT_NODED_PORT = DAEMONS_PORTS[NODED][1]
185 DEFAULT_CONFD_PORT = DAEMONS_PORTS[CONFD][1]
186 DEFAULT_MOND_PORT = DAEMONS_PORTS[MOND][1]
187 DEFAULT_RAPI_PORT = DAEMONS_PORTS[RAPI][1]
188
189 FIRST_DRBD_PORT = 11000
190 LAST_DRBD_PORT = 14999
191
192 DAEMONS_LOGBASE = {
193 NODED: "node-daemon",
194 CONFD: "conf-daemon",
195 LUXID: "luxi-daemon",
196 RAPI: "rapi-daemon",
197 MASTERD: "master-daemon",
198 MOND: "monitoring-daemon",
199 }
200
201 DAEMONS_LOGFILES = \
202 dict((daemon, pathutils.GetLogFilename(DAEMONS_LOGBASE[daemon]))
203 for daemon in DAEMONS_LOGBASE)
204
205
206
207
208
209
210 EXTRA_LOGREASON_ACCESS = "access"
211 EXTRA_LOGREASON_ERROR = "error"
212
213 VALID_EXTRA_LOGREASONS = compat.UniqueFrozenset([
214 EXTRA_LOGREASON_ACCESS,
215 EXTRA_LOGREASON_ERROR,
216 ])
217
218
219 DAEMONS_EXTRA_LOGBASE = {
220 MOND: {
221 EXTRA_LOGREASON_ACCESS: "monitoring-daemon-access",
222 EXTRA_LOGREASON_ERROR: "monitoring-daemon-error",
223 }
224 }
225
226 DAEMONS_EXTRA_LOGFILES = \
227 dict((daemon, dict((extra,
228 pathutils.GetLogFilename(DAEMONS_EXTRA_LOGBASE[daemon][extra]))
229 for extra in DAEMONS_EXTRA_LOGBASE[daemon]))
230 for daemon in DAEMONS_EXTRA_LOGBASE)
231
232 DEV_CONSOLE = "/dev/console"
233
234 PROC_MOUNTS = "/proc/mounts"
235
236
237 LUXI_EOM = "\3"
238 LUXI_VERSION = CONFIG_VERSION
239
240 LUXI_OVERRIDE = "FORCE_LUXI_SOCKET"
241 LUXI_OVERRIDE_MASTER = "master"
242 LUXI_OVERRIDE_QUERY = "query"
243 LUXI_SOCKET_PERMS = 0660
244
245
246 SYSLOG_USAGE = _autoconf.SYSLOG_USAGE
247 SYSLOG_NO = "no"
248 SYSLOG_YES = "yes"
249 SYSLOG_ONLY = "only"
250 SYSLOG_SOCKET = "/dev/log"
251
252 EXPORT_CONF_FILE = "config.ini"
253
254 XEN_BOOTLOADER = _autoconf.XEN_BOOTLOADER
255 XEN_KERNEL = _autoconf.XEN_KERNEL
256 XEN_INITRD = _autoconf.XEN_INITRD
257 XEN_CMD_XM = "xm"
258 XEN_CMD_XL = "xl"
259
260 XEN_CMD = _autoconf.XEN_CMD
261
262 KNOWN_XEN_COMMANDS = compat.UniqueFrozenset([
263 XEN_CMD_XM,
264 XEN_CMD_XL,
265 ])
266
267
268
269
270
271
272 XL_SSH_CMD = ("ssh -l %s -oGlobalKnownHostsFile=%s"
273 " -oUserKnownHostsFile=/dev/null"
274 " -oCheckHostIp=no -oStrictHostKeyChecking=yes"
275 " -oHostKeyAlias=%%s") % (SSH_LOGIN_USER,
276 pathutils.SSH_KNOWN_HOSTS_FILE)
277
278 KVM_PATH = _autoconf.KVM_PATH
279 KVM_KERNEL = _autoconf.KVM_KERNEL
280 SOCAT_PATH = _autoconf.SOCAT_PATH
281 SOCAT_USE_ESCAPE = _autoconf.SOCAT_USE_ESCAPE
282 SOCAT_USE_COMPRESS = _autoconf.SOCAT_USE_COMPRESS
283 SOCAT_ESCAPE_CODE = "0x1d"
284
285
286 CONS_SSH = "ssh"
287
288
289 CONS_VNC = "vnc"
290
291
292 CONS_SPICE = "spice"
293
294
295 CONS_MESSAGE = "msg"
296
297
298 CONS_ALL = compat.UniqueFrozenset([
299 CONS_SSH,
300 CONS_VNC,
301 CONS_SPICE,
302 CONS_MESSAGE,
303 ])
304
305
306
307
308 RSA_KEY_BITS = 2048
309
310
311
312
313
314
315
316 OPENSSL_CIPHERS = "HIGH:-DES:-3DES:-EXPORT:-ADH"
317
318
319 X509_CERT_SIGN_DIGEST = "SHA1"
320
321
322 X509_CERT_DEFAULT_VALIDITY = 365 * 5
323
324
325 X509_CERT_CN = "ganeti.example.com"
326
327 X509_CERT_SIGNATURE_HEADER = "X-Ganeti-Signature"
328
329
330 IEM_IMPORT = "import"
331 IEM_EXPORT = "export"
332
333
334 IEC_NONE = "none"
335 IEC_GZIP = "gzip"
336 IEC_ALL = compat.UniqueFrozenset([
337 IEC_NONE,
338 IEC_GZIP,
339 ])
340
341 IE_CUSTOM_SIZE = "fd"
342
343 IE_MAGIC_RE = re.compile(r"^[-_.a-zA-Z0-9]{5,100}$")
344
345
346
347 IEIO_FILE = "file"
348
349 IEIO_RAW_DISK = "raw"
350
351 IEIO_SCRIPT = "script"
352
353 VALUE_DEFAULT = "default"
354 VALUE_AUTO = "auto"
355 VALUE_GENERATE = "generate"
356 VALUE_NONE = "none"
357 VALUE_TRUE = "true"
358 VALUE_FALSE = "false"
359
360
361 EXT_PLUGIN_MASK = re.compile("^[a-zA-Z0-9_-]+$")
362
363
364 HOOKS_PHASE_PRE = "pre"
365 HOOKS_PHASE_POST = "post"
366 HOOKS_NAME_CFGUPDATE = "config-update"
367 HOOKS_NAME_WATCHER = "watcher"
368 HOOKS_VERSION = 2
369 HOOKS_PATH = "/sbin:/bin:/usr/sbin:/usr/bin"
370
371
372 HTYPE_CLUSTER = "CLUSTER"
373 HTYPE_NODE = "NODE"
374 HTYPE_GROUP = "GROUP"
375 HTYPE_INSTANCE = "INSTANCE"
376 HTYPE_NETWORK = "NETWORK"
377
378 HKR_SKIP = 0
379 HKR_FAIL = 1
380 HKR_SUCCESS = 2
381
382
383 ST_BLOCK = "blockdev"
384 ST_DISKLESS = "diskless"
385 ST_EXT = "ext"
386 ST_FILE = "file"
387 ST_LVM_PV = "lvm-pv"
388 ST_LVM_VG = "lvm-vg"
389 ST_RADOS = "rados"
390
391 VALID_STORAGE_TYPES = compat.UniqueFrozenset([
392 ST_BLOCK,
393 ST_DISKLESS,
394 ST_EXT,
395 ST_FILE,
396 ST_LVM_PV,
397 ST_LVM_VG,
398 ST_RADOS,
399 ])
400
401
402
403 SF_NODE = "node"
404 SF_TYPE = "type"
405
406 SF_NAME = "name"
407 SF_SIZE = "size"
408 SF_FREE = "free"
409 SF_USED = "used"
410 SF_ALLOCATABLE = "allocatable"
411
412
413 SO_FIX_CONSISTENCY = "fix-consistency"
414
415
416 VALID_STORAGE_FIELDS = compat.UniqueFrozenset([
417 SF_NAME,
418 SF_TYPE,
419 SF_SIZE,
420 SF_USED,
421 SF_FREE,
422 SF_ALLOCATABLE,
423 ])
424
425 MODIFIABLE_STORAGE_FIELDS = {
426 ST_LVM_PV: frozenset([SF_ALLOCATABLE]),
427 }
428
429 VALID_STORAGE_OPERATIONS = {
430 ST_LVM_VG: frozenset([SO_FIX_CONSISTENCY]),
431 }
432
433
434
435 (LDS_OKAY,
436 LDS_UNKNOWN,
437 LDS_FAULTY) = range(1, 4)
438
439
440 DT_BLOCK = "blockdev"
441 DT_DISKLESS = "diskless"
442 DT_DRBD8 = "drbd"
443 DT_EXT = "ext"
444 DT_FILE = "file"
445 DT_PLAIN = "plain"
446 DT_RBD = "rbd"
447 DT_SHARED_FILE = "sharedfile"
448
449
450
451
452
453 DISK_TEMPLATE_PREFERENCE = [
454 DT_DRBD8,
455 DT_PLAIN,
456 DT_FILE,
457 DT_SHARED_FILE,
458 DT_RBD,
459 DT_BLOCK,
460 DT_DISKLESS,
461 DT_EXT
462 ]
463
464 DISK_TEMPLATES = compat.UniqueFrozenset([
465 DT_DISKLESS,
466 DT_PLAIN,
467 DT_DRBD8,
468 DT_FILE,
469 DT_SHARED_FILE,
470 DT_BLOCK,
471 DT_RBD,
472 DT_EXT
473 ])
474
475
476 DEFAULT_ENABLED_DISK_TEMPLATES = compat.UniqueFrozenset([
477 DT_DRBD8,
478 DT_PLAIN,
479 ])
480
481
482 DISK_TEMPLATES_STORAGE_TYPE = {
483 DT_BLOCK: ST_BLOCK,
484 DT_DISKLESS: ST_DISKLESS,
485 DT_DRBD8: ST_LVM_VG,
486 DT_EXT: ST_EXT,
487 DT_FILE: ST_FILE,
488 DT_PLAIN: ST_LVM_VG,
489 DT_RBD: ST_RADOS,
490 DT_SHARED_FILE: ST_FILE,
491 }
492
493
494 DTS_INT_MIRROR = compat.UniqueFrozenset([DT_DRBD8])
495
496
497 DTS_EXT_MIRROR = compat.UniqueFrozenset([
498 DT_DISKLESS,
499 DT_SHARED_FILE,
500 DT_BLOCK,
501 DT_RBD,
502 DT_EXT,
503 ])
504
505
506 DTS_NOT_LVM = compat.UniqueFrozenset([
507 DT_DISKLESS,
508 DT_FILE,
509 DT_SHARED_FILE,
510 DT_BLOCK,
511 DT_RBD,
512 DT_EXT,
513 ])
514
515
516 DTS_GROWABLE = compat.UniqueFrozenset([
517 DT_PLAIN,
518 DT_DRBD8,
519 DT_FILE,
520 DT_SHARED_FILE,
521 DT_RBD,
522 DT_EXT,
523 ])
524
525
526 DTS_MAY_ADOPT = compat.UniqueFrozenset([
527 DT_PLAIN,
528 DT_BLOCK,
529 ])
530
531
532 DTS_MUST_ADOPT = compat.UniqueFrozenset([DT_BLOCK])
533
534
535 DTS_MIRRORED = frozenset.union(DTS_INT_MIRROR, DTS_EXT_MIRROR)
536
537
538 DTS_FILEBASED = compat.UniqueFrozenset([
539 DT_FILE,
540 DT_SHARED_FILE,
541 ])
542
543
544
545
546 DTS_COPYABLE = compat.UniqueFrozenset([
547 DT_FILE,
548 DT_PLAIN,
549 ])
550
551
552 DTS_EXCL_STORAGE = compat.UniqueFrozenset([DT_PLAIN])
553
554
555 DTS_NO_FREE_SPACE_CHECK = compat.UniqueFrozenset([
556 DT_FILE,
557 DT_SHARED_FILE,
558 DT_RBD,
559 DT_EXT,
560 ])
561
562
563 LD_LV = "lvm"
564 LD_DRBD8 = "drbd8"
565 LD_FILE = "file"
566 LD_BLOCKDEV = "blockdev"
567 LD_RBD = "rbd"
568 LD_EXT = "ext"
569 LOGICAL_DISK_TYPES = compat.UniqueFrozenset([
570 LD_LV,
571 LD_DRBD8,
572 LD_FILE,
573 LD_BLOCKDEV,
574 LD_RBD,
575 LD_EXT,
576 ])
577
578 LDS_BLOCK = compat.UniqueFrozenset([
579 LD_LV,
580 LD_DRBD8,
581 LD_BLOCKDEV,
582 LD_RBD,
583 LD_EXT,
584 ])
585
586
587 DRBD_HMAC_ALG = "md5"
588 DRBD_NET_PROTOCOL = "C"
589 DRBD_STATUS_FILE = "/proc/drbd"
590
591
592 DRBD_META_SIZE = 128
593
594
595 DRBD_B_NONE = "n"
596 DRBD_B_DISK_BARRIERS = "b"
597 DRBD_B_DISK_DRAIN = "d"
598 DRBD_B_DISK_FLUSH = "f"
599
600
601 DRBD_VALID_BARRIER_OPT = compat.UniqueFrozenset([
602 frozenset([DRBD_B_NONE]),
603 frozenset([DRBD_B_DISK_BARRIERS]),
604 frozenset([DRBD_B_DISK_DRAIN]),
605 frozenset([DRBD_B_DISK_FLUSH]),
606 frozenset([DRBD_B_DISK_DRAIN, DRBD_B_DISK_FLUSH]),
607 frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_DRAIN]),
608 frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_FLUSH]),
609 frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_FLUSH, DRBD_B_DISK_DRAIN]),
610 ])
611
612
613 RBD_CMD = "rbd"
614
615
616 FD_LOOP = "loop"
617 FD_BLKTAP = "blktap"
618 FD_BLKTAP2 = "blktap2"
619 FD_DEFAULT = FD_LOOP
620
621
622 LDS_DRBD = compat.UniqueFrozenset([LD_DRBD8])
623
624
625 DISK_RDONLY = "ro"
626 DISK_RDWR = "rw"
627 DISK_ACCESS_SET = compat.UniqueFrozenset([DISK_RDONLY, DISK_RDWR])
628
629
630 REPLACE_DISK_PRI = "replace_on_primary"
631 REPLACE_DISK_SEC = "replace_on_secondary"
632 REPLACE_DISK_CHG = "replace_new_secondary"
633 REPLACE_DISK_AUTO = "replace_auto"
634 REPLACE_MODES = compat.UniqueFrozenset([
635 REPLACE_DISK_PRI,
636 REPLACE_DISK_SEC,
637 REPLACE_DISK_CHG,
638 REPLACE_DISK_AUTO,
639 ])
640
641
642 EXPORT_MODE_LOCAL = "local"
643 EXPORT_MODE_REMOTE = "remote"
644 EXPORT_MODES = compat.UniqueFrozenset([
645 EXPORT_MODE_LOCAL,
646 EXPORT_MODE_REMOTE,
647 ])
648
649
650 INSTANCE_CREATE = "create"
651 INSTANCE_IMPORT = "import"
652 INSTANCE_REMOTE_IMPORT = "remote-import"
653 INSTANCE_CREATE_MODES = compat.UniqueFrozenset([
654 INSTANCE_CREATE,
655 INSTANCE_IMPORT,
656 INSTANCE_REMOTE_IMPORT,
657 ])
658
659
660 RIE_VERSION = 0
661 RIE_HANDSHAKE = "Hi, I'm Ganeti"
662
663
664 RIE_CERT_VALIDITY = 24 * 60 * 60
665
666
667 RIE_CONNECT_TIMEOUT = 180
668
669
670 RIE_CONNECT_ATTEMPT_TIMEOUT = 20
671
672
673 RIE_CONNECT_RETRIES = 10
674
675
676 CHILD_LINGER_TIMEOUT = 5.0
677
678 FILE_DRIVER = compat.UniqueFrozenset([FD_LOOP, FD_BLKTAP, FD_BLKTAP2])
679
680
681 INISECT_EXP = "export"
682 INISECT_INS = "instance"
683 INISECT_HYP = "hypervisor"
684 INISECT_BEP = "backend"
685 INISECT_OSP = "os"
686
687
688 DDM_ADD = "add"
689 DDM_MODIFY = "modify"
690 DDM_REMOVE = "remove"
691 DDMS_VALUES = compat.UniqueFrozenset([DDM_ADD, DDM_REMOVE])
692 DDMS_VALUES_WITH_MODIFY = (DDMS_VALUES | frozenset([
693 DDM_MODIFY,
694 ]))
695
696
697
698 EXIT_SUCCESS = 0
699 EXIT_FAILURE = 1
700 EXIT_NOTCLUSTER = 5
701 EXIT_NOTMASTER = 11
702 EXIT_NODESETUP_ERROR = 12
703 EXIT_CONFIRMATION = 13
704
705
706 EXIT_UNKNOWN_FIELD = 14
707
708
709 TAG_CLUSTER = "cluster"
710 TAG_NODEGROUP = "nodegroup"
711 TAG_NODE = "node"
712 TAG_INSTANCE = "instance"
713 TAG_NETWORK = "network"
714 VALID_TAG_TYPES = compat.UniqueFrozenset([
715 TAG_CLUSTER,
716 TAG_NODEGROUP,
717 TAG_NODE,
718 TAG_INSTANCE,
719 TAG_NETWORK,
720 ])
721 MAX_TAG_LEN = 128
722 MAX_TAGS_PER_OBJ = 4096
723
724
725 DEFAULT_BRIDGE = "xen-br0"
726 CLASSIC_DRBD_SYNC_SPEED = 60 * 1024
727 IP4_ADDRESS_LOCALHOST = "127.0.0.1"
728 IP4_ADDRESS_ANY = "0.0.0.0"
729 IP6_ADDRESS_LOCALHOST = "::1"
730 IP6_ADDRESS_ANY = "::"
731 IP4_VERSION = 4
732 IP6_VERSION = 6
733 VALID_IP_VERSIONS = compat.UniqueFrozenset([IP4_VERSION, IP6_VERSION])
734
735 IP4_FAMILY = socket.AF_INET
736 IP6_FAMILY = socket.AF_INET6
737
738 TCP_PING_TIMEOUT = 10
739 DEFAULT_VG = "xenvg"
740 DEFAULT_DRBD_HELPER = "/bin/true"
741 MIN_VG_SIZE = 20480
742 DEFAULT_MAC_PREFIX = "aa:00:00"
743
744 DEFAULT_SHUTDOWN_TIMEOUT = 120
745 NODE_MAX_CLOCK_SKEW = 150
746
747 DISK_TRANSFER_CONNECT_TIMEOUT = 60
748
749 DISK_SEPARATOR = _autoconf.DISK_SEPARATOR
750 IP_COMMAND_PATH = _autoconf.IP_PATH
751
752
753 JOB_IDS_KEY = "jobs"
754
755
756 (RUNPARTS_SKIP,
757 RUNPARTS_RUN,
758 RUNPARTS_ERR) = range(3)
759
760 RUNPARTS_STATUS = compat.UniqueFrozenset([
761 RUNPARTS_SKIP,
762 RUNPARTS_RUN,
763 RUNPARTS_ERR,
764 ])
765
766
767 (RPC_ENCODING_NONE,
768 RPC_ENCODING_ZLIB_BASE64) = range(2)
769
770
771 RPC_TMO_URGENT = 60
772 RPC_TMO_FAST = 5 * 60
773 RPC_TMO_NORMAL = 15 * 60
774 RPC_TMO_SLOW = 3600
775 RPC_TMO_4HRS = 4 * 3600
776 RPC_TMO_1DAY = 86400
777
778
779 RPC_CONNECT_TIMEOUT = 5
780
781
782 OS_SCRIPT_CREATE = "create"
783 OS_SCRIPT_IMPORT = "import"
784 OS_SCRIPT_EXPORT = "export"
785 OS_SCRIPT_RENAME = "rename"
786 OS_SCRIPT_VERIFY = "verify"
787 OS_SCRIPTS = compat.UniqueFrozenset([
788 OS_SCRIPT_CREATE,
789 OS_SCRIPT_IMPORT,
790 OS_SCRIPT_EXPORT,
791 OS_SCRIPT_RENAME,
792 OS_SCRIPT_VERIFY,
793 ])
794
795 OS_API_FILE = "ganeti_api_version"
796 OS_VARIANTS_FILE = "variants.list"
797 OS_PARAMETERS_FILE = "parameters.list"
798
799 OS_VALIDATE_PARAMETERS = "parameters"
800 OS_VALIDATE_CALLS = compat.UniqueFrozenset([OS_VALIDATE_PARAMETERS])
801
802
803 ES_ACTION_CREATE = "create"
804 ES_ACTION_REMOVE = "remove"
805 ES_ACTION_GROW = "grow"
806 ES_ACTION_ATTACH = "attach"
807 ES_ACTION_DETACH = "detach"
808 ES_ACTION_SETINFO = "setinfo"
809 ES_ACTION_VERIFY = "verify"
810
811 ES_SCRIPT_CREATE = ES_ACTION_CREATE
812 ES_SCRIPT_REMOVE = ES_ACTION_REMOVE
813 ES_SCRIPT_GROW = ES_ACTION_GROW
814 ES_SCRIPT_ATTACH = ES_ACTION_ATTACH
815 ES_SCRIPT_DETACH = ES_ACTION_DETACH
816 ES_SCRIPT_SETINFO = ES_ACTION_SETINFO
817 ES_SCRIPT_VERIFY = ES_ACTION_VERIFY
818 ES_SCRIPTS = frozenset([
819 ES_SCRIPT_CREATE,
820 ES_SCRIPT_REMOVE,
821 ES_SCRIPT_GROW,
822 ES_SCRIPT_ATTACH,
823 ES_SCRIPT_DETACH,
824 ES_SCRIPT_SETINFO,
825 ES_SCRIPT_VERIFY
826 ])
827
828 ES_PARAMETERS_FILE = "parameters.list"
829
830
831 INSTANCE_REBOOT_SOFT = "soft"
832 INSTANCE_REBOOT_HARD = "hard"
833 INSTANCE_REBOOT_FULL = "full"
834
835 REBOOT_TYPES = compat.UniqueFrozenset([
836 INSTANCE_REBOOT_SOFT,
837 INSTANCE_REBOOT_HARD,
838 INSTANCE_REBOOT_FULL,
839 ])
840
841
842 INSTANCE_REBOOT_ALLOWED = "reboot"
843 INSTANCE_REBOOT_EXIT = "exit"
844
845 REBOOT_BEHAVIORS = compat.UniqueFrozenset([
846 INSTANCE_REBOOT_ALLOWED,
847 INSTANCE_REBOOT_EXIT,
848 ])
849
850 VTYPE_STRING = "string"
851 VTYPE_MAYBE_STRING = "maybe-string"
852 VTYPE_BOOL = "bool"
853 VTYPE_SIZE = "size"
854 VTYPE_INT = "int"
855 ENFORCEABLE_TYPES = compat.UniqueFrozenset([
856 VTYPE_STRING,
857 VTYPE_MAYBE_STRING,
858 VTYPE_BOOL,
859 VTYPE_SIZE,
860 VTYPE_INT,
861 ])
862
863
864 IFACE_NO_IP_VERSION_SPECIFIED = 0
865
866 VALID_SERIAL_SPEEDS = compat.UniqueFrozenset([
867 75,
868 110,
869 300,
870 600,
871 1200,
872 1800,
873 2400,
874 4800,
875 9600,
876 14400,
877 19200,
878 28800,
879 38400,
880 57600,
881 115200,
882 230400,
883 345600,
884 460800,
885 ])
886
887
888 HV_BOOT_ORDER = "boot_order"
889 HV_CDROM_IMAGE_PATH = "cdrom_image_path"
890 HV_KVM_CDROM2_IMAGE_PATH = "cdrom2_image_path"
891 HV_KVM_FLOPPY_IMAGE_PATH = "floppy_image_path"
892 HV_NIC_TYPE = "nic_type"
893 HV_DISK_TYPE = "disk_type"
894 HV_KVM_CDROM_DISK_TYPE = "cdrom_disk_type"
895 HV_VNC_BIND_ADDRESS = "vnc_bind_address"
896 HV_VNC_PASSWORD_FILE = "vnc_password_file"
897 HV_VNC_TLS = "vnc_tls"
898 HV_VNC_X509 = "vnc_x509_path"
899 HV_VNC_X509_VERIFY = "vnc_x509_verify"
900 HV_KVM_SPICE_BIND = "spice_bind"
901 HV_KVM_SPICE_IP_VERSION = "spice_ip_version"
902 HV_KVM_SPICE_PASSWORD_FILE = "spice_password_file"
903 HV_KVM_SPICE_LOSSLESS_IMG_COMPR = "spice_image_compression"
904 HV_KVM_SPICE_JPEG_IMG_COMPR = "spice_jpeg_wan_compression"
905 HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR = "spice_zlib_glz_wan_compression"
906 HV_KVM_SPICE_STREAMING_VIDEO_DETECTION = "spice_streaming_video"
907 HV_KVM_SPICE_AUDIO_COMPR = "spice_playback_compression"
908 HV_KVM_SPICE_USE_TLS = "spice_use_tls"
909 HV_KVM_SPICE_TLS_CIPHERS = "spice_tls_ciphers"
910 HV_KVM_SPICE_USE_VDAGENT = "spice_use_vdagent"
911 HV_ACPI = "acpi"
912 HV_PAE = "pae"
913 HV_USE_BOOTLOADER = "use_bootloader"
914 HV_BOOTLOADER_ARGS = "bootloader_args"
915 HV_BOOTLOADER_PATH = "bootloader_path"
916 HV_KERNEL_ARGS = "kernel_args"
917 HV_KERNEL_PATH = "kernel_path"
918 HV_INITRD_PATH = "initrd_path"
919 HV_ROOT_PATH = "root_path"
920 HV_SERIAL_CONSOLE = "serial_console"
921 HV_SERIAL_SPEED = "serial_speed"
922 HV_USB_MOUSE = "usb_mouse"
923 HV_KEYMAP = "keymap"
924 HV_DEVICE_MODEL = "device_model"
925 HV_INIT_SCRIPT = "init_script"
926 HV_MIGRATION_PORT = "migration_port"
927 HV_MIGRATION_BANDWIDTH = "migration_bandwidth"
928 HV_MIGRATION_DOWNTIME = "migration_downtime"
929 HV_MIGRATION_MODE = "migration_mode"
930 HV_USE_LOCALTIME = "use_localtime"
931 HV_DISK_CACHE = "disk_cache"
932 HV_SECURITY_MODEL = "security_model"
933 HV_SECURITY_DOMAIN = "security_domain"
934 HV_KVM_FLAG = "kvm_flag"
935 HV_VHOST_NET = "vhost_net"
936 HV_KVM_USE_CHROOT = "use_chroot"
937 HV_CPU_MASK = "cpu_mask"
938 HV_MEM_PATH = "mem_path"
939 HV_PASSTHROUGH = "pci_pass"
940 HV_BLOCKDEV_PREFIX = "blockdev_prefix"
941 HV_REBOOT_BEHAVIOR = "reboot_behavior"
942 HV_CPU_TYPE = "cpu_type"
943 HV_CPU_CAP = "cpu_cap"
944 HV_CPU_WEIGHT = "cpu_weight"
945 HV_CPU_CORES = "cpu_cores"
946 HV_CPU_THREADS = "cpu_threads"
947 HV_CPU_SOCKETS = "cpu_sockets"
948 HV_SOUNDHW = "soundhw"
949 HV_USB_DEVICES = "usb_devices"
950 HV_VGA = "vga"
951 HV_KVM_EXTRA = "kvm_extra"
952 HV_KVM_MACHINE_VERSION = "machine_version"
953 HV_KVM_PATH = "kvm_path"
954 HV_VIF_TYPE = "vif_type"
955 HV_VNET_HDR = "vnet_hdr"
956 HV_VIRIDIAN = "viridian"
957
958
959 HVS_PARAMETER_TYPES = {
960 HV_KVM_PATH: VTYPE_STRING,
961 HV_BOOT_ORDER: VTYPE_STRING,
962 HV_KVM_FLOPPY_IMAGE_PATH: VTYPE_STRING,
963 HV_CDROM_IMAGE_PATH: VTYPE_STRING,
964 HV_KVM_CDROM2_IMAGE_PATH: VTYPE_STRING,
965 HV_NIC_TYPE: VTYPE_STRING,
966 HV_DISK_TYPE: VTYPE_STRING,
967 HV_KVM_CDROM_DISK_TYPE: VTYPE_STRING,
968 HV_VNC_PASSWORD_FILE: VTYPE_STRING,
969 HV_VNC_BIND_ADDRESS: VTYPE_STRING,
970 HV_VNC_TLS: VTYPE_BOOL,
971 HV_VNC_X509: VTYPE_STRING,
972 HV_VNC_X509_VERIFY: VTYPE_BOOL,
973 HV_KVM_SPICE_BIND: VTYPE_STRING,
974 HV_KVM_SPICE_IP_VERSION: VTYPE_INT,
975 HV_KVM_SPICE_PASSWORD_FILE: VTYPE_STRING,
976 HV_KVM_SPICE_LOSSLESS_IMG_COMPR: VTYPE_STRING,
977 HV_KVM_SPICE_JPEG_IMG_COMPR: VTYPE_STRING,
978 HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR: VTYPE_STRING,
979 HV_KVM_SPICE_STREAMING_VIDEO_DETECTION: VTYPE_STRING,
980 HV_KVM_SPICE_AUDIO_COMPR: VTYPE_BOOL,
981 HV_KVM_SPICE_USE_TLS: VTYPE_BOOL,
982 HV_KVM_SPICE_TLS_CIPHERS: VTYPE_STRING,
983 HV_KVM_SPICE_USE_VDAGENT: VTYPE_BOOL,
984 HV_ACPI: VTYPE_BOOL,
985 HV_PAE: VTYPE_BOOL,
986 HV_USE_BOOTLOADER: VTYPE_BOOL,
987 HV_BOOTLOADER_PATH: VTYPE_STRING,
988 HV_BOOTLOADER_ARGS: VTYPE_STRING,
989 HV_KERNEL_PATH: VTYPE_STRING,
990 HV_KERNEL_ARGS: VTYPE_STRING,
991 HV_INITRD_PATH: VTYPE_STRING,
992 HV_ROOT_PATH: VTYPE_MAYBE_STRING,
993 HV_SERIAL_CONSOLE: VTYPE_BOOL,
994 HV_SERIAL_SPEED: VTYPE_INT,
995 HV_USB_MOUSE: VTYPE_STRING,
996 HV_KEYMAP: VTYPE_STRING,
997 HV_DEVICE_MODEL: VTYPE_STRING,
998 HV_INIT_SCRIPT: VTYPE_STRING,
999 HV_MIGRATION_PORT: VTYPE_INT,
1000 HV_MIGRATION_BANDWIDTH: VTYPE_INT,
1001 HV_MIGRATION_DOWNTIME: VTYPE_INT,
1002 HV_MIGRATION_MODE: VTYPE_STRING,
1003 HV_USE_LOCALTIME: VTYPE_BOOL,
1004 HV_DISK_CACHE: VTYPE_STRING,
1005 HV_SECURITY_MODEL: VTYPE_STRING,
1006 HV_SECURITY_DOMAIN: VTYPE_STRING,
1007 HV_KVM_FLAG: VTYPE_STRING,
1008 HV_VHOST_NET: VTYPE_BOOL,
1009 HV_KVM_USE_CHROOT: VTYPE_BOOL,
1010 HV_CPU_MASK: VTYPE_STRING,
1011 HV_MEM_PATH: VTYPE_STRING,
1012 HV_PASSTHROUGH: VTYPE_STRING,
1013 HV_BLOCKDEV_PREFIX: VTYPE_STRING,
1014 HV_REBOOT_BEHAVIOR: VTYPE_STRING,
1015 HV_CPU_TYPE: VTYPE_STRING,
1016 HV_CPU_CAP: VTYPE_INT,
1017 HV_CPU_WEIGHT: VTYPE_INT,
1018 HV_CPU_CORES: VTYPE_INT,
1019 HV_CPU_THREADS: VTYPE_INT,
1020 HV_CPU_SOCKETS: VTYPE_INT,
1021 HV_SOUNDHW: VTYPE_STRING,
1022 HV_USB_DEVICES: VTYPE_STRING,
1023 HV_VGA: VTYPE_STRING,
1024 HV_KVM_EXTRA: VTYPE_STRING,
1025 HV_KVM_MACHINE_VERSION: VTYPE_STRING,
1026 HV_VIF_TYPE: VTYPE_STRING,
1027 HV_VNET_HDR: VTYPE_BOOL,
1028 HV_VIRIDIAN: VTYPE_BOOL,
1029 }
1030
1031 HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
1032
1033 HVS_PARAMETER_TITLES = {
1034 HV_ACPI: "ACPI",
1035 HV_BOOT_ORDER: "Boot_order",
1036 HV_CDROM_IMAGE_PATH: "CDROM_image_path",
1037 HV_DISK_TYPE: "Disk_type",
1038 HV_INITRD_PATH: "Initrd_path",
1039 HV_KERNEL_PATH: "Kernel_path",
1040 HV_NIC_TYPE: "NIC_type",
1041 HV_PAE: "PAE",
1042 HV_VNC_BIND_ADDRESS: "VNC_bind_address",
1043 HV_PASSTHROUGH: "pci_pass",
1044 HV_CPU_TYPE: "cpu_type",
1045 }
1046
1047
1048 HV_MIGRATION_COMPLETED = "completed"
1049 HV_MIGRATION_ACTIVE = "active"
1050 HV_MIGRATION_FAILED = "failed"
1051 HV_MIGRATION_CANCELLED = "cancelled"
1052
1053 HV_MIGRATION_VALID_STATUSES = compat.UniqueFrozenset([
1054 HV_MIGRATION_COMPLETED,
1055 HV_MIGRATION_ACTIVE,
1056 HV_MIGRATION_FAILED,
1057 HV_MIGRATION_CANCELLED,
1058 ])
1059
1060 HV_MIGRATION_FAILED_STATUSES = compat.UniqueFrozenset([
1061 HV_MIGRATION_FAILED,
1062 HV_MIGRATION_CANCELLED,
1063 ])
1064
1065
1066 HV_KVM_MIGRATION_VALID_STATUSES = HV_MIGRATION_VALID_STATUSES
1067
1068
1069 HV_NODEINFO_KEY_VERSION = "hv_version"
1070
1071
1072 HVST_MEMORY_TOTAL = "mem_total"
1073 HVST_MEMORY_NODE = "mem_node"
1074 HVST_MEMORY_HV = "mem_hv"
1075 HVST_CPU_TOTAL = "cpu_total"
1076 HVST_CPU_NODE = "cpu_node"
1077
1078 HVST_DEFAULTS = {
1079 HVST_MEMORY_TOTAL: 0,
1080 HVST_MEMORY_NODE: 0,
1081 HVST_MEMORY_HV: 0,
1082 HVST_CPU_TOTAL: 1,
1083 HVST_CPU_NODE: 1,
1084 }
1085
1086 HVSTS_PARAMETER_TYPES = {
1087 HVST_MEMORY_TOTAL: VTYPE_INT,
1088 HVST_MEMORY_NODE: VTYPE_INT,
1089 HVST_MEMORY_HV: VTYPE_INT,
1090 HVST_CPU_TOTAL: VTYPE_INT,
1091 HVST_CPU_NODE: VTYPE_INT,
1092 }
1093
1094 HVSTS_PARAMETERS = frozenset(HVSTS_PARAMETER_TYPES.keys())
1095
1096
1097 DS_DISK_TOTAL = "disk_total"
1098 DS_DISK_RESERVED = "disk_reserved"
1099 DS_DISK_OVERHEAD = "disk_overhead"
1100
1101 DS_DEFAULTS = {
1102 DS_DISK_TOTAL: 0,
1103 DS_DISK_RESERVED: 0,
1104 DS_DISK_OVERHEAD: 0,
1105 }
1106
1107 DSS_PARAMETER_TYPES = {
1108 DS_DISK_TOTAL: VTYPE_INT,
1109 DS_DISK_RESERVED: VTYPE_INT,
1110 DS_DISK_OVERHEAD: VTYPE_INT,
1111 }
1112
1113 DSS_PARAMETERS = frozenset(DSS_PARAMETER_TYPES.keys())
1114 DS_VALID_TYPES = compat.UniqueFrozenset([LD_LV])
1115
1116
1117 BE_MEMORY = "memory"
1118 BE_MAXMEM = "maxmem"
1119 BE_MINMEM = "minmem"
1120 BE_VCPUS = "vcpus"
1121 BE_AUTO_BALANCE = "auto_balance"
1122 BE_ALWAYS_FAILOVER = "always_failover"
1123 BE_SPINDLE_USE = "spindle_use"
1124
1125 BES_PARAMETER_TYPES = {
1126 BE_MAXMEM: VTYPE_SIZE,
1127 BE_MINMEM: VTYPE_SIZE,
1128 BE_VCPUS: VTYPE_INT,
1129 BE_AUTO_BALANCE: VTYPE_BOOL,
1130 BE_ALWAYS_FAILOVER: VTYPE_BOOL,
1131 BE_SPINDLE_USE: VTYPE_INT,
1132 }
1133
1134 BES_PARAMETER_TITLES = {
1135 BE_AUTO_BALANCE: "Auto_balance",
1136 BE_MAXMEM: "ConfigMaxMem",
1137 BE_MINMEM: "ConfigMinMem",
1138 BE_VCPUS: "ConfigVCPUs",
1139 }
1140
1141 BES_PARAMETER_COMPAT = {
1142 BE_MEMORY: VTYPE_SIZE,
1143 }
1144 BES_PARAMETER_COMPAT.update(BES_PARAMETER_TYPES)
1145
1146 BES_PARAMETERS = frozenset(BES_PARAMETER_TYPES.keys())
1147
1148
1149 ISPEC_MEM_SIZE = "memory-size"
1150 ISPEC_CPU_COUNT = "cpu-count"
1151 ISPEC_DISK_COUNT = "disk-count"
1152 ISPEC_DISK_SIZE = "disk-size"
1153 ISPEC_NIC_COUNT = "nic-count"
1154 ISPEC_SPINDLE_USE = "spindle-use"
1155
1156 ISPECS_PARAMETER_TYPES = {
1157 ISPEC_MEM_SIZE: VTYPE_INT,
1158 ISPEC_CPU_COUNT: VTYPE_INT,
1159 ISPEC_DISK_COUNT: VTYPE_INT,
1160 ISPEC_DISK_SIZE: VTYPE_INT,
1161 ISPEC_NIC_COUNT: VTYPE_INT,
1162 ISPEC_SPINDLE_USE: VTYPE_INT,
1163 }
1164
1165 ISPECS_PARAMETERS = frozenset(ISPECS_PARAMETER_TYPES.keys())
1166
1167 ISPECS_MINMAX = "minmax"
1168 ISPECS_MIN = "min"
1169 ISPECS_MAX = "max"
1170 ISPECS_STD = "std"
1171 IPOLICY_DTS = "disk-templates"
1172 IPOLICY_VCPU_RATIO = "vcpu-ratio"
1173 IPOLICY_SPINDLE_RATIO = "spindle-ratio"
1174
1175 ISPECS_MINMAX_KEYS = compat.UniqueFrozenset([
1176 ISPECS_MIN,
1177 ISPECS_MAX,
1178 ])
1179
1180 IPOLICY_PARAMETERS = compat.UniqueFrozenset([
1181 IPOLICY_VCPU_RATIO,
1182 IPOLICY_SPINDLE_RATIO,
1183 ])
1184
1185 IPOLICY_ALL_KEYS = (IPOLICY_PARAMETERS |
1186 frozenset([ISPECS_MINMAX, ISPECS_STD, IPOLICY_DTS]))
1187
1188
1189 ND_OOB_PROGRAM = "oob_program"
1190 ND_SPINDLE_COUNT = "spindle_count"
1191 ND_EXCLUSIVE_STORAGE = "exclusive_storage"
1192
1193 NDS_PARAMETER_TYPES = {
1194 ND_OOB_PROGRAM: VTYPE_STRING,
1195 ND_SPINDLE_COUNT: VTYPE_INT,
1196 ND_EXCLUSIVE_STORAGE: VTYPE_BOOL,
1197 }
1198
1199 NDS_PARAMETERS = frozenset(NDS_PARAMETER_TYPES.keys())
1200
1201 NDS_PARAMETER_TITLES = {
1202 ND_OOB_PROGRAM: "OutOfBandProgram",
1203 ND_SPINDLE_COUNT: "SpindleCount",
1204 ND_EXCLUSIVE_STORAGE: "ExclusiveStorage",
1205 }
1206
1207
1208 LDP_RESYNC_RATE = "resync-rate"
1209 LDP_STRIPES = "stripes"
1210 LDP_BARRIERS = "disabled-barriers"
1211 LDP_NO_META_FLUSH = "disable-meta-flush"
1212 LDP_DEFAULT_METAVG = "default-metavg"
1213 LDP_DISK_CUSTOM = "disk-custom"
1214 LDP_NET_CUSTOM = "net-custom"
1215 LDP_DYNAMIC_RESYNC = "dynamic-resync"
1216 LDP_PLAN_AHEAD = "c-plan-ahead"
1217 LDP_FILL_TARGET = "c-fill-target"
1218 LDP_DELAY_TARGET = "c-delay-target"
1219 LDP_MAX_RATE = "c-max-rate"
1220 LDP_MIN_RATE = "c-min-rate"
1221 LDP_POOL = "pool"
1222 DISK_LD_TYPES = {
1223 LDP_RESYNC_RATE: VTYPE_INT,
1224 LDP_STRIPES: VTYPE_INT,
1225 LDP_BARRIERS: VTYPE_STRING,
1226 LDP_NO_META_FLUSH: VTYPE_BOOL,
1227 LDP_DEFAULT_METAVG: VTYPE_STRING,
1228 LDP_DISK_CUSTOM: VTYPE_STRING,
1229 LDP_NET_CUSTOM: VTYPE_STRING,
1230 LDP_DYNAMIC_RESYNC: VTYPE_BOOL,
1231 LDP_PLAN_AHEAD: VTYPE_INT,
1232 LDP_FILL_TARGET: VTYPE_INT,
1233 LDP_DELAY_TARGET: VTYPE_INT,
1234 LDP_MAX_RATE: VTYPE_INT,
1235 LDP_MIN_RATE: VTYPE_INT,
1236 LDP_POOL: VTYPE_STRING,
1237 }
1238 DISK_LD_PARAMETERS = frozenset(DISK_LD_TYPES.keys())
1239
1240
1241
1242 DRBD_RESYNC_RATE = "resync-rate"
1243 DRBD_DATA_STRIPES = "data-stripes"
1244 DRBD_META_STRIPES = "meta-stripes"
1245 DRBD_DISK_BARRIERS = "disk-barriers"
1246 DRBD_META_BARRIERS = "meta-barriers"
1247 DRBD_DEFAULT_METAVG = "metavg"
1248 DRBD_DISK_CUSTOM = "disk-custom"
1249 DRBD_NET_CUSTOM = "net-custom"
1250 DRBD_DYNAMIC_RESYNC = "dynamic-resync"
1251 DRBD_PLAN_AHEAD = "c-plan-ahead"
1252 DRBD_FILL_TARGET = "c-fill-target"
1253 DRBD_DELAY_TARGET = "c-delay-target"
1254 DRBD_MAX_RATE = "c-max-rate"
1255 DRBD_MIN_RATE = "c-min-rate"
1256 LV_STRIPES = "stripes"
1257 RBD_POOL = "pool"
1258 DISK_DT_TYPES = {
1259 DRBD_RESYNC_RATE: VTYPE_INT,
1260 DRBD_DATA_STRIPES: VTYPE_INT,
1261 DRBD_META_STRIPES: VTYPE_INT,
1262 DRBD_DISK_BARRIERS: VTYPE_STRING,
1263 DRBD_META_BARRIERS: VTYPE_BOOL,
1264 DRBD_DEFAULT_METAVG: VTYPE_STRING,
1265 DRBD_DISK_CUSTOM: VTYPE_STRING,
1266 DRBD_NET_CUSTOM: VTYPE_STRING,
1267 DRBD_DYNAMIC_RESYNC: VTYPE_BOOL,
1268 DRBD_PLAN_AHEAD: VTYPE_INT,
1269 DRBD_FILL_TARGET: VTYPE_INT,
1270 DRBD_DELAY_TARGET: VTYPE_INT,
1271 DRBD_MAX_RATE: VTYPE_INT,
1272 DRBD_MIN_RATE: VTYPE_INT,
1273 LV_STRIPES: VTYPE_INT,
1274 RBD_POOL: VTYPE_STRING,
1275 }
1276
1277 DISK_DT_PARAMETERS = frozenset(DISK_DT_TYPES.keys())
1278
1279
1280 OOB_POWER_ON = "power-on"
1281 OOB_POWER_OFF = "power-off"
1282 OOB_POWER_CYCLE = "power-cycle"
1283 OOB_POWER_STATUS = "power-status"
1284 OOB_HEALTH = "health"
1285
1286 OOB_COMMANDS = compat.UniqueFrozenset([
1287 OOB_POWER_ON,
1288 OOB_POWER_OFF,
1289 OOB_POWER_CYCLE,
1290 OOB_POWER_STATUS,
1291 OOB_HEALTH,
1292 ])
1293
1294 OOB_POWER_STATUS_POWERED = "powered"
1295
1296 OOB_TIMEOUT = 60
1297 OOB_POWER_DELAY = 2.0
1298
1299 OOB_STATUS_OK = "OK"
1300 OOB_STATUS_WARNING = "WARNING"
1301 OOB_STATUS_CRITICAL = "CRITICAL"
1302 OOB_STATUS_UNKNOWN = "UNKNOWN"
1303
1304 OOB_STATUSES = compat.UniqueFrozenset([
1305 OOB_STATUS_OK,
1306 OOB_STATUS_WARNING,
1307 OOB_STATUS_CRITICAL,
1308 OOB_STATUS_UNKNOWN,
1309 ])
1310
1311
1312 PP_DEFAULT = "default"
1313
1314
1315 NIC_MODE = "mode"
1316 NIC_LINK = "link"
1317
1318 NIC_MODE_BRIDGED = "bridged"
1319 NIC_MODE_ROUTED = "routed"
1320 NIC_MODE_OVS = "openvswitch"
1321 NIC_IP_POOL = "pool"
1322
1323 NIC_VALID_MODES = compat.UniqueFrozenset([
1324 NIC_MODE_BRIDGED,
1325 NIC_MODE_ROUTED,
1326 NIC_MODE_OVS,
1327 ])
1328
1329 RESERVE_ACTION = "reserve"
1330 RELEASE_ACTION = "release"
1331
1332 NICS_PARAMETER_TYPES = {
1333 NIC_MODE: VTYPE_STRING,
1334 NIC_LINK: VTYPE_STRING,
1335 }
1336
1337 NICS_PARAMETERS = frozenset(NICS_PARAMETER_TYPES.keys())
1338
1339
1340 IDISK_SIZE = "size"
1341 IDISK_MODE = "mode"
1342 IDISK_ADOPT = "adopt"
1343 IDISK_VG = "vg"
1344 IDISK_METAVG = "metavg"
1345 IDISK_PROVIDER = "provider"
1346 IDISK_NAME = "name"
1347 IDISK_PARAMS_TYPES = {
1348 IDISK_SIZE: VTYPE_SIZE,
1349 IDISK_MODE: VTYPE_STRING,
1350 IDISK_ADOPT: VTYPE_STRING,
1351 IDISK_VG: VTYPE_STRING,
1352 IDISK_METAVG: VTYPE_STRING,
1353 IDISK_PROVIDER: VTYPE_STRING,
1354 IDISK_NAME: VTYPE_MAYBE_STRING,
1355 }
1356 IDISK_PARAMS = frozenset(IDISK_PARAMS_TYPES.keys())
1357
1358 MODIFIABLE_IDISK_PARAMS_TYPES = {
1359 IDISK_MODE: VTYPE_STRING,
1360 IDISK_NAME: VTYPE_STRING,
1361 }
1362 MODIFIABLE_IDISK_PARAMS = frozenset(MODIFIABLE_IDISK_PARAMS_TYPES.keys())
1363
1364
1365 INIC_MAC = "mac"
1366 INIC_IP = "ip"
1367 INIC_MODE = "mode"
1368 INIC_LINK = "link"
1369 INIC_NETWORK = "network"
1370 INIC_NAME = "name"
1371 INIC_PARAMS_TYPES = {
1372 INIC_IP: VTYPE_MAYBE_STRING,
1373 INIC_LINK: VTYPE_STRING,
1374 INIC_MAC: VTYPE_STRING,
1375 INIC_MODE: VTYPE_STRING,
1376 INIC_NETWORK: VTYPE_MAYBE_STRING,
1377 INIC_NAME: VTYPE_MAYBE_STRING,
1378 }
1379 INIC_PARAMS = frozenset(INIC_PARAMS_TYPES.keys())
1380
1381
1382 HT_XEN_PVM = "xen-pvm"
1383 HT_FAKE = "fake"
1384 HT_XEN_HVM = "xen-hvm"
1385 HT_KVM = "kvm"
1386 HT_CHROOT = "chroot"
1387 HT_LXC = "lxc"
1388 HYPER_TYPES = compat.UniqueFrozenset([
1389 HT_XEN_PVM,
1390 HT_FAKE,
1391 HT_XEN_HVM,
1392 HT_KVM,
1393 HT_CHROOT,
1394 HT_LXC,
1395 ])
1396 HTS_REQ_PORT = compat.UniqueFrozenset([HT_XEN_HVM, HT_KVM])
1397
1398 VNC_BASE_PORT = 5900
1399 VNC_DEFAULT_BIND_ADDRESS = IP4_ADDRESS_ANY
1400
1401
1402 HT_NIC_RTL8139 = "rtl8139"
1403 HT_NIC_NE2K_PCI = "ne2k_pci"
1404 HT_NIC_NE2K_ISA = "ne2k_isa"
1405 HT_NIC_I82551 = "i82551"
1406 HT_NIC_I85557B = "i82557b"
1407 HT_NIC_I8259ER = "i82559er"
1408 HT_NIC_PCNET = "pcnet"
1409 HT_NIC_E1000 = "e1000"
1410 HT_NIC_PARAVIRTUAL = HT_DISK_PARAVIRTUAL = "paravirtual"
1411
1412 HT_HVM_VALID_NIC_TYPES = compat.UniqueFrozenset([
1413 HT_NIC_RTL8139,
1414 HT_NIC_NE2K_PCI,
1415 HT_NIC_E1000,
1416 HT_NIC_NE2K_ISA,
1417 HT_NIC_PARAVIRTUAL,
1418 ])
1419 HT_KVM_VALID_NIC_TYPES = compat.UniqueFrozenset([
1420 HT_NIC_RTL8139,
1421 HT_NIC_NE2K_PCI,
1422 HT_NIC_NE2K_ISA,
1423 HT_NIC_I82551,
1424 HT_NIC_I85557B,
1425 HT_NIC_I8259ER,
1426 HT_NIC_PCNET,
1427 HT_NIC_E1000,
1428 HT_NIC_PARAVIRTUAL,
1429 ])
1430
1431
1432
1433 HT_HVM_VIF_IOEMU = "ioemu"
1434 HT_HVM_VIF_VIF = "vif"
1435 HT_HVM_VALID_VIF_TYPES = compat.UniqueFrozenset([
1436 HT_HVM_VIF_IOEMU,
1437 HT_HVM_VIF_VIF,
1438 ])
1439
1440
1441 HT_DISK_IOEMU = "ioemu"
1442 HT_DISK_IDE = "ide"
1443 HT_DISK_SCSI = "scsi"
1444 HT_DISK_SD = "sd"
1445 HT_DISK_MTD = "mtd"
1446 HT_DISK_PFLASH = "pflash"
1447
1448 HT_CACHE_DEFAULT = "default"
1449 HT_CACHE_NONE = "none"
1450 HT_CACHE_WTHROUGH = "writethrough"
1451 HT_CACHE_WBACK = "writeback"
1452 HT_VALID_CACHE_TYPES = compat.UniqueFrozenset([
1453 HT_CACHE_DEFAULT,
1454 HT_CACHE_NONE,
1455 HT_CACHE_WTHROUGH,
1456 HT_CACHE_WBACK,
1457 ])
1458
1459 HT_HVM_VALID_DISK_TYPES = compat.UniqueFrozenset([
1460 HT_DISK_PARAVIRTUAL,
1461 HT_DISK_IOEMU,
1462 ])
1463 HT_KVM_VALID_DISK_TYPES = compat.UniqueFrozenset([
1464 HT_DISK_PARAVIRTUAL,
1465 HT_DISK_IDE,
1466 HT_DISK_SCSI,
1467 HT_DISK_SD,
1468 HT_DISK_MTD,
1469 HT_DISK_PFLASH,
1470 ])
1471
1472
1473 HT_MOUSE_MOUSE = "mouse"
1474 HT_MOUSE_TABLET = "tablet"
1475
1476 HT_KVM_VALID_MOUSE_TYPES = compat.UniqueFrozenset([
1477 HT_MOUSE_MOUSE,
1478 HT_MOUSE_TABLET,
1479 ])
1480
1481
1482 HT_BO_FLOPPY = "floppy"
1483 HT_BO_CDROM = "cdrom"
1484 HT_BO_DISK = "disk"
1485 HT_BO_NETWORK = "network"
1486
1487 HT_KVM_VALID_BO_TYPES = compat.UniqueFrozenset([
1488 HT_BO_FLOPPY,
1489 HT_BO_CDROM,
1490 HT_BO_DISK,
1491 HT_BO_NETWORK,
1492 ])
1493
1494
1495 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_GLZ = "auto_glz"
1496 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_LZ = "auto_lz"
1497 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_QUIC = "quic"
1498 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_GLZ = "glz"
1499 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_LZ = "lz"
1500 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_OFF = "off"
1501
1502 HT_KVM_SPICE_VALID_LOSSLESS_IMG_COMPR_OPTIONS = compat.UniqueFrozenset([
1503 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_GLZ,
1504 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_LZ,
1505 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_QUIC,
1506 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_GLZ,
1507 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_LZ,
1508 HT_KVM_SPICE_LOSSLESS_IMG_COMPR_OFF,
1509 ])
1510
1511
1512 HT_KVM_SPICE_LOSSY_IMG_COMPR_AUTO = "auto"
1513 HT_KVM_SPICE_LOSSY_IMG_COMPR_NEVER = "never"
1514 HT_KVM_SPICE_LOSSY_IMG_COMPR_ALWAYS = "always"
1515
1516 HT_KVM_SPICE_VALID_LOSSY_IMG_COMPR_OPTIONS = compat.UniqueFrozenset([
1517 HT_KVM_SPICE_LOSSY_IMG_COMPR_AUTO,
1518 HT_KVM_SPICE_LOSSY_IMG_COMPR_NEVER,
1519 HT_KVM_SPICE_LOSSY_IMG_COMPR_ALWAYS,
1520 ])
1521
1522
1523 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_OFF = "off"
1524 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_ALL = "all"
1525 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_FILTER = "filter"
1526
1527 HT_KVM_SPICE_VALID_VIDEO_STREAM_DETECTION_OPTIONS = compat.UniqueFrozenset([
1528 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_OFF,
1529 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_ALL,
1530 HT_KVM_SPICE_VIDEO_STREAM_DETECTION_FILTER,
1531 ])
1532
1533
1534 HT_SM_NONE = "none"
1535 HT_SM_USER = "user"
1536 HT_SM_POOL = "pool"
1537
1538 HT_KVM_VALID_SM_TYPES = compat.UniqueFrozenset([
1539 HT_SM_NONE,
1540 HT_SM_USER,
1541 HT_SM_POOL,
1542 ])
1543
1544
1545 HT_KVM_ENABLED = "enabled"
1546 HT_KVM_DISABLED = "disabled"
1547
1548 HT_KVM_FLAG_VALUES = compat.UniqueFrozenset([HT_KVM_ENABLED, HT_KVM_DISABLED])
1549
1550
1551 HT_MIGRATION_LIVE = "live"
1552 HT_MIGRATION_NONLIVE = "non-live"
1553 HT_MIGRATION_MODES = compat.UniqueFrozenset([
1554 HT_MIGRATION_LIVE,
1555 HT_MIGRATION_NONLIVE,
1556 ])
1557
1558
1559 VERIFY_NPLUSONE_MEM = "nplusone_mem"
1560 VERIFY_OPTIONAL_CHECKS = compat.UniqueFrozenset([VERIFY_NPLUSONE_MEM])
1561
1562
1563 CV_TCLUSTER = "cluster"
1564 CV_TGROUP = "group"
1565 CV_TNODE = "node"
1566 CV_TINSTANCE = "instance"
1567
1568
1569 CV_ECLUSTERCFG = \
1570 (CV_TCLUSTER, "ECLUSTERCFG", "Cluster configuration verification failure")
1571 CV_ECLUSTERCERT = \
1572 (CV_TCLUSTER, "ECLUSTERCERT",
1573 "Cluster certificate files verification failure")
1574 CV_ECLUSTERFILECHECK = \
1575 (CV_TCLUSTER, "ECLUSTERFILECHECK",
1576 "Cluster configuration verification failure")
1577 CV_ECLUSTERDANGLINGNODES = \
1578 (CV_TNODE, "ECLUSTERDANGLINGNODES",
1579 "Some nodes belong to non-existing groups")
1580 CV_ECLUSTERDANGLINGINST = \
1581 (CV_TNODE, "ECLUSTERDANGLINGINST",
1582 "Some instances have a non-existing primary node")
1583 CV_EGROUPDIFFERENTPVSIZE = \
1584 (CV_TGROUP, "EGROUPDIFFERENTPVSIZE", "PVs in the group have different sizes")
1585 CV_EINSTANCEBADNODE = \
1586 (CV_TINSTANCE, "EINSTANCEBADNODE",
1587 "Instance marked as running lives on an offline node")
1588 CV_EINSTANCEDOWN = \
1589 (CV_TINSTANCE, "EINSTANCEDOWN", "Instance not running on its primary node")
1590 CV_EINSTANCELAYOUT = \
1591 (CV_TINSTANCE, "EINSTANCELAYOUT", "Instance has multiple secondary nodes")
1592 CV_EINSTANCEMISSINGDISK = \
1593 (CV_TINSTANCE, "EINSTANCEMISSINGDISK", "Missing volume on an instance")
1594 CV_EINSTANCEFAULTYDISK = \
1595 (CV_TINSTANCE, "EINSTANCEFAULTYDISK",
1596 "Impossible to retrieve status for a disk")
1597 CV_EINSTANCEWRONGNODE = \
1598 (CV_TINSTANCE, "EINSTANCEWRONGNODE", "Instance running on the wrong node")
1599 CV_EINSTANCESPLITGROUPS = \
1600 (CV_TINSTANCE, "EINSTANCESPLITGROUPS",
1601 "Instance with primary and secondary nodes in different groups")
1602 CV_EINSTANCEPOLICY = \
1603 (CV_TINSTANCE, "EINSTANCEPOLICY",
1604 "Instance does not meet policy")
1605 CV_EINSTANCEUNSUITABLENODE = \
1606 (CV_TINSTANCE, "EINSTANCEUNSUITABLENODE",
1607 "Instance running on nodes that are not suitable for it")
1608 CV_ENODEDRBD = \
1609 (CV_TNODE, "ENODEDRBD", "Error parsing the DRBD status file")
1610 CV_ENODEDRBDHELPER = \
1611 (CV_TNODE, "ENODEDRBDHELPER", "Error caused by the DRBD helper")
1612 CV_ENODEFILECHECK = \
1613 (CV_TNODE, "ENODEFILECHECK",
1614 "Error retrieving the checksum of the node files")
1615 CV_ENODEHOOKS = \
1616 (CV_TNODE, "ENODEHOOKS", "Communication failure in hooks execution")
1617 CV_ENODEHV = \
1618 (CV_TNODE, "ENODEHV", "Hypervisor parameters verification failure")
1619 CV_ENODELVM = \
1620 (CV_TNODE, "ENODELVM", "LVM-related node error")
1621 CV_ENODEN1 = \
1622 (CV_TNODE, "ENODEN1", "Not enough memory to accommodate instance failovers")
1623 CV_ENODENET = \
1624 (CV_TNODE, "ENODENET", "Network-related node error")
1625 CV_ENODEOS = \
1626 (CV_TNODE, "ENODEOS", "OS-related node error")
1627 CV_ENODEORPHANINSTANCE = \
1628 (CV_TNODE, "ENODEORPHANINSTANCE", "Unknown intance running on a node")
1629 CV_ENODEORPHANLV = \
1630 (CV_TNODE, "ENODEORPHANLV", "Unknown LVM logical volume")
1631 CV_ENODERPC = \
1632 (CV_TNODE, "ENODERPC",
1633 "Error during connection to the primary node of an instance")
1634 CV_ENODESSH = \
1635 (CV_TNODE, "ENODESSH", "SSH-related node error")
1636 CV_ENODEVERSION = \
1637 (CV_TNODE, "ENODEVERSION",
1638 "Protocol version mismatch or Ganeti version mismatch")
1639 CV_ENODESETUP = \
1640 (CV_TNODE, "ENODESETUP", "Node setup error")
1641 CV_ENODETIME = \
1642 (CV_TNODE, "ENODETIME", "Node returned invalid time")
1643 CV_ENODEOOBPATH = \
1644 (CV_TNODE, "ENODEOOBPATH", "Invalid Out Of Band path")
1645 CV_ENODEUSERSCRIPTS = \
1646 (CV_TNODE, "ENODEUSERSCRIPTS", "User scripts not present or not executable")
1647 CV_ENODEFILESTORAGEPATHS = \
1648 (CV_TNODE, "ENODEFILESTORAGEPATHS", "Detected bad file storage paths")
1649
1650 CV_ALL_ECODES = compat.UniqueFrozenset([
1651 CV_ECLUSTERCFG,
1652 CV_ECLUSTERCERT,
1653 CV_ECLUSTERFILECHECK,
1654 CV_ECLUSTERDANGLINGNODES,
1655 CV_ECLUSTERDANGLINGINST,
1656 CV_EINSTANCEBADNODE,
1657 CV_EINSTANCEDOWN,
1658 CV_EINSTANCELAYOUT,
1659 CV_EINSTANCEMISSINGDISK,
1660 CV_EINSTANCEFAULTYDISK,
1661 CV_EINSTANCEWRONGNODE,
1662 CV_EINSTANCESPLITGROUPS,
1663 CV_EINSTANCEPOLICY,
1664 CV_ENODEDRBD,
1665 CV_ENODEDRBDHELPER,
1666 CV_ENODEFILECHECK,
1667 CV_ENODEHOOKS,
1668 CV_ENODEHV,
1669 CV_ENODELVM,
1670 CV_ENODEN1,
1671 CV_ENODENET,
1672 CV_ENODEOS,
1673 CV_ENODEORPHANINSTANCE,
1674 CV_ENODEORPHANLV,
1675 CV_ENODERPC,
1676 CV_ENODESSH,
1677 CV_ENODEVERSION,
1678 CV_ENODESETUP,
1679 CV_ENODETIME,
1680 CV_ENODEOOBPATH,
1681 CV_ENODEUSERSCRIPTS,
1682 CV_ENODEFILESTORAGEPATHS,
1683 ])
1684
1685 CV_ALL_ECODES_STRINGS = \
1686 compat.UniqueFrozenset(estr for (_, estr, _) in CV_ALL_ECODES)
1687
1688
1689 NV_BRIDGES = "bridges"
1690 NV_DRBDHELPER = "drbd-helper"
1691 NV_DRBDLIST = "drbd-list"
1692 NV_EXCLUSIVEPVS = "exclusive-pvs"
1693 NV_FILELIST = "filelist"
1694 NV_FILE_STORAGE_PATHS = "file-storage-paths"
1695 NV_HVINFO = "hvinfo"
1696 NV_HVPARAMS = "hvparms"
1697 NV_HYPERVISOR = "hypervisor"
1698 NV_INSTANCELIST = "instancelist"
1699 NV_LVLIST = "lvlist"
1700 NV_MASTERIP = "master-ip"
1701 NV_NODELIST = "nodelist"
1702 NV_NODENETTEST = "node-net-test"
1703 NV_NODESETUP = "nodesetup"
1704 NV_OOB_PATHS = "oob-paths"
1705 NV_OSLIST = "oslist"
1706 NV_PVLIST = "pvlist"
1707 NV_TIME = "time"
1708 NV_USERSCRIPTS = "user-scripts"
1709 NV_VERSION = "version"
1710 NV_VGLIST = "vglist"
1711 NV_VMNODES = "vmnodes"
1712
1713
1714 INSTST_RUNNING = "running"
1715 INSTST_ADMINDOWN = "ADMIN_down"
1716 INSTST_ADMINOFFLINE = "ADMIN_offline"
1717 INSTST_NODEOFFLINE = "ERROR_nodeoffline"
1718 INSTST_NODEDOWN = "ERROR_nodedown"
1719 INSTST_WRONGNODE = "ERROR_wrongnode"
1720 INSTST_ERRORUP = "ERROR_up"
1721 INSTST_ERRORDOWN = "ERROR_down"
1722 INSTST_ALL = compat.UniqueFrozenset([
1723 INSTST_RUNNING,
1724 INSTST_ADMINDOWN,
1725 INSTST_ADMINOFFLINE,
1726 INSTST_NODEOFFLINE,
1727 INSTST_NODEDOWN,
1728 INSTST_WRONGNODE,
1729 INSTST_ERRORUP,
1730 INSTST_ERRORDOWN,
1731 ])
1732
1733
1734 ADMINST_UP = "up"
1735 ADMINST_DOWN = "down"
1736 ADMINST_OFFLINE = "offline"
1737 ADMINST_ALL = compat.UniqueFrozenset([
1738 ADMINST_UP,
1739 ADMINST_DOWN,
1740 ADMINST_OFFLINE,
1741 ])
1742
1743
1744 NR_REGULAR = "R"
1745 NR_MASTER = "M"
1746 NR_MCANDIDATE = "C"
1747 NR_DRAINED = "D"
1748 NR_OFFLINE = "O"
1749 NR_ALL = compat.UniqueFrozenset([
1750 NR_REGULAR,
1751 NR_MASTER,
1752 NR_MCANDIDATE,
1753 NR_DRAINED,
1754 NR_OFFLINE,
1755 ])
1756
1757
1758 SSL_CERT_EXPIRATION_WARN = 30
1759 SSL_CERT_EXPIRATION_ERROR = 7
1760
1761
1762 IALLOCATOR_VERSION = 2
1763 IALLOCATOR_DIR_IN = "in"
1764 IALLOCATOR_DIR_OUT = "out"
1765 VALID_IALLOCATOR_DIRECTIONS = compat.UniqueFrozenset([
1766 IALLOCATOR_DIR_IN,
1767 IALLOCATOR_DIR_OUT,
1768 ])
1769 IALLOCATOR_MODE_ALLOC = "allocate"
1770 IALLOCATOR_MODE_RELOC = "relocate"
1771 IALLOCATOR_MODE_CHG_GROUP = "change-group"
1772 IALLOCATOR_MODE_NODE_EVAC = "node-evacuate"
1773 IALLOCATOR_MODE_MULTI_ALLOC = "multi-allocate"
1774 VALID_IALLOCATOR_MODES = compat.UniqueFrozenset([
1775 IALLOCATOR_MODE_ALLOC,
1776 IALLOCATOR_MODE_RELOC,
1777 IALLOCATOR_MODE_CHG_GROUP,
1778 IALLOCATOR_MODE_NODE_EVAC,
1779 IALLOCATOR_MODE_MULTI_ALLOC,
1780 ])
1781 IALLOCATOR_SEARCH_PATH = _autoconf.IALLOCATOR_SEARCH_PATH
1782 DEFAULT_IALLOCATOR_SHORTCUT = "."
1783
1784 IALLOCATOR_NEVAC_PRI = "primary-only"
1785 IALLOCATOR_NEVAC_SEC = "secondary-only"
1786 IALLOCATOR_NEVAC_ALL = "all"
1787 IALLOCATOR_NEVAC_MODES = compat.UniqueFrozenset([
1788 IALLOCATOR_NEVAC_PRI,
1789 IALLOCATOR_NEVAC_SEC,
1790 IALLOCATOR_NEVAC_ALL,
1791 ])
1792
1793
1794 NODE_EVAC_PRI = "primary-only"
1795 NODE_EVAC_SEC = "secondary-only"
1796 NODE_EVAC_ALL = "all"
1797 NODE_EVAC_MODES = compat.UniqueFrozenset([
1798 NODE_EVAC_PRI,
1799 NODE_EVAC_SEC,
1800 NODE_EVAC_ALL,
1801 ])
1802
1803
1804 JOB_QUEUE_VERSION = 1
1805 JOB_QUEUE_SIZE_HARD_LIMIT = 5000
1806 JOB_QUEUE_FILES_PERMS = 0640
1807
1808 JOB_ID_TEMPLATE = r"\d+"
1809 JOB_FILE_RE = re.compile(r"^job-(%s)$" % JOB_ID_TEMPLATE)
1810
1811
1812 JOB_NOTCHANGED = "nochange"
1813
1814
1815 JOB_STATUS_QUEUED = "queued"
1816 JOB_STATUS_WAITING = "waiting"
1817 JOB_STATUS_CANCELING = "canceling"
1818 JOB_STATUS_RUNNING = "running"
1819 JOB_STATUS_CANCELED = "canceled"
1820 JOB_STATUS_SUCCESS = "success"
1821 JOB_STATUS_ERROR = "error"
1822 JOBS_PENDING = compat.UniqueFrozenset([
1823 JOB_STATUS_QUEUED,
1824 JOB_STATUS_WAITING,
1825 JOB_STATUS_CANCELING,
1826 ])
1827 JOBS_FINALIZED = compat.UniqueFrozenset([
1828 JOB_STATUS_CANCELED,
1829 JOB_STATUS_SUCCESS,
1830 JOB_STATUS_ERROR,
1831 ])
1832 JOB_STATUS_ALL = compat.UniqueFrozenset([
1833 JOB_STATUS_RUNNING,
1834 ]) | JOBS_PENDING | JOBS_FINALIZED
1835
1836
1837
1838 OP_STATUS_QUEUED = "queued"
1839 OP_STATUS_WAITING = "waiting"
1840 OP_STATUS_CANCELING = "canceling"
1841 OP_STATUS_RUNNING = "running"
1842
1843 OP_STATUS_CANCELED = "canceled"
1844 OP_STATUS_SUCCESS = "success"
1845 OP_STATUS_ERROR = "error"
1846 OPS_FINALIZED = compat.UniqueFrozenset([
1847 OP_STATUS_CANCELED,
1848 OP_STATUS_SUCCESS,
1849 OP_STATUS_ERROR,
1850 ])
1851
1852
1853 OP_PRIO_LOWEST = +19
1854 OP_PRIO_HIGHEST = -20
1855
1856 OP_PRIO_LOW = +10
1857 OP_PRIO_NORMAL = 0
1858 OP_PRIO_HIGH = -10
1859
1860 OP_PRIO_SUBMIT_VALID = compat.UniqueFrozenset([
1861 OP_PRIO_LOW,
1862 OP_PRIO_NORMAL,
1863 OP_PRIO_HIGH,
1864 ])
1865
1866 OP_PRIO_DEFAULT = OP_PRIO_NORMAL
1867
1868
1869 LOCKS_REPLACE = "replace"
1870 LOCKS_APPEND = "append"
1871
1872
1873
1874
1875
1876
1877 LOCK_ATTEMPTS_TIMEOUT = 10 * 3600 / (OP_PRIO_DEFAULT - OP_PRIO_HIGHEST)
1878 LOCK_ATTEMPTS_MAXWAIT = 15.0
1879 LOCK_ATTEMPTS_MINWAIT = 1.0
1880
1881
1882 ELOG_MESSAGE = "message"
1883 ELOG_REMOTE_IMPORT = "remote-import"
1884 ELOG_JQUEUE_TEST = "jqueue-test"
1885
1886
1887 ETC_HOSTS_ADD = "add"
1888 ETC_HOSTS_REMOVE = "remove"
1889
1890
1891 JQT_MSGPREFIX = "TESTMSG="
1892 JQT_EXPANDNAMES = "expandnames"
1893 JQT_EXEC = "exec"
1894 JQT_LOGMSG = "logmsg"
1895 JQT_STARTMSG = "startmsg"
1896 JQT_ALL = compat.UniqueFrozenset([
1897 JQT_EXPANDNAMES,
1898 JQT_EXEC,
1899 JQT_LOGMSG,
1900 JQT_STARTMSG,
1901 ])
1902
1903
1904 QR_CLUSTER = "cluster"
1905 QR_INSTANCE = "instance"
1906 QR_NODE = "node"
1907 QR_LOCK = "lock"
1908 QR_GROUP = "group"
1909 QR_OS = "os"
1910 QR_JOB = "job"
1911 QR_EXPORT = "export"
1912 QR_NETWORK = "network"
1913 QR_EXTSTORAGE = "extstorage"
1914
1915
1916 QR_VIA_OP = compat.UniqueFrozenset([
1917 QR_CLUSTER,
1918 QR_INSTANCE,
1919 QR_NODE,
1920 QR_GROUP,
1921 QR_OS,
1922 QR_EXPORT,
1923 QR_NETWORK,
1924 QR_EXTSTORAGE,
1925 ])
1926
1927
1928 QR_VIA_LUXI = QR_VIA_OP.union([
1929 QR_LOCK,
1930 QR_JOB,
1931 ])
1932
1933
1934 QR_VIA_RAPI = QR_VIA_LUXI
1935
1936
1937 QFT_UNKNOWN = "unknown"
1938 QFT_TEXT = "text"
1939 QFT_BOOL = "bool"
1940 QFT_NUMBER = "number"
1941 QFT_UNIT = "unit"
1942 QFT_TIMESTAMP = "timestamp"
1943 QFT_OTHER = "other"
1944
1945
1946 QFT_ALL = compat.UniqueFrozenset([
1947 QFT_UNKNOWN,
1948 QFT_TEXT,
1949 QFT_BOOL,
1950 QFT_NUMBER,
1951 QFT_UNIT,
1952 QFT_TIMESTAMP,
1953 QFT_OTHER,
1954 ])
1955
1956
1957
1958
1959 RS_NORMAL = 0
1960
1961 RS_UNKNOWN = 1
1962
1963 RS_NODATA = 2
1964
1965
1966
1967 RS_UNAVAIL = 3
1968
1969 RS_OFFLINE = 4
1970
1971 RS_ALL = compat.UniqueFrozenset([
1972 RS_NORMAL,
1973 RS_UNKNOWN,
1974 RS_NODATA,
1975 RS_UNAVAIL,
1976 RS_OFFLINE,
1977 ])
1978
1979
1980 RSS_DESCRIPTION = {
1981 RS_UNKNOWN: ("(unknown)", "??"),
1982 RS_NODATA: ("(nodata)", "?"),
1983 RS_OFFLINE: ("(offline)", "*"),
1984 RS_UNAVAIL: ("(unavail)", "-"),
1985 }
1986
1987
1988 MAX_NICS = 8
1989 MAX_DISKS = 16
1990
1991
1992 SSCONF_FILEPREFIX = "ssconf_"
1993
1994 SS_CLUSTER_NAME = "cluster_name"
1995 SS_CLUSTER_TAGS = "cluster_tags"
1996 SS_FILE_STORAGE_DIR = "file_storage_dir"
1997 SS_SHARED_FILE_STORAGE_DIR = "shared_file_storage_dir"
1998 SS_MASTER_CANDIDATES = "master_candidates"
1999 SS_MASTER_CANDIDATES_IPS = "master_candidates_ips"
2000 SS_MASTER_IP = "master_ip"
2001 SS_MASTER_NETDEV = "master_netdev"
2002 SS_MASTER_NETMASK = "master_netmask"
2003 SS_MASTER_NODE = "master_node"
2004 SS_NODE_LIST = "node_list"
2005 SS_NODE_PRIMARY_IPS = "node_primary_ips"
2006 SS_NODE_SECONDARY_IPS = "node_secondary_ips"
2007 SS_OFFLINE_NODES = "offline_nodes"
2008 SS_ONLINE_NODES = "online_nodes"
2009 SS_PRIMARY_IP_FAMILY = "primary_ip_family"
2010 SS_INSTANCE_LIST = "instance_list"
2011 SS_RELEASE_VERSION = "release_version"
2012 SS_HYPERVISOR_LIST = "hypervisor_list"
2013 SS_MAINTAIN_NODE_HEALTH = "maintain_node_health"
2014 SS_UID_POOL = "uid_pool"
2015 SS_NODEGROUPS = "nodegroups"
2016 SS_NETWORKS = "networks"
2017
2018 SS_FILE_PERMS = 0444
2019
2020
2021 DEFAULT_ENABLED_HYPERVISOR = HT_XEN_PVM
2022
2023 HVC_DEFAULTS = {
2024 HT_XEN_PVM: {
2025 HV_USE_BOOTLOADER: False,
2026 HV_BOOTLOADER_PATH: XEN_BOOTLOADER,
2027 HV_BOOTLOADER_ARGS: "",
2028 HV_KERNEL_PATH: XEN_KERNEL,
2029 HV_INITRD_PATH: "",
2030 HV_ROOT_PATH: "/dev/xvda1",
2031 HV_KERNEL_ARGS: "ro",
2032 HV_MIGRATION_PORT: 8002,
2033 HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
2034 HV_BLOCKDEV_PREFIX: "sd",
2035 HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
2036 HV_CPU_MASK: CPU_PINNING_ALL,
2037 HV_CPU_CAP: 0,
2038 HV_CPU_WEIGHT: 256,
2039 },
2040 HT_XEN_HVM: {
2041 HV_BOOT_ORDER: "cd",
2042 HV_CDROM_IMAGE_PATH: "",
2043 HV_NIC_TYPE: HT_NIC_RTL8139,
2044 HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
2045 HV_VNC_BIND_ADDRESS: IP4_ADDRESS_ANY,
2046 HV_VNC_PASSWORD_FILE: pathutils.VNC_PASSWORD_FILE,
2047 HV_ACPI: True,
2048 HV_PAE: True,
2049 HV_KERNEL_PATH: "/usr/lib/xen/boot/hvmloader",
2050 HV_DEVICE_MODEL: "/usr/lib/xen/bin/qemu-dm",
2051 HV_MIGRATION_PORT: 8002,
2052 HV_MIGRATION_MODE: HT_MIGRATION_NONLIVE,
2053 HV_USE_LOCALTIME: False,
2054 HV_BLOCKDEV_PREFIX: "hd",
2055 HV_PASSTHROUGH: "",
2056 HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
2057 HV_CPU_MASK: CPU_PINNING_ALL,
2058 HV_CPU_CAP: 0,
2059 HV_CPU_WEIGHT: 256,
2060 HV_VIF_TYPE: HT_HVM_VIF_IOEMU,
2061 HV_VIRIDIAN: False,
2062 },
2063 HT_KVM: {
2064 HV_KVM_PATH: KVM_PATH,
2065 HV_KERNEL_PATH: KVM_KERNEL,
2066 HV_INITRD_PATH: "",
2067 HV_KERNEL_ARGS: "ro",
2068 HV_ROOT_PATH: "/dev/vda1",
2069 HV_ACPI: True,
2070 HV_SERIAL_CONSOLE: True,
2071 HV_SERIAL_SPEED: 38400,
2072 HV_VNC_BIND_ADDRESS: "",
2073 HV_VNC_TLS: False,
2074 HV_VNC_X509: "",
2075 HV_VNC_X509_VERIFY: False,
2076 HV_VNC_PASSWORD_FILE: "",
2077 HV_KVM_SPICE_BIND: "",
2078 HV_KVM_SPICE_IP_VERSION: IFACE_NO_IP_VERSION_SPECIFIED,
2079 HV_KVM_SPICE_PASSWORD_FILE: "",
2080 HV_KVM_SPICE_LOSSLESS_IMG_COMPR: "",
2081 HV_KVM_SPICE_JPEG_IMG_COMPR: "",
2082 HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR: "",
2083 HV_KVM_SPICE_STREAMING_VIDEO_DETECTION: "",
2084 HV_KVM_SPICE_AUDIO_COMPR: True,
2085 HV_KVM_SPICE_USE_TLS: False,
2086 HV_KVM_SPICE_TLS_CIPHERS: OPENSSL_CIPHERS,
2087 HV_KVM_SPICE_USE_VDAGENT: True,
2088 HV_KVM_FLOPPY_IMAGE_PATH: "",
2089 HV_CDROM_IMAGE_PATH: "",
2090 HV_KVM_CDROM2_IMAGE_PATH: "",
2091 HV_BOOT_ORDER: HT_BO_DISK,
2092 HV_NIC_TYPE: HT_NIC_PARAVIRTUAL,
2093 HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
2094 HV_KVM_CDROM_DISK_TYPE: "",
2095 HV_USB_MOUSE: "",
2096 HV_KEYMAP: "",
2097 HV_MIGRATION_PORT: 8102,
2098 HV_MIGRATION_BANDWIDTH: 32,
2099 HV_MIGRATION_DOWNTIME: 30,
2100 HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
2101 HV_USE_LOCALTIME: False,
2102 HV_DISK_CACHE: HT_CACHE_DEFAULT,
2103 HV_SECURITY_MODEL: HT_SM_NONE,
2104 HV_SECURITY_DOMAIN: "",
2105 HV_KVM_FLAG: "",
2106 HV_VHOST_NET: False,
2107 HV_KVM_USE_CHROOT: False,
2108 HV_MEM_PATH: "",
2109 HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
2110 HV_CPU_MASK: CPU_PINNING_ALL,
2111 HV_CPU_TYPE: "",
2112 HV_CPU_CORES: 0,
2113 HV_CPU_THREADS: 0,
2114 HV_CPU_SOCKETS: 0,
2115 HV_SOUNDHW: "",
2116 HV_USB_DEVICES: "",
2117 HV_VGA: "",
2118 HV_KVM_EXTRA: "",
2119 HV_KVM_MACHINE_VERSION: "",
2120 HV_VNET_HDR: True,
2121 },
2122 HT_FAKE: {},
2123 HT_CHROOT: {
2124 HV_INIT_SCRIPT: "/ganeti-chroot",
2125 },
2126 HT_LXC: {
2127 HV_CPU_MASK: "",
2128 },
2129 }
2130
2131 HVC_GLOBALS = compat.UniqueFrozenset([
2132 HV_MIGRATION_PORT,
2133 HV_MIGRATION_BANDWIDTH,
2134 HV_MIGRATION_MODE,
2135 ])
2136
2137 BEC_DEFAULTS = {
2138 BE_MINMEM: 128,
2139 BE_MAXMEM: 128,
2140 BE_VCPUS: 1,
2141 BE_AUTO_BALANCE: True,
2142 BE_ALWAYS_FAILOVER: False,
2143 BE_SPINDLE_USE: 1,
2144 }
2145
2146 NDC_DEFAULTS = {
2147 ND_OOB_PROGRAM: "",
2148 ND_SPINDLE_COUNT: 1,
2149 ND_EXCLUSIVE_STORAGE: False,
2150 }
2151
2152 NDC_GLOBALS = compat.UniqueFrozenset([
2153 ND_EXCLUSIVE_STORAGE,
2154 ])
2155
2156 DISK_LD_DEFAULTS = {
2157 LD_DRBD8: {
2158 LDP_RESYNC_RATE: CLASSIC_DRBD_SYNC_SPEED,
2159 LDP_BARRIERS: _autoconf.DRBD_BARRIERS,
2160 LDP_NO_META_FLUSH: _autoconf.DRBD_NO_META_FLUSH,
2161 LDP_DEFAULT_METAVG: DEFAULT_VG,
2162 LDP_DISK_CUSTOM: "",
2163 LDP_NET_CUSTOM: "",
2164 LDP_DYNAMIC_RESYNC: False,
2165
2166
2167
2168
2169
2170
2171 LDP_PLAN_AHEAD: 20,
2172 LDP_FILL_TARGET: 0,
2173 LDP_DELAY_TARGET: 1,
2174 LDP_MAX_RATE: CLASSIC_DRBD_SYNC_SPEED,
2175 LDP_MIN_RATE: 4 * 1024,
2176 },
2177 LD_LV: {
2178 LDP_STRIPES: _autoconf.LVM_STRIPECOUNT
2179 },
2180 LD_FILE: {},
2181 LD_BLOCKDEV: {},
2182 LD_RBD: {
2183 LDP_POOL: "rbd"
2184 },
2185 LD_EXT: {},
2186 }
2187
2188
2189 _LV_DEFAULTS = DISK_LD_DEFAULTS[LD_LV]
2190 _DRBD_DEFAULTS = DISK_LD_DEFAULTS[LD_DRBD8]
2191
2192 DISK_DT_DEFAULTS = {
2193 DT_PLAIN: {
2194 LV_STRIPES: DISK_LD_DEFAULTS[LD_LV][LDP_STRIPES],
2195 },
2196 DT_DRBD8: {
2197 DRBD_RESYNC_RATE: _DRBD_DEFAULTS[LDP_RESYNC_RATE],
2198 DRBD_DATA_STRIPES: _LV_DEFAULTS[LDP_STRIPES],
2199 DRBD_META_STRIPES: _LV_DEFAULTS[LDP_STRIPES],
2200 DRBD_DISK_BARRIERS: _DRBD_DEFAULTS[LDP_BARRIERS],
2201 DRBD_META_BARRIERS: _DRBD_DEFAULTS[LDP_NO_META_FLUSH],
2202 DRBD_DEFAULT_METAVG: _DRBD_DEFAULTS[LDP_DEFAULT_METAVG],
2203 DRBD_DISK_CUSTOM: _DRBD_DEFAULTS[LDP_DISK_CUSTOM],
2204 DRBD_NET_CUSTOM: _DRBD_DEFAULTS[LDP_NET_CUSTOM],
2205 DRBD_DYNAMIC_RESYNC: _DRBD_DEFAULTS[LDP_DYNAMIC_RESYNC],
2206 DRBD_PLAN_AHEAD: _DRBD_DEFAULTS[LDP_PLAN_AHEAD],
2207 DRBD_FILL_TARGET: _DRBD_DEFAULTS[LDP_FILL_TARGET],
2208 DRBD_DELAY_TARGET: _DRBD_DEFAULTS[LDP_DELAY_TARGET],
2209 DRBD_MAX_RATE: _DRBD_DEFAULTS[LDP_MAX_RATE],
2210 DRBD_MIN_RATE: _DRBD_DEFAULTS[LDP_MIN_RATE],
2211 },
2212 DT_DISKLESS: {},
2213 DT_FILE: {},
2214 DT_SHARED_FILE: {},
2215 DT_BLOCK: {},
2216 DT_RBD: {
2217 RBD_POOL: DISK_LD_DEFAULTS[LD_RBD][LDP_POOL]
2218 },
2219 DT_EXT: {},
2220 }
2221
2222
2223 del _LV_DEFAULTS, _DRBD_DEFAULTS
2224
2225 NICC_DEFAULTS = {
2226 NIC_MODE: NIC_MODE_BRIDGED,
2227 NIC_LINK: DEFAULT_BRIDGE,
2228 }
2229
2230
2231
2232 ISPECS_MINMAX_DEFAULTS = {
2233 ISPECS_MIN: {
2234 ISPEC_MEM_SIZE: 128,
2235 ISPEC_CPU_COUNT: 1,
2236 ISPEC_DISK_COUNT: 1,
2237 ISPEC_DISK_SIZE: 1024,
2238 ISPEC_NIC_COUNT: 1,
2239 ISPEC_SPINDLE_USE: 1,
2240 },
2241 ISPECS_MAX: {
2242 ISPEC_MEM_SIZE: 32768,
2243 ISPEC_CPU_COUNT: 8,
2244 ISPEC_DISK_COUNT: MAX_DISKS,
2245 ISPEC_DISK_SIZE: 1024 * 1024,
2246 ISPEC_NIC_COUNT: MAX_NICS,
2247 ISPEC_SPINDLE_USE: 12,
2248 },
2249 }
2250 IPOLICY_DEFAULTS = {
2251 ISPECS_MINMAX: [ISPECS_MINMAX_DEFAULTS],
2252 ISPECS_STD: {
2253 ISPEC_MEM_SIZE: 128,
2254 ISPEC_CPU_COUNT: 1,
2255 ISPEC_DISK_COUNT: 1,
2256 ISPEC_DISK_SIZE: 1024,
2257 ISPEC_NIC_COUNT: 1,
2258 ISPEC_SPINDLE_USE: 1,
2259 },
2260 IPOLICY_DTS: list(DISK_TEMPLATES),
2261 IPOLICY_VCPU_RATIO: 4.0,
2262 IPOLICY_SPINDLE_RATIO: 32.0,
2263 }
2264
2265 MASTER_POOL_SIZE_DEFAULT = 10
2266
2267
2268
2269 PART_MARGIN = .01
2270
2271 PART_RESERVED = .02
2272
2273 CONFD_PROTOCOL_VERSION = 1
2274
2275 CONFD_REQ_PING = 0
2276 CONFD_REQ_NODE_ROLE_BYNAME = 1
2277 CONFD_REQ_NODE_PIP_BY_INSTANCE_IP = 2
2278 CONFD_REQ_CLUSTER_MASTER = 3
2279 CONFD_REQ_NODE_PIP_LIST = 4
2280 CONFD_REQ_MC_PIP_LIST = 5
2281 CONFD_REQ_INSTANCES_IPS_LIST = 6
2282 CONFD_REQ_NODE_DRBD = 7
2283 CONFD_REQ_NODE_INSTANCES = 8
2284
2285
2286
2287
2288 CONFD_REQQ_LINK = "0"
2289 CONFD_REQQ_IP = "1"
2290 CONFD_REQQ_IPLIST = "2"
2291 CONFD_REQQ_FIELDS = "3"
2292
2293 CONFD_REQFIELD_NAME = "0"
2294 CONFD_REQFIELD_IP = "1"
2295 CONFD_REQFIELD_MNODE_PIP = "2"
2296
2297 CONFD_REQS = compat.UniqueFrozenset([
2298 CONFD_REQ_PING,
2299 CONFD_REQ_NODE_ROLE_BYNAME,
2300 CONFD_REQ_NODE_PIP_BY_INSTANCE_IP,
2301 CONFD_REQ_CLUSTER_MASTER,
2302 CONFD_REQ_NODE_PIP_LIST,
2303 CONFD_REQ_MC_PIP_LIST,
2304 CONFD_REQ_INSTANCES_IPS_LIST,
2305 CONFD_REQ_NODE_DRBD,
2306 ])
2307
2308 CONFD_REPL_STATUS_OK = 0
2309 CONFD_REPL_STATUS_ERROR = 1
2310 CONFD_REPL_STATUS_NOTIMPLEMENTED = 2
2311
2312 CONFD_REPL_STATUSES = compat.UniqueFrozenset([
2313 CONFD_REPL_STATUS_OK,
2314 CONFD_REPL_STATUS_ERROR,
2315 CONFD_REPL_STATUS_NOTIMPLEMENTED,
2316 ])
2317
2318 (CONFD_NODE_ROLE_MASTER,
2319 CONFD_NODE_ROLE_CANDIDATE,
2320 CONFD_NODE_ROLE_OFFLINE,
2321 CONFD_NODE_ROLE_DRAINED,
2322 CONFD_NODE_ROLE_REGULAR,
2323 ) = range(5)
2324
2325
2326 CONFD_ERROR_UNKNOWN_ENTRY = 1
2327 CONFD_ERROR_INTERNAL = 2
2328 CONFD_ERROR_ARGUMENT = 3
2329
2330
2331
2332
2333 CONFD_MAX_CLOCK_SKEW = 2 * NODE_MAX_CLOCK_SKEW
2334
2335
2336
2337
2338
2339 CONFD_CONFIG_RELOAD_TIMEOUT = 17
2340
2341
2342
2343
2344 CONFD_CONFIG_RELOAD_RATELIMIT = 250000
2345
2346
2347
2348
2349
2350 CONFD_MAGIC_FOURCC = "plj0"
2351
2352
2353
2354
2355 CONFD_DEFAULT_REQ_COVERAGE = 6
2356
2357
2358
2359
2360 CONFD_CLIENT_EXPIRE_TIMEOUT = 10
2361
2362
2363
2364
2365
2366
2367 MAX_UDP_DATA_SIZE = 61440
2368
2369
2370 UIDPOOL_UID_MIN = 0
2371 UIDPOOL_UID_MAX = 2 ** 32 - 1
2372
2373
2374 PGREP = "pgrep"
2375
2376
2377 INITIAL_NODE_GROUP_NAME = "default"
2378
2379
2380 ALLOC_POLICY_PREFERRED = "preferred"
2381 ALLOC_POLICY_LAST_RESORT = "last_resort"
2382 ALLOC_POLICY_UNALLOCABLE = "unallocable"
2383 VALID_ALLOC_POLICIES = [
2384 ALLOC_POLICY_PREFERRED,
2385 ALLOC_POLICY_LAST_RESORT,
2386 ALLOC_POLICY_UNALLOCABLE,
2387 ]
2388
2389
2390 BLOCKDEV_DRIVER_MANUAL = "manual"
2391
2392
2393 QEMUIMG_PATH = _autoconf.QEMUIMG_PATH
2394
2395
2396 HTOOLS = _autoconf.HTOOLS
2397
2398 IALLOC_HAIL = "hail"
2399
2400
2401
2402 FAKE_OP_MASTER_TURNUP = "OP_CLUSTER_IP_TURNUP"
2403 FAKE_OP_MASTER_TURNDOWN = "OP_CLUSTER_IP_TURNDOWN"
2404
2405
2406 SSHK_RSA = "rsa"
2407 SSHK_DSA = "dsa"
2408 SSHK_ALL = compat.UniqueFrozenset([SSHK_RSA, SSHK_DSA])
2409
2410
2411 SSHAK_RSA = "ssh-rsa"
2412 SSHAK_DSS = "ssh-dss"
2413 SSHAK_ALL = compat.UniqueFrozenset([SSHAK_RSA, SSHAK_DSS])
2414
2415
2416 SSHS_CLUSTER_NAME = "cluster_name"
2417 SSHS_SSH_HOST_KEY = "ssh_host_key"
2418 SSHS_SSH_ROOT_KEY = "ssh_root_key"
2419 SSHS_NODE_DAEMON_CERTIFICATE = "node_daemon_certificate"
2420
2421
2422 SSH_DAEMON_KEYFILES = {
2423 SSHK_RSA: (pathutils.SSH_HOST_RSA_PRIV, pathutils.SSH_HOST_RSA_PUB),
2424 SSHK_DSA: (pathutils.SSH_HOST_DSA_PRIV, pathutils.SSH_HOST_DSA_PUB),
2425 }
2426
2427
2428 NDS_CLUSTER_NAME = "cluster_name"
2429 NDS_NODE_DAEMON_CERTIFICATE = "node_daemon_certificate"
2430 NDS_SSCONF = "ssconf"
2431 NDS_START_NODE_DAEMON = "start_node_daemon"
2432
2433
2434 RANDOM_UUID_FILE = "/proc/sys/kernel/random/uuid"
2435
2436
2437 UUID_REGEX = "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"
2438
2439
2440 AUTO_REPAIR_TAG_PREFIX = "ganeti:watcher:autorepair:"
2441 AUTO_REPAIR_TAG_ENABLED = AUTO_REPAIR_TAG_PREFIX
2442 AUTO_REPAIR_TAG_SUSPENDED = AUTO_REPAIR_TAG_ENABLED + "suspend:"
2443 AUTO_REPAIR_TAG_PENDING = AUTO_REPAIR_TAG_PREFIX + "pending:"
2444 AUTO_REPAIR_TAG_RESULT = AUTO_REPAIR_TAG_PREFIX + "result:"
2445
2446
2447 AUTO_REPAIR_FIX_STORAGE = "fix-storage"
2448 AUTO_REPAIR_MIGRATE = "migrate"
2449 AUTO_REPAIR_FAILOVER = "failover"
2450 AUTO_REPAIR_REINSTALL = "reinstall"
2451 AUTO_REPAIR_ALL_TYPES = [
2452 AUTO_REPAIR_FIX_STORAGE,
2453 AUTO_REPAIR_MIGRATE,
2454 AUTO_REPAIR_FAILOVER,
2455 AUTO_REPAIR_REINSTALL,
2456 ]
2457
2458
2459 AUTO_REPAIR_SUCCESS = "success"
2460 AUTO_REPAIR_FAILURE = "failure"
2461 AUTO_REPAIR_ENOPERM = "enoperm"
2462 AUTO_REPAIR_ALL_RESULTS = frozenset([
2463 AUTO_REPAIR_SUCCESS,
2464 AUTO_REPAIR_FAILURE,
2465 AUTO_REPAIR_ENOPERM,
2466 ])
2467
2468
2469 BUILTIN_DATA_COLLECTOR_VERSION = "B"
2470
2471
2472 OPCODE_REASON = "reason"
2473
2474
2475 OPCODE_REASON_SRC_CLIENT = "gnt:client"
2476 OPCODE_REASON_SRC_NODED = "gnt:daemon:noded"
2477 OPCODE_REASON_SRC_OPCODE = "gnt:opcode"
2478 OPCODE_REASON_SRC_RLIB2 = "gnt:library:rlib2"
2479 OPCODE_REASON_SRC_USER = "gnt:user"
2480
2481 OPCODE_REASON_SOURCES = compat.UniqueFrozenset([
2482 OPCODE_REASON_SRC_CLIENT,
2483 OPCODE_REASON_SRC_NODED,
2484 OPCODE_REASON_SRC_OPCODE,
2485 OPCODE_REASON_SRC_RLIB2,
2486 OPCODE_REASON_SRC_USER,
2487 ])
2488
2489
2490 del re, _vcsversion, _autoconf, socket, pathutils, compat
2491