Statistics
| Branch: | Tag: | Revision:

root / lib / constants.py @ f39b695a

History | View | Annotate | Download (36.6 kB)

1 2f31098c Iustin Pop
#
2 a8083063 Iustin Pop
#
3 a8083063 Iustin Pop
4 dcb9946c Iustin Pop
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 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 4fe80ef2 Iustin Pop
import re
25 4fe80ef2 Iustin Pop
26 2ec08468 Michael Hanselmann
from ganeti import _autoconf
27 13aeae6a Iustin Pop
from ganeti import _vcsversion
28 7c18ef8e Michael Hanselmann
29 a8083063 Iustin Pop
# various versions
30 2ec08468 Michael Hanselmann
RELEASE_VERSION = _autoconf.PACKAGE_VERSION
31 d1a7d66f Guido Trotter
OS_API_V10 = 10
32 d1a7d66f Guido Trotter
OS_API_V15 = 15
33 b41b3516 Iustin Pop
OS_API_V20 = 20
34 b41b3516 Iustin Pop
OS_API_VERSIONS = frozenset([OS_API_V10, OS_API_V15, OS_API_V20])
35 13aeae6a Iustin Pop
VCS_VERSION = _vcsversion.VCS_VERSION
36 a8083063 Iustin Pop
EXPORT_VERSION = 0
37 bac5ffc3 Oleksiy Mishchenko
RAPI_VERSION = 2
38 a8083063 Iustin Pop
39 1b45f4e5 Michael Hanselmann
40 243cdbcc Michael Hanselmann
# Format for CONFIG_VERSION:
41 243cdbcc Michael Hanselmann
#   01 03 0123 = 01030123
42 243cdbcc Michael Hanselmann
#   ^^ ^^ ^^^^
43 243cdbcc Michael Hanselmann
#   |  |  + Configuration version/revision
44 243cdbcc Michael Hanselmann
#   |  + Minor version
45 243cdbcc Michael Hanselmann
#   + Major version
46 243cdbcc Michael Hanselmann
#
47 243cdbcc Michael Hanselmann
# It stored as an integer. Make sure not to write an octal number.
48 1b45f4e5 Michael Hanselmann
49 1b45f4e5 Michael Hanselmann
# BuildVersion and SplitVersion must be in here because we can't import other
50 1b45f4e5 Michael Hanselmann
# modules. The cfgupgrade tool must be able to read and write version numbers
51 1b45f4e5 Michael Hanselmann
# and thus requires these functions. To avoid code duplication, they're kept in
52 1b45f4e5 Michael Hanselmann
# here.
53 1b45f4e5 Michael Hanselmann
54 1b45f4e5 Michael Hanselmann
def BuildVersion(major, minor, revision):
55 1b45f4e5 Michael Hanselmann
  """Calculates int version number from major, minor and revision numbers.
56 1b45f4e5 Michael Hanselmann

57 1b45f4e5 Michael Hanselmann
  Returns: int representing version number
58 1b45f4e5 Michael Hanselmann

59 1b45f4e5 Michael Hanselmann
  """
60 1b45f4e5 Michael Hanselmann
  assert isinstance(major, int)
61 1b45f4e5 Michael Hanselmann
  assert isinstance(minor, int)
62 1b45f4e5 Michael Hanselmann
  assert isinstance(revision, int)
63 1b45f4e5 Michael Hanselmann
  return (1000000 * major +
64 1b45f4e5 Michael Hanselmann
            10000 * minor +
65 1b45f4e5 Michael Hanselmann
                1 * revision)
66 1b45f4e5 Michael Hanselmann
67 1b45f4e5 Michael Hanselmann
68 1b45f4e5 Michael Hanselmann
def SplitVersion(version):
69 1b45f4e5 Michael Hanselmann
  """Splits version number stored in an int.
70 1b45f4e5 Michael Hanselmann

71 1b45f4e5 Michael Hanselmann
  Returns: tuple; (major, minor, revision)
72 1b45f4e5 Michael Hanselmann

73 1b45f4e5 Michael Hanselmann
  """
74 1b45f4e5 Michael Hanselmann
  assert isinstance(version, int)
75 1b45f4e5 Michael Hanselmann
76 1b45f4e5 Michael Hanselmann
  (major, remainder) = divmod(version, 1000000)
77 1b45f4e5 Michael Hanselmann
  (minor, revision) = divmod(remainder, 10000)
78 1b45f4e5 Michael Hanselmann
79 1b45f4e5 Michael Hanselmann
  return (major, minor, revision)
80 1b45f4e5 Michael Hanselmann
81 1b45f4e5 Michael Hanselmann
82 243cdbcc Michael Hanselmann
CONFIG_MAJOR = int(_autoconf.VERSION_MAJOR)
83 243cdbcc Michael Hanselmann
CONFIG_MINOR = int(_autoconf.VERSION_MINOR)
84 243cdbcc Michael Hanselmann
CONFIG_REVISION = 0
85 1b45f4e5 Michael Hanselmann
CONFIG_VERSION = BuildVersion(CONFIG_MAJOR, CONFIG_MINOR, CONFIG_REVISION)
86 a8083063 Iustin Pop
87 cc7d6f1a Michael Hanselmann
#: RPC protocol version
88 cc7d6f1a Michael Hanselmann
PROTOCOL_VERSION = BuildVersion(CONFIG_MAJOR, CONFIG_MINOR, 0)
89 cc7d6f1a Michael Hanselmann
90 8b72b05c René Nussbaumer
# user separation
91 8b72b05c René Nussbaumer
DAEMONS_GROUP = _autoconf.DAEMONS_GROUP
92 f12e1736 René Nussbaumer
ADMIN_GROUP = _autoconf.ADMIN_GROUP
93 8b72b05c René Nussbaumer
MASTERD_USER = _autoconf.MASTERD_USER
94 f12e1736 René Nussbaumer
MASTERD_GROUP = _autoconf.MASTERD_GROUP
95 8b72b05c René Nussbaumer
RAPI_USER = _autoconf.RAPI_USER
96 f12e1736 René Nussbaumer
RAPI_GROUP = _autoconf.RAPI_GROUP
97 f12e1736 René Nussbaumer
CONFD_USER = _autoconf.CONFD_USER
98 f12e1736 René Nussbaumer
CONFD_GROUP = _autoconf.CONFD_GROUP
99 f12e1736 René Nussbaumer
NODED_USER = _autoconf.NODED_USER
100 03881cb0 René Nussbaumer
NODED_GROUP = _autoconf.NODED_GROUP
101 8b72b05c René Nussbaumer
102 a03fcb26 René Nussbaumer
103 6e991d0e René Nussbaumer
# Wipe
104 da63bb4e René Nussbaumer
DD_CMD = "dd"
105 da63bb4e René Nussbaumer
WIPE_BLOCK_SIZE = 1024**2
106 a03fcb26 René Nussbaumer
MAX_WIPE_CHUNK = 1024 # 1GB
107 a03fcb26 René Nussbaumer
MIN_WIPE_CHUNK_PERCENT = 10
108 a03fcb26 René Nussbaumer
109 6e991d0e René Nussbaumer
110 a8083063 Iustin Pop
# file paths
111 2ec08468 Michael Hanselmann
DATA_DIR = _autoconf.LOCALSTATEDIR + "/lib/ganeti"
112 1ed70996 Iustin Pop
RUN_DIR = _autoconf.LOCALSTATEDIR + "/run"
113 75afaefc Iustin Pop
RUN_GANETI_DIR = RUN_DIR + "/ganeti"
114 42ff3343 Guido Trotter
BDEV_CACHE_DIR = RUN_GANETI_DIR + "/bdev-cache"
115 75afaefc Iustin Pop
DISK_LINKS_DIR = RUN_GANETI_DIR + "/instance-disks"
116 8b72b05c René Nussbaumer
RUN_DIRS_MODE = 0775
117 b4442fd9 Guido Trotter
SOCKET_DIR = RUN_GANETI_DIR + "/socket"
118 5bae14d9 Guido Trotter
SECURE_DIR_MODE = 0700
119 637c8ab8 Balazs Lecz
SECURE_FILE_MODE = 0600
120 8b72b05c René Nussbaumer
SOCKET_DIR_MODE = 0750
121 f942a838 Michael Hanselmann
CRYPTO_KEYS_DIR = RUN_GANETI_DIR + "/crypto"
122 01144827 Guido Trotter
CRYPTO_KEYS_DIR_MODE = SECURE_DIR_MODE
123 1651d116 Michael Hanselmann
IMPORT_EXPORT_DIR = RUN_GANETI_DIR + "/import-export"
124 1651d116 Michael Hanselmann
IMPORT_EXPORT_DIR_MODE = 0755
125 b6135bbc Apollon Oikonomopoulos
ADOPTABLE_BLOCKDEV_ROOT = "/dev/disk/"
126 75afaefc Iustin Pop
# keep RUN_GANETI_DIR first here, to make sure all get created when the node
127 75afaefc Iustin Pop
# daemon is started (this takes care of RUN_DIR being tmpfs)
128 75afaefc Iustin Pop
SUB_RUN_DIRS = [ RUN_GANETI_DIR, BDEV_CACHE_DIR, DISK_LINKS_DIR ]
129 3aecd2c7 Iustin Pop
LOCK_DIR = _autoconf.LOCALSTATEDIR + "/lock"
130 0c223ea9 Michael Hanselmann
SSCONF_LOCK_FILE = LOCK_DIR + "/ganeti-ssconf.lock"
131 649bcdd8 Balazs Lecz
# User-id pool lock directory
132 649bcdd8 Balazs Lecz
# The user-ids that are in use have a corresponding lock file in this directory
133 649bcdd8 Balazs Lecz
UIDPOOL_LOCKDIR = RUN_GANETI_DIR + "/uid-pool"
134 a8083063 Iustin Pop
CLUSTER_CONF_FILE = DATA_DIR + "/config.data"
135 168c1de2 Michael Hanselmann
NODED_CERT_FILE = DATA_DIR + "/server.pem"
136 61a08fa3 Michael Hanselmann
RAPI_CERT_FILE = DATA_DIR + "/rapi.pem"
137 6b7d5878 Michael Hanselmann
CONFD_HMAC_KEY = DATA_DIR + "/hmac.key"
138 3db3eb2a Michael Hanselmann
CLUSTER_DOMAIN_SECRET_FILE = DATA_DIR + "/cluster-domain-secret"
139 5a3103e9 Michael Hanselmann
WATCHER_STATEFILE = DATA_DIR + "/watcher.data"
140 05e50653 Michael Hanselmann
WATCHER_PAUSEFILE = DATA_DIR + "/watcher.pause"
141 78f44650 Iustin Pop
INSTANCE_UPFILE = RUN_GANETI_DIR + "/instance-status"
142 82122173 Iustin Pop
SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts"
143 fdd9ac5b Michael Hanselmann
RAPI_USERS_FILE = DATA_DIR + "/rapi/users"
144 f1da30e6 Michael Hanselmann
QUEUE_DIR = DATA_DIR + "/queue"
145 f154a7a3 Michael Hanselmann
DAEMON_UTIL = _autoconf.PKGLIBDIR + "/daemon-util"
146 2e6469a1 René Nussbaumer
SETUP_SSH = _autoconf.TOOLSDIR + "/setup-ssh"
147 26916aad Apollon Oikonomopoulos
KVM_IFUP = _autoconf.PKGLIBDIR + "/kvm-ifup"
148 2f4c951e Stephen Shirley
KVM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/kvm-console-wrapper"
149 61631293 Stephen Shirley
XM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/xm-console-wrapper"
150 c8a0948f Michael Hanselmann
ETC_HOSTS = "/etc/hosts"
151 1abbbbe2 Manuel Franceschini
DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR
152 4b97f902 Apollon Oikonomopoulos
DEFAULT_SHARED_FILE_STORAGE_DIR = _autoconf.SHARED_FILE_STORAGE_DIR
153 cb7c0198 Iustin Pop
ENABLE_FILE_STORAGE = _autoconf.ENABLE_FILE_STORAGE
154 4b97f902 Apollon Oikonomopoulos
ENABLE_SHARED_FILE_STORAGE = _autoconf.ENABLE_SHARED_FILE_STORAGE
155 5420ffc9 Guido Trotter
SYSCONFDIR = _autoconf.SYSCONFDIR
156 bea60381 Michael Hanselmann
TOOLSDIR = _autoconf.TOOLSDIR
157 131178b9 Luca Bigliardi
CONF_DIR = SYSCONFDIR + "/ganeti"
158 9894ece7 Michael Hanselmann
159 168c1de2 Michael Hanselmann
ALL_CERT_FILES = frozenset([NODED_CERT_FILE, RAPI_CERT_FILE])
160 d3100055 Michael Hanselmann
161 227647ac Guido Trotter
MASTER_SOCKET = SOCKET_DIR + "/ganeti-master"
162 a8083063 Iustin Pop
163 cd50653c Guido Trotter
NODED = "ganeti-noded"
164 18679072 Guido Trotter
CONFD = "ganeti-confd"
165 8c96d01f Guido Trotter
RAPI = "ganeti-rapi"
166 dae3fdd2 Guido Trotter
MASTERD = "ganeti-masterd"
167 4d32feba Guido Trotter
# used in the ganeti-nbma project
168 4d32feba Guido Trotter
NLD = "ganeti-nld"
169 cd50653c Guido Trotter
170 cd50653c Guido Trotter
DAEMONS_PORTS = {
171 cd50653c Guido Trotter
  # daemon-name: ("proto", "default-port")
172 cd50653c Guido Trotter
  NODED: ("tcp", 1811),
173 18679072 Guido Trotter
  CONFD: ("udp", 1814),
174 8c96d01f Guido Trotter
  RAPI: ("tcp", 5080),
175 2089573e René Nussbaumer
  "ssh": ("tcp", 22),
176 4d32feba Guido Trotter
  # used in the ganeti-nbma project
177 4d32feba Guido Trotter
  NLD: ("udp", 1816),
178 cd50653c Guido Trotter
}
179 cd50653c Guido Trotter
DEFAULT_NODED_PORT = DAEMONS_PORTS[NODED][1]
180 18679072 Guido Trotter
DEFAULT_CONFD_PORT = DAEMONS_PORTS[CONFD][1]
181 8c96d01f Guido Trotter
DEFAULT_RAPI_PORT = DAEMONS_PORTS[RAPI][1]
182 4d32feba Guido Trotter
# used in the ganeti-nbma project
183 4d32feba Guido Trotter
DEFAULT_NLD_PORT = DAEMONS_PORTS[NLD][1]
184 cd50653c Guido Trotter
185 a8083063 Iustin Pop
FIRST_DRBD_PORT = 11000
186 a8083063 Iustin Pop
LAST_DRBD_PORT = 14999
187 880478f8 Iustin Pop
MASTER_SCRIPT = "ganeti-master"
188 a8083063 Iustin Pop
189 9936bd63 Iustin Pop
LOG_DIR = _autoconf.LOCALSTATEDIR + "/log/ganeti/"
190 dae3fdd2 Guido Trotter
DAEMONS_LOGFILES = {
191 d73ef63f Michael Hanselmann
  # "daemon-name": "logfile"
192 d73ef63f Michael Hanselmann
  NODED: LOG_DIR + "node-daemon.log",
193 d73ef63f Michael Hanselmann
  CONFD: LOG_DIR + "conf-daemon.log",
194 d73ef63f Michael Hanselmann
  RAPI: LOG_DIR + "rapi-daemon.log",
195 d73ef63f Michael Hanselmann
  MASTERD: LOG_DIR + "master-daemon.log",
196 4d32feba Guido Trotter
  # used in the ganeti-nbma project
197 4d32feba Guido Trotter
  NLD: LOG_DIR + "nl-daemon.log",
198 d73ef63f Michael Hanselmann
  }
