Statistics
| Branch: | Tag: | Revision:

root / lib / constants.py @ 98dfcaff

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