Statistics
| Branch: | Tag: | Revision:

root / lib / constants.py @ c4dfb0b6

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