199 57fd6d0b Michael Hanselmann
200 9936bd63 Iustin Pop
LOG_OS_DIR = LOG_DIR + "os"
201 9936bd63 Iustin Pop
LOG_WATCHER = LOG_DIR + "watcher.log"
202 9936bd63 Iustin Pop
LOG_COMMANDS = LOG_DIR + "commands.log"
203 6abe9194 Iustin Pop
LOG_BURNIN = LOG_DIR + "burnin.log"
204 2089573e René Nussbaumer
LOG_SETUP_SSH = LOG_DIR + "setup-ssh.log"
205 a8083063 Iustin Pop
206 481d47e8 Luca Bigliardi
DEV_CONSOLE = "/dev/console"
207 481d47e8 Luca Bigliardi
208 1b045f5d Balazs Lecz
PROC_MOUNTS = "/proc/mounts"
209 1b045f5d Balazs Lecz
210 3d5ebbf0 Stephen Shirley
# Local UniX Interface related constants
211 25942a6c Guido Trotter
LUXI_EOM = "\3"
212 e986f20c Michael Hanselmann
LUXI_VERSION = CONFIG_VERSION
213 25942a6c Guido Trotter
214 d0c8c01d Iustin Pop
# one of "no", "yes", "only"
215 551b6283 Iustin Pop
SYSLOG_USAGE = _autoconf.SYSLOG_USAGE
216 551b6283 Iustin Pop
SYSLOG_NO = "no"
217 551b6283 Iustin Pop
SYSLOG_YES = "yes"
218 551b6283 Iustin Pop
SYSLOG_ONLY = "only"
219 551b6283 Iustin Pop
SYSLOG_SOCKET = "/dev/log"
220 551b6283 Iustin Pop
221 7c3d51d4 Guido Trotter
OS_SEARCH_PATH = _autoconf.OS_SEARCH_PATH
222 68dccc07 Guido Trotter
EXPORT_DIR = _autoconf.EXPORT_DIR
223 a8083063 Iustin Pop
224 a8083063 Iustin Pop
EXPORT_CONF_FILE = "config.ini"
225 a8083063 Iustin Pop
226 2f2dbb4b Jun Futagawa
XEN_BOOTLOADER = _autoconf.XEN_BOOTLOADER
227 f00b46bc Michael Hanselmann
XEN_KERNEL = _autoconf.XEN_KERNEL
228 f00b46bc Michael Hanselmann
XEN_INITRD = _autoconf.XEN_INITRD
229 f00b46bc Michael Hanselmann
230 7e2c5b9e Guido Trotter
KVM_PATH = _autoconf.KVM_PATH
231 14aa53cb Guido Trotter
SOCAT_PATH = _autoconf.SOCAT_PATH
232 fe5b0c42 Michael Hanselmann
SOCAT_USE_ESCAPE = _autoconf.SOCAT_USE_ESCAPE
233 e90739d6 Michael Hanselmann
SOCAT_USE_COMPRESS = _autoconf.SOCAT_USE_COMPRESS
234 86d6bc2a Guido Trotter
SOCAT_ESCAPE_CODE = "0x1d"
235 7e2c5b9e Guido Trotter
236 25ce3ec4 Michael Hanselmann
#: Console as SSH command
237 25ce3ec4 Michael Hanselmann
CONS_SSH = "ssh"
238 25ce3ec4 Michael Hanselmann
239 25ce3ec4 Michael Hanselmann
#: Console as VNC server
240 25ce3ec4 Michael Hanselmann
CONS_VNC = "vnc"
241 25ce3ec4 Michael Hanselmann
242 25ce3ec4 Michael Hanselmann
#: Display a message for console access
243 25ce3ec4 Michael Hanselmann
CONS_MESSAGE = "msg"
244 25ce3ec4 Michael Hanselmann
245 25ce3ec4 Michael Hanselmann
#: All console types
246 25ce3ec4 Michael Hanselmann
CONS_ALL = frozenset([CONS_SSH, CONS_VNC, CONS_MESSAGE])
247 25ce3ec4 Michael Hanselmann
248 bdd5e420 Michael Hanselmann
# For RSA keys more bits are better, but they also make operations more
249 bdd5e420 Michael Hanselmann
# expensive. NIST SP 800-131 recommends a minimum of 2048 bits from the year
250 bdd5e420 Michael Hanselmann
# 2010 on.
251 bdd5e420 Michael Hanselmann
RSA_KEY_BITS = 2048
252 bdd5e420 Michael Hanselmann
253 971bbd84 Michael Hanselmann
# Ciphers allowed for SSL connections. For the format, see ciphers(1). A better
254 971bbd84 Michael Hanselmann
# way to disable ciphers would be to use the exclamation mark (!), but socat
255 971bbd84 Michael Hanselmann
# versions below 1.5 can't parse exclamation marks in options properly. When
256 7407c2d5 Adeodato Simo
# modifying the ciphers, ensure not to accidentially add something after it's
257 971bbd84 Michael Hanselmann
# been removed. Use the "openssl" utility to check the allowed ciphers, e.g.
258 971bbd84 Michael Hanselmann
# "openssl ciphers -v HIGH:-DES".
259 971bbd84 Michael Hanselmann
OPENSSL_CIPHERS = "HIGH:-DES:-3DES:-EXPORT:-ADH"
260 971bbd84 Michael Hanselmann
261 bdd5e420 Michael Hanselmann
# Digest used to sign certificates ("openssl x509" uses SHA1 by default)
262 bdd5e420 Michael Hanselmann
X509_CERT_SIGN_DIGEST = "SHA1"
263 bdd5e420 Michael Hanselmann
264 600535f0 Manuel Franceschini
# Default validity of certificates in days
265 600535f0 Manuel Franceschini
X509_CERT_DEFAULT_VALIDITY = 365 * 5
266 600535f0 Manuel Franceschini
267 600535f0 Manuel Franceschini
# commonName (CN) used in certificates
268 600535f0 Manuel Franceschini
X509_CERT_CN = "ganeti.example.com"
269 600535f0 Manuel Franceschini
270 68857643 Michael Hanselmann
X509_CERT_SIGNATURE_HEADER = "X-Ganeti-Signature"
271 68857643 Michael Hanselmann
272 2d76b580 Michael Hanselmann
IMPORT_EXPORT_DAEMON = _autoconf.PKGLIBDIR + "/import-export"
273 2d76b580 Michael Hanselmann
274 2d76b580 Michael Hanselmann
# Import/export daemon mode
275 2d76b580 Michael Hanselmann
IEM_IMPORT = "import"
276 2d76b580 Michael Hanselmann
IEM_EXPORT = "export"
277 2d76b580 Michael Hanselmann
278 7e3c1da6 Michael Hanselmann
# Import/export transport compression
279 7e3c1da6 Michael Hanselmann
IEC_NONE = "none"
280 7e3c1da6 Michael Hanselmann
IEC_GZIP = "gzip"
281 7e3c1da6 Michael Hanselmann
IEC_ALL = frozenset([
282 7e3c1da6 Michael Hanselmann
  IEC_NONE,
283 7e3c1da6 Michael Hanselmann
  IEC_GZIP,
284 7e3c1da6 Michael Hanselmann
  ])
285 7e3c1da6 Michael Hanselmann
286 f9323011 Michael Hanselmann
IE_CUSTOM_SIZE = "fd"
287 f9323011 Michael Hanselmann
288 1d3dfa29 Michael Hanselmann
IE_MAGIC_RE = re.compile(r"^[-_.a-zA-Z0-9]{5,100}$")
289 1d3dfa29 Michael Hanselmann
290 1651d116 Michael Hanselmann
# Import/export I/O
291 1651d116 Michael Hanselmann
# Direct file I/O, equivalent to a shell's I/O redirection using '<' or '>'
292 1651d116 Michael Hanselmann
IEIO_FILE = "file"
293 1651d116 Michael Hanselmann
# Raw block device I/O using "dd"
294 1651d116 Michael Hanselmann
IEIO_RAW_DISK = "raw"
295 1651d116 Michael Hanselmann
# OS definition import/export script
296 1651d116 Michael Hanselmann
IEIO_SCRIPT = "script"
297 1651d116 Michael Hanselmann
298 973d7867 Iustin Pop
VALUE_DEFAULT = "default"
299 4c566ede Guido Trotter
VALUE_AUTO = "auto"
300 4c566ede Guido Trotter
VALUE_GENERATE = "generate"
301 973d7867 Iustin Pop
VALUE_NONE = "none"
302 1817f49b Guido Trotter
VALUE_TRUE = "true"
303 1817f49b Guido Trotter
VALUE_FALSE = "false"
304 973d7867 Iustin Pop
305 4fe80ef2 Iustin Pop
# External script validation mask
306 4fe80ef2 Iustin Pop
EXT_PLUGIN_MASK = re.compile("^[a-zA-Z0-9_-]+$")
307 4fe80ef2 Iustin Pop
308 a8083063 Iustin Pop
# hooks-related constants
309 131178b9 Luca Bigliardi
HOOKS_BASE_DIR = CONF_DIR + "/hooks"
310 a8083063 Iustin Pop
HOOKS_PHASE_PRE = "pre"
311 a8083063 Iustin Pop
HOOKS_PHASE_POST = "post"
312 6a4aa7c1 Iustin Pop
HOOKS_NAME_CFGUPDATE = "config-update"
313 9e289e36 Guido Trotter
HOOKS_NAME_WATCHER = "watcher"
314 f3e2e4c6 Iustin Pop
HOOKS_VERSION = 2
315 a8083063 Iustin Pop
316 a8083063 Iustin Pop
# hooks subject type (what object type does the LU deal with)
317 a8083063 Iustin Pop
HTYPE_CLUSTER = "CLUSTER"
318 a8083063 Iustin Pop
HTYPE_NODE = "NODE"
319 b1ee5610 Adeodato Simo
HTYPE_GROUP = "GROUP"
320 a8083063 Iustin Pop
HTYPE_INSTANCE = "INSTANCE"
321 a8083063 Iustin Pop
322 a8083063 Iustin Pop
HKR_SKIP = 0
323 a8083063 Iustin Pop
HKR_FAIL = 1
324 a8083063 Iustin Pop
HKR_SUCCESS = 2
325 a8083063 Iustin Pop
326 ac2d0fe4 Michael Hanselmann
# Storage types
327 ac2d0fe4 Michael Hanselmann
ST_FILE = "file"
328 ac2d0fe4 Michael Hanselmann
ST_LVM_PV = "lvm-pv"
329 ac2d0fe4 Michael Hanselmann
ST_LVM_VG = "lvm-vg"
330 6032697c Michael Hanselmann
331 6032697c Michael Hanselmann
# Storage fields
332 620a85fd Iustin Pop
# first two are valid in LU context only, not passed to backend
333 620a85fd Iustin Pop
SF_NODE = "node"
334 620a85fd Iustin Pop
SF_TYPE = "type"
335 620a85fd Iustin Pop
# and the rest are valid in backend
336 6032697c Michael Hanselmann
SF_NAME = "name"
337 6032697c Michael Hanselmann
SF_SIZE = "size"
338 6032697c Michael Hanselmann
SF_FREE = "free"
339 6032697c Michael Hanselmann
SF_USED = "used"
340 6032697c Michael Hanselmann
SF_ALLOCATABLE = "allocatable"
341 6032697c Michael Hanselmann
342 6c3c6db9 Michael Hanselmann
# Storage operations
343 6c3c6db9 Michael Hanselmann
SO_FIX_CONSISTENCY = "fix-consistency"
344 6c3c6db9 Michael Hanselmann
345 6032697c Michael Hanselmann
# Available fields per storage type
346 620a85fd Iustin Pop
VALID_STORAGE_FIELDS = frozenset([SF_NAME, SF_TYPE, SF_SIZE,
347 620a85fd Iustin Pop
                                  SF_USED, SF_FREE, SF_ALLOCATABLE])
348 620a85fd Iustin Pop
349 620a85fd Iustin Pop
VALID_STORAGE_TYPES = frozenset([ST_FILE, ST_LVM_PV, ST_LVM_VG])
350 a8083063 Iustin Pop
351 efb8da02 Michael Hanselmann
MODIFIABLE_STORAGE_FIELDS = {
352 efb8da02 Michael Hanselmann
  ST_LVM_PV: frozenset([SF_ALLOCATABLE]),
353 efb8da02 Michael Hanselmann
  }
354 efb8da02 Michael Hanselmann
355 4b37cac5 Michael Hanselmann
VALID_STORAGE_OPERATIONS = {
356 6c3c6db9 Michael Hanselmann
  ST_LVM_VG: frozenset([SO_FIX_CONSISTENCY]),
357 4b37cac5 Michael Hanselmann
  }
