Statistics
| Branch: | Tag: | Revision:

root / lib / constants.py @ 298fe380

History | View | Annotate | Download (5 kB)

1 2f31098c Iustin Pop
#
2 a8083063 Iustin Pop
#
3 a8083063 Iustin Pop
4 a8083063 Iustin Pop
# Copyright (C) 2006, 2007 Google Inc.
5 a8083063 Iustin Pop
#
6 a8083063 Iustin Pop
# This program is free software; you can redistribute it and/or modify
7 a8083063 Iustin Pop
# it under the terms of the GNU General Public License as published by
8 a8083063 Iustin Pop
# the Free Software Foundation; either version 2 of the License, or
9 a8083063 Iustin Pop
# (at your option) any later version.
10 a8083063 Iustin Pop
#
11 a8083063 Iustin Pop
# This program is distributed in the hope that it will be useful, but
12 a8083063 Iustin Pop
# WITHOUT ANY WARRANTY; without even the implied warranty of
13 a8083063 Iustin Pop
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 a8083063 Iustin Pop
# General Public License for more details.
15 a8083063 Iustin Pop
#
16 a8083063 Iustin Pop
# You should have received a copy of the GNU General Public License
17 a8083063 Iustin Pop
# along with this program; if not, write to the Free Software
18 a8083063 Iustin Pop
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 a8083063 Iustin Pop
# 02110-1301, USA.
20 a8083063 Iustin Pop
21 a8083063 Iustin Pop
22 a8083063 Iustin Pop
"""Module holding different constants."""
23 a8083063 Iustin Pop
24 2ec08468 Michael Hanselmann
from ganeti import _autoconf
25 7c18ef8e Michael Hanselmann
26 a8083063 Iustin Pop
# various versions
27 0006af7d Michael Hanselmann
CONFIG_VERSION = 3
28 f4d377e7 Iustin Pop
PROTOCOL_VERSION = 11
29 2ec08468 Michael Hanselmann
RELEASE_VERSION = _autoconf.PACKAGE_VERSION
30 386b57af Iustin Pop
OS_API_VERSION = 5
31 a8083063 Iustin Pop
EXPORT_VERSION = 0
32 a8083063 Iustin Pop
33 a8083063 Iustin Pop
34 a8083063 Iustin Pop
# file paths
35 2ec08468 Michael Hanselmann
DATA_DIR = _autoconf.LOCALSTATEDIR + "/lib/ganeti"
36 1ed70996 Iustin Pop
RUN_DIR = _autoconf.LOCALSTATEDIR + "/run"
37 1ed70996 Iustin Pop
BDEV_CACHE_DIR = RUN_DIR + "/ganeti"
38 3aecd2c7 Iustin Pop
LOCK_DIR = _autoconf.LOCALSTATEDIR + "/lock"
39 a8083063 Iustin Pop
CLUSTER_CONF_FILE = DATA_DIR + "/config.data"
40 a8083063 Iustin Pop
SSL_CERT_FILE = DATA_DIR + "/server.pem"
41 5a3103e9 Michael Hanselmann
WATCHER_STATEFILE = DATA_DIR + "/watcher.data"
42 82122173 Iustin Pop
SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts"
43 c8a0948f Michael Hanselmann
ETC_HOSTS = "/etc/hosts"
44 1abbbbe2 Manuel Franceschini
DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR
45 ceab32dd Iustin Pop
MASTER_SOCKET = RUN_DIR + "/master.sock"
46 a8083063 Iustin Pop
47 2ec08468 Michael Hanselmann
NODE_INITD_SCRIPT = _autoconf.SYSCONFDIR + "/init.d/ganeti"
48 a8083063 Iustin Pop
DEFAULT_NODED_PORT = 1811
49 a8083063 Iustin Pop
FIRST_DRBD_PORT = 11000
50 a8083063 Iustin Pop
LAST_DRBD_PORT = 14999
51 880478f8 Iustin Pop
MASTER_SCRIPT = "ganeti-master"
52 a8083063 Iustin Pop
53 2ec08468 Michael Hanselmann
LOG_DIR = _autoconf.LOCALSTATEDIR + "/log/ganeti"
54 a8083063 Iustin Pop
LOG_OS_DIR = LOG_DIR + "/os"
55 a8083063 Iustin Pop
LOG_NODESERVER = LOG_DIR + "/node-daemon.log"
56 5a3103e9 Michael Hanselmann
LOG_WATCHER = LOG_DIR + "/watcher.log"
57 c1f2901b Iustin Pop
LOG_MASTERDAEMON = LOG_DIR + "/master-daemon.log"
58 a8083063 Iustin Pop
59 7c3d51d4 Guido Trotter
OS_SEARCH_PATH = _autoconf.OS_SEARCH_PATH
60 68dccc07 Guido Trotter
EXPORT_DIR = _autoconf.EXPORT_DIR
61 a8083063 Iustin Pop
62 a8083063 Iustin Pop
EXPORT_CONF_FILE = "config.ini"
63 a8083063 Iustin Pop
64 f00b46bc Michael Hanselmann
XEN_KERNEL = _autoconf.XEN_KERNEL
65 f00b46bc Michael Hanselmann
XEN_INITRD = _autoconf.XEN_INITRD
66 f00b46bc Michael Hanselmann
67 973d7867 Iustin Pop
VALUE_DEFAULT = "default"
68 973d7867 Iustin Pop
VALUE_NONE = "none"
69 973d7867 Iustin Pop
70 a8083063 Iustin Pop
# hooks-related constants
71 2ec08468 Michael Hanselmann
HOOKS_BASE_DIR = _autoconf.SYSCONFDIR + "/ganeti/hooks"
72 a8083063 Iustin Pop
HOOKS_PHASE_PRE = "pre"
73 a8083063 Iustin Pop
HOOKS_PHASE_POST = "post"
74 6a4aa7c1 Iustin Pop
HOOKS_NAME_CFGUPDATE = "config-update"
75 a8083063 Iustin Pop
HOOKS_VERSION = 1
76 a8083063 Iustin Pop
77 a8083063 Iustin Pop
# hooks subject type (what object type does the LU deal with)
78 a8083063 Iustin Pop
HTYPE_CLUSTER = "CLUSTER"
79 a8083063 Iustin Pop
HTYPE_NODE = "NODE"
80 a8083063 Iustin Pop
HTYPE_INSTANCE = "INSTANCE"
81 a8083063 Iustin Pop
82 a8083063 Iustin Pop
HKR_SKIP = 0
83 a8083063 Iustin Pop
HKR_FAIL = 1
84 a8083063 Iustin Pop
HKR_SUCCESS = 2
85 a8083063 Iustin Pop
86 a8083063 Iustin Pop
# disk template types
87 a8083063 Iustin Pop
DT_DISKLESS = "diskless"
88 a8083063 Iustin Pop
DT_PLAIN = "plain"
89 a8083063 Iustin Pop
DT_LOCAL_RAID1 = "local_raid1"
90 a8083063 Iustin Pop
DT_REMOTE_RAID1 = "remote_raid1"
91 a1f445d3 Iustin Pop
DT_DRBD8 = "drbd"
92 04fa07f2 Manuel Franceschini
DT_FILE = "file"
93 a1f445d3 Iustin Pop
94 a1f445d3 Iustin Pop
# the set of network-mirrored disk templates
95 a1f445d3 Iustin Pop
DTS_NET_MIRROR = frozenset([DT_REMOTE_RAID1, DT_DRBD8])
96 a8083063 Iustin Pop
97 d63e148a Manuel Franceschini
# the set of non-lvm-based disk templates
98 d63e148a Manuel Franceschini
DTS_NOT_LVM = frozenset([DT_DISKLESS, DT_FILE])
99 d63e148a Manuel Franceschini
100 fe96220b Iustin Pop
# logical disk types
101 fe96220b Iustin Pop
LD_LV = "lvm"
102 fe96220b Iustin Pop
LD_MD_R1 = "md_raid1"
103 fe96220b Iustin Pop
LD_DRBD7 = "drbd"
104 a1f445d3 Iustin Pop
LD_DRBD8 = "drbd8"
105 04fa07f2 Manuel Franceschini
LD_FILE = "file"
106 04fa07f2 Manuel Franceschini
107 04fa07f2 Manuel Franceschini
# file backend driver
108 04fa07f2 Manuel Franceschini
FD_LOOP = "loop"
109 04fa07f2 Manuel Franceschini
FD_BLKTAP = "blktap"
110 a1f445d3 Iustin Pop
111 a1f445d3 Iustin Pop
# the set of drbd-like disk types
112 a1f445d3 Iustin Pop
LDS_DRBD = frozenset([LD_DRBD7, LD_DRBD8])
113 fe96220b Iustin Pop
114 a9e0c397 Iustin Pop
# disk replacement mode
115 a9e0c397 Iustin Pop
REPLACE_DISK_PRI = "replace_primary"
116 a9e0c397 Iustin Pop
REPLACE_DISK_SEC = "replace_secondary"
117 a9e0c397 Iustin Pop
REPLACE_DISK_ALL = "replace_all"
118 a9e0c397 Iustin Pop
119 2f6eebee Guido Trotter
# instance creation modes
120 a8083063 Iustin Pop
INSTANCE_CREATE = "create"
121 a8083063 Iustin Pop
INSTANCE_IMPORT = "import"
122 a8083063 Iustin Pop
123 a8083063 Iustin Pop
DISK_TEMPLATES = frozenset([DT_DISKLESS, DT_PLAIN,
124 a1f445d3 Iustin Pop
                            DT_LOCAL_RAID1, DT_REMOTE_RAID1,
125 04fa07f2 Manuel Franceschini
                            DT_DRBD8, DT_FILE])
