Statistics
| Branch: | Tag: | Revision:

root / lib / constants.py @ d7c42723

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