358 4b37cac5 Michael Hanselmann
359 74f37195 Michael Hanselmann
# Local disk status
360 74f37195 Michael Hanselmann
# Note: Code depends on LDS_OKAY < LDS_UNKNOWN < LDS_FAULTY
361 74f37195 Michael Hanselmann
(LDS_OKAY,
362 74f37195 Michael Hanselmann
 LDS_UNKNOWN,
363 74f37195 Michael Hanselmann
 LDS_FAULTY) = range(1, 4)
364 74f37195 Michael Hanselmann
365 a8083063 Iustin Pop
# disk template types
366 a8083063 Iustin Pop
DT_DISKLESS = "diskless"
367 a8083063 Iustin Pop
DT_PLAIN = "plain"
368 a1f445d3 Iustin Pop
DT_DRBD8 = "drbd"
369 04fa07f2 Manuel Franceschini
DT_FILE = "file"
370 4b97f902 Apollon Oikonomopoulos
DT_SHARED_FILE = "sharedfile"
371 b6135bbc Apollon Oikonomopoulos
DT_BLOCK = "blockdev"
372 a1f445d3 Iustin Pop
373 a1f445d3 Iustin Pop
# the set of network-mirrored disk templates
374 3429a076 Apollon Oikonomopoulos
DTS_INT_MIRROR = frozenset([DT_DRBD8])
375 a8083063 Iustin Pop
376 b6135bbc Apollon Oikonomopoulos
# the set of externally-mirrored disk templates (e.g. SAN, NAS)
377 b6135bbc Apollon Oikonomopoulos
DTS_EXT_MIRROR = frozenset([DT_SHARED_FILE, DT_BLOCK])
378 4b97f902 Apollon Oikonomopoulos
379 d63e148a Manuel Franceschini
# the set of non-lvm-based disk templates
380 b6135bbc Apollon Oikonomopoulos
DTS_NOT_LVM = frozenset([DT_DISKLESS, DT_FILE, DT_SHARED_FILE, DT_BLOCK])
381 d63e148a Manuel Franceschini
382 728489a3 Guido Trotter
# the set of disk templates which can be grown
383 4b97f902 Apollon Oikonomopoulos
DTS_GROWABLE = frozenset([DT_PLAIN, DT_DRBD8, DT_FILE, DT_SHARED_FILE])
384 728489a3 Guido Trotter
385 3b08cd1c Apollon Oikonomopoulos
# the set of disk templates that allow adoption
386 b6135bbc Apollon Oikonomopoulos
DTS_MAY_ADOPT = frozenset([DT_PLAIN, DT_BLOCK])
387 b6135bbc Apollon Oikonomopoulos
388 b6135bbc Apollon Oikonomopoulos
# the set of disk templates that *must* use adoption
389 b6135bbc Apollon Oikonomopoulos
DTS_MUST_ADOPT = frozenset([DT_BLOCK])
390 3b08cd1c Apollon Oikonomopoulos
391 85a0ff7e Apollon Oikonomopoulos
# the set of disk templates that allow migrations
392 3429a076 Apollon Oikonomopoulos
DTS_MIRRORED = frozenset.union(DTS_INT_MIRROR, DTS_EXT_MIRROR)
393 85a0ff7e Apollon Oikonomopoulos
394 c16915bd Guido Trotter
# the set of file based disk templates
395 c16915bd Guido Trotter
DTS_FILEBASED = frozenset([DT_FILE, DT_SHARED_FILE])
396 85a0ff7e Apollon Oikonomopoulos
397 fe96220b Iustin Pop
# logical disk types
398 fe96220b Iustin Pop
LD_LV = "lvm"
399 a1f445d3 Iustin Pop
LD_DRBD8 = "drbd8"
400 04fa07f2 Manuel Franceschini
LD_FILE = "file"
401 b6135bbc Apollon Oikonomopoulos
LD_BLOCKDEV = "blockdev"
402 b6135bbc Apollon Oikonomopoulos
LDS_BLOCK = frozenset([LD_LV, LD_DRBD8, LD_BLOCKDEV])
403 04fa07f2 Manuel Franceschini
404 2899d9de Iustin Pop
# drbd constants
405 2899d9de Iustin Pop
DRBD_HMAC_ALG = "md5"
406 3c03759a Iustin Pop
DRBD_NET_PROTOCOL = "C"
407 89b70f39 Iustin Pop
DRBD_BARRIERS = _autoconf.DRBD_BARRIERS
408 2899d9de Iustin Pop
409 04fa07f2 Manuel Franceschini
# file backend driver
410 04fa07f2 Manuel Franceschini
FD_LOOP = "loop"
411 04fa07f2 Manuel Franceschini
FD_BLKTAP = "blktap"
412 a1f445d3 Iustin Pop
413 a1f445d3 Iustin Pop
# the set of drbd-like disk types
414 abdf0113 Iustin Pop
LDS_DRBD = frozenset([LD_DRBD8])
415 fe96220b Iustin Pop
416 08db7c5c Iustin Pop
# disk access mode
417 24991749 Iustin Pop
DISK_RDONLY = "ro"
418 24991749 Iustin Pop
DISK_RDWR = "rw"
419 08db7c5c Iustin Pop
DISK_ACCESS_SET = frozenset([DISK_RDONLY, DISK_RDWR])
420 08db7c5c Iustin Pop
421 a9e0c397 Iustin Pop
# disk replacement mode
422 cfacfd6e Iustin Pop
REPLACE_DISK_PRI = "replace_on_primary"    # replace disks on primary
423 cfacfd6e Iustin Pop
REPLACE_DISK_SEC = "replace_on_secondary"  # replace disks on secondary
424 cfacfd6e Iustin Pop
REPLACE_DISK_CHG = "replace_new_secondary" # change secondary node
425 942be002 Michael Hanselmann
REPLACE_DISK_AUTO = "replace_auto"
426 3636400f Iustin Pop
REPLACE_MODES = frozenset([
427 3636400f Iustin Pop
  REPLACE_DISK_PRI,
428 3636400f Iustin Pop
  REPLACE_DISK_SEC,
429 3636400f Iustin Pop
  REPLACE_DISK_CHG,
430 3636400f Iustin Pop
  REPLACE_DISK_AUTO,
431 3636400f Iustin Pop
  ])
432 a9e0c397 Iustin Pop
433 4a96f1d1 Michael Hanselmann
# Instance export mode
434 4a96f1d1 Michael Hanselmann
EXPORT_MODE_LOCAL = "local"
435 4a96f1d1 Michael Hanselmann
EXPORT_MODE_REMOTE = "remote"
436 4a96f1d1 Michael Hanselmann
EXPORT_MODES = frozenset([
437 4a96f1d1 Michael Hanselmann
  EXPORT_MODE_LOCAL,
438 4a96f1d1 Michael Hanselmann
  EXPORT_MODE_REMOTE,
439 4a96f1d1 Michael Hanselmann
  ])
440 4a96f1d1 Michael Hanselmann
441 d385a174 Iustin Pop
# Lock recalculate mode
442 d0c8c01d Iustin Pop
LOCKS_REPLACE = "replace"
443 d0c8c01d Iustin Pop
LOCKS_APPEND = "append"
444 f6d9a522 Guido Trotter
445 d385a174 Iustin Pop
# Lock timeout (sum) before we should go into blocking acquire (still
446 d385a174 Iustin Pop
# can be reset by priority change); computed as max time (10 hours)
447 d385a174 Iustin Pop
# before we should actually go into blocking acquire given that we
448 d385a174 Iustin Pop
# start from default priority level; in seconds
449 d385a174 Iustin Pop
LOCK_ATTEMPTS_TIMEOUT = 10 * 3600 / 20.0
450 d385a174 Iustin Pop
LOCK_ATTEMPTS_MAXWAIT = 15.0
451 d385a174 Iustin Pop
LOCK_ATTEMPTS_MINWAIT = 1.0
452 d385a174 Iustin Pop
453 2f6eebee Guido Trotter
# instance creation modes
454 a8083063 Iustin Pop
INSTANCE_CREATE = "create"
455 a8083063 Iustin Pop
INSTANCE_IMPORT = "import"
456 9bf56d77 Michael Hanselmann
INSTANCE_REMOTE_IMPORT = "remote-import"
457 9bf56d77 Michael Hanselmann
INSTANCE_CREATE_MODES = frozenset([
458 9bf56d77 Michael Hanselmann
  INSTANCE_CREATE,
459 9bf56d77 Michael Hanselmann
  INSTANCE_IMPORT,
460 9bf56d77 Michael Hanselmann
  INSTANCE_REMOTE_IMPORT,
461 9bf56d77 Michael Hanselmann
  ])
462 a8083063 Iustin Pop
463 1410fa8d Michael Hanselmann
# Remote import/export handshake message and version
464 1410fa8d Michael Hanselmann
RIE_VERSION = 0
465 1410fa8d Michael Hanselmann
RIE_HANDSHAKE = "Hi, I'm Ganeti"
466 1410fa8d Michael Hanselmann
467 1410fa8d Michael Hanselmann
# Remote import/export certificate validity in seconds
468 1410fa8d Michael Hanselmann
RIE_CERT_VALIDITY = 24 * 60 * 60
469 1410fa8d Michael Hanselmann
470 4478301b Michael Hanselmann
# Overall timeout for establishing connection
471 8fd2e34c Michael Hanselmann
RIE_CONNECT_TIMEOUT = 180
472 4a96f1d1 Michael Hanselmann
473 4478301b Michael Hanselmann
# Export only: how long to wait per connection attempt (seconds)
474 4478301b Michael Hanselmann
RIE_CONNECT_ATTEMPT_TIMEOUT = 20
475 4478301b Michael Hanselmann
476 4478301b Michael Hanselmann
# Export only: number of attempts to connect
477 4478301b Michael Hanselmann
RIE_CONNECT_RETRIES = 10
478 4478301b Michael Hanselmann
479 c74cda62 René Nussbaumer
#: Give child process up to 5 seconds to exit after sending a signal
480 c74cda62 René Nussbaumer
CHILD_LINGER_TIMEOUT = 5.0
481 4a96f1d1 Michael Hanselmann
482 4b97f902 Apollon Oikonomopoulos
DISK_TEMPLATES = frozenset([DT_DISKLESS, DT_PLAIN, DT_DRBD8,
483 b6135bbc Apollon Oikonomopoulos
                            DT_FILE, DT_SHARED_FILE, DT_BLOCK])
484 04fa07f2 Manuel Franceschini
485 04fa07f2 Manuel Franceschini
FILE_DRIVER = frozenset([FD_LOOP, FD_BLKTAP])
486 a8083063 Iustin Pop
487 a8083063 Iustin Pop
# import/export config options
488 a8083063 Iustin Pop
INISECT_EXP = "export"
489 a8083063 Iustin Pop
INISECT_INS = "instance"
490 3c8954ad Iustin Pop
INISECT_HYP = "hypervisor"
491 3c8954ad Iustin Pop
INISECT_BEP = "backend"
492 535b49cb Iustin Pop
INISECT_OSP = "os"
493 38242904 Iustin Pop
494 24991749 Iustin Pop
# dynamic device modification
495 61a14bb3 Iustin Pop
DDM_ADD = "add"
496 61a14bb3 Iustin Pop
DDM_REMOVE = "remove"
497 61a14bb3 Iustin Pop
DDMS_VALUES = frozenset([DDM_ADD, DDM_REMOVE])
498 24991749 Iustin Pop
499 38242904 Iustin Pop
# common exit codes
500 a5bc662a Iustin Pop
EXIT_SUCCESS = 0
501 438b45d4 Michael Hanselmann
EXIT_FAILURE = 1
502 46479775 Guido Trotter
EXIT_NOTCLUSTER = 5
503 38242904 Iustin Pop
EXIT_NOTMASTER = 11
504 619fdc8e Iustin Pop
EXIT_NODESETUP_ERROR = 12
505 a5bc662a Iustin Pop
EXIT_CONFIRMATION = 13 # need user confirmation
506 cf62a272 Michael Hanselmann
507 ee3aedff Michael Hanselmann
#: Exit code for query operations with unknown fields
508 ee3aedff Michael Hanselmann
EXIT_UNKNOWN_FIELD = 14
509 ee3aedff Michael Hanselmann
510 5c947f38 Iustin Pop
# tags
511 5c947f38 Iustin Pop
TAG_CLUSTER = "cluster"
512 1ffd2673 Michael Hanselmann
TAG_NODEGROUP = "nodegroup"
513 5c947f38 Iustin Pop
TAG_NODE = "node"
514 5c947f38 Iustin Pop
TAG_INSTANCE = "instance"
515 3636400f Iustin Pop
VALID_TAG_TYPES = frozenset([
516 3636400f Iustin Pop
  TAG_CLUSTER,
517 1ffd2673 Michael Hanselmann
  TAG_NODEGROUP,
518 3636400f Iustin Pop
  TAG_NODE,
519 3636400f Iustin Pop
  TAG_INSTANCE,
520 3636400f Iustin Pop
  ])
521 5c947f38 Iustin Pop
MAX_TAG_LEN = 128
522 5c947f38 Iustin Pop
MAX_TAGS_PER_OBJ = 4096
523 5c947f38 Iustin Pop
524 cf62a272 Michael Hanselmann
# others
525 cf62a272 Michael Hanselmann
DEFAULT_BRIDGE = "xen-br0"
526 24b0d752 Iustin Pop
SYNC_SPEED = 60 * 1024
527 9769bb78 Manuel Franceschini
IP4_ADDRESS_LOCALHOST = "127.0.0.1"
528 9769bb78 Manuel Franceschini
IP4_ADDRESS_ANY = "0.0.0.0"
529 0d2cd893 Manuel Franceschini
IP6_ADDRESS_LOCALHOST = "::1"
530 0d2cd893 Manuel Franceschini
IP6_ADDRESS_ANY = "::"
531 2f20d07b Manuel Franceschini
IP4_VERSION = 4
532 2f20d07b Manuel Franceschini
IP6_VERSION = 6
533 16abfbc2 Alexander Schreiber
TCP_PING_TIMEOUT = 10
534 7900ed01 Iustin Pop
GANETI_RUNAS = "root"
535 d63e148a Manuel Franceschini
DEFAULT_VG = "xenvg"
536 ee2f0ed4 Luca Bigliardi
DEFAULT_DRBD_HELPER = "/bin/true"
537 8d1a2a64 Michael Hanselmann
MIN_VG_SIZE = 20480
538 c5e489f7 Iustin Pop
DEFAULT_MAC_PREFIX = "aa:00:00"
539 3736cb6b Iustin Pop
LVM_STRIPECOUNT = _autoconf.LVM_STRIPECOUNT
540 88cd08aa Guido Trotter
# default maximum instance wait time, in seconds.
541 88cd08aa Guido Trotter
DEFAULT_SHUTDOWN_TIMEOUT = 120
542 313b2dd4 Michael Hanselmann
NODE_MAX_CLOCK_SKEW = 150
543 033a1d00 Michael Hanselmann
# Time for an intra-cluster disk transfer to wait for a connection
544 81635b5a Iustin Pop
DISK_TRANSFER_CONNECT_TIMEOUT = 60
545 3536c792 Iustin Pop
# Disk index separator
546 3536c792 Iustin Pop
DISK_SEPARATOR = _autoconf.DISK_SEPARATOR
547 7900ed01 Iustin Pop
548 6a373640 Michael Hanselmann
#: Key for job IDs in opcode result
549 6a373640 Michael Hanselmann
JOB_IDS_KEY = "jobs"
550 6a373640 Michael Hanselmann
551 6bb65e3a Guido Trotter
# runparts results
552 6bb65e3a Guido Trotter
(RUNPARTS_SKIP,
553 6bb65e3a Guido Trotter
 RUNPARTS_RUN,
554 6bb65e3a Guido Trotter
 RUNPARTS_ERR) = range(3)