126 04fa07f2 Manuel Franceschini
127 04fa07f2 Manuel Franceschini
FILE_DRIVER = frozenset([FD_LOOP, FD_BLKTAP])
128 a8083063 Iustin Pop
129 a8083063 Iustin Pop
# import/export config options
130 a8083063 Iustin Pop
INISECT_EXP = "export"
131 a8083063 Iustin Pop
INISECT_INS = "instance"
132 38242904 Iustin Pop
133 38242904 Iustin Pop
# common exit codes
134 a5bc662a Iustin Pop
EXIT_SUCCESS = 0
135 38242904 Iustin Pop
EXIT_NOTMASTER = 11
136 619fdc8e Iustin Pop
EXIT_NODESETUP_ERROR = 12
137 a5bc662a Iustin Pop
EXIT_CONFIRMATION = 13 # need user confirmation
138 cf62a272 Michael Hanselmann
139 5c947f38 Iustin Pop
# tags
140 5c947f38 Iustin Pop
TAG_CLUSTER = "cluster"
141 5c947f38 Iustin Pop
TAG_NODE = "node"
142 5c947f38 Iustin Pop
TAG_INSTANCE = "instance"
143 5c947f38 Iustin Pop
MAX_TAG_LEN = 128
144 5c947f38 Iustin Pop
MAX_TAGS_PER_OBJ = 4096
145 5c947f38 Iustin Pop
146 cf62a272 Michael Hanselmann
# others
147 cf62a272 Michael Hanselmann
DEFAULT_BRIDGE = "xen-br0"
148 e31c43f7 Michael Hanselmann
SYNC_SPEED = 30 * 1024
149 aa4260ca Iustin Pop
LOCALHOST_IP_ADDRESS = "127.0.0.1"
150 16abfbc2 Alexander Schreiber
TCP_PING_TIMEOUT = 10
151 7900ed01 Iustin Pop
GANETI_RUNAS = "root"
152 d63e148a Manuel Franceschini
DEFAULT_VG = "xenvg"
153 7900ed01 Iustin Pop
154 37482e7b Guido Trotter
# valid os status
155 37482e7b Guido Trotter
OS_VALID_STATUS = "VALID"
156 37482e7b Guido Trotter
157 70d9e3d8 Iustin Pop
# ssh constants
158 7900ed01 Iustin Pop
SSH_INITD_SCRIPT = _autoconf.SSH_INITD_SCRIPT
159 70d9e3d8 Iustin Pop
SSH_CONFIG_DIR = "/etc/ssh/"
160 70d9e3d8 Iustin Pop
SSH_HOST_DSA_PRIV = SSH_CONFIG_DIR + "ssh_host_dsa_key"
161 70d9e3d8 Iustin Pop
SSH_HOST_DSA_PUB = SSH_HOST_DSA_PRIV + ".pub"
162 70d9e3d8 Iustin Pop
SSH_HOST_RSA_PRIV = SSH_CONFIG_DIR + "ssh_host_rsa_key"
163 70d9e3d8 Iustin Pop
SSH_HOST_RSA_PUB = SSH_HOST_RSA_PRIV + ".pub"
164 fff33d70 Michael Hanselmann
SSH = "ssh"
165 fff33d70 Michael Hanselmann
SCP = "scp"
166 007a2f3e Alexander Schreiber
167 007a2f3e Alexander Schreiber
# reboot types
168 007a2f3e Alexander Schreiber
INSTANCE_REBOOT_SOFT = "soft"
169 007a2f3e Alexander Schreiber
INSTANCE_REBOOT_HARD = "hard"
170 007a2f3e Alexander Schreiber
INSTANCE_REBOOT_FULL = "full"
171 2584d4a4 Alexander Schreiber
172 2584d4a4 Alexander Schreiber
# Hypervisor constants
173 631eb662 Alexander Schreiber
HT_XEN_PVM30 = "xen-3.0"
174 2584d4a4 Alexander Schreiber
HT_FAKE = "fake"
175 2a6469d5 Alexander Schreiber
HT_XEN_HVM31 = "xen-hvm-3.1"
176 2a6469d5 Alexander Schreiber
HYPER_TYPES = frozenset([HT_XEN_PVM30, HT_FAKE, HT_XEN_HVM31])
177 2a6469d5 Alexander Schreiber
HTS_REQ_PORT = frozenset([HT_XEN_HVM31])
178 2584d4a4 Alexander Schreiber
179 2a6469d5 Alexander Schreiber
HT_HVM_VNC_BASE_PORT = 5900
180 25c5878d Alexander Schreiber
HT_HVM_DEFAULT_BOOT_ORDER = 'dc'
181 2a6469d5 Alexander Schreiber
VNC_PASSWORD_FILE = _autoconf.SYSCONFDIR + "/ganeti/vnc-cluster-password"
182 e54c4c5e Guido Trotter
183 e54c4c5e Guido Trotter
# Cluster Verify steps
184 e54c4c5e Guido Trotter
VERIFY_NPLUSONE_MEM = 'nplusone_mem'
185 e54c4c5e Guido Trotter
VERIFY_OPTIONAL_CHECKS = frozenset([VERIFY_NPLUSONE_MEM])
186 e54c4c5e Guido Trotter
187 d61df03e Iustin Pop
# Allocator framework constants
188 298fe380 Iustin Pop
IALLOCATOR_DIR_IN = "in"
189 298fe380 Iustin Pop
IALLOCATOR_DIR_OUT = "out"
190 298fe380 Iustin Pop
IALLOCATOR_MODE_ALLOC = "allocate"
191 298fe380 Iustin Pop
IALLOCATOR_MODE_RELOC = "relocate"
192 298fe380 Iustin Pop
IALLOCATOR_SEARCH_PATH = _autoconf.IALLOCATOR_SEARCH_PATH