4 # Copyright (C) 2006, 2007 Google Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 """Module holding different constants."""
24 from ganeti import _autoconf
29 RELEASE_VERSION = _autoconf.PACKAGE_VERSION
36 DATA_DIR = _autoconf.LOCALSTATEDIR + "/lib/ganeti"
37 RUN_DIR = _autoconf.LOCALSTATEDIR + "/run"
38 RUN_GANETI_DIR = RUN_DIR + "/ganeti"
39 BDEV_CACHE_DIR = RUN_GANETI_DIR # TODO(2.0): move deeper
40 DISK_LINKS_DIR = RUN_GANETI_DIR + "/instance-disks"
41 # keep RUN_GANETI_DIR first here, to make sure all get created when the node
42 # daemon is started (this takes care of RUN_DIR being tmpfs)
43 SUB_RUN_DIRS = [ RUN_GANETI_DIR, BDEV_CACHE_DIR, DISK_LINKS_DIR ]
44 LOCK_DIR = _autoconf.LOCALSTATEDIR + "/lock"
45 CLUSTER_CONF_FILE = DATA_DIR + "/config.data"
46 SSL_CERT_FILE = DATA_DIR + "/server.pem"
47 WATCHER_STATEFILE = DATA_DIR + "/watcher.data"
48 SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts"
49 ETC_HOSTS = "/etc/hosts"
51 NODE_INITD_SCRIPT = _autoconf.SYSCONFDIR + "/init.d/ganeti"
52 DEFAULT_NODED_PORT = 1811
53 FIRST_DRBD_PORT = 11000
54 LAST_DRBD_PORT = 14999
55 MASTER_SCRIPT = "ganeti-master"
57 LOG_DIR = _autoconf.LOCALSTATEDIR + "/log/ganeti"
58 LOG_OS_DIR = LOG_DIR + "/os"
59 LOG_NODESERVER = LOG_DIR + "/node-daemon.log"
60 LOG_RAPISERVER = LOG_DIR + "/rapi-daemon.log"
61 LOG_RAPIACCESS = LOG_DIR + "/rapi-access.log"
62 LOG_WATCHER = LOG_DIR + "/watcher.log"
64 OS_SEARCH_PATH = _autoconf.OS_SEARCH_PATH
65 EXPORT_DIR = _autoconf.EXPORT_DIR
67 EXPORT_CONF_FILE = "config.ini"
69 XEN_KERNEL = _autoconf.XEN_KERNEL
70 XEN_INITRD = _autoconf.XEN_INITRD
72 VALUE_DEFAULT = "default"
75 # hooks-related constants
76 HOOKS_BASE_DIR = _autoconf.SYSCONFDIR + "/ganeti/hooks"
77 HOOKS_PHASE_PRE = "pre"
78 HOOKS_PHASE_POST = "post"
79 HOOKS_NAME_CFGUPDATE = "config-update"
82 # hooks subject type (what object type does the LU deal with)
83 HTYPE_CLUSTER = "CLUSTER"
85 HTYPE_INSTANCE = "INSTANCE"
92 DT_DISKLESS = "diskless"
94 DT_LOCAL_RAID1 = "local_raid1"
95 DT_REMOTE_RAID1 = "remote_raid1"
98 # the set of network-mirrored disk templates
99 DTS_NET_MIRROR = frozenset([DT_REMOTE_RAID1, DT_DRBD8])
103 LD_MD_R1 = "md_raid1"
107 # the set of drbd-like disk types
108 LDS_DRBD = frozenset([LD_DRBD7, LD_DRBD8])
110 # disk replacement mode
111 REPLACE_DISK_PRI = "replace_primary"
112 REPLACE_DISK_SEC = "replace_secondary"
113 REPLACE_DISK_ALL = "replace_all"
115 # instance creation modes
116 INSTANCE_CREATE = "create"
117 INSTANCE_IMPORT = "import"
119 DISK_TEMPLATES = frozenset([DT_DISKLESS, DT_PLAIN,
120 DT_LOCAL_RAID1, DT_REMOTE_RAID1,
123 # import/export config options
124 INISECT_EXP = "export"
125 INISECT_INS = "instance"
131 EXIT_NODESETUP_ERROR = 12
132 EXIT_CONFIRMATION = 13 # need user confirmation
135 TAG_CLUSTER = "cluster"
137 TAG_INSTANCE = "instance"
139 MAX_TAGS_PER_OBJ = 48
142 DEFAULT_BRIDGE = "xen-br0"
143 SYNC_SPEED = 30 * 1024
144 LOCALHOST_IP_ADDRESS = "127.0.0.1"
145 TCP_PING_TIMEOUT = 10
146 GANETI_RUNAS = "root"
147 BIND_ADDRESS_GLOBAL = "0.0.0.0"
149 # migration rpc steps
150 (DRBD_RECONF_RPC_INIT,
151 DRBD_RECONF_RPC_DISCONNECT,
152 DRBD_RECONF_RPC_RECONNECT,
153 DRBD_RECONF_RPC_SECONDARY,
154 DRBD_RECONF_RPC_WFSYNC,
158 OS_VALID_STATUS = "VALID"
161 SSH_INITD_SCRIPT = _autoconf.SSH_INITD_SCRIPT
162 SSH_CONFIG_DIR = "/etc/ssh/"
163 SSH_HOST_DSA_PRIV = SSH_CONFIG_DIR + "ssh_host_dsa_key"
164 SSH_HOST_DSA_PUB = SSH_HOST_DSA_PRIV + ".pub"
165 SSH_HOST_RSA_PRIV = SSH_CONFIG_DIR + "ssh_host_rsa_key"
166 SSH_HOST_RSA_PUB = SSH_HOST_RSA_PRIV + ".pub"
169 INSTANCE_REBOOT_SOFT = "soft"
170 INSTANCE_REBOOT_HARD = "hard"
171 INSTANCE_REBOOT_FULL = "full"
173 # Hypervisor constants
174 HT_XEN_PVM30 = "xen-3.0"
176 HT_XEN_HVM31 = "xen-hvm-3.1"
177 HYPER_TYPES = frozenset([HT_XEN_PVM30, HT_FAKE, HT_XEN_HVM31])
178 HTS_REQ_PORT = frozenset([HT_XEN_HVM31])
180 HT_HVM_VNC_BASE_PORT = 5900
181 HT_HVM_DEFAULT_BOOT_ORDER = 'dc'
182 HT_HVM_DEFAULT_ACPI_MODE = '1'
183 HT_HVM_DEFAULT_PAE_MODE = '1'
184 VNC_PASSWORD_FILE = _autoconf.SYSCONFDIR + "/ganeti/vnc-cluster-password"
185 VNC_DEFAULT_BIND_ADDRESS = '0.0.0.0'
188 HT_HVM_NIC_RTL8139 = "rtl8139"
189 HT_HVM_NIC_NE2K_PCI = "ne2k_pci"
190 HT_HVM_NIC_NE2K_ISA = "ne2k_isa"
191 HT_HVM_DEV_PARAVIRTUAL = "paravirtual"
192 HT_HVM_DEV_IOEMU = "ioemu"
193 HT_HVM_VALID_NIC_TYPES = frozenset([HT_HVM_NIC_RTL8139, HT_HVM_NIC_NE2K_PCI,
195 HT_HVM_DEV_PARAVIRTUAL])
196 HT_HVM_VALID_DISK_TYPES = frozenset([HT_HVM_DEV_PARAVIRTUAL, HT_HVM_DEV_IOEMU])
198 # Cluster Verify steps
199 VERIFY_NPLUSONE_MEM = 'nplusone_mem'
200 VERIFY_OPTIONAL_CHECKS = frozenset([VERIFY_NPLUSONE_MEM])
202 # Allocator framework constants
203 IALLOCATOR_DIR_IN = "in"
204 IALLOCATOR_DIR_OUT = "out"
205 IALLOCATOR_MODE_ALLOC = "allocate"
206 IALLOCATOR_MODE_RELOC = "relocate"
207 IALLOCATOR_SEARCH_PATH = _autoconf.IALLOCATOR_SEARCH_PATH
212 # Remote API constants
213 RAPI_ENABLE = _autoconf.RAPI_ENABLE