555 6bb65e3a Guido Trotter
556 6bb65e3a Guido Trotter
RUNPARTS_STATUS = frozenset([RUNPARTS_SKIP, RUNPARTS_RUN, RUNPARTS_ERR])
557 6bb65e3a Guido Trotter
558 12bce260 Michael Hanselmann
# RPC constants
559 12bce260 Michael Hanselmann
(RPC_ENCODING_NONE,
560 12bce260 Michael Hanselmann
 RPC_ENCODING_ZLIB_BASE64) = range(2)
561 12bce260 Michael Hanselmann
562 ded1c679 Guido Trotter
# os related constants
563 d0c8c01d Iustin Pop
OS_SCRIPT_CREATE = "create"
564 d0c8c01d Iustin Pop
OS_SCRIPT_IMPORT = "import"
565 d0c8c01d Iustin Pop
OS_SCRIPT_EXPORT = "export"
566 d0c8c01d Iustin Pop
OS_SCRIPT_RENAME = "rename"
567 d0c8c01d Iustin Pop
OS_SCRIPT_VERIFY = "verify"
568 16653425 Iustin Pop
OS_SCRIPTS = frozenset([OS_SCRIPT_CREATE, OS_SCRIPT_IMPORT,
569 b41b3516 Iustin Pop
                        OS_SCRIPT_EXPORT, OS_SCRIPT_RENAME,
570 b41b3516 Iustin Pop
                        OS_SCRIPT_VERIFY])
571 37482e7b Guido Trotter
572 d0c8c01d Iustin Pop
OS_API_FILE = "ganeti_api_version"
573 d0c8c01d Iustin Pop
OS_VARIANTS_FILE = "variants.list"
574 d0c8c01d Iustin Pop
OS_PARAMETERS_FILE = "parameters.list"
575 b41b3516 Iustin Pop
576 d0c8c01d Iustin Pop
OS_VALIDATE_PARAMETERS = "parameters"
577 acd9ff9e Iustin Pop
OS_VALIDATE_CALLS = frozenset([OS_VALIDATE_PARAMETERS])
578 b6b45e0d Guido Trotter
579 70d9e3d8 Iustin Pop
# ssh constants
580 553bd93f Vitaly Kuznetsov
SSH_CONFIG_DIR = _autoconf.SSH_CONFIG_DIR
581 553bd93f Vitaly Kuznetsov
SSH_HOST_DSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_dsa_key"
582 70d9e3d8 Iustin Pop
SSH_HOST_DSA_PUB = SSH_HOST_DSA_PRIV + ".pub"
583 553bd93f Vitaly Kuznetsov
SSH_HOST_RSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_rsa_key"
584 70d9e3d8 Iustin Pop
SSH_HOST_RSA_PUB = SSH_HOST_RSA_PRIV + ".pub"
585 fff33d70 Michael Hanselmann
SSH = "ssh"
586 fff33d70 Michael Hanselmann
SCP = "scp"
587 007a2f3e Alexander Schreiber
588 007a2f3e Alexander Schreiber
# reboot types
589 007a2f3e Alexander Schreiber
INSTANCE_REBOOT_SOFT = "soft"
590 007a2f3e Alexander Schreiber
INSTANCE_REBOOT_HARD = "hard"
591 007a2f3e Alexander Schreiber
INSTANCE_REBOOT_FULL = "full"
592 2584d4a4 Alexander Schreiber
593 00f91f29 Iustin Pop
REBOOT_TYPES = frozenset([INSTANCE_REBOOT_SOFT,
594 00f91f29 Iustin Pop
                          INSTANCE_REBOOT_HARD,
595 00f91f29 Iustin Pop
                          INSTANCE_REBOOT_FULL])
596 00f91f29 Iustin Pop
597 d0c8c01d Iustin Pop
VTYPE_STRING = "string"
598 59525e1f Michael Hanselmann
VTYPE_MAYBE_STRING = "maybe-string"
599 d0c8c01d Iustin Pop
VTYPE_BOOL = "bool"
600 d0c8c01d Iustin Pop
VTYPE_SIZE = "size" # size, in MiBs
601 d0c8c01d Iustin Pop
VTYPE_INT = "int"
602 a5728081 Guido Trotter
ENFORCEABLE_TYPES = frozenset([
603 a5728081 Guido Trotter
                      VTYPE_STRING,
604 59525e1f Michael Hanselmann
                      VTYPE_MAYBE_STRING,
605 a5728081 Guido Trotter
                      VTYPE_BOOL,
606 a5728081 Guido Trotter
                      VTYPE_SIZE,
607 a5728081 Guido Trotter
                      VTYPE_INT,
608 a5728081 Guido Trotter
                      ])
609 a5728081 Guido Trotter
610 e64b8beb Iustin Pop
# HV parameter names (global namespace)
611 e64b8beb Iustin Pop
HV_BOOT_ORDER = "boot_order"
612 e64b8beb Iustin Pop
HV_CDROM_IMAGE_PATH = "cdrom_image_path"
613 cc130cc7 Marco Casavecchia
HV_KVM_CDROM2_IMAGE_PATH = "cdrom2_image_path"
614 cc130cc7 Marco Casavecchia
HV_KVM_FLOPPY_IMAGE_PATH = "floppy_image_path"
615 e64b8beb Iustin Pop
HV_NIC_TYPE = "nic_type"
616 e64b8beb Iustin Pop
HV_DISK_TYPE = "disk_type"
617 cc130cc7 Marco Casavecchia
HV_KVM_CDROM_DISK_TYPE = "cdrom_disk_type"
618 e64b8beb Iustin Pop
HV_VNC_BIND_ADDRESS = "vnc_bind_address"
619 6e6bb8d5 Guido Trotter
HV_VNC_PASSWORD_FILE = "vnc_password_file"
620 8b2d1013 Guido Trotter
HV_VNC_TLS = "vnc_tls"
621 8b2d1013 Guido Trotter
HV_VNC_X509 = "vnc_x509_path"
622 8b2d1013 Guido Trotter
HV_VNC_X509_VERIFY = "vnc_x509_verify"
623 e64b8beb Iustin Pop
HV_ACPI = "acpi"
624 e64b8beb Iustin Pop
HV_PAE = "pae"
625 2f2dbb4b Jun Futagawa
HV_USE_BOOTLOADER = "use_bootloader"
626 2f2dbb4b Jun Futagawa
HV_BOOTLOADER_ARGS = "bootloader_args"
627 2f2dbb4b Jun Futagawa
HV_BOOTLOADER_PATH = "bootloader_path"
628 f9d6542d Iustin Pop
HV_KERNEL_ARGS = "kernel_args"
629 e64b8beb Iustin Pop
HV_KERNEL_PATH = "kernel_path"
630 e64b8beb Iustin Pop
HV_INITRD_PATH = "initrd_path"
631 074ca009 Guido Trotter
HV_ROOT_PATH = "root_path"
632 a2faf9ee Guido Trotter
HV_SERIAL_CONSOLE = "serial_console"
633 11344a50 Guido Trotter
HV_USB_MOUSE = "usb_mouse"
634 4f580fef Sébastien Bocahu
HV_KEYMAP = "keymap"
635 09ea8710 Iustin Pop
HV_DEVICE_MODEL = "device_model"
636 48297fa2 Iustin Pop
HV_INIT_SCRIPT = "init_script"
637 78411c60 Iustin Pop
HV_MIGRATION_PORT = "migration_port"
638 e43d4f9f Apollon Oikonomopoulos
HV_MIGRATION_BANDWIDTH = "migration_bandwidth"
639 e43d4f9f Apollon Oikonomopoulos
HV_MIGRATION_DOWNTIME = "migration_downtime"
640 783a6c0b Iustin Pop
HV_MIGRATION_MODE = "migration_mode"
641 6b970cef Jun Futagawa
HV_USE_LOCALTIME = "use_localtime"
642 ea0f3d7a Iustin Pop
HV_DISK_CACHE = "disk_cache"
643 3424767f Guido Trotter
HV_SECURITY_MODEL = "security_model"
644 3424767f Guido Trotter
HV_SECURITY_DOMAIN = "security_domain"
645 7ba594c0 Guido Trotter
HV_KVM_FLAG = "kvm_flag"
646 fbe27e2b Guido Trotter
HV_VHOST_NET = "vhost_net"
647 84c08e4e Balazs Lecz
HV_KVM_USE_CHROOT = "use_chroot"
648 e3ed5316 Balazs Lecz
HV_CPU_MASK = "cpu_mask"
649 4f958b0b Miguel Di Ciurcio Filho
HV_MEM_PATH = "mem_path"
650 525011bc Maciej Bliziński
HV_BLOCKDEV_PREFIX = "blockdev_prefix"
651 e64b8beb Iustin Pop
652 a5728081 Guido Trotter
HVS_PARAMETER_TYPES = {
653 a5728081 Guido Trotter
  HV_BOOT_ORDER: VTYPE_STRING,
654 cc130cc7 Marco Casavecchia
  HV_KVM_FLOPPY_IMAGE_PATH: VTYPE_STRING,
655 a5728081 Guido Trotter
  HV_CDROM_IMAGE_PATH: VTYPE_STRING,
656 cc130cc7 Marco Casavecchia
  HV_KVM_CDROM2_IMAGE_PATH: VTYPE_STRING,
657 a5728081 Guido Trotter
  HV_NIC_TYPE: VTYPE_STRING,
658 a5728081 Guido Trotter
  HV_DISK_TYPE: VTYPE_STRING,
659 cc130cc7 Marco Casavecchia
  HV_KVM_CDROM_DISK_TYPE: VTYPE_STRING,
660 6e6bb8d5 Guido Trotter
  HV_VNC_PASSWORD_FILE: VTYPE_STRING,
661 a5728081 Guido Trotter
  HV_VNC_BIND_ADDRESS: VTYPE_STRING,
662 a5728081 Guido Trotter
  HV_VNC_TLS: VTYPE_BOOL,
663 a5728081 Guido Trotter
  HV_VNC_X509: VTYPE_STRING,
664 a5728081 Guido Trotter
  HV_VNC_X509_VERIFY: VTYPE_BOOL,
665 a5728081 Guido Trotter
  HV_ACPI: VTYPE_BOOL,
666 a5728081 Guido Trotter
  HV_PAE: VTYPE_BOOL,
667 2f2dbb4b Jun Futagawa
  HV_USE_BOOTLOADER: VTYPE_BOOL,
668 2f2dbb4b Jun Futagawa
  HV_BOOTLOADER_PATH: VTYPE_STRING,
669 2f2dbb4b Jun Futagawa
  HV_BOOTLOADER_ARGS: VTYPE_STRING,
670 a5728081 Guido Trotter
  HV_KERNEL_PATH: VTYPE_STRING,
671 f9d6542d Iustin Pop
  HV_KERNEL_ARGS: VTYPE_STRING,
672 a5728081 Guido Trotter
  HV_INITRD_PATH: VTYPE_STRING,
673 7adf7814 René Nussbaumer
  HV_ROOT_PATH: VTYPE_MAYBE_STRING,
674 a5728081 Guido Trotter
  HV_SERIAL_CONSOLE: VTYPE_BOOL,
675 a5728081 Guido Trotter
  HV_USB_MOUSE: VTYPE_STRING,
676 4f580fef Sébastien Bocahu
  HV_KEYMAP: VTYPE_STRING,
677 09ea8710 Iustin Pop
  HV_DEVICE_MODEL: VTYPE_STRING,
678 48297fa2 Iustin Pop
  HV_INIT_SCRIPT: VTYPE_STRING,
679 78411c60 Iustin Pop
  HV_MIGRATION_PORT: VTYPE_INT,
680 e43d4f9f Apollon Oikonomopoulos
  HV_MIGRATION_BANDWIDTH: VTYPE_INT,
681 e43d4f9f Apollon Oikonomopoulos
  HV_MIGRATION_DOWNTIME: VTYPE_INT,
682 783a6c0b Iustin Pop
  HV_MIGRATION_MODE: VTYPE_STRING,
683 6b970cef Jun Futagawa
  HV_USE_LOCALTIME: VTYPE_BOOL,
684 ea0f3d7a Iustin Pop
  HV_DISK_CACHE: VTYPE_STRING,
685 3424767f Guido Trotter
  HV_SECURITY_MODEL: VTYPE_STRING,
686 3424767f Guido Trotter
  HV_SECURITY_DOMAIN: VTYPE_STRING,
687 7ba594c0 Guido Trotter
  HV_KVM_FLAG: VTYPE_STRING,
688 fbe27e2b Guido Trotter
  HV_VHOST_NET: VTYPE_BOOL,
689 84c08e4e Balazs Lecz
  HV_KVM_USE_CHROOT: VTYPE_BOOL,
690 e3ed5316 Balazs Lecz
  HV_CPU_MASK: VTYPE_STRING,
691 4f958b0b Miguel Di Ciurcio Filho
  HV_MEM_PATH: VTYPE_STRING,
692 525011bc Maciej Bliziński
  HV_BLOCKDEV_PREFIX: VTYPE_STRING,
693 a5728081 Guido Trotter
  }
694 a5728081 Guido Trotter
695 a5728081 Guido Trotter
HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
696 5018a335 Iustin Pop
697 3d5ebbf0 Stephen Shirley
# Backend parameter names
698 cd3ab26e Iustin Pop
BE_MEMORY = "memory"
699 e64b8beb Iustin Pop
BE_VCPUS = "vcpus"
700 c0f2b229 Iustin Pop
BE_AUTO_BALANCE = "auto_balance"
701 e64b8beb Iustin Pop
702 a5728081 Guido Trotter
BES_PARAMETER_TYPES = {
703 a5728081 Guido Trotter
    BE_MEMORY: VTYPE_SIZE,
704 a5728081 Guido Trotter
    BE_VCPUS: VTYPE_INT,
705 a5728081 Guido Trotter
    BE_AUTO_BALANCE: VTYPE_BOOL,
706 a5728081 Guido Trotter
    }
707 a5728081 Guido Trotter
708 a5728081 Guido Trotter
BES_PARAMETERS = frozenset(BES_PARAMETER_TYPES.keys())
709 cd3ab26e Iustin Pop
710 095e71aa René Nussbaumer
# Node parameter names
711 095e71aa René Nussbaumer
ND_OOB_PROGRAM = "oob_program"
712 095e71aa René Nussbaumer
713 095e71aa René Nussbaumer
NDS_PARAMETER_TYPES = {
714 095e71aa René Nussbaumer
    ND_OOB_PROGRAM: VTYPE_MAYBE_STRING,
715 095e71aa René Nussbaumer
    }
716 095e71aa René Nussbaumer
717 095e71aa René Nussbaumer
NDS_PARAMETERS = frozenset(NDS_PARAMETER_TYPES.keys())
718 095e71aa René Nussbaumer
719 b2f29800 René Nussbaumer
# OOB supported commands
720 b2f29800 René Nussbaumer
OOB_POWER_ON = "power-on"
721 b2f29800 René Nussbaumer
OOB_POWER_OFF = "power-off"
722 b2f29800 René Nussbaumer
OOB_POWER_CYCLE = "power-cycle"
723 b2f29800 René Nussbaumer
OOB_POWER_STATUS = "power-status"
724 b2f29800 René Nussbaumer
OOB_HEALTH = "health"
725 b2f29800 René Nussbaumer
726 b2f29800 René Nussbaumer
OOB_COMMANDS = frozenset([OOB_POWER_ON, OOB_POWER_OFF, OOB_POWER_CYCLE,
727 b2f29800 René Nussbaumer
                          OOB_POWER_STATUS, OOB_HEALTH])
728 b2f29800 René Nussbaumer
729 b528a12d René Nussbaumer
OOB_POWER_STATUS_POWERED = "powered"
730 b528a12d René Nussbaumer
731 445f735d René Nussbaumer
OOB_TIMEOUT = 60 # 60 seconds
732 beff3779 René Nussbaumer
OOB_POWER_DELAY = 2.0 # 2 seconds
733 445f735d René Nussbaumer
734 445f735d René Nussbaumer
OOB_STATUS_OK = "OK"
735 445f735d René Nussbaumer
OOB_STATUS_WARNING = "WARNING"
736 445f735d René Nussbaumer
OOB_STATUS_CRITICAL = "CRITICAL"
737 445f735d René Nussbaumer
OOB_STATUS_UNKNOWN = "UNKNOWN"
738 445f735d René Nussbaumer
739 445f735d René Nussbaumer
OOB_STATUSES = frozenset([
740 445f735d René Nussbaumer
  OOB_STATUS_OK,
741 445f735d René Nussbaumer
  OOB_STATUS_WARNING,
742 445f735d René Nussbaumer
  OOB_STATUS_CRITICAL,
743 445f735d René Nussbaumer
  OOB_STATUS_UNKNOWN,
744 445f735d René Nussbaumer
  ])
745 445f735d René Nussbaumer
746 4ef7f423 Guido Trotter
# Instance Parameters Profile
747 4ef7f423 Guido Trotter
PP_DEFAULT = "default"
748 e64b8beb Iustin Pop
749 246f4067 Guido Trotter
# NIC_* constants are used inside the ganeti config
750 ac061be9 Guido Trotter
NIC_MODE = "mode"
751 ac061be9 Guido Trotter
NIC_LINK = "link"
752 ac061be9 Guido Trotter
753 ac061be9 Guido Trotter
NIC_MODE_BRIDGED = "bridged"
754 ac061be9 Guido Trotter
NIC_MODE_ROUTED = "routed"
755 ac061be9 Guido Trotter
756 ac061be9 Guido Trotter
NIC_VALID_MODES = frozenset([NIC_MODE_BRIDGED, NIC_MODE_ROUTED])
757 ac061be9 Guido Trotter
758 ac061be9 Guido Trotter
NICS_PARAMETER_TYPES = {
759 ac061be9 Guido Trotter
    NIC_MODE: VTYPE_STRING,
760 ac061be9 Guido Trotter
    NIC_LINK: VTYPE_STRING,
761 ac061be9 Guido Trotter
    }
762 ac061be9 Guido Trotter
763 ac061be9 Guido Trotter
NICS_PARAMETERS = frozenset(NICS_PARAMETER_TYPES.keys())
764 e64b8beb Iustin Pop
765 246f4067 Guido Trotter
# IDISK_* constants are used in opcodes, to create/change disks
766 bd061c35 Guido Trotter
IDISK_SIZE = "size"
767 bd061c35 Guido Trotter
IDISK_MODE = "mode"
768 8494604f Apollon Oikonomopoulos
IDISK_ADOPT = "adopt"
769 7af3534e Dmitry Chernyak
IDISK_VG = "vg"
770 87001920 Iustin Pop
IDISK_METAVG = "metavg"
771 8494604f Apollon Oikonomopoulos
IDISK_PARAMS_TYPES = {
772 8494604f Apollon Oikonomopoulos
  IDISK_SIZE: VTYPE_SIZE,
773 8494604f Apollon Oikonomopoulos
  IDISK_MODE: VTYPE_STRING,
774 8494604f Apollon Oikonomopoulos
  IDISK_ADOPT: VTYPE_STRING,
775 7af3534e Dmitry Chernyak
  IDISK_VG: VTYPE_STRING,
776 87001920 Iustin Pop
  IDISK_METAVG: VTYPE_STRING,
777 8494604f Apollon Oikonomopoulos
  }
778 cc87d736 Michael Hanselmann
IDISK_PARAMS = frozenset(IDISK_PARAMS_TYPES.keys())
779 cc87d736 Michael Hanselmann
780 246f4067 Guido Trotter
# INIC_* constants are used in opcodes, to create/change nics
781 bd061c35 Guido Trotter
INIC_MAC = "mac"
782 bd061c35 Guido Trotter
INIC_IP = "ip"
783 bd061c35 Guido Trotter
INIC_MODE = "mode"
784 bd061c35 Guido Trotter
INIC_LINK = "link"
785 cc87d736 Michael Hanselmann
INIC_PARAMS_TYPES = {
786 cc87d736 Michael Hanselmann
  INIC_IP: VTYPE_MAYBE_STRING,
787 cc87d736 Michael Hanselmann
  INIC_LINK: VTYPE_STRING,
788 cc87d736 Michael Hanselmann
  INIC_MAC: VTYPE_STRING,
789 cc87d736 Michael Hanselmann
  INIC_MODE: VTYPE_STRING,
790 cc87d736 Michael Hanselmann
  }
791 cc87d736 Michael Hanselmann
INIC_PARAMS = frozenset(INIC_PARAMS_TYPES.keys())
792 bd061c35 Guido Trotter
793 2584d4a4 Alexander Schreiber
# Hypervisor constants
794 00cd937c Iustin Pop
HT_XEN_PVM = "xen-pvm"
795 2584d4a4 Alexander Schreiber
HT_FAKE = "fake"
796 00cd937c Iustin Pop
HT_XEN_HVM = "xen-hvm"
797 550e49b9 Guido Trotter
HT_KVM = "kvm"
798 48297fa2 Iustin Pop
HT_CHROOT = "chroot"
799 4b5e40a5 Iustin Pop
HT_LXC = "lxc"
800 4b5e40a5 Iustin Pop
HYPER_TYPES = frozenset([
801 4b5e40a5 Iustin Pop
  HT_XEN_PVM,
802 4b5e40a5 Iustin Pop
  HT_FAKE,
803 4b5e40a5 Iustin Pop
  HT_XEN_HVM,
804 4b5e40a5 Iustin Pop
  HT_KVM,
805 4b5e40a5 Iustin Pop
  HT_CHROOT,
806 4b5e40a5 Iustin Pop
  HT_LXC,
807 4b5e40a5 Iustin Pop
  ])
808 fd4daa3a Guido Trotter
HTS_REQ_PORT = frozenset([HT_XEN_HVM, HT_KVM])
809 2584d4a4 Alexander Schreiber
810 377d74c9 Guido Trotter
VNC_BASE_PORT = 5900
811 131178b9 Luca Bigliardi
VNC_PASSWORD_FILE = CONF_DIR + "/vnc-cluster-password"
812 0d2cd893 Manuel Franceschini
VNC_DEFAULT_BIND_ADDRESS = IP4_ADDRESS_ANY
813 e54c4c5e Guido Trotter
814 835528af Iustin Pop
# NIC types
815 d08f6067 Guido Trotter
HT_NIC_RTL8139 = "rtl8139"
816 d08f6067 Guido Trotter
HT_NIC_NE2K_PCI = "ne2k_pci"
817 d08f6067 Guido Trotter
HT_NIC_NE2K_ISA = "ne2k_isa"
818 43440815 Guido Trotter
HT_NIC_I82551 = "i82551"
819 43440815 Guido Trotter
HT_NIC_I85557B = "i82557b"
820 43440815 Guido Trotter
HT_NIC_I8259ER = "i82559er"
821 43440815 Guido Trotter
HT_NIC_PCNET = "pcnet"
822 43440815 Guido Trotter
HT_NIC_E1000 = "e1000"
823 d08f6067 Guido Trotter
HT_NIC_PARAVIRTUAL = HT_DISK_PARAVIRTUAL = "paravirtual"
824 43440815 Guido Trotter
825 d08f6067 Guido Trotter
HT_HVM_VALID_NIC_TYPES = frozenset([HT_NIC_RTL8139, HT_NIC_NE2K_PCI,
826 a4d9fbac Guido Trotter
                                    HT_NIC_E1000, HT_NIC_NE2K_ISA,
827 a4d9fbac Guido Trotter
                                    HT_NIC_PARAVIRTUAL])
828 43440815 Guido Trotter
HT_KVM_VALID_NIC_TYPES = frozenset([HT_NIC_RTL8139, HT_NIC_NE2K_PCI,
829 43440815 Guido Trotter
                                    HT_NIC_NE2K_ISA, HT_NIC_I82551,
830 43440815 Guido Trotter
                                    HT_NIC_I85557B, HT_NIC_I8259ER,
831 43440815 Guido Trotter
                                    HT_NIC_PCNET, HT_NIC_E1000,
832 43440815 Guido Trotter
                                    HT_NIC_PARAVIRTUAL])
833 835528af Iustin Pop
# Disk types
834 835528af Iustin Pop
HT_DISK_IOEMU = "ioemu"
835 835528af Iustin Pop
HT_DISK_IDE = "ide"
836 835528af Iustin Pop
HT_DISK_SCSI = "scsi"
837 835528af Iustin Pop
HT_DISK_SD = "sd"
838 835528af Iustin Pop
HT_DISK_MTD = "mtd"
839 835528af Iustin Pop
HT_DISK_PFLASH = "pflash"
840 835528af Iustin Pop
841 ea0f3d7a Iustin Pop
HT_CACHE_DEFAULT = "default"
842 ea0f3d7a Iustin Pop
HT_CACHE_NONE = "none"
843 ea0f3d7a Iustin Pop
HT_CACHE_WTHROUGH = "writethrough"
844 ea0f3d7a Iustin Pop
HT_CACHE_WBACK = "writeback"
845 ea0f3d7a Iustin Pop
HT_VALID_CACHE_TYPES = frozenset([HT_CACHE_DEFAULT,
846 ea0f3d7a Iustin Pop
                                  HT_CACHE_NONE,
847 ea0f3d7a Iustin Pop
                                  HT_CACHE_WTHROUGH,
848 ea0f3d7a Iustin Pop
                                  HT_CACHE_WBACK])
849 ea0f3d7a Iustin Pop
850 835528af Iustin Pop
HT_HVM_VALID_DISK_TYPES = frozenset([HT_DISK_PARAVIRTUAL, HT_DISK_IOEMU])
851 43440815 Guido Trotter
HT_KVM_VALID_DISK_TYPES = frozenset([HT_DISK_PARAVIRTUAL, HT_DISK_IDE,
852 43440815 Guido Trotter
                                     HT_DISK_SCSI, HT_DISK_SD, HT_DISK_MTD,
853 43440815 Guido Trotter
                                     HT_DISK_PFLASH])
854 b894f5a8 Alexander Schreiber
855 835528af Iustin Pop
# Mouse types:
856 835528af Iustin Pop
HT_MOUSE_MOUSE = "mouse"
857 835528af Iustin Pop
HT_MOUSE_TABLET = "tablet"
858 835528af Iustin Pop
859 835528af Iustin Pop
HT_KVM_VALID_MOUSE_TYPES = frozenset([HT_MOUSE_MOUSE, HT_MOUSE_TABLET])
860 835528af Iustin Pop
861 835528af Iustin Pop
# Boot order
862 cc130cc7 Marco Casavecchia
HT_BO_FLOPPY = "floppy"
863 835528af Iustin Pop
HT_BO_CDROM = "cdrom"
864 835528af Iustin Pop
HT_BO_DISK = "disk"
865 835528af Iustin Pop
HT_BO_NETWORK = "network"
866 835528af Iustin Pop
867 cc130cc7 Marco Casavecchia
HT_KVM_VALID_BO_TYPES = frozenset([HT_BO_FLOPPY, HT_BO_CDROM,
868 cc130cc7 Marco Casavecchia
                                   HT_BO_DISK, HT_BO_NETWORK])
869 835528af Iustin Pop
870 3424767f Guido Trotter
# Security models
871 3424767f Guido Trotter
HT_SM_NONE = "none"
872 3424767f Guido Trotter
HT_SM_USER = "user"
873 3424767f Guido Trotter
HT_SM_POOL = "pool"
874 3424767f Guido Trotter
875 3424767f Guido Trotter
HT_KVM_VALID_SM_TYPES = frozenset([HT_SM_NONE, HT_SM_USER, HT_SM_POOL])
876 3424767f Guido Trotter
877 7ba594c0 Guido Trotter
# Kvm flag values
878 7ba594c0 Guido Trotter
HT_KVM_ENABLED = "enabled"
879 7ba594c0 Guido Trotter
HT_KVM_DISABLED = "disabled"
880 7ba594c0 Guido Trotter
881 7ba594c0 Guido Trotter
HT_KVM_FLAG_VALUES = frozenset([HT_KVM_ENABLED, HT_KVM_DISABLED])
882 7ba594c0 Guido Trotter
883 e71b9ef4 Iustin Pop
# Migration type
884 e71b9ef4 Iustin Pop
HT_MIGRATION_LIVE = "live"
885 e71b9ef4 Iustin Pop
HT_MIGRATION_NONLIVE = "non-live"
886 783a6c0b Iustin Pop
HT_MIGRATION_MODES = frozenset([HT_MIGRATION_LIVE, HT_MIGRATION_NONLIVE])
887 e71b9ef4 Iustin Pop
888 e54c4c5e Guido Trotter
# Cluster Verify steps
889 d0c8c01d Iustin Pop
VERIFY_NPLUSONE_MEM = "nplusone_mem"
890 e54c4c5e Guido Trotter
VERIFY_OPTIONAL_CHECKS = frozenset([VERIFY_NPLUSONE_MEM])
891 e54c4c5e Guido Trotter
892 25361b9a Iustin Pop
# Node verify constants
893 7ef40fbe Luca Bigliardi
NV_DRBDHELPER = "drbd-helper"
894 b0d85178 Iustin Pop
NV_DRBDLIST = "drbd-list"
895 25361b9a Iustin Pop
NV_FILELIST = "filelist"
896 25361b9a Iustin Pop
NV_HVINFO = "hvinfo"
897 25361b9a Iustin Pop
NV_HYPERVISOR = "hypervisor"
898 58a59652 Iustin Pop
NV_HVPARAMS = "hvparms"
899 25361b9a Iustin Pop
NV_INSTANCELIST = "instancelist"
900 b0d85178 Iustin Pop
NV_LVLIST = "lvlist"
901 b0d85178 Iustin Pop
NV_MASTERIP = "master-ip"
902 25361b9a Iustin Pop
NV_NODELIST = "nodelist"
903 25361b9a Iustin Pop
NV_NODENETTEST = "node-net-test"
904 7c0aa8e9 Iustin Pop
NV_NODESETUP = "nodesetup"
905 b0d85178 Iustin Pop
NV_OSLIST = "oslist"
906 b0d85178 Iustin Pop
NV_PVLIST = "pvlist"
907 313b2dd4 Michael Hanselmann
NV_TIME = "time"
908 b0d85178 Iustin Pop
NV_VERSION = "version"
909 b0d85178 Iustin Pop
NV_VGLIST = "vglist"
910 8964ee14 Iustin Pop
NV_VMNODES = "vmnodes"
911 16f41f24 René Nussbaumer
NV_OOB_PATHS = "oob-paths"
912 20d317d4 Iustin Pop
NV_BRIDGES = "bridges"
913 25361b9a Iustin Pop
914 61a980a9 Michael Hanselmann
# Instance status
915 61a980a9 Michael Hanselmann
INSTST_RUNNING = "running"
916 61a980a9 Michael Hanselmann
INSTST_ADMINDOWN = "ADMIN_down"
917 61a980a9 Michael Hanselmann
INSTST_NODEOFFLINE = "ERROR_nodeoffline"
918 61a980a9 Michael Hanselmann
INSTST_NODEDOWN = "ERROR_nodedown"
919 61a980a9 Michael Hanselmann
INSTST_WRONGNODE = "ERROR_wrongnode"
920 61a980a9 Michael Hanselmann
INSTST_ERRORUP = "ERROR_up"
921 61a980a9 Michael Hanselmann
INSTST_ERRORDOWN = "ERROR_down"
922 61a980a9 Michael Hanselmann
INSTST_ALL = frozenset([
923 61a980a9 Michael Hanselmann
  INSTST_RUNNING,
924 61a980a9 Michael Hanselmann
  INSTST_ADMINDOWN,
925 61a980a9 Michael Hanselmann
  INSTST_NODEOFFLINE,
926 61a980a9 Michael Hanselmann
  INSTST_NODEDOWN,
927 61a980a9 Michael Hanselmann
  INSTST_WRONGNODE,
928 61a980a9 Michael Hanselmann
  INSTST_ERRORUP,
929 61a980a9 Michael Hanselmann
  INSTST_ERRORDOWN,
930 61a980a9 Michael Hanselmann
  ])
931 61a980a9 Michael Hanselmann
932 1e28e3b8 Michael Hanselmann
# Node roles
933 1e28e3b8 Michael Hanselmann
NR_REGULAR = "R"
934 1e28e3b8 Michael Hanselmann
NR_MASTER = "M"
935 1e28e3b8 Michael Hanselmann
NR_MCANDIDATE = "C"
936 1e28e3b8 Michael Hanselmann
NR_DRAINED = "D"
937 1e28e3b8 Michael Hanselmann
NR_OFFLINE = "O"
938 1e28e3b8 Michael Hanselmann
NR_ALL = frozenset([
939 1e28e3b8 Michael Hanselmann
  NR_REGULAR,
940 1e28e3b8 Michael Hanselmann
  NR_MASTER,
941 1e28e3b8 Michael Hanselmann
  NR_MCANDIDATE,
942 1e28e3b8 Michael Hanselmann
  NR_DRAINED,
943 1e28e3b8 Michael Hanselmann
  NR_OFFLINE,
944 1e28e3b8 Michael Hanselmann
  ])
945 1e28e3b8 Michael Hanselmann
946 b98bf262 Michael Hanselmann
# SSL certificate check constants (in days)
947 b98bf262 Michael Hanselmann
SSL_CERT_EXPIRATION_WARN = 30
948 b98bf262 Michael Hanselmann
SSL_CERT_EXPIRATION_ERROR = 7
949 b98bf262 Michael Hanselmann
950 d61df03e Iustin Pop
# Allocator framework constants
951 77031881 Iustin Pop
IALLOCATOR_VERSION = 2
952 298fe380 Iustin Pop
IALLOCATOR_DIR_IN = "in"
953 298fe380 Iustin Pop
IALLOCATOR_DIR_OUT = "out"
954 3636400f Iustin Pop
VALID_IALLOCATOR_DIRECTIONS = frozenset([
955 3636400f Iustin Pop
  IALLOCATOR_DIR_IN,
956 3636400f Iustin Pop
  IALLOCATOR_DIR_OUT,
957 3636400f Iustin Pop
  ])
958 298fe380 Iustin Pop
IALLOCATOR_MODE_ALLOC = "allocate"
959 298fe380 Iustin Pop
IALLOCATOR_MODE_RELOC = "relocate"
960 7f60a422 Iustin Pop
IALLOCATOR_MODE_MEVAC = "multi-evacuate"
961 60152bbe Michael Hanselmann
IALLOCATOR_MODE_CHG_GROUP = "change-group"
962 60152bbe Michael Hanselmann
IALLOCATOR_MODE_NODE_EVAC = "node-evacuate"
963 3636400f Iustin Pop
VALID_IALLOCATOR_MODES = frozenset([
964 3636400f Iustin Pop
  IALLOCATOR_MODE_ALLOC,
965 3636400f Iustin Pop
  IALLOCATOR_MODE_RELOC,
966 3636400f Iustin Pop
  IALLOCATOR_MODE_MEVAC,
967 60152bbe Michael Hanselmann
  IALLOCATOR_MODE_CHG_GROUP,
968 60152bbe Michael Hanselmann
  IALLOCATOR_MODE_NODE_EVAC,
969 3636400f Iustin Pop
  ])
970 298fe380 Iustin Pop
IALLOCATOR_SEARCH_PATH = _autoconf.IALLOCATOR_SEARCH_PATH
971 5f33b613 Michael Hanselmann
972 60152bbe Michael Hanselmann
IALLOCATOR_NEVAC_PRI = "primary-only"
973 60152bbe Michael Hanselmann
IALLOCATOR_NEVAC_SEC = "secondary-only"
974 60152bbe Michael Hanselmann
IALLOCATOR_NEVAC_ALL = "all"
975 60152bbe Michael Hanselmann
IALLOCATOR_NEVAC_MODES = frozenset([
976 60152bbe Michael Hanselmann
  IALLOCATOR_NEVAC_PRI,
977 60152bbe Michael Hanselmann
  IALLOCATOR_NEVAC_SEC,
978 60152bbe Michael Hanselmann
  IALLOCATOR_NEVAC_ALL,
979 60152bbe Michael Hanselmann
  ])
980 60152bbe Michael Hanselmann
981 f1da30e6 Michael Hanselmann
# Job queue
982 f1da30e6 Michael Hanselmann
JOB_QUEUE_VERSION = 1
983 f1da30e6 Michael Hanselmann
JOB_QUEUE_LOCK_FILE = QUEUE_DIR + "/lock"
984 f1da30e6 Michael Hanselmann
JOB_QUEUE_VERSION_FILE = QUEUE_DIR + "/version"
985 f1da30e6 Michael Hanselmann
JOB_QUEUE_SERIAL_FILE = QUEUE_DIR + "/serial"
986 0cb94105 Michael Hanselmann
JOB_QUEUE_ARCHIVE_DIR = QUEUE_DIR + "/archive"
987 686d7433 Iustin Pop
JOB_QUEUE_DRAIN_FILE = QUEUE_DIR + "/drain"
988 f87b405e Michael Hanselmann
JOB_QUEUE_SIZE_HARD_LIMIT = 5000
989 c33549ef Guido Trotter
JOB_QUEUE_DIRS = [QUEUE_DIR, JOB_QUEUE_ARCHIVE_DIR]
990 5bae14d9 Guido Trotter
JOB_QUEUE_DIRS_MODE = SECURE_DIR_MODE
991 f1da30e6 Michael Hanselmann
992 bac5ffc3 Oleksiy Mishchenko
JOB_ID_TEMPLATE = r"\d+"
993 bac5ffc3 Oleksiy Mishchenko
994 5c735209 Iustin Pop
# unchanged job return
995 5c735209 Iustin Pop
JOB_NOTCHANGED = "nochange"
996 5c735209 Iustin Pop
997 5f33b613 Michael Hanselmann
# Job status
998 5f33b613 Michael Hanselmann
JOB_STATUS_QUEUED = "queued"
999 47099cd1 Michael Hanselmann
JOB_STATUS_WAITING = "waiting"
1000 fbf0262f Michael Hanselmann
JOB_STATUS_CANCELING = "canceling"
1001 5f33b613 Michael Hanselmann
JOB_STATUS_RUNNING = "running"
1002 5f33b613 Michael Hanselmann
JOB_STATUS_CANCELED = "canceled"
1003 5f33b613 Michael Hanselmann
JOB_STATUS_SUCCESS = "success"
1004 5f33b613 Michael Hanselmann
JOB_STATUS_ERROR = "error"
1005 989a8bee Michael Hanselmann
JOBS_FINALIZED = frozenset([
1006 989a8bee Michael Hanselmann
  JOB_STATUS_CANCELED,
1007 989a8bee Michael Hanselmann
  JOB_STATUS_SUCCESS,
1008 989a8bee Michael Hanselmann
  JOB_STATUS_ERROR,
1009 989a8bee Michael Hanselmann
  ])
1010 db5bce34 Michael Hanselmann
JOB_STATUS_ALL = frozenset([
1011 db5bce34 Michael Hanselmann
  JOB_STATUS_QUEUED,
1012 47099cd1 Michael Hanselmann
  JOB_STATUS_WAITING,
1013 db5bce34 Michael Hanselmann
  JOB_STATUS_CANCELING,
1014 db5bce34 Michael Hanselmann
  JOB_STATUS_RUNNING,
1015 db5bce34 Michael Hanselmann
  ]) | JOBS_FINALIZED
1016 5f33b613 Michael Hanselmann
1017 34327f51 Iustin Pop
# OpCode status
1018 34327f51 Iustin Pop
# not yet finalized
1019 5f33b613 Michael Hanselmann
OP_STATUS_QUEUED = "queued"
1020 47099cd1 Michael Hanselmann
OP_STATUS_WAITING = "waiting"
1021 fbf0262f Michael Hanselmann
OP_STATUS_CANCELING = "canceling"
1022 5f33b613 Michael Hanselmann
OP_STATUS_RUNNING = "running"
1023 34327f51 Iustin Pop
# finalized
1024 4cb1d919 Michael Hanselmann
OP_STATUS_CANCELED = "canceled"
1025 5f33b613 Michael Hanselmann
OP_STATUS_SUCCESS = "success"
1026 5f33b613 Michael Hanselmann
OP_STATUS_ERROR = "error"
1027 34327f51 Iustin Pop
OPS_FINALIZED = frozenset([OP_STATUS_CANCELED,
1028 34327f51 Iustin Pop
                           OP_STATUS_SUCCESS,
1029 34327f51 Iustin Pop
                           OP_STATUS_ERROR])
1030 f1048938 Iustin Pop
1031 e5d8774b Michael Hanselmann
# OpCode priority
1032 e5d8774b Michael Hanselmann
OP_PRIO_LOWEST = +19
1033 e5d8774b Michael Hanselmann
OP_PRIO_HIGHEST = -20
1034 e5d8774b Michael Hanselmann
1035 e5d8774b Michael Hanselmann
OP_PRIO_LOW = +10
1036 e5d8774b Michael Hanselmann
OP_PRIO_NORMAL = 0
1037 e5d8774b Michael Hanselmann
OP_PRIO_HIGH = -10
1038 e5d8774b Michael Hanselmann
1039 e71c8147 Michael Hanselmann
OP_PRIO_SUBMIT_VALID = frozenset([
1040 e71c8147 Michael Hanselmann
  OP_PRIO_LOW,
1041 e71c8147 Michael Hanselmann
  OP_PRIO_NORMAL,
1042 e71c8147 Michael Hanselmann
  OP_PRIO_HIGH,
1043 e71c8147 Michael Hanselmann
  ])
1044 e71c8147 Michael Hanselmann
1045 e5d8774b Michael Hanselmann
OP_PRIO_DEFAULT = OP_PRIO_NORMAL
1046 e5d8774b Michael Hanselmann
1047 f1048938 Iustin Pop
# Execution log types
1048 f1048938 Iustin Pop
ELOG_MESSAGE = "message"
1049 f1048938 Iustin Pop
ELOG_PROGRESS = "progress"
1050 9bf56d77 Michael Hanselmann
ELOG_REMOTE_IMPORT = "remote-import"
1051 e58f87a9 Michael Hanselmann
ELOG_JQUEUE_TEST = "jqueue-test"
1052 e58f87a9 Michael Hanselmann
1053 19ddc57a René Nussbaumer
# /etc/hosts modification
1054 19ddc57a René Nussbaumer
ETC_HOSTS_ADD = "add"
1055 19ddc57a René Nussbaumer
ETC_HOSTS_REMOVE = "remove"
1056 19ddc57a René Nussbaumer
1057 e58f87a9 Michael Hanselmann
# Job queue test
1058 e58f87a9 Michael Hanselmann
JQT_MSGPREFIX = "TESTMSG="
1059 e58f87a9 Michael Hanselmann
JQT_EXPANDNAMES = "expandnames"
1060 e58f87a9 Michael Hanselmann
JQT_EXEC = "exec"
1061 e58f87a9 Michael Hanselmann
JQT_LOGMSG = "logmsg"
1062 f99010b2 Michael Hanselmann
JQT_STARTMSG = "startmsg"
1063 e58f87a9 Michael Hanselmann
JQT_ALL = frozenset([
1064 e58f87a9 Michael Hanselmann
  JQT_EXPANDNAMES,
1065 e58f87a9 Michael Hanselmann
  JQT_EXEC,
1066 e58f87a9 Michael Hanselmann
  JQT_LOGMSG,
1067 f99010b2 Michael Hanselmann
  JQT_STARTMSG,
1068 e58f87a9 Michael Hanselmann
  ])
1069 d4104181 Iustin Pop
1070 4a917de6 Michael Hanselmann
# Query resources
1071 4a917de6 Michael Hanselmann
QR_INSTANCE = "instance"
1072 4a917de6 Michael Hanselmann
QR_NODE = "node"
1073 24d16f76 Michael Hanselmann
QR_LOCK = "lock"
1074 e070c663 Adeodato Simo
QR_GROUP = "group"
1075 be3a4b14 Michael Hanselmann
QR_OS = "os"
1076 4a917de6 Michael Hanselmann
1077 4a917de6 Michael Hanselmann
#: List of resources which can be queried using L{opcodes.OpQuery}
1078 abd66bf8 Michael Hanselmann
QR_VIA_OP = frozenset([QR_INSTANCE, QR_NODE, QR_GROUP, QR_OS])
1079 4a917de6 Michael Hanselmann
1080 3d5ebbf0 Stephen Shirley
#: List of resources which can be queried using Local UniX Interface
1081 abd66bf8 Michael Hanselmann
QR_VIA_LUXI = QR_VIA_OP.union([
1082 24d16f76 Michael Hanselmann
  QR_LOCK,
1083 28b71a76 Michael Hanselmann
  ])
1084 28b71a76 Michael Hanselmann
1085 abd66bf8 Michael Hanselmann
#: List of resources which can be queried using RAPI
1086 abd66bf8 Michael Hanselmann
QR_VIA_RAPI = QR_VIA_LUXI
1087 abd66bf8 Michael Hanselmann
1088 4a917de6 Michael Hanselmann
# Query field types
1089 4a917de6 Michael Hanselmann
QFT_UNKNOWN = "unknown"
1090 4a917de6 Michael Hanselmann
QFT_TEXT = "text"
1091 4a917de6 Michael Hanselmann
QFT_BOOL = "bool"
1092 4a917de6 Michael Hanselmann
QFT_NUMBER = "number"
1093 4a917de6 Michael Hanselmann
QFT_UNIT = "unit"
1094 4a917de6 Michael Hanselmann
QFT_TIMESTAMP = "timestamp"
1095 4a917de6 Michael Hanselmann
QFT_OTHER = "other"
1096 4a917de6 Michael Hanselmann
1097 4a917de6 Michael Hanselmann
#: All query field types
1098 4a917de6 Michael Hanselmann
QFT_ALL = frozenset([
1099 4a917de6 Michael Hanselmann
  QFT_UNKNOWN,
1100 4a917de6 Michael Hanselmann
  QFT_TEXT,
1101 4a917de6 Michael Hanselmann
  QFT_BOOL,
1102 4a917de6 Michael Hanselmann
  QFT_NUMBER,
1103 4a917de6 Michael Hanselmann
  QFT_UNIT,
1104 4a917de6 Michael Hanselmann
  QFT_TIMESTAMP,
1105 4a917de6 Michael Hanselmann
  QFT_OTHER,
1106 4a917de6 Michael Hanselmann
  ])
1107 4a917de6 Michael Hanselmann
1108 a6070ef7 Michael Hanselmann
# Query result field status (don't change or reuse values as they're used by
1109 a6070ef7 Michael Hanselmann
# clients)
1110 4a917de6 Michael Hanselmann
#: Normal field status
1111 cfb084ae René Nussbaumer
RS_NORMAL = 0
1112 4a917de6 Michael Hanselmann
#: Unknown field
1113 cfb084ae René Nussbaumer
RS_UNKNOWN = 1
1114 cfb084ae René Nussbaumer
#: No data (e.g. RPC error), can be used instead of L{RS_OFFLINE}
1115 cfb084ae René Nussbaumer
RS_NODATA = 2
1116 dcb9946c Iustin Pop
#: Value unavailable/unsupported for item; if this field is supported
1117 e18c6c47 Iustin Pop
#: but we cannot get the data for the moment, RS_NODATA or
1118 e18c6c47 Iustin Pop
#: RS_OFFLINE should be used
1119 cfb084ae René Nussbaumer
RS_UNAVAIL = 3
1120 a6070ef7 Michael Hanselmann
#: Resource marked offline
1121 cfb084ae René Nussbaumer
RS_OFFLINE = 4
1122 cfb084ae René Nussbaumer
1123 cfb084ae René Nussbaumer
RS_ALL = frozenset([
1124 cfb084ae René Nussbaumer
  RS_NORMAL,
1125 cfb084ae René Nussbaumer
  RS_UNKNOWN,
1126 cfb084ae René Nussbaumer
  RS_NODATA,
1127 cfb084ae René Nussbaumer
  RS_UNAVAIL,
1128 cfb084ae René Nussbaumer
  RS_OFFLINE,
1129 ee3aedff Michael Hanselmann
  ])
1130 ee3aedff Michael Hanselmann
1131 f0b1bafe Iustin Pop
#: Dictionary with special field cases and their verbose/terse formatting
1132 f0b1bafe Iustin Pop
RSS_DESCRIPTION = {
1133 f0b1bafe Iustin Pop
  RS_UNKNOWN: ("(unknown)", "??"),
1134 f0b1bafe Iustin Pop
  RS_NODATA:  ("(nodata)",  "?"),
1135 f0b1bafe Iustin Pop
  RS_OFFLINE: ("(offline)", "*"),
1136 f0b1bafe Iustin Pop
  RS_UNAVAIL: ("(unavail)", "-"),
1137 f0b1bafe Iustin Pop
  }
1138 f0b1bafe Iustin Pop
1139 c5e489f7 Iustin Pop
# max dynamic devices
1140 24991749 Iustin Pop
MAX_NICS = 8
1141 24991749 Iustin Pop
MAX_DISKS = 16
1142 24991749 Iustin Pop
1143 93384844 Iustin Pop
# SSCONF keys
1144 93384844 Iustin Pop
SS_CLUSTER_NAME = "cluster_name"
1145 5d60b3bd Iustin Pop
SS_CLUSTER_TAGS = "cluster_tags"
1146 93384844 Iustin Pop
SS_FILE_STORAGE_DIR = "file_storage_dir"
1147 4b97f902 Apollon Oikonomopoulos
SS_SHARED_FILE_STORAGE_DIR = "shared_file_storage_dir"
1148 f56618e0 Iustin Pop
SS_MASTER_CANDIDATES = "master_candidates"
1149 8113a52e Luca Bigliardi
SS_MASTER_CANDIDATES_IPS = "master_candidates_ips"
1150 93384844 Iustin Pop
SS_MASTER_IP = "master_ip"
1151 93384844 Iustin Pop
SS_MASTER_NETDEV = "master_netdev"
1152 93384844 Iustin Pop
SS_MASTER_NODE = "master_node"
1153 93384844 Iustin Pop
SS_NODE_LIST = "node_list"
1154 f9780ccd Luca Bigliardi
SS_NODE_PRIMARY_IPS = "node_primary_ips"
1155 f9780ccd Luca Bigliardi
SS_NODE_SECONDARY_IPS = "node_secondary_ips"
1156 a3316e4a Iustin Pop
SS_OFFLINE_NODES = "offline_nodes"
1157 81a49123 Iustin Pop
SS_ONLINE_NODES = "online_nodes"
1158 868a98ca Manuel Franceschini
SS_PRIMARY_IP_FAMILY = "primary_ip_family"
1159 81a49123 Iustin Pop
SS_INSTANCE_LIST = "instance_list"
1160 8a113c7a Iustin Pop
SS_RELEASE_VERSION = "release_version"
1161 4f7a6a10 Iustin Pop
SS_HYPERVISOR_LIST = "hypervisor_list"
1162 5c465a95 Iustin Pop
SS_MAINTAIN_NODE_HEALTH = "maintain_node_health"
1163 0fbae49a Balazs Lecz
SS_UID_POOL = "uid_pool"
1164 6f076453 Guido Trotter
SS_NODEGROUPS = "nodegroups"
1165 93384844 Iustin Pop
1166 7888a614 Alexander Schreiber
# cluster wide default parameters
1167 7888a614 Alexander Schreiber
DEFAULT_ENABLED_HYPERVISOR = HT_XEN_PVM
1168 7888a614 Alexander Schreiber
1169 7888a614 Alexander Schreiber
HVC_DEFAULTS = {
1170 bd0ff7c2 Iustin Pop
  HT_XEN_PVM: {
1171 2f2dbb4b Jun Futagawa
    HV_USE_BOOTLOADER: False,
1172 2f2dbb4b Jun Futagawa
    HV_BOOTLOADER_PATH: XEN_BOOTLOADER,
1173 d0c8c01d Iustin Pop
    HV_BOOTLOADER_ARGS: "",
1174 bd0ff7c2 Iustin Pop
    HV_KERNEL_PATH: "/boot/vmlinuz-2.6-xenU",
1175 d0c8c01d Iustin Pop
    HV_INITRD_PATH: "",
1176 d0c8c01d Iustin Pop
    HV_ROOT_PATH: "/dev/sda1",
1177 d0c8c01d Iustin Pop
    HV_KERNEL_ARGS: "ro",
1178 78411c60 Iustin Pop
    HV_MIGRATION_PORT: 8002,
1179 783a6c0b Iustin Pop
    HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1180 525011bc Maciej Bliziński
    HV_BLOCKDEV_PREFIX: "sd",
1181 bd0ff7c2 Iustin Pop
    },
1182 bd0ff7c2 Iustin Pop
  HT_XEN_HVM: {
1183 bd0ff7c2 Iustin Pop
    HV_BOOT_ORDER: "cd",
1184 d0c8c01d Iustin Pop
    HV_CDROM_IMAGE_PATH: "",
1185 d08f6067 Guido Trotter
    HV_NIC_TYPE: HT_NIC_RTL8139,
1186 43440815 Guido Trotter
    HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
1187 9769bb78 Manuel Franceschini
    HV_VNC_BIND_ADDRESS: IP4_ADDRESS_ANY,
1188 6e6bb8d5 Guido Trotter
    HV_VNC_PASSWORD_FILE: VNC_PASSWORD_FILE,
1189 bd0ff7c2 Iustin Pop
    HV_ACPI: True,
1190 bd0ff7c2 Iustin Pop
    HV_PAE: True,
1191 e2ee1cea Iustin Pop
    HV_KERNEL_PATH: "/usr/lib/xen/boot/hvmloader",
1192 09ea8710 Iustin Pop
    HV_DEVICE_MODEL: "/usr/lib/xen/bin/qemu-dm",
1193 78411c60 Iustin Pop
    HV_MIGRATION_PORT: 8002,
1194 783a6c0b Iustin Pop
    HV_MIGRATION_MODE: HT_MIGRATION_NONLIVE,
1195 6b970cef Jun Futagawa
    HV_USE_LOCALTIME: False,
1196 525011bc Maciej Bliziński
    HV_BLOCKDEV_PREFIX: "hd",
1197 bd0ff7c2 Iustin Pop
    },
1198 bd0ff7c2 Iustin Pop
  HT_KVM: {
1199 bd0ff7c2 Iustin Pop
    HV_KERNEL_PATH: "/boot/vmlinuz-2.6-kvmU",
1200 d0c8c01d Iustin Pop
    HV_INITRD_PATH: "",
1201 d0c8c01d Iustin Pop
    HV_KERNEL_ARGS: "ro",
1202 d0c8c01d Iustin Pop
    HV_ROOT_PATH: "/dev/vda1",
1203 bd0ff7c2 Iustin Pop
    HV_ACPI: True,
1204 bd0ff7c2 Iustin Pop
    HV_SERIAL_CONSOLE: True,
1205 d0c8c01d Iustin Pop
    HV_VNC_BIND_ADDRESS: "",
1206 8b2d1013 Guido Trotter
    HV_VNC_TLS: False,
1207 d0c8c01d Iustin Pop
    HV_VNC_X509: "",
1208 8b2d1013 Guido Trotter
    HV_VNC_X509_VERIFY: False,
1209 d0c8c01d Iustin Pop
    HV_VNC_PASSWORD_FILE: "",
1210 d0c8c01d Iustin Pop
    HV_KVM_FLOPPY_IMAGE_PATH: "",
1211 d0c8c01d Iustin Pop
    HV_CDROM_IMAGE_PATH: "",
1212 d0c8c01d Iustin Pop
    HV_KVM_CDROM2_IMAGE_PATH: "",
1213 835528af Iustin Pop
    HV_BOOT_ORDER: HT_BO_DISK,
1214 43440815 Guido Trotter
    HV_NIC_TYPE: HT_NIC_PARAVIRTUAL,
1215 43440815 Guido Trotter
    HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
1216 d0c8c01d Iustin Pop
    HV_KVM_CDROM_DISK_TYPE: "",
1217 d0c8c01d Iustin Pop
    HV_USB_MOUSE: "",
1218 4f580fef Sébastien Bocahu
    HV_KEYMAP: "",
1219 3c075436 Iustin Pop
    HV_MIGRATION_PORT: 8102,
1220 e43d4f9f Apollon Oikonomopoulos
    HV_MIGRATION_BANDWIDTH: 32, # MiB/s
1221 e43d4f9f Apollon Oikonomopoulos
    HV_MIGRATION_DOWNTIME: 30,  # ms
1222 783a6c0b Iustin Pop
    HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1223 6b970cef Jun Futagawa
    HV_USE_LOCALTIME: False,
1224 ea0f3d7a Iustin Pop
    HV_DISK_CACHE: HT_CACHE_DEFAULT,
1225 d19d94db Guido Trotter
    HV_SECURITY_MODEL: HT_SM_NONE,
1226 d0c8c01d Iustin Pop
    HV_SECURITY_DOMAIN: "",
1227 7ba594c0 Guido Trotter
    HV_KVM_FLAG: "",
1228 fbe27e2b Guido Trotter
    HV_VHOST_NET: False,
1229 84c08e4e Balazs Lecz
    HV_KVM_USE_CHROOT: False,
1230 4f958b0b Miguel Di Ciurcio Filho
    HV_MEM_PATH: "",
1231 bd0ff7c2 Iustin Pop
    },
1232 bd0ff7c2 Iustin Pop
  HT_FAKE: {
1233 bd0ff7c2 Iustin Pop
    },
1234 48297fa2 Iustin Pop
  HT_CHROOT: {
1235 48297fa2 Iustin Pop
    HV_INIT_SCRIPT: "/ganeti-chroot",
1236 48297fa2 Iustin Pop
    },
1237 4b5e40a5 Iustin Pop
  HT_LXC: {
1238 e3ed5316 Balazs Lecz
    HV_CPU_MASK: "",
1239 4b5e40a5 Iustin Pop
    },
1240 bd0ff7c2 Iustin Pop
  }
1241 7888a614 Alexander Schreiber
1242 7736a5f2 Iustin Pop
HVC_GLOBALS = frozenset([
1243 7736a5f2 Iustin Pop
  HV_MIGRATION_PORT,
1244 e43d4f9f Apollon Oikonomopoulos
  HV_MIGRATION_BANDWIDTH,
1245 783a6c0b Iustin Pop
  HV_MIGRATION_MODE,
1246 7736a5f2 Iustin Pop
  ])
1247 7736a5f2 Iustin Pop
1248 7888a614 Alexander Schreiber
BEC_DEFAULTS = {
1249 bd0ff7c2 Iustin Pop
  BE_MEMORY: 128,
1250 bd0ff7c2 Iustin Pop
  BE_VCPUS: 1,
1251 bd0ff7c2 Iustin Pop
  BE_AUTO_BALANCE: True,
1252 bd0ff7c2 Iustin Pop
  }
1253 c3e618cc Guido Trotter
1254 095e71aa René Nussbaumer
NDC_DEFAULTS = {
1255 095e71aa René Nussbaumer
  ND_OOB_PROGRAM: None,
1256 095e71aa René Nussbaumer
  }
1257 095e71aa René Nussbaumer
1258 ac061be9 Guido Trotter
NICC_DEFAULTS = {
1259 ac061be9 Guido Trotter
  NIC_MODE: NIC_MODE_BRIDGED,
1260 ac061be9 Guido Trotter
  NIC_LINK: DEFAULT_BRIDGE,
1261 ac061be9 Guido Trotter
  }
1262 ac061be9 Guido Trotter
1263 c3e618cc Guido Trotter
MASTER_POOL_SIZE_DEFAULT = 10
1264 ea1518af Guido Trotter
1265 ea1518af Guido Trotter
CONFD_PROTOCOL_VERSION = 1
1266 ea1518af Guido Trotter
1267 09444532 Guido Trotter
CONFD_REQ_PING = 0
1268 ea1518af Guido Trotter
CONFD_REQ_NODE_ROLE_BYNAME = 1
1269 ea1518af Guido Trotter
CONFD_REQ_NODE_PIP_BY_INSTANCE_IP = 2
1270 48166551 Guido Trotter
CONFD_REQ_CLUSTER_MASTER = 3
1271 efbb4fd2 Luca Bigliardi
CONFD_REQ_NODE_PIP_LIST = 4
1272 efbb4fd2 Luca Bigliardi
CONFD_REQ_MC_PIP_LIST = 5
1273 d01ae714 Luca Bigliardi
CONFD_REQ_INSTANCES_IPS_LIST = 6
1274 ea1518af Guido Trotter
1275 19351457 Guido Trotter
# Confd request query fields. These are used to narrow down queries.
1276 19351457 Guido Trotter
# These must be strings rather than integers, because json-encoding
1277 19351457 Guido Trotter
# converts them to strings anyway, as they're used as dict-keys.
1278 19351457 Guido Trotter
CONFD_REQQ_LINK = "0"
1279 19351457 Guido Trotter
CONFD_REQQ_IP = "1"
1280 19351457 Guido Trotter
CONFD_REQQ_IPLIST = "2"
1281 250554a9 Guido Trotter
CONFD_REQQ_FIELDS = "3"
1282 250554a9 Guido Trotter
1283 250554a9 Guido Trotter
CONFD_REQFIELD_NAME = "0"
1284 250554a9 Guido Trotter
CONFD_REQFIELD_IP = "1"
1285 43dc8496 Guido Trotter
CONFD_REQFIELD_MNODE_PIP = "2"
1286 19351457 Guido Trotter
1287 ea1518af Guido Trotter
CONFD_REQS = frozenset([
1288 09444532 Guido Trotter
  CONFD_REQ_PING,
1289 ea1518af Guido Trotter
  CONFD_REQ_NODE_ROLE_BYNAME,
1290 ea1518af Guido Trotter
  CONFD_REQ_NODE_PIP_BY_INSTANCE_IP,
1291 48166551 Guido Trotter
  CONFD_REQ_CLUSTER_MASTER,
1292 efbb4fd2 Luca Bigliardi
  CONFD_REQ_NODE_PIP_LIST,
1293 efbb4fd2 Luca Bigliardi
  CONFD_REQ_MC_PIP_LIST,
1294 d01ae714 Luca Bigliardi
  CONFD_REQ_INSTANCES_IPS_LIST,
1295 ea1518af Guido Trotter
  ])
1296 ea1518af Guido Trotter
1297 31c2a99e Guido Trotter
CONFD_REPL_STATUS_OK = 0
1298 31c2a99e Guido Trotter
CONFD_REPL_STATUS_ERROR = 1
1299 31c2a99e Guido Trotter
CONFD_REPL_STATUS_NOTIMPLEMENTED = 2
1300 31c2a99e Guido Trotter
1301 31c2a99e Guido Trotter
CONFD_REPL_STATUSES = frozenset([
1302 31c2a99e Guido Trotter
  CONFD_REPL_STATUS_OK,
1303 31c2a99e Guido Trotter
  CONFD_REPL_STATUS_ERROR,
1304 31c2a99e Guido Trotter
  CONFD_REPL_STATUS_NOTIMPLEMENTED,
1305 31c2a99e Guido Trotter
  ])
1306 31c2a99e Guido Trotter
1307 89c52785 Guido Trotter
(CONFD_NODE_ROLE_MASTER,
1308 89c52785 Guido Trotter
 CONFD_NODE_ROLE_CANDIDATE,
1309 89c52785 Guido Trotter
 CONFD_NODE_ROLE_OFFLINE,
1310 197b0f5d Guido Trotter
 CONFD_NODE_ROLE_DRAINED,
1311 197b0f5d Guido Trotter
 CONFD_NODE_ROLE_REGULAR,
1312 197b0f5d Guido Trotter
 ) = range(5)
1313 89c52785 Guido Trotter
1314 ca2a5b13 Guido Trotter
# A few common errors for confd
1315 ca2a5b13 Guido Trotter
CONFD_ERROR_UNKNOWN_ENTRY = 1
1316 7189e790 Guido Trotter
CONFD_ERROR_INTERNAL = 2
1317 19351457 Guido Trotter
CONFD_ERROR_ARGUMENT = 3
1318 ca2a5b13 Guido Trotter
1319 71f27d19 Guido Trotter
# Each request is "salted" by the current timestamp.
1320 71f27d19 Guido Trotter
# This constants decides how many seconds of skew to accept.
1321 71f27d19 Guido Trotter
# TODO: make this a default and allow the value to be more configurable
1322 313b2dd4 Michael Hanselmann
CONFD_MAX_CLOCK_SKEW = 2 * NODE_MAX_CLOCK_SKEW
1323 84c3ab28 Guido Trotter
1324 84c3ab28 Guido Trotter
# When we haven't reloaded the config for more than this amount of seconds, we
1325 84c3ab28 Guido Trotter
# force a test to see if inotify is betraying us.
1326 84c3ab28 Guido Trotter
CONFD_CONFIG_RELOAD_TIMEOUT = 60
1327 84c3ab28 Guido Trotter
1328 84c3ab28 Guido Trotter
# If we receive more than one update in this amount of seconds, we move to
1329 84c3ab28 Guido Trotter
# polling every RATELIMIT seconds, rather than relying on inotify, to be able
1330 84c3ab28 Guido Trotter
# to serve more requests.
1331 84c3ab28 Guido Trotter
CONFD_CONFIG_RELOAD_RATELIMIT = 2
1332 c8eded0b Guido Trotter
1333 a3758ab2 Guido Trotter
# Magic number prepended to all confd queries.
1334 a3758ab2 Guido Trotter
# This allows us to distinguish different types of confd protocols and handle
1335 a3758ab2 Guido Trotter
# them. For example by changing this we can move the whole payload to be
1336 a3758ab2 Guido Trotter
# compressed, or move away from json.
1337 d0c8c01d Iustin Pop
CONFD_MAGIC_FOURCC = "plj0"
1338 a3758ab2 Guido Trotter
1339 e4ccf6cd Guido Trotter
# By default a confd request is sent to the minimum between this number and all
1340 e4ccf6cd Guido Trotter
# MCs. 6 was chosen because even in the case of a disastrous 50% response rate,
1341 e4ccf6cd Guido Trotter
# we should have enough answers to be able to compare more than one.
1342 e4ccf6cd Guido Trotter
CONFD_DEFAULT_REQ_COVERAGE = 6
1343 e4ccf6cd Guido Trotter
1344 e4ccf6cd Guido Trotter
# Timeout in seconds to expire pending query request in the confd client
1345 e4ccf6cd Guido Trotter
# library. We don't actually expect any answer more than 10 seconds after we
1346 e4ccf6cd Guido Trotter
# sent a request.
1347 e4ccf6cd Guido Trotter
CONFD_CLIENT_EXPIRE_TIMEOUT = 10
1348 e4ccf6cd Guido Trotter
1349 c8eded0b Guido Trotter
# Maximum UDP datagram size.
1350 c8eded0b Guido Trotter
# On IPv4: 64K - 20 (ip header size) - 8 (udp header size) = 65507
1351 c8eded0b Guido Trotter
# On IPv6: 64K - 40 (ip6 header size) - 8 (udp header size) = 65487
1352 c8eded0b Guido Trotter
#   (assuming we can't use jumbo frames)
1353 c8eded0b Guido Trotter
# We just set this to 60K, which should be enough
1354 c8eded0b Guido Trotter
MAX_UDP_DATA_SIZE = 61440
1355 6d127406 Balazs Lecz
1356 6d127406 Balazs Lecz
# User-id pool minimum/maximum acceptable user-ids.
1357 6d127406 Balazs Lecz
UIDPOOL_UID_MIN = 0
1358 6d127406 Balazs Lecz
UIDPOOL_UID_MAX = 2**32-1 # Assuming 32 bit user-ids
1359 649bcdd8 Balazs Lecz
1360 649bcdd8 Balazs Lecz
# Name or path of the pgrep command
1361 649bcdd8 Balazs Lecz
PGREP = "pgrep"
1362 75cf411a Adeodato Simo
1363 75cf411a Adeodato Simo
# Name of the node group that gets created at cluster init or upgrade
1364 75cf411a Adeodato Simo
INITIAL_NODE_GROUP_NAME = "default"
1365 90e99856 Adeodato Simo
1366 90e99856 Adeodato Simo
# Possible values for NodeGroup.alloc_policy
1367 90e99856 Adeodato Simo
ALLOC_POLICY_PREFERRED = "preferred"
1368 90e99856 Adeodato Simo
ALLOC_POLICY_LAST_RESORT = "last_resort"
1369 90e99856 Adeodato Simo
ALLOC_POLICY_UNALLOCABLE = "unallocable"
1370 90e99856 Adeodato Simo
VALID_ALLOC_POLICIES = [
1371 90e99856 Adeodato Simo
  ALLOC_POLICY_PREFERRED,
1372 90e99856 Adeodato Simo
  ALLOC_POLICY_LAST_RESORT,
1373 90e99856 Adeodato Simo
  ALLOC_POLICY_UNALLOCABLE,
1374 90e99856 Adeodato Simo
  ]
1375 b6135bbc Apollon Oikonomopoulos
1376 b6135bbc Apollon Oikonomopoulos
# Temporary external/shared storage parameters
1377 b6135bbc Apollon Oikonomopoulos
BLOCKDEV_DRIVER_MANUAL = "manual"
1378 e5395072 Iustin Pop
1379 e5395072 Iustin Pop
# Whether htools was enabled at compilation time
1380 e5395072 Iustin Pop
HTOOLS = _autoconf.HTOOLS
1381 e5395072 Iustin Pop
# The hail iallocator
1382 e5395072 Iustin Pop
IALLOC_HAIL = "hail"