Statistics
| Branch: | Tag: | Revision:

root / lib / constants.py @ 3e77a36c

History | View | Annotate | Download (59.3 kB)

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

65 1b45f4e5 Michael Hanselmann
  Returns: int representing version number
66 1b45f4e5 Michael Hanselmann

67 1b45f4e5 Michael Hanselmann
  """
68 1b45f4e5 Michael Hanselmann
  assert isinstance(major, int)
69 1b45f4e5 Michael Hanselmann
  assert isinstance(minor, int)
70 1b45f4e5 Michael Hanselmann
  assert isinstance(revision, int)
71 1b45f4e5 Michael Hanselmann
  return (1000000 * major +
72 1b45f4e5 Michael Hanselmann
            10000 * minor +
73 1b45f4e5 Michael Hanselmann
                1 * revision)
74 1b45f4e5 Michael Hanselmann
75 1b45f4e5 Michael Hanselmann
76 1b45f4e5 Michael Hanselmann
def SplitVersion(version):
77 1b45f4e5 Michael Hanselmann
  """Splits version number stored in an int.
78 1b45f4e5 Michael Hanselmann

79 1b45f4e5 Michael Hanselmann
  Returns: tuple; (major, minor, revision)
80 1b45f4e5 Michael Hanselmann

81 1b45f4e5 Michael Hanselmann
  """
82 1b45f4e5 Michael Hanselmann
  assert isinstance(version, int)
83 1b45f4e5 Michael Hanselmann
84 1b45f4e5 Michael Hanselmann
  (major, remainder) = divmod(version, 1000000)
85 1b45f4e5 Michael Hanselmann
  (minor, revision) = divmod(remainder, 10000)
86 1b45f4e5 Michael Hanselmann
87 1b45f4e5 Michael Hanselmann
  return (major, minor, revision)
88 1b45f4e5 Michael Hanselmann
89 1b45f4e5 Michael Hanselmann
90 243cdbcc Michael Hanselmann
CONFIG_MAJOR = int(_autoconf.VERSION_MAJOR)
91 243cdbcc Michael Hanselmann
CONFIG_MINOR = int(_autoconf.VERSION_MINOR)
92 243cdbcc Michael Hanselmann
CONFIG_REVISION = 0
93 1b45f4e5 Michael Hanselmann
CONFIG_VERSION = BuildVersion(CONFIG_MAJOR, CONFIG_MINOR, CONFIG_REVISION)
94 a8083063 Iustin Pop
95 cc7d6f1a Michael Hanselmann
#: RPC protocol version
96 cc7d6f1a Michael Hanselmann
PROTOCOL_VERSION = BuildVersion(CONFIG_MAJOR, CONFIG_MINOR, 0)
97 cc7d6f1a Michael Hanselmann
98 8b72b05c René Nussbaumer
# user separation
99 8b72b05c René Nussbaumer
DAEMONS_GROUP = _autoconf.DAEMONS_GROUP
100 f12e1736 René Nussbaumer
ADMIN_GROUP = _autoconf.ADMIN_GROUP
101 8b72b05c René Nussbaumer
MASTERD_USER = _autoconf.MASTERD_USER
102 f12e1736 René Nussbaumer
MASTERD_GROUP = _autoconf.MASTERD_GROUP
103 8b72b05c René Nussbaumer
RAPI_USER = _autoconf.RAPI_USER
104 f12e1736 René Nussbaumer
RAPI_GROUP = _autoconf.RAPI_GROUP
105 f12e1736 René Nussbaumer
CONFD_USER = _autoconf.CONFD_USER
106 f12e1736 René Nussbaumer
CONFD_GROUP = _autoconf.CONFD_GROUP
107 f12e1736 René Nussbaumer
NODED_USER = _autoconf.NODED_USER
108 03881cb0 René Nussbaumer
NODED_GROUP = _autoconf.NODED_GROUP
109 052783ff Michael Hanselmann
SSH_LOGIN_USER = _autoconf.SSH_LOGIN_USER
110 052783ff Michael Hanselmann
SSH_CONSOLE_USER = _autoconf.SSH_CONSOLE_USER
111 8b72b05c René Nussbaumer
112 7e7629c6 Tsachy Shacham
# cpu pinning separators and constants
113 7e7629c6 Tsachy Shacham
CPU_PINNING_SEP = ":"
114 7e7629c6 Tsachy Shacham
CPU_PINNING_ALL = "all"
115 7e7629c6 Tsachy Shacham
# internal representation of "all"
116 7e7629c6 Tsachy Shacham
CPU_PINNING_ALL_VAL = -1
117 bf5681c0 Tsachy Shacham
# one "all" entry in a CPU list means CPU pinning is off
118 bf5681c0 Tsachy Shacham
CPU_PINNING_OFF = [CPU_PINNING_ALL_VAL]
119 7e7629c6 Tsachy Shacham
120 7e7629c6 Tsachy Shacham
# A Xen-specific implementation detail - there is no way to actually say
121 7e7629c6 Tsachy Shacham
# "use any cpu for pinning" in a Xen configuration file, as opposed to the
122 7e7629c6 Tsachy Shacham
# command line, where you can say "xm vcpu-pin <domain> <vcpu> all".
123 7e7629c6 Tsachy Shacham
# The workaround used in Xen is "0-63" (see source code function
124 7e7629c6 Tsachy Shacham
# xm_vcpu_pin in <xen-source>/tools/python/xen/xm/main.py).
125 7e7629c6 Tsachy Shacham
# To support future changes, the following constant is treated as a
126 7e7629c6 Tsachy Shacham
# blackbox string that simply means use-any-cpu-for-pinning-under-xen.
127 7e7629c6 Tsachy Shacham
CPU_PINNING_ALL_XEN = "0-63"
128 a03fcb26 René Nussbaumer
129 bf5681c0 Tsachy Shacham
# A KVM-specific implementation detail - the following value is used
130 bf5681c0 Tsachy Shacham
# to set CPU affinity to all processors (#0 through #31), per taskset
131 bf5681c0 Tsachy Shacham
# man page.
132 38ef0c2c Michael Hanselmann
# FIXME: This only works for machines with up to 32 CPU cores
133 bf5681c0 Tsachy Shacham
CPU_PINNING_ALL_KVM = 0xFFFFFFFF
134 bf5681c0 Tsachy Shacham
135 6e991d0e René Nussbaumer
# Wipe
136 da63bb4e René Nussbaumer
DD_CMD = "dd"
137 a03fcb26 René Nussbaumer
MAX_WIPE_CHUNK = 1024 # 1GB
138 a03fcb26 René Nussbaumer
MIN_WIPE_CHUNK_PERCENT = 10
139 a03fcb26 René Nussbaumer
140 8b72b05c René Nussbaumer
RUN_DIRS_MODE = 0775
141 5bae14d9 Guido Trotter
SECURE_DIR_MODE = 0700
142 637c8ab8 Balazs Lecz
SECURE_FILE_MODE = 0600
143 b6135bbc Apollon Oikonomopoulos
ADOPTABLE_BLOCKDEV_ROOT = "/dev/disk/"
144 cb7c0198 Iustin Pop
ENABLE_FILE_STORAGE = _autoconf.ENABLE_FILE_STORAGE
145 4b97f902 Apollon Oikonomopoulos
ENABLE_SHARED_FILE_STORAGE = _autoconf.ENABLE_SHARED_FILE_STORAGE
146 cd8b0072 Iustin Pop
ENABLE_CONFD = _autoconf.ENABLE_CONFD
147 42ab9ac4 Iustin Pop
ENABLE_SPLIT_QUERY = _autoconf.ENABLE_SPLIT_QUERY
148 1fdeb284 Michael Hanselmann
ENABLE_RESTRICTED_COMMANDS = _autoconf.ENABLE_RESTRICTED_COMMANDS
149 9894ece7 Michael Hanselmann
150 cd50653c Guido Trotter
NODED = "ganeti-noded"
151 18679072 Guido Trotter
CONFD = "ganeti-confd"
152 8c96d01f Guido Trotter
RAPI = "ganeti-rapi"
153 dae3fdd2 Guido Trotter
MASTERD = "ganeti-masterd"
154 cd50653c Guido Trotter
155 cd50653c Guido Trotter
DAEMONS_PORTS = {
156 cd50653c Guido Trotter
  # daemon-name: ("proto", "default-port")
157 cd50653c Guido Trotter
  NODED: ("tcp", 1811),
158 18679072 Guido Trotter
  CONFD: ("udp", 1814),
159 8c96d01f Guido Trotter
  RAPI: ("tcp", 5080),
160 2089573e René Nussbaumer
  "ssh": ("tcp", 22),
161 cd50653c Guido Trotter
}
162 cd50653c Guido Trotter
DEFAULT_NODED_PORT = DAEMONS_PORTS[NODED][1]
163 18679072 Guido Trotter
DEFAULT_CONFD_PORT = DAEMONS_PORTS[CONFD][1]
164 8c96d01f Guido Trotter
DEFAULT_RAPI_PORT = DAEMONS_PORTS[RAPI][1]
165 cd50653c Guido Trotter
166 a8083063 Iustin Pop
FIRST_DRBD_PORT = 11000
167 a8083063 Iustin Pop
LAST_DRBD_PORT = 14999
168 a8083063 Iustin Pop
169 3a6a89d7 Michael Hanselmann
DAEMONS_LOGFILES = {
170 3a6a89d7 Michael Hanselmann
  NODED: pathutils.GetLogFilename("node-daemon"),
171 3a6a89d7 Michael Hanselmann
  CONFD: pathutils.GetLogFilename("conf-daemon"),
172 3a6a89d7 Michael Hanselmann
  RAPI: pathutils.GetLogFilename("rapi-daemon"),
173 3a6a89d7 Michael Hanselmann
  MASTERD: pathutils.GetLogFilename("master-daemon"),
174 3a6a89d7 Michael Hanselmann
  }
175 3a6a89d7 Michael Hanselmann
176 481d47e8 Luca Bigliardi
DEV_CONSOLE = "/dev/console"
177 481d47e8 Luca Bigliardi
178 1b045f5d Balazs Lecz
PROC_MOUNTS = "/proc/mounts"
179 1b045f5d Balazs Lecz
180 3d5ebbf0 Stephen Shirley
# Local UniX Interface related constants
181 25942a6c Guido Trotter
LUXI_EOM = "\3"
182 e986f20c Michael Hanselmann
LUXI_VERSION = CONFIG_VERSION
183 25942a6c Guido Trotter
184 d0c8c01d Iustin Pop
# one of "no", "yes", "only"
185 551b6283 Iustin Pop
SYSLOG_USAGE = _autoconf.SYSLOG_USAGE
186 551b6283 Iustin Pop
SYSLOG_NO = "no"
187 551b6283 Iustin Pop
SYSLOG_YES = "yes"
188 551b6283 Iustin Pop
SYSLOG_ONLY = "only"
189 551b6283 Iustin Pop
SYSLOG_SOCKET = "/dev/log"
190 551b6283 Iustin Pop
191 a8083063 Iustin Pop
EXPORT_CONF_FILE = "config.ini"
192 a8083063 Iustin Pop
193 2f2dbb4b Jun Futagawa
XEN_BOOTLOADER = _autoconf.XEN_BOOTLOADER
194 f00b46bc Michael Hanselmann
XEN_KERNEL = _autoconf.XEN_KERNEL
195 f00b46bc Michael Hanselmann
XEN_INITRD = _autoconf.XEN_INITRD
196 0625d08f René Nussbaumer
XEN_CMD_XM = "xm"
197 0625d08f René Nussbaumer
XEN_CMD_XL = "xl"
198 0625d08f René Nussbaumer
# FIXME: This will be made configurable using hvparams in Ganeti 2.7
199 0625d08f René Nussbaumer
XEN_CMD = _autoconf.XEN_CMD
200 053c356a Guido Trotter
# When the Xen toolstack used is "xl", live migration requires the source host
201 053c356a Guido Trotter
# to connect to the target host via ssh (xl runs this command). We need to pass
202 053c356a Guido Trotter
# the command xl runs some extra info so that it can use Ganeti's key
203 053c356a Guido Trotter
# verification and not fail. Note that this string is incomplete: it must be
204 053c356a Guido Trotter
# filled with the cluster name before being used.
205 f215debf Guido Trotter
XL_SSH_CMD = ("ssh -l %s -oGlobalKnownHostsFile=%s"
206 053c356a Guido Trotter
              " -oUserKnownHostsFile=/dev/null"
207 053c356a Guido Trotter
              " -oCheckHostIp=no -oStrictHostKeyChecking=yes"
208 f215debf Guido Trotter
              " -oHostKeyAlias=%%s") % (SSH_LOGIN_USER,
209 f215debf Guido Trotter
                                        pathutils.SSH_KNOWN_HOSTS_FILE)
210 f00b46bc Michael Hanselmann
211 7e2c5b9e Guido Trotter
KVM_PATH = _autoconf.KVM_PATH
212 b8203e1e Iustin Pop
KVM_KERNEL = _autoconf.KVM_KERNEL
213 14aa53cb Guido Trotter
SOCAT_PATH = _autoconf.SOCAT_PATH
214 fe5b0c42 Michael Hanselmann
SOCAT_USE_ESCAPE = _autoconf.SOCAT_USE_ESCAPE
215 e90739d6 Michael Hanselmann
SOCAT_USE_COMPRESS = _autoconf.SOCAT_USE_COMPRESS
216 86d6bc2a Guido Trotter
SOCAT_ESCAPE_CODE = "0x1d"
217 7e2c5b9e Guido Trotter
218 25ce3ec4 Michael Hanselmann
#: Console as SSH command
219 25ce3ec4 Michael Hanselmann
CONS_SSH = "ssh"
220 25ce3ec4 Michael Hanselmann
221 25ce3ec4 Michael Hanselmann
#: Console as VNC server
222 25ce3ec4 Michael Hanselmann
CONS_VNC = "vnc"
223 25ce3ec4 Michael Hanselmann
224 4d2cdb5a Andrea Spadaccini
#: Console as SPICE server
225 4d2cdb5a Andrea Spadaccini
CONS_SPICE = "spice"
226 4d2cdb5a Andrea Spadaccini
227 25ce3ec4 Michael Hanselmann
#: Display a message for console access
228 25ce3ec4 Michael Hanselmann
CONS_MESSAGE = "msg"
229 25ce3ec4 Michael Hanselmann
230 25ce3ec4 Michael Hanselmann
#: All console types
231 b8028dcf Michael Hanselmann
CONS_ALL = compat.UniqueFrozenset([
232 b8028dcf Michael Hanselmann
  CONS_SSH,
233 b8028dcf Michael Hanselmann
  CONS_VNC,
234 b8028dcf Michael Hanselmann
  CONS_SPICE,
235 b8028dcf Michael Hanselmann
  CONS_MESSAGE,
236 b8028dcf Michael Hanselmann
  ])
237 25ce3ec4 Michael Hanselmann
238 bdd5e420 Michael Hanselmann
# For RSA keys more bits are better, but they also make operations more
239 bdd5e420 Michael Hanselmann
# expensive. NIST SP 800-131 recommends a minimum of 2048 bits from the year
240 bdd5e420 Michael Hanselmann
# 2010 on.
241 bdd5e420 Michael Hanselmann
RSA_KEY_BITS = 2048
242 bdd5e420 Michael Hanselmann
243 971bbd84 Michael Hanselmann
# Ciphers allowed for SSL connections. For the format, see ciphers(1). A better
244 971bbd84 Michael Hanselmann
# way to disable ciphers would be to use the exclamation mark (!), but socat
245 971bbd84 Michael Hanselmann
# versions below 1.5 can't parse exclamation marks in options properly. When
246 7407c2d5 Adeodato Simo
# modifying the ciphers, ensure not to accidentially add something after it's
247 971bbd84 Michael Hanselmann
# been removed. Use the "openssl" utility to check the allowed ciphers, e.g.
248 971bbd84 Michael Hanselmann
# "openssl ciphers -v HIGH:-DES".
249 971bbd84 Michael Hanselmann
OPENSSL_CIPHERS = "HIGH:-DES:-3DES:-EXPORT:-ADH"
250 971bbd84 Michael Hanselmann
251 bdd5e420 Michael Hanselmann
# Digest used to sign certificates ("openssl x509" uses SHA1 by default)
252 bdd5e420 Michael Hanselmann
X509_CERT_SIGN_DIGEST = "SHA1"
253 bdd5e420 Michael Hanselmann
254 600535f0 Manuel Franceschini
# Default validity of certificates in days
255 600535f0 Manuel Franceschini
X509_CERT_DEFAULT_VALIDITY = 365 * 5
256 600535f0 Manuel Franceschini
257 600535f0 Manuel Franceschini
# commonName (CN) used in certificates
258 600535f0 Manuel Franceschini
X509_CERT_CN = "ganeti.example.com"
259 600535f0 Manuel Franceschini
260 68857643 Michael Hanselmann
X509_CERT_SIGNATURE_HEADER = "X-Ganeti-Signature"
261 68857643 Michael Hanselmann
262 2d76b580 Michael Hanselmann
# Import/export daemon mode
263 2d76b580 Michael Hanselmann
IEM_IMPORT = "import"
264 2d76b580 Michael Hanselmann
IEM_EXPORT = "export"
265 2d76b580 Michael Hanselmann
266 7e3c1da6 Michael Hanselmann
# Import/export transport compression
267 7e3c1da6 Michael Hanselmann
IEC_NONE = "none"
268 7e3c1da6 Michael Hanselmann
IEC_GZIP = "gzip"
269 b8028dcf Michael Hanselmann
IEC_ALL = compat.UniqueFrozenset([
270 7e3c1da6 Michael Hanselmann
  IEC_NONE,
271 7e3c1da6 Michael Hanselmann
  IEC_GZIP,
272 7e3c1da6 Michael Hanselmann
  ])
273 7e3c1da6 Michael Hanselmann
274 f9323011 Michael Hanselmann
IE_CUSTOM_SIZE = "fd"
275 f9323011 Michael Hanselmann
276 1d3dfa29 Michael Hanselmann
IE_MAGIC_RE = re.compile(r"^[-_.a-zA-Z0-9]{5,100}$")
277 1d3dfa29 Michael Hanselmann
278 1651d116 Michael Hanselmann
# Import/export I/O
279 1651d116 Michael Hanselmann
# Direct file I/O, equivalent to a shell's I/O redirection using '<' or '>'
280 1651d116 Michael Hanselmann
IEIO_FILE = "file"
281 1651d116 Michael Hanselmann
# Raw block device I/O using "dd"
282 1651d116 Michael Hanselmann
IEIO_RAW_DISK = "raw"
283 1651d116 Michael Hanselmann
# OS definition import/export script
284 1651d116 Michael Hanselmann
IEIO_SCRIPT = "script"
285 1651d116 Michael Hanselmann
286 973d7867 Iustin Pop
VALUE_DEFAULT = "default"
287 4c566ede Guido Trotter
VALUE_AUTO = "auto"
288 4c566ede Guido Trotter
VALUE_GENERATE = "generate"
289 973d7867 Iustin Pop
VALUE_NONE = "none"
290 1817f49b Guido Trotter
VALUE_TRUE = "true"
291 1817f49b Guido Trotter
VALUE_FALSE = "false"
292 973d7867 Iustin Pop
293 4fe80ef2 Iustin Pop
# External script validation mask
294 4fe80ef2 Iustin Pop
EXT_PLUGIN_MASK = re.compile("^[a-zA-Z0-9_-]+$")
295 4fe80ef2 Iustin Pop
296 a8083063 Iustin Pop
# hooks-related constants
297 a8083063 Iustin Pop
HOOKS_PHASE_PRE = "pre"
298 a8083063 Iustin Pop
HOOKS_PHASE_POST = "post"
299 6a4aa7c1 Iustin Pop
HOOKS_NAME_CFGUPDATE = "config-update"
300 9e289e36 Guido Trotter
HOOKS_NAME_WATCHER = "watcher"
301 f3e2e4c6 Iustin Pop
HOOKS_VERSION = 2
302 fe5ca2bb Andrea Spadaccini
HOOKS_PATH = "/sbin:/bin:/usr/sbin:/usr/bin"
303 a8083063 Iustin Pop
304 a8083063 Iustin Pop
# hooks subject type (what object type does the LU deal with)
305 a8083063 Iustin Pop
HTYPE_CLUSTER = "CLUSTER"
306 a8083063 Iustin Pop
HTYPE_NODE = "NODE"
307 b1ee5610 Adeodato Simo
HTYPE_GROUP = "GROUP"
308 a8083063 Iustin Pop
HTYPE_INSTANCE = "INSTANCE"
309 eaa4c57c Dimitris Aragiorgis
HTYPE_NETWORK = "NETWORK"
310 a8083063 Iustin Pop
311 a8083063 Iustin Pop
HKR_SKIP = 0
312 a8083063 Iustin Pop
HKR_FAIL = 1
313 a8083063 Iustin Pop
HKR_SUCCESS = 2
314 a8083063 Iustin Pop
315 ac2d0fe4 Michael Hanselmann
# Storage types
316 ac2d0fe4 Michael Hanselmann
ST_FILE = "file"
317 ac2d0fe4 Michael Hanselmann
ST_LVM_PV = "lvm-pv"
318 ac2d0fe4 Michael Hanselmann
ST_LVM_VG = "lvm-vg"
319 6032697c Michael Hanselmann
320 6032697c Michael Hanselmann
# Storage fields
321 620a85fd Iustin Pop
# first two are valid in LU context only, not passed to backend
322 620a85fd Iustin Pop
SF_NODE = "node"
323 620a85fd Iustin Pop
SF_TYPE = "type"
324 620a85fd Iustin Pop
# and the rest are valid in backend
325 6032697c Michael Hanselmann
SF_NAME = "name"
326 6032697c Michael Hanselmann
SF_SIZE = "size"
327 6032697c Michael Hanselmann
SF_FREE = "free"
328 6032697c Michael Hanselmann
SF_USED = "used"
329 6032697c Michael Hanselmann
SF_ALLOCATABLE = "allocatable"
330 6032697c Michael Hanselmann
331 6c3c6db9 Michael Hanselmann
# Storage operations
332 6c3c6db9 Michael Hanselmann
SO_FIX_CONSISTENCY = "fix-consistency"
333 6c3c6db9 Michael Hanselmann
334 6032697c Michael Hanselmann
# Available fields per storage type
335 b8028dcf Michael Hanselmann
VALID_STORAGE_FIELDS = compat.UniqueFrozenset([
336 21daa4a8 Stephen Shirley
  SF_NAME,
337 21daa4a8 Stephen Shirley
  SF_TYPE,
338 21daa4a8 Stephen Shirley
  SF_SIZE,
339 21daa4a8 Stephen Shirley
  SF_USED,
340 21daa4a8 Stephen Shirley
  SF_FREE,
341 3c286190 Dimitris Aragiorgis
  SF_ALLOCATABLE,
342 21daa4a8 Stephen Shirley
  ])
343 620a85fd Iustin Pop
344 b8028dcf Michael Hanselmann
VALID_STORAGE_TYPES = compat.UniqueFrozenset([
345 b8028dcf Michael Hanselmann
  ST_FILE,
346 b8028dcf Michael Hanselmann
  ST_LVM_PV,
347 b8028dcf Michael Hanselmann
  ST_LVM_VG,
348 b8028dcf Michael Hanselmann
  ])
349 a8083063 Iustin Pop
350 efb8da02 Michael Hanselmann
MODIFIABLE_STORAGE_FIELDS = {
351 efb8da02 Michael Hanselmann
  ST_LVM_PV: frozenset([SF_ALLOCATABLE]),
352 efb8da02 Michael Hanselmann
  }
353 efb8da02 Michael Hanselmann
354 4b37cac5 Michael Hanselmann
VALID_STORAGE_OPERATIONS = {
355 6c3c6db9 Michael Hanselmann
  ST_LVM_VG: frozenset([SO_FIX_CONSISTENCY]),
356 4b37cac5 Michael Hanselmann
  }
357 4b37cac5 Michael Hanselmann
358 74f37195 Michael Hanselmann
# Local disk status
359 74f37195 Michael Hanselmann
# Note: Code depends on LDS_OKAY < LDS_UNKNOWN < LDS_FAULTY
360 74f37195 Michael Hanselmann
(LDS_OKAY,
361 74f37195 Michael Hanselmann
 LDS_UNKNOWN,
362 74f37195 Michael Hanselmann
 LDS_FAULTY) = range(1, 4)
363 74f37195 Michael Hanselmann
364 a8083063 Iustin Pop
# disk template types
365 a8083063 Iustin Pop
DT_DISKLESS = "diskless"
366 a8083063 Iustin Pop
DT_PLAIN = "plain"
367 a1f445d3 Iustin Pop
DT_DRBD8 = "drbd"
368 04fa07f2 Manuel Franceschini
DT_FILE = "file"
369 4b97f902 Apollon Oikonomopoulos
DT_SHARED_FILE = "sharedfile"
370 b6135bbc Apollon Oikonomopoulos
DT_BLOCK = "blockdev"
371 7181fba0 Constantinos Venetsanopoulos
DT_RBD = "rbd"
372 376631d1 Constantinos Venetsanopoulos
DT_EXT = "ext"
373 a1f445d3 Iustin Pop
374 a1f445d3 Iustin Pop
# the set of network-mirrored disk templates
375 b8028dcf Michael Hanselmann
DTS_INT_MIRROR = compat.UniqueFrozenset([DT_DRBD8])
376 a8083063 Iustin Pop
377 b6135bbc Apollon Oikonomopoulos
# the set of externally-mirrored disk templates (e.g. SAN, NAS)
378 b8028dcf Michael Hanselmann
DTS_EXT_MIRROR = compat.UniqueFrozenset([
379 b8028dcf Michael Hanselmann
  DT_SHARED_FILE,
380 b8028dcf Michael Hanselmann
  DT_BLOCK,
381 b8028dcf Michael Hanselmann
  DT_RBD,
382 376631d1 Constantinos Venetsanopoulos
  DT_EXT,
383 b8028dcf Michael Hanselmann
  ])
384 4b97f902 Apollon Oikonomopoulos
385 d63e148a Manuel Franceschini
# the set of non-lvm-based disk templates
386 b8028dcf Michael Hanselmann
DTS_NOT_LVM = compat.UniqueFrozenset([
387 b8028dcf Michael Hanselmann
  DT_DISKLESS,
388 b8028dcf Michael Hanselmann
  DT_FILE,
389 b8028dcf Michael Hanselmann
  DT_SHARED_FILE,
390 b8028dcf Michael Hanselmann
  DT_BLOCK,
391 b8028dcf Michael Hanselmann
  DT_RBD,
392 376631d1 Constantinos Venetsanopoulos
  DT_EXT,
393 b8028dcf Michael Hanselmann
  ])
394 d63e148a Manuel Franceschini
395 728489a3 Guido Trotter
# the set of disk templates which can be grown
396 b8028dcf Michael Hanselmann
DTS_GROWABLE = compat.UniqueFrozenset([
397 b8028dcf Michael Hanselmann
  DT_PLAIN,
398 b8028dcf Michael Hanselmann
  DT_DRBD8,
399 b8028dcf Michael Hanselmann
  DT_FILE,
400 b8028dcf Michael Hanselmann
  DT_SHARED_FILE,
401 b8028dcf Michael Hanselmann
  DT_RBD,
402 376631d1 Constantinos Venetsanopoulos
  DT_EXT,
403 b8028dcf Michael Hanselmann
  ])
404 728489a3 Guido Trotter
405 3b08cd1c Apollon Oikonomopoulos
# the set of disk templates that allow adoption
406 b8028dcf Michael Hanselmann
DTS_MAY_ADOPT = compat.UniqueFrozenset([
407 b8028dcf Michael Hanselmann
  DT_PLAIN,
408 b8028dcf Michael Hanselmann
  DT_BLOCK,
409 b8028dcf Michael Hanselmann
  ])
410 b6135bbc Apollon Oikonomopoulos
411 b6135bbc Apollon Oikonomopoulos
# the set of disk templates that *must* use adoption
412 b8028dcf Michael Hanselmann
DTS_MUST_ADOPT = compat.UniqueFrozenset([DT_BLOCK])
413 3b08cd1c Apollon Oikonomopoulos
414 85a0ff7e Apollon Oikonomopoulos
# the set of disk templates that allow migrations
415 3429a076 Apollon Oikonomopoulos
DTS_MIRRORED = frozenset.union(DTS_INT_MIRROR, DTS_EXT_MIRROR)
416 85a0ff7e Apollon Oikonomopoulos
417 c16915bd Guido Trotter
# the set of file based disk templates
418 b8028dcf Michael Hanselmann
DTS_FILEBASED = compat.UniqueFrozenset([
419 b8028dcf Michael Hanselmann
  DT_FILE,
420 b8028dcf Michael Hanselmann
  DT_SHARED_FILE,
421 b8028dcf Michael Hanselmann
  ])
422 85a0ff7e Apollon Oikonomopoulos
423 6ebfef42 Bernardo Dal Seno
# the set of disk templates that are supported by exclusive_storage
424 6ebfef42 Bernardo Dal Seno
DTS_EXCL_STORAGE = frozenset([DT_PLAIN])
425 6ebfef42 Bernardo Dal Seno
426 6ebfef42 Bernardo Dal Seno
# templates for which we don't perform checks on free space
427 ce003543 Iustin Pop
DTS_NO_FREE_SPACE_CHECK = compat.UniqueFrozenset([
428 ce003543 Iustin Pop
  DT_FILE,
429 ce003543 Iustin Pop
  DT_SHARED_FILE,
430 ce003543 Iustin Pop
  DT_RBD,
431 ce003543 Iustin Pop
  DT_EXT,
432 ce003543 Iustin Pop
  ])
433 6ebfef42 Bernardo Dal Seno
434 fe96220b Iustin Pop
# logical disk types
435 fe96220b Iustin Pop
LD_LV = "lvm"
436 a1f445d3 Iustin Pop
LD_DRBD8 = "drbd8"
437 04fa07f2 Manuel Franceschini
LD_FILE = "file"
438 b6135bbc Apollon Oikonomopoulos
LD_BLOCKDEV = "blockdev"
439 7181fba0 Constantinos Venetsanopoulos
LD_RBD = "rbd"
440 376631d1 Constantinos Venetsanopoulos
LD_EXT = "ext"
441 b8028dcf Michael Hanselmann
LOGICAL_DISK_TYPES = compat.UniqueFrozenset([
442 bc5d0215 Andrea Spadaccini
  LD_LV,
443 bc5d0215 Andrea Spadaccini
  LD_DRBD8,
444 bc5d0215 Andrea Spadaccini
  LD_FILE,
445 bc5d0215 Andrea Spadaccini
  LD_BLOCKDEV,
446 7181fba0 Constantinos Venetsanopoulos
  LD_RBD,
447 376631d1 Constantinos Venetsanopoulos
  LD_EXT,
448 bc5d0215 Andrea Spadaccini
  ])
449 bc5d0215 Andrea Spadaccini
450 b8028dcf Michael Hanselmann
LDS_BLOCK = compat.UniqueFrozenset([
451 b8028dcf Michael Hanselmann
  LD_LV,
452 b8028dcf Michael Hanselmann
  LD_DRBD8,
453 b8028dcf Michael Hanselmann
  LD_BLOCKDEV,
454 b8028dcf Michael Hanselmann
  LD_RBD,
455 376631d1 Constantinos Venetsanopoulos
  LD_EXT,
456 b8028dcf Michael Hanselmann
  ])
457 04fa07f2 Manuel Franceschini
458 2899d9de Iustin Pop
# drbd constants
459 2899d9de Iustin Pop
DRBD_HMAC_ALG = "md5"
460 3c03759a Iustin Pop
DRBD_NET_PROTOCOL = "C"
461 61e062dd Michele Tartara
DRBD_STATUS_FILE = "/proc/drbd"
462 8a69b3a8 Andrea Spadaccini
463 0c77c331 René Nussbaumer
#: Size of DRBD meta block device
464 0c77c331 René Nussbaumer
DRBD_META_SIZE = 128
465 0c77c331 René Nussbaumer
466 8a69b3a8 Andrea Spadaccini
# drbd barrier types
467 8a69b3a8 Andrea Spadaccini
DRBD_B_NONE = "n"
468 8a69b3a8 Andrea Spadaccini
DRBD_B_DISK_BARRIERS = "b"
469 8a69b3a8 Andrea Spadaccini
DRBD_B_DISK_DRAIN = "d"
470 8a69b3a8 Andrea Spadaccini
DRBD_B_DISK_FLUSH = "f"
471 8a69b3a8 Andrea Spadaccini
472 8a69b3a8 Andrea Spadaccini
# Valid barrier combinations: "n" or any non-null subset of "bfd"
473 b8028dcf Michael Hanselmann
DRBD_VALID_BARRIER_OPT = compat.UniqueFrozenset([
474 8a69b3a8 Andrea Spadaccini
  frozenset([DRBD_B_NONE]),
475 8a69b3a8 Andrea Spadaccini
  frozenset([DRBD_B_DISK_BARRIERS]),
476 8a69b3a8 Andrea Spadaccini
  frozenset([DRBD_B_DISK_DRAIN]),
477 8a69b3a8 Andrea Spadaccini
  frozenset([DRBD_B_DISK_FLUSH]),
478 8a69b3a8 Andrea Spadaccini
  frozenset([DRBD_B_DISK_DRAIN, DRBD_B_DISK_FLUSH]),
479 8a69b3a8 Andrea Spadaccini
  frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_DRAIN]),
480 8a69b3a8 Andrea Spadaccini
  frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_FLUSH]),
481 8a69b3a8 Andrea Spadaccini
  frozenset([DRBD_B_DISK_BARRIERS, DRBD_B_DISK_FLUSH, DRBD_B_DISK_DRAIN]),
482 8a69b3a8 Andrea Spadaccini
  ])
483 2899d9de Iustin Pop
484 7181fba0 Constantinos Venetsanopoulos
# rbd tool command
485 7181fba0 Constantinos Venetsanopoulos
RBD_CMD = "rbd"
486 7181fba0 Constantinos Venetsanopoulos
487 04fa07f2 Manuel Franceschini
# file backend driver
488 04fa07f2 Manuel Franceschini
FD_LOOP = "loop"
489 04fa07f2 Manuel Franceschini
FD_BLKTAP = "blktap"
490 a1f445d3 Iustin Pop
491 a1f445d3 Iustin Pop
# the set of drbd-like disk types
492 b8028dcf Michael Hanselmann
LDS_DRBD = compat.UniqueFrozenset([LD_DRBD8])
493 fe96220b Iustin Pop
494 08db7c5c Iustin Pop
# disk access mode
495 24991749 Iustin Pop
DISK_RDONLY = "ro"
496 24991749 Iustin Pop
DISK_RDWR = "rw"
497 b8028dcf Michael Hanselmann
DISK_ACCESS_SET = compat.UniqueFrozenset([DISK_RDONLY, DISK_RDWR])
498 08db7c5c Iustin Pop
499 a9e0c397 Iustin Pop
# disk replacement mode
500 cfacfd6e Iustin Pop
REPLACE_DISK_PRI = "replace_on_primary"    # replace disks on primary
501 cfacfd6e Iustin Pop
REPLACE_DISK_SEC = "replace_on_secondary"  # replace disks on secondary
502 cfacfd6e Iustin Pop
REPLACE_DISK_CHG = "replace_new_secondary" # change secondary node
503 942be002 Michael Hanselmann
REPLACE_DISK_AUTO = "replace_auto"
504 b8028dcf Michael Hanselmann
REPLACE_MODES = compat.UniqueFrozenset([
505 3636400f Iustin Pop
  REPLACE_DISK_PRI,
506 3636400f Iustin Pop
  REPLACE_DISK_SEC,
507 3636400f Iustin Pop
  REPLACE_DISK_CHG,
508 3636400f Iustin Pop
  REPLACE_DISK_AUTO,
509 3636400f Iustin Pop
  ])
510 a9e0c397 Iustin Pop
511 4a96f1d1 Michael Hanselmann
# Instance export mode
512 4a96f1d1 Michael Hanselmann
EXPORT_MODE_LOCAL = "local"
513 4a96f1d1 Michael Hanselmann
EXPORT_MODE_REMOTE = "remote"
514 b8028dcf Michael Hanselmann
EXPORT_MODES = compat.UniqueFrozenset([
515 4a96f1d1 Michael Hanselmann
  EXPORT_MODE_LOCAL,
516 4a96f1d1 Michael Hanselmann
  EXPORT_MODE_REMOTE,
517 4a96f1d1 Michael Hanselmann
  ])
518 4a96f1d1 Michael Hanselmann
519 2f6eebee Guido Trotter
# instance creation modes
520 a8083063 Iustin Pop
INSTANCE_CREATE = "create"
521 a8083063 Iustin Pop
INSTANCE_IMPORT = "import"
522 9bf56d77 Michael Hanselmann
INSTANCE_REMOTE_IMPORT = "remote-import"
523 b8028dcf Michael Hanselmann
INSTANCE_CREATE_MODES = compat.UniqueFrozenset([
524 9bf56d77 Michael Hanselmann
  INSTANCE_CREATE,
525 9bf56d77 Michael Hanselmann
  INSTANCE_IMPORT,
526 9bf56d77 Michael Hanselmann
  INSTANCE_REMOTE_IMPORT,
527 9bf56d77 Michael Hanselmann
  ])
528 a8083063 Iustin Pop
529 1410fa8d Michael Hanselmann
# Remote import/export handshake message and version
530 1410fa8d Michael Hanselmann
RIE_VERSION = 0
531 1410fa8d Michael Hanselmann
RIE_HANDSHAKE = "Hi, I'm Ganeti"
532 1410fa8d Michael Hanselmann
533 1410fa8d Michael Hanselmann
# Remote import/export certificate validity in seconds
534 1410fa8d Michael Hanselmann
RIE_CERT_VALIDITY = 24 * 60 * 60
535 1410fa8d Michael Hanselmann
536 4478301b Michael Hanselmann
# Overall timeout for establishing connection
537 8fd2e34c Michael Hanselmann
RIE_CONNECT_TIMEOUT = 180
538 4a96f1d1 Michael Hanselmann
539 4478301b Michael Hanselmann
# Export only: how long to wait per connection attempt (seconds)
540 4478301b Michael Hanselmann
RIE_CONNECT_ATTEMPT_TIMEOUT = 20
541 4478301b Michael Hanselmann
542 4478301b Michael Hanselmann
# Export only: number of attempts to connect
543 4478301b Michael Hanselmann
RIE_CONNECT_RETRIES = 10
544 4478301b Michael Hanselmann
545 c74cda62 René Nussbaumer
#: Give child process up to 5 seconds to exit after sending a signal
546 c74cda62 René Nussbaumer
CHILD_LINGER_TIMEOUT = 5.0
547 4a96f1d1 Michael Hanselmann
548 b8028dcf Michael Hanselmann
DISK_TEMPLATES = compat.UniqueFrozenset([
549 21daa4a8 Stephen Shirley
  DT_DISKLESS,
550 21daa4a8 Stephen Shirley
  DT_PLAIN,
551 21daa4a8 Stephen Shirley
  DT_DRBD8,
552 21daa4a8 Stephen Shirley
  DT_FILE,
553 21daa4a8 Stephen Shirley
  DT_SHARED_FILE,
554 7181fba0 Constantinos Venetsanopoulos
  DT_BLOCK,
555 3c286190 Dimitris Aragiorgis
  DT_RBD,
556 376631d1 Constantinos Venetsanopoulos
  DT_EXT
557 21daa4a8 Stephen Shirley
  ])
558 04fa07f2 Manuel Franceschini
559 b8028dcf Michael Hanselmann
FILE_DRIVER = compat.UniqueFrozenset([FD_LOOP, FD_BLKTAP])
560 a8083063 Iustin Pop
561 a8083063 Iustin Pop
# import/export config options
562 a8083063 Iustin Pop
INISECT_EXP = "export"
563 a8083063 Iustin Pop
INISECT_INS = "instance"
564 3c8954ad Iustin Pop
INISECT_HYP = "hypervisor"
565 3c8954ad Iustin Pop
INISECT_BEP = "backend"
566 535b49cb Iustin Pop
INISECT_OSP = "os"
567 38242904 Iustin Pop
568 24991749 Iustin Pop
# dynamic device modification
569 61a14bb3 Iustin Pop
DDM_ADD = "add"
570 bf629e45 Michael Hanselmann
DDM_MODIFY = "modify"
571 61a14bb3 Iustin Pop
DDM_REMOVE = "remove"
572 b8028dcf Michael Hanselmann
DDMS_VALUES = compat.UniqueFrozenset([DDM_ADD, DDM_REMOVE])
573 bf629e45 Michael Hanselmann
DDMS_VALUES_WITH_MODIFY = (DDMS_VALUES | frozenset([
574 bf629e45 Michael Hanselmann
  DDM_MODIFY,
575 bf629e45 Michael Hanselmann
  ]))
576 bf629e45 Michael Hanselmann
# TODO: DDM_SWAP, DDM_MOVE?
577 24991749 Iustin Pop
578 38242904 Iustin Pop
# common exit codes
579 a5bc662a Iustin Pop
EXIT_SUCCESS = 0
580 438b45d4 Michael Hanselmann
EXIT_FAILURE = 1
581 46479775 Guido Trotter
EXIT_NOTCLUSTER = 5
582 38242904 Iustin Pop
EXIT_NOTMASTER = 11
583 619fdc8e Iustin Pop
EXIT_NODESETUP_ERROR = 12
584 a5bc662a Iustin Pop
EXIT_CONFIRMATION = 13 # need user confirmation
585 cf62a272 Michael Hanselmann
586 ee3aedff Michael Hanselmann
#: Exit code for query operations with unknown fields
587 ee3aedff Michael Hanselmann
EXIT_UNKNOWN_FIELD = 14
588 ee3aedff Michael Hanselmann
589 5c947f38 Iustin Pop
# tags
590 5c947f38 Iustin Pop
TAG_CLUSTER = "cluster"
591 1ffd2673 Michael Hanselmann
TAG_NODEGROUP = "nodegroup"
592 5c947f38 Iustin Pop
TAG_NODE = "node"
593 5c947f38 Iustin Pop
TAG_INSTANCE = "instance"
594 8140e24f Dimitris Aragiorgis
TAG_NETWORK = "network"
595 b8028dcf Michael Hanselmann
VALID_TAG_TYPES = compat.UniqueFrozenset([
596 3636400f Iustin Pop
  TAG_CLUSTER,
597 1ffd2673 Michael Hanselmann
  TAG_NODEGROUP,
598 3636400f Iustin Pop
  TAG_NODE,
599 3636400f Iustin Pop
  TAG_INSTANCE,
600 8140e24f Dimitris Aragiorgis
  TAG_NETWORK,
601 3636400f Iustin Pop
  ])
602 5c947f38 Iustin Pop
MAX_TAG_LEN = 128
603 5c947f38 Iustin Pop
MAX_TAGS_PER_OBJ = 4096
604 5c947f38 Iustin Pop
605 cf62a272 Michael Hanselmann
# others
606 cf62a272 Michael Hanselmann
DEFAULT_BRIDGE = "xen-br0"
607 6e9814a1 Andrea Spadaccini
CLASSIC_DRBD_SYNC_SPEED = 60 * 1024  # 60 MiB, expressed in KiB
608 9769bb78 Manuel Franceschini
IP4_ADDRESS_LOCALHOST = "127.0.0.1"
609 9769bb78 Manuel Franceschini
IP4_ADDRESS_ANY = "0.0.0.0"
610 0d2cd893 Manuel Franceschini
IP6_ADDRESS_LOCALHOST = "::1"
611 0d2cd893 Manuel Franceschini
IP6_ADDRESS_ANY = "::"
612 2f20d07b Manuel Franceschini
IP4_VERSION = 4
613 2f20d07b Manuel Franceschini
IP6_VERSION = 6
614 b8028dcf Michael Hanselmann
VALID_IP_VERSIONS = compat.UniqueFrozenset([IP4_VERSION, IP6_VERSION])
615 47334810 Iustin Pop
# for export to htools
616 47334810 Iustin Pop
IP4_FAMILY = socket.AF_INET
617 47334810 Iustin Pop
IP6_FAMILY = socket.AF_INET6
618 47334810 Iustin Pop
619 16abfbc2 Alexander Schreiber
TCP_PING_TIMEOUT = 10
620 d63e148a Manuel Franceschini
DEFAULT_VG = "xenvg"
621 ee2f0ed4 Luca Bigliardi
DEFAULT_DRBD_HELPER = "/bin/true"
622 8d1a2a64 Michael Hanselmann
MIN_VG_SIZE = 20480
623 c5e489f7 Iustin Pop
DEFAULT_MAC_PREFIX = "aa:00:00"
624 88cd08aa Guido Trotter
# default maximum instance wait time, in seconds.
625 88cd08aa Guido Trotter
DEFAULT_SHUTDOWN_TIMEOUT = 120
626 313b2dd4 Michael Hanselmann
NODE_MAX_CLOCK_SKEW = 150
627 033a1d00 Michael Hanselmann
# Time for an intra-cluster disk transfer to wait for a connection
628 81635b5a Iustin Pop
DISK_TRANSFER_CONNECT_TIMEOUT = 60
629 3536c792 Iustin Pop
# Disk index separator
630 3536c792 Iustin Pop
DISK_SEPARATOR = _autoconf.DISK_SEPARATOR
631 c4dfb0b6 Andrea Spadaccini
IP_COMMAND_PATH = _autoconf.IP_PATH
632 7900ed01 Iustin Pop
633 6a373640 Michael Hanselmann
#: Key for job IDs in opcode result
634 6a373640 Michael Hanselmann
JOB_IDS_KEY = "jobs"
635 6a373640 Michael Hanselmann
636 6bb65e3a Guido Trotter
# runparts results
637 6bb65e3a Guido Trotter
(RUNPARTS_SKIP,
638 6bb65e3a Guido Trotter
 RUNPARTS_RUN,
639 6bb65e3a Guido Trotter
 RUNPARTS_ERR) = range(3)
640 6bb65e3a Guido Trotter
641 b8028dcf Michael Hanselmann
RUNPARTS_STATUS = compat.UniqueFrozenset([
642 b8028dcf Michael Hanselmann
  RUNPARTS_SKIP,
643 b8028dcf Michael Hanselmann
  RUNPARTS_RUN,
644 b8028dcf Michael Hanselmann
  RUNPARTS_ERR,
645 b8028dcf Michael Hanselmann
  ])
646 6bb65e3a Guido Trotter
647 12bce260 Michael Hanselmann
# RPC constants
648 12bce260 Michael Hanselmann
(RPC_ENCODING_NONE,
649 12bce260 Michael Hanselmann
 RPC_ENCODING_ZLIB_BASE64) = range(2)
650 12bce260 Michael Hanselmann
651 2ff587d4 Agata Murawska
# Various time constants for the timeout table
652 2ff587d4 Agata Murawska
RPC_TMO_URGENT = 60 # one minute
653 2ff587d4 Agata Murawska
RPC_TMO_FAST = 5 * 60 # five minutes
654 2ff587d4 Agata Murawska
RPC_TMO_NORMAL = 15 * 60 # 15 minutes
655 2ff587d4 Agata Murawska
RPC_TMO_SLOW = 3600 # one hour
656 2ff587d4 Agata Murawska
RPC_TMO_4HRS = 4 * 3600
657 2ff587d4 Agata Murawska
RPC_TMO_1DAY = 86400
658 2ff587d4 Agata Murawska
659 2ff587d4 Agata Murawska
# Timeout for connecting to nodes (seconds)
660 2ff587d4 Agata Murawska
RPC_CONNECT_TIMEOUT = 5
661 2ff587d4 Agata Murawska
662 ded1c679 Guido Trotter
# os related constants
663 d0c8c01d Iustin Pop
OS_SCRIPT_CREATE = "create"
664 d0c8c01d Iustin Pop
OS_SCRIPT_IMPORT = "import"
665 d0c8c01d Iustin Pop
OS_SCRIPT_EXPORT = "export"
666 d0c8c01d Iustin Pop
OS_SCRIPT_RENAME = "rename"
667 d0c8c01d Iustin Pop
OS_SCRIPT_VERIFY = "verify"
668 b8028dcf Michael Hanselmann
OS_SCRIPTS = compat.UniqueFrozenset([
669 21daa4a8 Stephen Shirley
  OS_SCRIPT_CREATE,
670 21daa4a8 Stephen Shirley
  OS_SCRIPT_IMPORT,
671 21daa4a8 Stephen Shirley
  OS_SCRIPT_EXPORT,
672 21daa4a8 Stephen Shirley
  OS_SCRIPT_RENAME,
673 3c286190 Dimitris Aragiorgis
  OS_SCRIPT_VERIFY,
674 21daa4a8 Stephen Shirley
  ])
675 37482e7b Guido Trotter
676 d0c8c01d Iustin Pop
OS_API_FILE = "ganeti_api_version"
677 d0c8c01d Iustin Pop
OS_VARIANTS_FILE = "variants.list"
678 d0c8c01d Iustin Pop
OS_PARAMETERS_FILE = "parameters.list"
679 b41b3516 Iustin Pop
680 d0c8c01d Iustin Pop
OS_VALIDATE_PARAMETERS = "parameters"
681 b8028dcf Michael Hanselmann
OS_VALIDATE_CALLS = compat.UniqueFrozenset([OS_VALIDATE_PARAMETERS])
682 b6b45e0d Guido Trotter
683 376631d1 Constantinos Venetsanopoulos
# External Storage (ES) related constants
684 376631d1 Constantinos Venetsanopoulos
ES_ACTION_CREATE = "create"
685 376631d1 Constantinos Venetsanopoulos
ES_ACTION_REMOVE = "remove"
686 376631d1 Constantinos Venetsanopoulos
ES_ACTION_GROW = "grow"
687 376631d1 Constantinos Venetsanopoulos
ES_ACTION_ATTACH = "attach"
688 376631d1 Constantinos Venetsanopoulos
ES_ACTION_DETACH = "detach"
689 376631d1 Constantinos Venetsanopoulos
ES_ACTION_SETINFO = "setinfo"
690 938adc87 Constantinos Venetsanopoulos
ES_ACTION_VERIFY = "verify"
691 376631d1 Constantinos Venetsanopoulos
692 376631d1 Constantinos Venetsanopoulos
ES_SCRIPT_CREATE = ES_ACTION_CREATE
693 376631d1 Constantinos Venetsanopoulos
ES_SCRIPT_REMOVE = ES_ACTION_REMOVE
694 376631d1 Constantinos Venetsanopoulos
ES_SCRIPT_GROW = ES_ACTION_GROW
695 376631d1 Constantinos Venetsanopoulos
ES_SCRIPT_ATTACH = ES_ACTION_ATTACH
696 376631d1 Constantinos Venetsanopoulos
ES_SCRIPT_DETACH = ES_ACTION_DETACH
697 376631d1 Constantinos Venetsanopoulos
ES_SCRIPT_SETINFO = ES_ACTION_SETINFO
698 938adc87 Constantinos Venetsanopoulos
ES_SCRIPT_VERIFY = ES_ACTION_VERIFY
699 376631d1 Constantinos Venetsanopoulos
ES_SCRIPTS = frozenset([
700 376631d1 Constantinos Venetsanopoulos
  ES_SCRIPT_CREATE,
701 376631d1 Constantinos Venetsanopoulos
  ES_SCRIPT_REMOVE,
702 376631d1 Constantinos Venetsanopoulos
  ES_SCRIPT_GROW,
703 376631d1 Constantinos Venetsanopoulos
  ES_SCRIPT_ATTACH,
704 376631d1 Constantinos Venetsanopoulos
  ES_SCRIPT_DETACH,
705 938adc87 Constantinos Venetsanopoulos
  ES_SCRIPT_SETINFO,
706 938adc87 Constantinos Venetsanopoulos
  ES_SCRIPT_VERIFY
707 376631d1 Constantinos Venetsanopoulos
  ])
708 376631d1 Constantinos Venetsanopoulos
709 938adc87 Constantinos Venetsanopoulos
ES_PARAMETERS_FILE = "parameters.list"
710 938adc87 Constantinos Venetsanopoulos
711 70d9e3d8 Iustin Pop
# ssh constants
712 fff33d70 Michael Hanselmann
SSH = "ssh"
713 fff33d70 Michael Hanselmann
SCP = "scp"
714 007a2f3e Alexander Schreiber
715 007a2f3e Alexander Schreiber
# reboot types
716 007a2f3e Alexander Schreiber
INSTANCE_REBOOT_SOFT = "soft"
717 007a2f3e Alexander Schreiber
INSTANCE_REBOOT_HARD = "hard"
718 007a2f3e Alexander Schreiber
INSTANCE_REBOOT_FULL = "full"
719 2584d4a4 Alexander Schreiber
720 b8028dcf Michael Hanselmann
REBOOT_TYPES = compat.UniqueFrozenset([
721 990ade2d Stephen Shirley
  INSTANCE_REBOOT_SOFT,
722 990ade2d Stephen Shirley
  INSTANCE_REBOOT_HARD,
723 3c286190 Dimitris Aragiorgis
  INSTANCE_REBOOT_FULL,
724 990ade2d Stephen Shirley
  ])
725 990ade2d Stephen Shirley
726 990ade2d Stephen Shirley
# instance reboot behaviors
727 990ade2d Stephen Shirley
INSTANCE_REBOOT_ALLOWED = "reboot"
728 990ade2d Stephen Shirley
INSTANCE_REBOOT_EXIT = "exit"
729 990ade2d Stephen Shirley
730 b8028dcf Michael Hanselmann
REBOOT_BEHAVIORS = compat.UniqueFrozenset([
731 990ade2d Stephen Shirley
  INSTANCE_REBOOT_ALLOWED,
732 3c286190 Dimitris Aragiorgis
  INSTANCE_REBOOT_EXIT,
733 990ade2d Stephen Shirley
  ])
734 00f91f29 Iustin Pop
735 d0c8c01d Iustin Pop
VTYPE_STRING = "string"
736 59525e1f Michael Hanselmann
VTYPE_MAYBE_STRING = "maybe-string"
737 d0c8c01d Iustin Pop
VTYPE_BOOL = "bool"
738 d0c8c01d Iustin Pop
VTYPE_SIZE = "size" # size, in MiBs
739 d0c8c01d Iustin Pop
VTYPE_INT = "int"
740 b8028dcf Michael Hanselmann
ENFORCEABLE_TYPES = compat.UniqueFrozenset([
741 21daa4a8 Stephen Shirley
  VTYPE_STRING,
742 21daa4a8 Stephen Shirley
  VTYPE_MAYBE_STRING,
743 21daa4a8 Stephen Shirley
  VTYPE_BOOL,
744 21daa4a8 Stephen Shirley
  VTYPE_SIZE,
745 21daa4a8 Stephen Shirley
  VTYPE_INT,
746 21daa4a8 Stephen Shirley
  ])
747 a5728081 Guido Trotter
748 b1cb62bd Andrea Spadaccini
# Constant representing that the user does not specify any IP version
749 b1cb62bd Andrea Spadaccini
IFACE_NO_IP_VERSION_SPECIFIED = 0
750 b1cb62bd Andrea Spadaccini
751 14fd6c81 Guido Trotter
VALID_SERIAL_SPEEDS = compat.UniqueFrozenset([
752 14fd6c81 Guido Trotter
  75,
753 14fd6c81 Guido Trotter
  110,
754 14fd6c81 Guido Trotter
  300,
755 14fd6c81 Guido Trotter
  600,
756 14fd6c81 Guido Trotter
  1200,
757 14fd6c81 Guido Trotter
  1800,
758 14fd6c81 Guido Trotter
  2400,
759 14fd6c81 Guido Trotter
  4800,
760 14fd6c81 Guido Trotter
  9600,
761 14fd6c81 Guido Trotter
  14400,
762 14fd6c81 Guido Trotter
  19200,
763 14fd6c81 Guido Trotter
  28800,
764 14fd6c81 Guido Trotter
  38400,
765 14fd6c81 Guido Trotter
  57600,
766 14fd6c81 Guido Trotter
  115200,
767 14fd6c81 Guido Trotter
  230400,
768 14fd6c81 Guido Trotter
  345600,
769 14fd6c81 Guido Trotter
  460800,
770 14fd6c81 Guido Trotter
  ])
771 14fd6c81 Guido Trotter
772 e64b8beb Iustin Pop
# HV parameter names (global namespace)
773 e64b8beb Iustin Pop
HV_BOOT_ORDER = "boot_order"
774 e64b8beb Iustin Pop
HV_CDROM_IMAGE_PATH = "cdrom_image_path"
775 cc130cc7 Marco Casavecchia
HV_KVM_CDROM2_IMAGE_PATH = "cdrom2_image_path"
776 cc130cc7 Marco Casavecchia
HV_KVM_FLOPPY_IMAGE_PATH = "floppy_image_path"
777 e64b8beb Iustin Pop
HV_NIC_TYPE = "nic_type"
778 e64b8beb Iustin Pop
HV_DISK_TYPE = "disk_type"
779 cc130cc7 Marco Casavecchia
HV_KVM_CDROM_DISK_TYPE = "cdrom_disk_type"
780 e64b8beb Iustin Pop
HV_VNC_BIND_ADDRESS = "vnc_bind_address"
781 6e6bb8d5 Guido Trotter
HV_VNC_PASSWORD_FILE = "vnc_password_file"
782 8b2d1013 Guido Trotter
HV_VNC_TLS = "vnc_tls"
783 8b2d1013 Guido Trotter
HV_VNC_X509 = "vnc_x509_path"
784 8b2d1013 Guido Trotter
HV_VNC_X509_VERIFY = "vnc_x509_verify"
785 b1cb62bd Andrea Spadaccini
HV_KVM_SPICE_BIND = "spice_bind"
786 b1cb62bd Andrea Spadaccini
HV_KVM_SPICE_IP_VERSION = "spice_ip_version"
787 b451c4c7 Andrea Spadaccini
HV_KVM_SPICE_PASSWORD_FILE = "spice_password_file"
788 ea064d24 Andrea Spadaccini
HV_KVM_SPICE_LOSSLESS_IMG_COMPR = "spice_image_compression"
789 ea064d24 Andrea Spadaccini
HV_KVM_SPICE_JPEG_IMG_COMPR = "spice_jpeg_wan_compression"
790 ea064d24 Andrea Spadaccini
HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR = "spice_zlib_glz_wan_compression"
791 ea064d24 Andrea Spadaccini
HV_KVM_SPICE_STREAMING_VIDEO_DETECTION = "spice_streaming_video"
792 ea064d24 Andrea Spadaccini
HV_KVM_SPICE_AUDIO_COMPR = "spice_playback_compression"
793 bfe86c76 Andrea Spadaccini
HV_KVM_SPICE_USE_TLS = "spice_use_tls"
794 3e40b587 Andrea Spadaccini
HV_KVM_SPICE_TLS_CIPHERS = "spice_tls_ciphers"
795 3e40b587 Andrea Spadaccini
HV_KVM_SPICE_USE_VDAGENT = "spice_use_vdagent"
796 e64b8beb Iustin Pop
HV_ACPI = "acpi"
797 e64b8beb Iustin Pop
HV_PAE = "pae"
798 2f2dbb4b Jun Futagawa
HV_USE_BOOTLOADER = "use_bootloader"
799 2f2dbb4b Jun Futagawa
HV_BOOTLOADER_ARGS = "bootloader_args"
800 2f2dbb4b Jun Futagawa
HV_BOOTLOADER_PATH = "bootloader_path"
801 f9d6542d Iustin Pop
HV_KERNEL_ARGS = "kernel_args"
802 e64b8beb Iustin Pop
HV_KERNEL_PATH = "kernel_path"
803 e64b8beb Iustin Pop
HV_INITRD_PATH = "initrd_path"
804 074ca009 Guido Trotter
HV_ROOT_PATH = "root_path"
805 a2faf9ee Guido Trotter
HV_SERIAL_CONSOLE = "serial_console"
806 14fd6c81 Guido Trotter
HV_SERIAL_SPEED = "serial_speed"
807 11344a50 Guido Trotter
HV_USB_MOUSE = "usb_mouse"
808 4f580fef Sébastien Bocahu
HV_KEYMAP = "keymap"
809 09ea8710 Iustin Pop
HV_DEVICE_MODEL = "device_model"
810 48297fa2 Iustin Pop
HV_INIT_SCRIPT = "init_script"
811 78411c60 Iustin Pop
HV_MIGRATION_PORT = "migration_port"
812 e43d4f9f Apollon Oikonomopoulos
HV_MIGRATION_BANDWIDTH = "migration_bandwidth"
813 e43d4f9f Apollon Oikonomopoulos
HV_MIGRATION_DOWNTIME = "migration_downtime"
814 783a6c0b Iustin Pop
HV_MIGRATION_MODE = "migration_mode"
815 6b970cef Jun Futagawa
HV_USE_LOCALTIME = "use_localtime"
816 ea0f3d7a Iustin Pop
HV_DISK_CACHE = "disk_cache"
817 3424767f Guido Trotter
HV_SECURITY_MODEL = "security_model"
818 3424767f Guido Trotter
HV_SECURITY_DOMAIN = "security_domain"
819 7ba594c0 Guido Trotter
HV_KVM_FLAG = "kvm_flag"
820 fbe27e2b Guido Trotter
HV_VHOST_NET = "vhost_net"
821 84c08e4e Balazs Lecz
HV_KVM_USE_CHROOT = "use_chroot"
822 e3ed5316 Balazs Lecz
HV_CPU_MASK = "cpu_mask"
823 4f958b0b Miguel Di Ciurcio Filho
HV_MEM_PATH = "mem_path"
824 87f0aa48 Jack
HV_PASSTHROUGH = "pci_pass"
825 525011bc Maciej Bliziński
HV_BLOCKDEV_PREFIX = "blockdev_prefix"
826 990ade2d Stephen Shirley
HV_REBOOT_BEHAVIOR = "reboot_behavior"
827 7cb42171 Nikita Staroverov
HV_CPU_TYPE = "cpu_type"
828 8bd977e9 Sébastien Bocahu
HV_CPU_CAP = "cpu_cap"
829 8bd977e9 Sébastien Bocahu
HV_CPU_WEIGHT = "cpu_weight"
830 4888a609 Guido Trotter
HV_CPU_CORES = "cpu_cores"
831 4888a609 Guido Trotter
HV_CPU_THREADS = "cpu_threads"
832 4888a609 Guido Trotter
HV_CPU_SOCKETS = "cpu_sockets"
833 2fddb144 Guido Trotter
HV_SOUNDHW = "soundhw"
834 156681c1 Guido Trotter
HV_USB_DEVICES = "usb_devices"
835 7589346f Guido Trotter
HV_VGA = "vga"
836 e6f24d89 Guido Trotter
HV_KVM_EXTRA = "kvm_extra"
837 8bd977e9 Sébastien Bocahu
838 e64b8beb Iustin Pop
839 a5728081 Guido Trotter
HVS_PARAMETER_TYPES = {
840 a5728081 Guido Trotter
  HV_BOOT_ORDER: VTYPE_STRING,
841 cc130cc7 Marco Casavecchia
  HV_KVM_FLOPPY_IMAGE_PATH: VTYPE_STRING,
842 a5728081 Guido Trotter
  HV_CDROM_IMAGE_PATH: VTYPE_STRING,
843 cc130cc7 Marco Casavecchia
  HV_KVM_CDROM2_IMAGE_PATH: VTYPE_STRING,
844 a5728081 Guido Trotter
  HV_NIC_TYPE: VTYPE_STRING,
845 a5728081 Guido Trotter
  HV_DISK_TYPE: VTYPE_STRING,
846 cc130cc7 Marco Casavecchia
  HV_KVM_CDROM_DISK_TYPE: VTYPE_STRING,
847 6e6bb8d5 Guido Trotter
  HV_VNC_PASSWORD_FILE: VTYPE_STRING,
848 a5728081 Guido Trotter
  HV_VNC_BIND_ADDRESS: VTYPE_STRING,
849 a5728081 Guido Trotter
  HV_VNC_TLS: VTYPE_BOOL,
850 a5728081 Guido Trotter
  HV_VNC_X509: VTYPE_STRING,
851 a5728081 Guido Trotter
  HV_VNC_X509_VERIFY: VTYPE_BOOL,
852 b1cb62bd Andrea Spadaccini
  HV_KVM_SPICE_BIND: VTYPE_STRING,
853 b1cb62bd Andrea Spadaccini
  HV_KVM_SPICE_IP_VERSION: VTYPE_INT,
854 b451c4c7 Andrea Spadaccini
  HV_KVM_SPICE_PASSWORD_FILE: VTYPE_STRING,
855 ea064d24 Andrea Spadaccini
  HV_KVM_SPICE_LOSSLESS_IMG_COMPR: VTYPE_STRING,
856 ea064d24 Andrea Spadaccini
  HV_KVM_SPICE_JPEG_IMG_COMPR: VTYPE_STRING,
857 ea064d24 Andrea Spadaccini
  HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR: VTYPE_STRING,
858 ea064d24 Andrea Spadaccini
  HV_KVM_SPICE_STREAMING_VIDEO_DETECTION: VTYPE_STRING,
859 ea064d24 Andrea Spadaccini
  HV_KVM_SPICE_AUDIO_COMPR: VTYPE_BOOL,
860 bfe86c76 Andrea Spadaccini
  HV_KVM_SPICE_USE_TLS: VTYPE_BOOL,
861 3e40b587 Andrea Spadaccini
  HV_KVM_SPICE_TLS_CIPHERS: VTYPE_STRING,
862 3e40b587 Andrea Spadaccini
  HV_KVM_SPICE_USE_VDAGENT: VTYPE_BOOL,
863 a5728081 Guido Trotter
  HV_ACPI: VTYPE_BOOL,
864 a5728081 Guido Trotter
  HV_PAE: VTYPE_BOOL,
865 2f2dbb4b Jun Futagawa
  HV_USE_BOOTLOADER: VTYPE_BOOL,
866 2f2dbb4b Jun Futagawa
  HV_BOOTLOADER_PATH: VTYPE_STRING,
867 2f2dbb4b Jun Futagawa
  HV_BOOTLOADER_ARGS: VTYPE_STRING,
868 a5728081 Guido Trotter
  HV_KERNEL_PATH: VTYPE_STRING,
869 f9d6542d Iustin Pop
  HV_KERNEL_ARGS: VTYPE_STRING,
870 a5728081 Guido Trotter
  HV_INITRD_PATH: VTYPE_STRING,
871 7adf7814 René Nussbaumer
  HV_ROOT_PATH: VTYPE_MAYBE_STRING,
872 a5728081 Guido Trotter
  HV_SERIAL_CONSOLE: VTYPE_BOOL,
873 14fd6c81 Guido Trotter
  HV_SERIAL_SPEED: VTYPE_INT,
874 a5728081 Guido Trotter
  HV_USB_MOUSE: VTYPE_STRING,
875 4f580fef Sébastien Bocahu
  HV_KEYMAP: VTYPE_STRING,
876 09ea8710 Iustin Pop
  HV_DEVICE_MODEL: VTYPE_STRING,
877 48297fa2 Iustin Pop
  HV_INIT_SCRIPT: VTYPE_STRING,
878 78411c60 Iustin Pop
  HV_MIGRATION_PORT: VTYPE_INT,
879 e43d4f9f Apollon Oikonomopoulos
  HV_MIGRATION_BANDWIDTH: VTYPE_INT,
880 e43d4f9f Apollon Oikonomopoulos
  HV_MIGRATION_DOWNTIME: VTYPE_INT,
881 783a6c0b Iustin Pop
  HV_MIGRATION_MODE: VTYPE_STRING,
882 6b970cef Jun Futagawa
  HV_USE_LOCALTIME: VTYPE_BOOL,
883 ea0f3d7a Iustin Pop
  HV_DISK_CACHE: VTYPE_STRING,
884 3424767f Guido Trotter
  HV_SECURITY_MODEL: VTYPE_STRING,
885 3424767f Guido Trotter
  HV_SECURITY_DOMAIN: VTYPE_STRING,
886 7ba594c0 Guido Trotter
  HV_KVM_FLAG: VTYPE_STRING,
887 fbe27e2b Guido Trotter
  HV_VHOST_NET: VTYPE_BOOL,
888 84c08e4e Balazs Lecz
  HV_KVM_USE_CHROOT: VTYPE_BOOL,
889 e3ed5316 Balazs Lecz
  HV_CPU_MASK: VTYPE_STRING,
890 4f958b0b Miguel Di Ciurcio Filho
  HV_MEM_PATH: VTYPE_STRING,
891 87f0aa48 Jack
  HV_PASSTHROUGH: VTYPE_STRING,
892 525011bc Maciej Bliziński
  HV_BLOCKDEV_PREFIX: VTYPE_STRING,
893 990ade2d Stephen Shirley
  HV_REBOOT_BEHAVIOR: VTYPE_STRING,
894 7cb42171 Nikita Staroverov
  HV_CPU_TYPE: VTYPE_STRING,
895 8bd977e9 Sébastien Bocahu
  HV_CPU_CAP: VTYPE_INT,
896 8bd977e9 Sébastien Bocahu
  HV_CPU_WEIGHT: VTYPE_INT,
897 4888a609 Guido Trotter
  HV_CPU_CORES: VTYPE_INT,
898 4888a609 Guido Trotter
  HV_CPU_THREADS: VTYPE_INT,
899 4888a609 Guido Trotter
  HV_CPU_SOCKETS: VTYPE_INT,
900 2fddb144 Guido Trotter
  HV_SOUNDHW: VTYPE_STRING,
901 156681c1 Guido Trotter
  HV_USB_DEVICES: VTYPE_STRING,
902 7589346f Guido Trotter
  HV_VGA: VTYPE_STRING,
903 e6f24d89 Guido Trotter
  HV_KVM_EXTRA: VTYPE_STRING,
904 a5728081 Guido Trotter
  }
905 a5728081 Guido Trotter
906 a5728081 Guido Trotter
HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
907 5018a335 Iustin Pop
908 a6c7e2a2 Iustin Pop
HVS_PARAMETER_TITLES = {
909 a6c7e2a2 Iustin Pop
  HV_ACPI: "ACPI",
910 a6c7e2a2 Iustin Pop
  HV_BOOT_ORDER: "Boot_order",
911 a6c7e2a2 Iustin Pop
  HV_CDROM_IMAGE_PATH: "CDROM_image_path",
912 a6c7e2a2 Iustin Pop
  HV_DISK_TYPE: "Disk_type",
913 a6c7e2a2 Iustin Pop
  HV_INITRD_PATH: "Initrd_path",
914 a6c7e2a2 Iustin Pop
  HV_KERNEL_PATH: "Kernel_path",
915 a6c7e2a2 Iustin Pop
  HV_NIC_TYPE: "NIC_type",
916 a6c7e2a2 Iustin Pop
  HV_PAE: "PAE",
917 a6c7e2a2 Iustin Pop
  HV_VNC_BIND_ADDRESS: "VNC_bind_address",
918 a6c7e2a2 Iustin Pop
  HV_PASSTHROUGH: "pci_pass",
919 a6c7e2a2 Iustin Pop
  HV_CPU_TYPE: "cpu_type",
920 a6c7e2a2 Iustin Pop
  }
921 a6c7e2a2 Iustin Pop
922 6a1434d7 Andrea Spadaccini
# Migration statuses
923 6a1434d7 Andrea Spadaccini
HV_MIGRATION_COMPLETED = "completed"
924 6a1434d7 Andrea Spadaccini
HV_MIGRATION_ACTIVE = "active"
925 6a1434d7 Andrea Spadaccini
HV_MIGRATION_FAILED = "failed"
926 6a1434d7 Andrea Spadaccini
HV_MIGRATION_CANCELLED = "cancelled"
927 6a1434d7 Andrea Spadaccini
928 b8028dcf Michael Hanselmann
HV_MIGRATION_VALID_STATUSES = compat.UniqueFrozenset([
929 6a1434d7 Andrea Spadaccini
  HV_MIGRATION_COMPLETED,
930 6a1434d7 Andrea Spadaccini
  HV_MIGRATION_ACTIVE,
931 6a1434d7 Andrea Spadaccini
  HV_MIGRATION_FAILED,
932 6a1434d7 Andrea Spadaccini
  HV_MIGRATION_CANCELLED,
933 6a1434d7 Andrea Spadaccini
  ])
934 6a1434d7 Andrea Spadaccini
935 b8028dcf Michael Hanselmann
HV_MIGRATION_FAILED_STATUSES = compat.UniqueFrozenset([
936 6a1434d7 Andrea Spadaccini
  HV_MIGRATION_FAILED,
937 6a1434d7 Andrea Spadaccini
  HV_MIGRATION_CANCELLED,
938 6a1434d7 Andrea Spadaccini
  ])
939 6a1434d7 Andrea Spadaccini
940 6a1434d7 Andrea Spadaccini
# KVM-specific statuses
941 6a1434d7 Andrea Spadaccini
HV_KVM_MIGRATION_VALID_STATUSES = HV_MIGRATION_VALID_STATUSES
942 6a1434d7 Andrea Spadaccini
943 34fbc862 Andrea Spadaccini
# Node info keys
944 34fbc862 Andrea Spadaccini
HV_NODEINFO_KEY_VERSION = "hv_version"
945 34fbc862 Andrea Spadaccini
946 5b49ed09 René Nussbaumer
# Hypervisor state
947 5b49ed09 René Nussbaumer
HVST_MEMORY_TOTAL = "mem_total"
948 5b49ed09 René Nussbaumer
HVST_MEMORY_NODE = "mem_node"
949 5b49ed09 René Nussbaumer
HVST_MEMORY_HV = "mem_hv"
950 5b49ed09 René Nussbaumer
HVST_CPU_TOTAL = "cpu_total"
951 5b49ed09 René Nussbaumer
HVST_CPU_NODE = "cpu_node"
952 5b49ed09 René Nussbaumer
953 2da9f556 René Nussbaumer
HVST_DEFAULTS = {
954 2da9f556 René Nussbaumer
  HVST_MEMORY_TOTAL: 0,
955 2da9f556 René Nussbaumer
  HVST_MEMORY_NODE: 0,
956 2da9f556 René Nussbaumer
  HVST_MEMORY_HV: 0,
957 2da9f556 René Nussbaumer
  HVST_CPU_TOTAL: 1,
958 2da9f556 René Nussbaumer
  HVST_CPU_NODE: 1,
959 2da9f556 René Nussbaumer
  }
960 2da9f556 René Nussbaumer
961 5b49ed09 René Nussbaumer
HVSTS_PARAMETER_TYPES = {
962 5b49ed09 René Nussbaumer
  HVST_MEMORY_TOTAL: VTYPE_INT,
963 5b49ed09 René Nussbaumer
  HVST_MEMORY_NODE: VTYPE_INT,
964 5b49ed09 René Nussbaumer
  HVST_MEMORY_HV: VTYPE_INT,
965 5b49ed09 René Nussbaumer
  HVST_CPU_TOTAL: VTYPE_INT,
966 5b49ed09 René Nussbaumer
  HVST_CPU_NODE: VTYPE_INT,
967 5b49ed09 René Nussbaumer
  }
968 5b49ed09 René Nussbaumer
969 5b49ed09 René Nussbaumer
HVSTS_PARAMETERS = frozenset(HVSTS_PARAMETER_TYPES.keys())
970 5b49ed09 René Nussbaumer
971 5b49ed09 René Nussbaumer
# Disk state
972 5b49ed09 René Nussbaumer
DS_DISK_TOTAL = "disk_total"
973 5b49ed09 René Nussbaumer
DS_DISK_RESERVED = "disk_reserved"
974 5b49ed09 René Nussbaumer
DS_DISK_OVERHEAD = "disk_overhead"
975 5b49ed09 René Nussbaumer
976 2da9f556 René Nussbaumer
DS_DEFAULTS = {
977 2da9f556 René Nussbaumer
  DS_DISK_TOTAL: 0,
978 2da9f556 René Nussbaumer
  DS_DISK_RESERVED: 0,
979 2da9f556 René Nussbaumer
  DS_DISK_OVERHEAD: 0,
980 2da9f556 René Nussbaumer
  }
981 2da9f556 René Nussbaumer
982 5b49ed09 René Nussbaumer
DSS_PARAMETER_TYPES = {
983 5b49ed09 René Nussbaumer
  DS_DISK_TOTAL: VTYPE_INT,
984 5b49ed09 René Nussbaumer
  DS_DISK_RESERVED: VTYPE_INT,
985 5b49ed09 René Nussbaumer
  DS_DISK_OVERHEAD: VTYPE_INT,
986 5b49ed09 René Nussbaumer
  }
987 5b49ed09 René Nussbaumer
988 5b49ed09 René Nussbaumer
DSS_PARAMETERS = frozenset(DSS_PARAMETER_TYPES.keys())
989 b8028dcf Michael Hanselmann
DS_VALID_TYPES = compat.UniqueFrozenset([LD_LV])
990 5b49ed09 René Nussbaumer
991 3d5ebbf0 Stephen Shirley
# Backend parameter names
992 8c72ab2b Guido Trotter
BE_MEMORY = "memory" # deprecated and replaced by max and min mem
993 8c72ab2b Guido Trotter
BE_MAXMEM = "maxmem"
994 8c72ab2b Guido Trotter
BE_MINMEM = "minmem"
995 e64b8beb Iustin Pop
BE_VCPUS = "vcpus"
996 c0f2b229 Iustin Pop
BE_AUTO_BALANCE = "auto_balance"
997 11dc66f3 Bernardo Dal Seno
BE_ALWAYS_FAILOVER = "always_failover"
998 34700f5b René Nussbaumer
BE_SPINDLE_USE = "spindle_use"
999 e64b8beb Iustin Pop
1000 a5728081 Guido Trotter
BES_PARAMETER_TYPES = {
1001 2e1a6024 Guido Trotter
  BE_MAXMEM: VTYPE_SIZE,
1002 2e1a6024 Guido Trotter
  BE_MINMEM: VTYPE_SIZE,
1003 2e1a6024 Guido Trotter
  BE_VCPUS: VTYPE_INT,
1004 2e1a6024 Guido Trotter
  BE_AUTO_BALANCE: VTYPE_BOOL,
1005 11dc66f3 Bernardo Dal Seno
  BE_ALWAYS_FAILOVER: VTYPE_BOOL,
1006 34700f5b René Nussbaumer
  BE_SPINDLE_USE: VTYPE_INT,
1007 2e1a6024 Guido Trotter
  }
1008 a5728081 Guido Trotter
1009 a6c7e2a2 Iustin Pop
BES_PARAMETER_TITLES = {
1010 a6c7e2a2 Iustin Pop
  BE_AUTO_BALANCE: "Auto_balance",
1011 a6c7e2a2 Iustin Pop
  BE_MAXMEM: "ConfigMaxMem",
1012 a6c7e2a2 Iustin Pop
  BE_MINMEM: "ConfigMinMem",
1013 a6c7e2a2 Iustin Pop
  BE_VCPUS: "ConfigVCPUs",
1014 a6c7e2a2 Iustin Pop
  }
1015 a6c7e2a2 Iustin Pop
1016 b2e233a5 Guido Trotter
BES_PARAMETER_COMPAT = {
1017 b2e233a5 Guido Trotter
  BE_MEMORY: VTYPE_SIZE,
1018 b2e233a5 Guido Trotter
  }
1019 b2e233a5 Guido Trotter
BES_PARAMETER_COMPAT.update(BES_PARAMETER_TYPES)
1020 b2e233a5 Guido Trotter
1021 a5728081 Guido Trotter
BES_PARAMETERS = frozenset(BES_PARAMETER_TYPES.keys())
1022 cd3ab26e Iustin Pop
1023 918eb80b Agata Murawska
# instance specs
1024 4f725341 Agata Murawska
ISPEC_MEM_SIZE = "memory-size"
1025 4f725341 Agata Murawska
ISPEC_CPU_COUNT = "cpu-count"
1026 4f725341 Agata Murawska
ISPEC_DISK_COUNT = "disk-count"
1027 4f725341 Agata Murawska
ISPEC_DISK_SIZE = "disk-size"
1028 4f725341 Agata Murawska
ISPEC_NIC_COUNT = "nic-count"
1029 553cb5f7 René Nussbaumer
ISPEC_SPINDLE_USE = "spindle-use"
1030 918eb80b Agata Murawska
1031 918eb80b Agata Murawska
ISPECS_PARAMETER_TYPES = {
1032 4f725341 Agata Murawska
  ISPEC_MEM_SIZE: VTYPE_INT,
1033 4f725341 Agata Murawska
  ISPEC_CPU_COUNT: VTYPE_INT,
1034 4f725341 Agata Murawska
  ISPEC_DISK_COUNT: VTYPE_INT,
1035 4f725341 Agata Murawska
  ISPEC_DISK_SIZE: VTYPE_INT,
1036 4f725341 Agata Murawska
  ISPEC_NIC_COUNT: VTYPE_INT,
1037 553cb5f7 René Nussbaumer
  ISPEC_SPINDLE_USE: VTYPE_INT,
1038 918eb80b Agata Murawska
  }
1039 918eb80b Agata Murawska
1040 918eb80b Agata Murawska
ISPECS_PARAMETERS = frozenset(ISPECS_PARAMETER_TYPES.keys())
1041 918eb80b Agata Murawska
1042 4f725341 Agata Murawska
ISPECS_MIN = "min"
1043 4f725341 Agata Murawska
ISPECS_MAX = "max"
1044 4f725341 Agata Murawska
ISPECS_STD = "std"
1045 784b6603 René Nussbaumer
IPOLICY_DTS = "disk-templates"
1046 784b6603 René Nussbaumer
IPOLICY_VCPU_RATIO = "vcpu-ratio"
1047 a194dc28 Iustin Pop
IPOLICY_SPINDLE_RATIO = "spindle-ratio"
1048 918eb80b Agata Murawska
1049 b8028dcf Michael Hanselmann
IPOLICY_ISPECS = compat.UniqueFrozenset([
1050 4f725341 Agata Murawska
  ISPECS_MIN,
1051 4f725341 Agata Murawska
  ISPECS_MAX,
1052 4f725341 Agata Murawska
  ISPECS_STD,
1053 918eb80b Agata Murawska
  ])
1054 ff6c5e55 Iustin Pop
1055 b8028dcf Michael Hanselmann
IPOLICY_PARAMETERS = compat.UniqueFrozenset([
1056 ff6c5e55 Iustin Pop
  IPOLICY_VCPU_RATIO,
1057 a194dc28 Iustin Pop
  IPOLICY_SPINDLE_RATIO,
1058 ff6c5e55 Iustin Pop
  ])
1059 ff6c5e55 Iustin Pop
1060 ff6c5e55 Iustin Pop
IPOLICY_ALL_KEYS = (IPOLICY_ISPECS |
1061 ff6c5e55 Iustin Pop
                    IPOLICY_PARAMETERS |
1062 ff6c5e55 Iustin Pop
                    frozenset([IPOLICY_DTS]))
1063 918eb80b Agata Murawska
1064 095e71aa René Nussbaumer
# Node parameter names
1065 095e71aa René Nussbaumer
ND_OOB_PROGRAM = "oob_program"
1066 432e8e2f Iustin Pop
ND_SPINDLE_COUNT = "spindle_count"
1067 0ea11dcb Bernardo Dal Seno
ND_EXCLUSIVE_STORAGE = "exclusive_storage"
1068 095e71aa René Nussbaumer
1069 095e71aa René Nussbaumer
NDS_PARAMETER_TYPES = {
1070 1df4d430 Iustin Pop
  ND_OOB_PROGRAM: VTYPE_STRING,
1071 432e8e2f Iustin Pop
  ND_SPINDLE_COUNT: VTYPE_INT,
1072 0ea11dcb Bernardo Dal Seno
  ND_EXCLUSIVE_STORAGE: VTYPE_BOOL,
1073 2e1a6024 Guido Trotter
  }
1074 095e71aa René Nussbaumer
1075 095e71aa René Nussbaumer
NDS_PARAMETERS = frozenset(NDS_PARAMETER_TYPES.keys())
1076 095e71aa René Nussbaumer
1077 a6c7e2a2 Iustin Pop
NDS_PARAMETER_TITLES = {
1078 a6c7e2a2 Iustin Pop
  ND_OOB_PROGRAM: "OutOfBandProgram",
1079 a6c7e2a2 Iustin Pop
  ND_SPINDLE_COUNT: "SpindleCount",
1080 0ea11dcb Bernardo Dal Seno
  ND_EXCLUSIVE_STORAGE: "ExclusiveStorage",
1081 a6c7e2a2 Iustin Pop
  }
1082 a6c7e2a2 Iustin Pop
1083 bc5d0215 Andrea Spadaccini
# Logical Disks parameters
1084 ac00bf1b Andrea Spadaccini
LDP_RESYNC_RATE = "resync-rate"
1085 ac00bf1b Andrea Spadaccini
LDP_STRIPES = "stripes"
1086 ac00bf1b Andrea Spadaccini
LDP_BARRIERS = "disabled-barriers"
1087 ac00bf1b Andrea Spadaccini
LDP_NO_META_FLUSH = "disable-meta-flush"
1088 8002e46b Andrea Spadaccini
LDP_DEFAULT_METAVG = "default-metavg"
1089 ad1dd4c7 Andrea Spadaccini
LDP_DISK_CUSTOM = "disk-custom"
1090 ad1dd4c7 Andrea Spadaccini
LDP_NET_CUSTOM = "net-custom"
1091 f2f57b6e Andrea Spadaccini
LDP_DYNAMIC_RESYNC = "dynamic-resync"
1092 8584e922 Andrea Spadaccini
LDP_PLAN_AHEAD = "c-plan-ahead"
1093 8584e922 Andrea Spadaccini
LDP_FILL_TARGET = "c-fill-target"
1094 8584e922 Andrea Spadaccini
LDP_DELAY_TARGET = "c-delay-target"
1095 8584e922 Andrea Spadaccini
LDP_MAX_RATE = "c-max-rate"
1096 8584e922 Andrea Spadaccini
LDP_MIN_RATE = "c-min-rate"
1097 7181fba0 Constantinos Venetsanopoulos
LDP_POOL = "pool"
1098 bc5d0215 Andrea Spadaccini
DISK_LD_TYPES = {
1099 ac00bf1b Andrea Spadaccini
  LDP_RESYNC_RATE: VTYPE_INT,
1100 ac00bf1b Andrea Spadaccini
  LDP_STRIPES: VTYPE_INT,
1101 ac00bf1b Andrea Spadaccini
  LDP_BARRIERS: VTYPE_STRING,
1102 ac00bf1b Andrea Spadaccini
  LDP_NO_META_FLUSH: VTYPE_BOOL,
1103 8002e46b Andrea Spadaccini
  LDP_DEFAULT_METAVG: VTYPE_STRING,
1104 ad1dd4c7 Andrea Spadaccini
  LDP_DISK_CUSTOM: VTYPE_STRING,
1105 ad1dd4c7 Andrea Spadaccini
  LDP_NET_CUSTOM: VTYPE_STRING,
1106 f2f57b6e Andrea Spadaccini
  LDP_DYNAMIC_RESYNC: VTYPE_BOOL,
1107 8584e922 Andrea Spadaccini
  LDP_PLAN_AHEAD: VTYPE_INT,
1108 8584e922 Andrea Spadaccini
  LDP_FILL_TARGET: VTYPE_INT,
1109 8584e922 Andrea Spadaccini
  LDP_DELAY_TARGET: VTYPE_INT,
1110 8584e922 Andrea Spadaccini
  LDP_MAX_RATE: VTYPE_INT,
1111 8584e922 Andrea Spadaccini
  LDP_MIN_RATE: VTYPE_INT,
1112 7181fba0 Constantinos Venetsanopoulos
  LDP_POOL: VTYPE_STRING,
1113 bc5d0215 Andrea Spadaccini
  }
1114 bc5d0215 Andrea Spadaccini
DISK_LD_PARAMETERS = frozenset(DISK_LD_TYPES.keys())
1115 bc5d0215 Andrea Spadaccini
1116 f2f57b6e Andrea Spadaccini
# Disk template parameters (can be set/changed by the user via gnt-cluster and
1117 f2f57b6e Andrea Spadaccini
# gnt-group)
1118 6e9814a1 Andrea Spadaccini
DRBD_RESYNC_RATE = "resync-rate"
1119 43e11798 Andrea Spadaccini
DRBD_DATA_STRIPES = "data-stripes"
1120 43e11798 Andrea Spadaccini
DRBD_META_STRIPES = "meta-stripes"
1121 8a69b3a8 Andrea Spadaccini
DRBD_DISK_BARRIERS = "disk-barriers"
1122 8a69b3a8 Andrea Spadaccini
DRBD_META_BARRIERS = "meta-barriers"
1123 8002e46b Andrea Spadaccini
DRBD_DEFAULT_METAVG = "metavg"
1124 ad1dd4c7 Andrea Spadaccini
DRBD_DISK_CUSTOM = "disk-custom"
1125 ad1dd4c7 Andrea Spadaccini
DRBD_NET_CUSTOM = "net-custom"
1126 f2f57b6e Andrea Spadaccini
DRBD_DYNAMIC_RESYNC = "dynamic-resync"
1127 8584e922 Andrea Spadaccini
DRBD_PLAN_AHEAD = "c-plan-ahead"
1128 8584e922 Andrea Spadaccini
DRBD_FILL_TARGET = "c-fill-target"
1129 8584e922 Andrea Spadaccini
DRBD_DELAY_TARGET = "c-delay-target"
1130 8584e922 Andrea Spadaccini
DRBD_MAX_RATE = "c-max-rate"
1131 8584e922 Andrea Spadaccini
DRBD_MIN_RATE = "c-min-rate"
1132 43e11798 Andrea Spadaccini
LV_STRIPES = "stripes"
1133 7181fba0 Constantinos Venetsanopoulos
RBD_POOL = "pool"
1134 bc5d0215 Andrea Spadaccini
DISK_DT_TYPES = {
1135 6e9814a1 Andrea Spadaccini
  DRBD_RESYNC_RATE: VTYPE_INT,
1136 43e11798 Andrea Spadaccini
  DRBD_DATA_STRIPES: VTYPE_INT,
1137 43e11798 Andrea Spadaccini
  DRBD_META_STRIPES: VTYPE_INT,
1138 8a69b3a8 Andrea Spadaccini
  DRBD_DISK_BARRIERS: VTYPE_STRING,
1139 8a69b3a8 Andrea Spadaccini
  DRBD_META_BARRIERS: VTYPE_BOOL,
1140 8002e46b Andrea Spadaccini
  DRBD_DEFAULT_METAVG: VTYPE_STRING,
1141 ad1dd4c7 Andrea Spadaccini
  DRBD_DISK_CUSTOM: VTYPE_STRING,
1142 ad1dd4c7 Andrea Spadaccini
  DRBD_NET_CUSTOM: VTYPE_STRING,
1143 f2f57b6e Andrea Spadaccini
  DRBD_DYNAMIC_RESYNC: VTYPE_BOOL,
1144 8584e922 Andrea Spadaccini
  DRBD_PLAN_AHEAD: VTYPE_INT,
1145 8584e922 Andrea Spadaccini
  DRBD_FILL_TARGET: VTYPE_INT,
1146 8584e922 Andrea Spadaccini
  DRBD_DELAY_TARGET: VTYPE_INT,
1147 8584e922 Andrea Spadaccini
  DRBD_MAX_RATE: VTYPE_INT,
1148 8584e922 Andrea Spadaccini
  DRBD_MIN_RATE: VTYPE_INT,
1149 43e11798 Andrea Spadaccini
  LV_STRIPES: VTYPE_INT,
1150 7181fba0 Constantinos Venetsanopoulos
  RBD_POOL: VTYPE_STRING,
1151 bc5d0215 Andrea Spadaccini
  }
1152 bc5d0215 Andrea Spadaccini
1153 bc5d0215 Andrea Spadaccini
DISK_DT_PARAMETERS = frozenset(DISK_DT_TYPES.keys())
1154 bc5d0215 Andrea Spadaccini
1155 b2f29800 René Nussbaumer
# OOB supported commands
1156 b2f29800 René Nussbaumer
OOB_POWER_ON = "power-on"
1157 b2f29800 René Nussbaumer
OOB_POWER_OFF = "power-off"
1158 b2f29800 René Nussbaumer
OOB_POWER_CYCLE = "power-cycle"
1159 b2f29800 René Nussbaumer
OOB_POWER_STATUS = "power-status"
1160 b2f29800 René Nussbaumer
OOB_HEALTH = "health"
1161 b2f29800 René Nussbaumer
1162 b8028dcf Michael Hanselmann
OOB_COMMANDS = compat.UniqueFrozenset([
1163 21daa4a8 Stephen Shirley
  OOB_POWER_ON,
1164 21daa4a8 Stephen Shirley
  OOB_POWER_OFF,
1165 21daa4a8 Stephen Shirley
  OOB_POWER_CYCLE,
1166 21daa4a8 Stephen Shirley
  OOB_POWER_STATUS,
1167 3c286190 Dimitris Aragiorgis
  OOB_HEALTH,
1168 21daa4a8 Stephen Shirley
  ])
1169 b2f29800 René Nussbaumer
1170 b528a12d René Nussbaumer
OOB_POWER_STATUS_POWERED = "powered"
1171 b528a12d René Nussbaumer
1172 445f735d René Nussbaumer
OOB_TIMEOUT = 60 # 60 seconds
1173 beff3779 René Nussbaumer
OOB_POWER_DELAY = 2.0 # 2 seconds
1174 445f735d René Nussbaumer
1175 445f735d René Nussbaumer
OOB_STATUS_OK = "OK"
1176 445f735d René Nussbaumer
OOB_STATUS_WARNING = "WARNING"
1177 445f735d René Nussbaumer
OOB_STATUS_CRITICAL = "CRITICAL"
1178 445f735d René Nussbaumer
OOB_STATUS_UNKNOWN = "UNKNOWN"
1179 445f735d René Nussbaumer
1180 b8028dcf Michael Hanselmann
OOB_STATUSES = compat.UniqueFrozenset([
1181 445f735d René Nussbaumer
  OOB_STATUS_OK,
1182 445f735d René Nussbaumer
  OOB_STATUS_WARNING,
1183 445f735d René Nussbaumer
  OOB_STATUS_CRITICAL,
1184 445f735d René Nussbaumer
  OOB_STATUS_UNKNOWN,
1185 445f735d René Nussbaumer
  ])
1186 445f735d René Nussbaumer
1187 4ef7f423 Guido Trotter
# Instance Parameters Profile
1188 4ef7f423 Guido Trotter
PP_DEFAULT = "default"
1189 e64b8beb Iustin Pop
1190 246f4067 Guido Trotter
# NIC_* constants are used inside the ganeti config
1191 ac061be9 Guido Trotter
NIC_MODE = "mode"
1192 ac061be9 Guido Trotter
NIC_LINK = "link"
1193 ac061be9 Guido Trotter
1194 ac061be9 Guido Trotter
NIC_MODE_BRIDGED = "bridged"
1195 ac061be9 Guido Trotter
NIC_MODE_ROUTED = "routed"
1196 57fb6fcb Guido Trotter
NIC_MODE_OVS = "openvswitch"
1197 eaa4c57c Dimitris Aragiorgis
NIC_IP_POOL = "pool"
1198 ac061be9 Guido Trotter
1199 b8028dcf Michael Hanselmann
NIC_VALID_MODES = compat.UniqueFrozenset([
1200 b8028dcf Michael Hanselmann
  NIC_MODE_BRIDGED,
1201 b8028dcf Michael Hanselmann
  NIC_MODE_ROUTED,
1202 b8028dcf Michael Hanselmann
  NIC_MODE_OVS,
1203 b8028dcf Michael Hanselmann
  ])
1204 ac061be9 Guido Trotter
1205 2556424d Iustin Pop
RESERVE_ACTION = "reserve"
1206 2556424d Iustin Pop
RELEASE_ACTION = "release"
1207 e81eef56 Dimitris Aragiorgis
1208 eaa4c57c Dimitris Aragiorgis
# An extra description of the network.
1209 eaa4c57c Dimitris Aragiorgis
# Can be used by hooks/kvm-vif-bridge to apply different rules
1210 eaa4c57c Dimitris Aragiorgis
NETWORK_TYPE_PRIVATE = "private"
1211 eaa4c57c Dimitris Aragiorgis
NETWORK_TYPE_PUBLIC = "public"
1212 eaa4c57c Dimitris Aragiorgis
1213 b8028dcf Michael Hanselmann
NETWORK_VALID_TYPES = compat.UniqueFrozenset([
1214 b8028dcf Michael Hanselmann
  NETWORK_TYPE_PRIVATE,
1215 b8028dcf Michael Hanselmann
  NETWORK_TYPE_PUBLIC,
1216 b8028dcf Michael Hanselmann
  ])
1217 eaa4c57c Dimitris Aragiorgis
1218 ac061be9 Guido Trotter
NICS_PARAMETER_TYPES = {
1219 2e1a6024 Guido Trotter
  NIC_MODE: VTYPE_STRING,
1220 2e1a6024 Guido Trotter
  NIC_LINK: VTYPE_STRING,
1221 2e1a6024 Guido Trotter
  }
1222 ac061be9 Guido Trotter
1223 ac061be9 Guido Trotter
NICS_PARAMETERS = frozenset(NICS_PARAMETER_TYPES.keys())
1224 e64b8beb Iustin Pop
1225 246f4067 Guido Trotter
# IDISK_* constants are used in opcodes, to create/change disks
1226 bd061c35 Guido Trotter
IDISK_SIZE = "size"
1227 bd061c35 Guido Trotter
IDISK_MODE = "mode"
1228 8494604f Apollon Oikonomopoulos
IDISK_ADOPT = "adopt"
1229 7af3534e Dmitry Chernyak
IDISK_VG = "vg"
1230 87001920 Iustin Pop
IDISK_METAVG = "metavg"
1231 938adc87 Constantinos Venetsanopoulos
IDISK_PROVIDER = "provider"
1232 8494604f Apollon Oikonomopoulos
IDISK_PARAMS_TYPES = {
1233 8494604f Apollon Oikonomopoulos
  IDISK_SIZE: VTYPE_SIZE,
1234 8494604f Apollon Oikonomopoulos
  IDISK_MODE: VTYPE_STRING,
1235 8494604f Apollon Oikonomopoulos
  IDISK_ADOPT: VTYPE_STRING,
1236 7af3534e Dmitry Chernyak
  IDISK_VG: VTYPE_STRING,
1237 87001920 Iustin Pop
  IDISK_METAVG: VTYPE_STRING,
1238 938adc87 Constantinos Venetsanopoulos
  IDISK_PROVIDER: VTYPE_STRING,
1239 8494604f Apollon Oikonomopoulos
  }
1240 cc87d736 Michael Hanselmann
IDISK_PARAMS = frozenset(IDISK_PARAMS_TYPES.keys())
1241 cc87d736 Michael Hanselmann
1242 246f4067 Guido Trotter
# INIC_* constants are used in opcodes, to create/change nics
1243 bd061c35 Guido Trotter
INIC_MAC = "mac"
1244 bd061c35 Guido Trotter
INIC_IP = "ip"
1245 bd061c35 Guido Trotter
INIC_MODE = "mode"
1246 bd061c35 Guido Trotter
INIC_LINK = "link"
1247 eaa4c57c Dimitris Aragiorgis
INIC_NETWORK = "network"
1248 cc87d736 Michael Hanselmann
INIC_PARAMS_TYPES = {
1249 cc87d736 Michael Hanselmann
  INIC_IP: VTYPE_MAYBE_STRING,
1250 cc87d736 Michael Hanselmann
  INIC_LINK: VTYPE_STRING,
1251 cc87d736 Michael Hanselmann
  INIC_MAC: VTYPE_STRING,
1252 cc87d736 Michael Hanselmann
  INIC_MODE: VTYPE_STRING,
1253 eaa4c57c Dimitris Aragiorgis
  INIC_NETWORK: VTYPE_MAYBE_STRING,
1254 cc87d736 Michael Hanselmann
  }
1255 cc87d736 Michael Hanselmann
INIC_PARAMS = frozenset(INIC_PARAMS_TYPES.keys())
1256 bd061c35 Guido Trotter
1257 2584d4a4 Alexander Schreiber
# Hypervisor constants
1258 00cd937c Iustin Pop
HT_XEN_PVM = "xen-pvm"
1259 2584d4a4 Alexander Schreiber
HT_FAKE = "fake"
1260 00cd937c Iustin Pop
HT_XEN_HVM = "xen-hvm"
1261 550e49b9 Guido Trotter
HT_KVM = "kvm"
1262 48297fa2 Iustin Pop
HT_CHROOT = "chroot"
1263 4b5e40a5 Iustin Pop
HT_LXC = "lxc"
1264 b8028dcf Michael Hanselmann
HYPER_TYPES = compat.UniqueFrozenset([
1265 4b5e40a5 Iustin Pop
  HT_XEN_PVM,
1266 4b5e40a5 Iustin Pop
  HT_FAKE,
1267 4b5e40a5 Iustin Pop
  HT_XEN_HVM,
1268 4b5e40a5 Iustin Pop
  HT_KVM,
1269 4b5e40a5 Iustin Pop
  HT_CHROOT,
1270 4b5e40a5 Iustin Pop
  HT_LXC,
1271 4b5e40a5 Iustin Pop
  ])
1272 b8028dcf Michael Hanselmann
HTS_REQ_PORT = compat.UniqueFrozenset([HT_XEN_HVM, HT_KVM])
1273 2584d4a4 Alexander Schreiber
1274 377d74c9 Guido Trotter
VNC_BASE_PORT = 5900
1275 0d2cd893 Manuel Franceschini
VNC_DEFAULT_BIND_ADDRESS = IP4_ADDRESS_ANY
1276 e54c4c5e Guido Trotter
1277 835528af Iustin Pop
# NIC types
1278 d08f6067 Guido Trotter
HT_NIC_RTL8139 = "rtl8139"
1279 d08f6067 Guido Trotter
HT_NIC_NE2K_PCI = "ne2k_pci"
1280 d08f6067 Guido Trotter
HT_NIC_NE2K_ISA = "ne2k_isa"
1281 43440815 Guido Trotter
HT_NIC_I82551 = "i82551"
1282 43440815 Guido Trotter
HT_NIC_I85557B = "i82557b"
1283 43440815 Guido Trotter
HT_NIC_I8259ER = "i82559er"
1284 43440815 Guido Trotter
HT_NIC_PCNET = "pcnet"
1285 43440815 Guido Trotter
HT_NIC_E1000 = "e1000"
1286 d08f6067 Guido Trotter
HT_NIC_PARAVIRTUAL = HT_DISK_PARAVIRTUAL = "paravirtual"
1287 43440815 Guido Trotter
1288 b8028dcf Michael Hanselmann
HT_HVM_VALID_NIC_TYPES = compat.UniqueFrozenset([
1289 21daa4a8 Stephen Shirley
  HT_NIC_RTL8139,
1290 21daa4a8 Stephen Shirley
  HT_NIC_NE2K_PCI,
1291 21daa4a8 Stephen Shirley
  HT_NIC_E1000,
1292 21daa4a8 Stephen Shirley
  HT_NIC_NE2K_ISA,
1293 3c286190 Dimitris Aragiorgis
  HT_NIC_PARAVIRTUAL,
1294 21daa4a8 Stephen Shirley
  ])
1295 b8028dcf Michael Hanselmann
HT_KVM_VALID_NIC_TYPES = compat.UniqueFrozenset([
1296 21daa4a8 Stephen Shirley
  HT_NIC_RTL8139,
1297 21daa4a8 Stephen Shirley
  HT_NIC_NE2K_PCI,
1298 21daa4a8 Stephen Shirley
  HT_NIC_NE2K_ISA,
1299 21daa4a8 Stephen Shirley
  HT_NIC_I82551,
1300 21daa4a8 Stephen Shirley
  HT_NIC_I85557B,
1301 21daa4a8 Stephen Shirley
  HT_NIC_I8259ER,
1302 21daa4a8 Stephen Shirley
  HT_NIC_PCNET,
1303 21daa4a8 Stephen Shirley
  HT_NIC_E1000,
1304 3c286190 Dimitris Aragiorgis
  HT_NIC_PARAVIRTUAL,
1305 21daa4a8 Stephen Shirley
  ])
1306 21daa4a8 Stephen Shirley
1307 835528af Iustin Pop
# Disk types
1308 835528af Iustin Pop
HT_DISK_IOEMU = "ioemu"
1309 835528af Iustin Pop
HT_DISK_IDE = "ide"
1310 835528af Iustin Pop
HT_DISK_SCSI = "scsi"
1311 835528af Iustin Pop
HT_DISK_SD = "sd"
1312 835528af Iustin Pop
HT_DISK_MTD = "mtd"
1313 835528af Iustin Pop
HT_DISK_PFLASH = "pflash"
1314 835528af Iustin Pop
1315 ea0f3d7a Iustin Pop
HT_CACHE_DEFAULT = "default"
1316 ea0f3d7a Iustin Pop
HT_CACHE_NONE = "none"
1317 ea0f3d7a Iustin Pop
HT_CACHE_WTHROUGH = "writethrough"
1318 ea0f3d7a Iustin Pop
HT_CACHE_WBACK = "writeback"
1319 b8028dcf Michael Hanselmann
HT_VALID_CACHE_TYPES = compat.UniqueFrozenset([
1320 21daa4a8 Stephen Shirley
  HT_CACHE_DEFAULT,
1321 21daa4a8 Stephen Shirley
  HT_CACHE_NONE,
1322 21daa4a8 Stephen Shirley
  HT_CACHE_WTHROUGH,
1323 3c286190 Dimitris Aragiorgis
  HT_CACHE_WBACK,
1324 21daa4a8 Stephen Shirley
  ])
1325 ea0f3d7a Iustin Pop
1326 b8028dcf Michael Hanselmann
HT_HVM_VALID_DISK_TYPES = compat.UniqueFrozenset([
1327 b8028dcf Michael Hanselmann
  HT_DISK_PARAVIRTUAL,
1328 b8028dcf Michael Hanselmann
  HT_DISK_IOEMU,
1329 b8028dcf Michael Hanselmann
  ])
1330 b8028dcf Michael Hanselmann
HT_KVM_VALID_DISK_TYPES = compat.UniqueFrozenset([
1331 21daa4a8 Stephen Shirley
  HT_DISK_PARAVIRTUAL,
1332 21daa4a8 Stephen Shirley
  HT_DISK_IDE,
1333 21daa4a8 Stephen Shirley
  HT_DISK_SCSI,
1334 21daa4a8 Stephen Shirley
  HT_DISK_SD,
1335 21daa4a8 Stephen Shirley
  HT_DISK_MTD,
1336 3c286190 Dimitris Aragiorgis
  HT_DISK_PFLASH,
1337 21daa4a8 Stephen Shirley
  ])
1338 b894f5a8 Alexander Schreiber
1339 835528af Iustin Pop
# Mouse types:
1340 835528af Iustin Pop
HT_MOUSE_MOUSE = "mouse"
1341 835528af Iustin Pop
HT_MOUSE_TABLET = "tablet"
1342 835528af Iustin Pop
1343 b8028dcf Michael Hanselmann
HT_KVM_VALID_MOUSE_TYPES = compat.UniqueFrozenset([
1344 b8028dcf Michael Hanselmann
  HT_MOUSE_MOUSE,
1345 b8028dcf Michael Hanselmann
  HT_MOUSE_TABLET,
1346 b8028dcf Michael Hanselmann
  ])
1347 835528af Iustin Pop
1348 835528af Iustin Pop
# Boot order
1349 cc130cc7 Marco Casavecchia
HT_BO_FLOPPY = "floppy"
1350 835528af Iustin Pop
HT_BO_CDROM = "cdrom"
1351 835528af Iustin Pop
HT_BO_DISK = "disk"
1352 835528af Iustin Pop
HT_BO_NETWORK = "network"
1353 835528af Iustin Pop
1354 b8028dcf Michael Hanselmann
HT_KVM_VALID_BO_TYPES = compat.UniqueFrozenset([
1355 21daa4a8 Stephen Shirley
  HT_BO_FLOPPY,
1356 21daa4a8 Stephen Shirley
  HT_BO_CDROM,
1357 21daa4a8 Stephen Shirley
  HT_BO_DISK,
1358 3c286190 Dimitris Aragiorgis
  HT_BO_NETWORK,
1359 21daa4a8 Stephen Shirley
  ])
1360 835528af Iustin Pop
1361 ea064d24 Andrea Spadaccini
# SPICE lossless image compression options
1362 ea064d24 Andrea Spadaccini
HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_GLZ = "auto_glz"
1363 ea064d24 Andrea Spadaccini
HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_LZ = "auto_lz"
1364 ea064d24 Andrea Spadaccini
HT_KVM_SPICE_LOSSLESS_IMG_COMPR_QUIC = "quic"
1365 ea064d24 Andrea Spadaccini
HT_KVM_SPICE_LOSSLESS_IMG_COMPR_GLZ = "glz"
1366 ea064d24 Andrea Spadaccini
HT_KVM_SPICE_LOSSLESS_IMG_COMPR_LZ = "lz"
1367 ea064d24 Andrea Spadaccini
HT_KVM_SPICE_LOSSLESS_IMG_COMPR_OFF = "off"
1368 ea064d24 Andrea Spadaccini
1369 b8028dcf Michael Hanselmann
HT_KVM_SPICE_VALID_LOSSLESS_IMG_COMPR_OPTIONS = compat.UniqueFrozenset([
1370 ea064d24 Andrea Spadaccini
  HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_GLZ,
1371 ea064d24 Andrea Spadaccini
  HT_KVM_SPICE_LOSSLESS_IMG_COMPR_AUTO_LZ,
1372 ea064d24 Andrea Spadaccini
  HT_KVM_SPICE_LOSSLESS_IMG_COMPR_QUIC,
1373 ea064d24 Andrea Spadaccini
  HT_KVM_SPICE_LOSSLESS_IMG_COMPR_GLZ,
1374 ea064d24 Andrea Spadaccini
  HT_KVM_SPICE_LOSSLESS_IMG_COMPR_LZ,
1375 ea064d24 Andrea Spadaccini
  HT_KVM_SPICE_LOSSLESS_IMG_COMPR_OFF,
1376 ea064d24 Andrea Spadaccini
  ])
1377 ea064d24 Andrea Spadaccini
1378 ea064d24 Andrea Spadaccini
# SPICE lossy image compression options (valid for both jpeg and zlib-glz)
1379 ea064d24 Andrea Spadaccini
HT_KVM_SPICE_LOSSY_IMG_COMPR_AUTO = "auto"
1380 ea064d24 Andrea Spadaccini
HT_KVM_SPICE_LOSSY_IMG_COMPR_NEVER = "never"
1381 ea064d24 Andrea Spadaccini
HT_KVM_SPICE_LOSSY_IMG_COMPR_ALWAYS = "always"
1382 ea064d24 Andrea Spadaccini
1383 b8028dcf Michael Hanselmann
HT_KVM_SPICE_VALID_LOSSY_IMG_COMPR_OPTIONS = compat.UniqueFrozenset([
1384 ea064d24 Andrea Spadaccini
  HT_KVM_SPICE_LOSSY_IMG_COMPR_AUTO,
1385 ea064d24 Andrea Spadaccini
  HT_KVM_SPICE_LOSSY_IMG_COMPR_NEVER,
1386 ea064d24 Andrea Spadaccini
  HT_KVM_SPICE_LOSSY_IMG_COMPR_ALWAYS,
1387 ea064d24 Andrea Spadaccini
  ])
1388 ea064d24 Andrea Spadaccini
1389 ea064d24 Andrea Spadaccini
# SPICE video stream detection
1390 ea064d24 Andrea Spadaccini
HT_KVM_SPICE_VIDEO_STREAM_DETECTION_OFF = "off"
1391 ea064d24 Andrea Spadaccini
HT_KVM_SPICE_VIDEO_STREAM_DETECTION_ALL = "all"
1392 ea064d24 Andrea Spadaccini
HT_KVM_SPICE_VIDEO_STREAM_DETECTION_FILTER = "filter"
1393 ea064d24 Andrea Spadaccini
1394 b8028dcf Michael Hanselmann
HT_KVM_SPICE_VALID_VIDEO_STREAM_DETECTION_OPTIONS = compat.UniqueFrozenset([
1395 ea064d24 Andrea Spadaccini
  HT_KVM_SPICE_VIDEO_STREAM_DETECTION_OFF,
1396 ea064d24 Andrea Spadaccini
  HT_KVM_SPICE_VIDEO_STREAM_DETECTION_ALL,
1397 ea064d24 Andrea Spadaccini
  HT_KVM_SPICE_VIDEO_STREAM_DETECTION_FILTER,
1398 ea064d24 Andrea Spadaccini
  ])
1399 ea064d24 Andrea Spadaccini
1400 3424767f Guido Trotter
# Security models
1401 3424767f Guido Trotter
HT_SM_NONE = "none"
1402 3424767f Guido Trotter
HT_SM_USER = "user"
1403 3424767f Guido Trotter
HT_SM_POOL = "pool"
1404 3424767f Guido Trotter
1405 b8028dcf Michael Hanselmann
HT_KVM_VALID_SM_TYPES = compat.UniqueFrozenset([
1406 b8028dcf Michael Hanselmann
  HT_SM_NONE,
1407 b8028dcf Michael Hanselmann
  HT_SM_USER,
1408 b8028dcf Michael Hanselmann
  HT_SM_POOL,
1409 b8028dcf Michael Hanselmann
  ])
1410 3424767f Guido Trotter
1411 7ba594c0 Guido Trotter
# Kvm flag values
1412 7ba594c0 Guido Trotter
HT_KVM_ENABLED = "enabled"
1413 7ba594c0 Guido Trotter
HT_KVM_DISABLED = "disabled"
1414 7ba594c0 Guido Trotter
1415 b8028dcf Michael Hanselmann
HT_KVM_FLAG_VALUES = compat.UniqueFrozenset([HT_KVM_ENABLED, HT_KVM_DISABLED])
1416 7ba594c0 Guido Trotter
1417 e71b9ef4 Iustin Pop
# Migration type
1418 e71b9ef4 Iustin Pop
HT_MIGRATION_LIVE = "live"
1419 e71b9ef4 Iustin Pop
HT_MIGRATION_NONLIVE = "non-live"
1420 b8028dcf Michael Hanselmann
HT_MIGRATION_MODES = compat.UniqueFrozenset([
1421 b8028dcf Michael Hanselmann
  HT_MIGRATION_LIVE,
1422 b8028dcf Michael Hanselmann
  HT_MIGRATION_NONLIVE,
1423 b8028dcf Michael Hanselmann
  ])
1424 e71b9ef4 Iustin Pop
1425 e54c4c5e Guido Trotter
# Cluster Verify steps
1426 d0c8c01d Iustin Pop
VERIFY_NPLUSONE_MEM = "nplusone_mem"
1427 b8028dcf Michael Hanselmann
VERIFY_OPTIONAL_CHECKS = compat.UniqueFrozenset([VERIFY_NPLUSONE_MEM])
1428 e54c4c5e Guido Trotter
1429 eedf99b5 Andrea Spadaccini
# Cluster Verify error classes
1430 eedf99b5 Andrea Spadaccini
CV_TCLUSTER = "cluster"
1431 eedf99b5 Andrea Spadaccini
CV_TNODE = "node"
1432 eedf99b5 Andrea Spadaccini
CV_TINSTANCE = "instance"
1433 eedf99b5 Andrea Spadaccini
1434 3ac3f5e4 Andrea Spadaccini
# Cluster Verify error codes and documentation
1435 3ac3f5e4 Andrea Spadaccini
CV_ECLUSTERCFG = \
1436 3ac3f5e4 Andrea Spadaccini
  (CV_TCLUSTER, "ECLUSTERCFG", "Cluster configuration verification failure")
1437 3ac3f5e4 Andrea Spadaccini
CV_ECLUSTERCERT = \
1438 3ac3f5e4 Andrea Spadaccini
  (CV_TCLUSTER, "ECLUSTERCERT",
1439 3ac3f5e4 Andrea Spadaccini
   "Cluster certificate files verification failure")
1440 3ac3f5e4 Andrea Spadaccini
CV_ECLUSTERFILECHECK = \
1441 3ac3f5e4 Andrea Spadaccini
  (CV_TCLUSTER, "ECLUSTERFILECHECK",
1442 3ac3f5e4 Andrea Spadaccini
   "Cluster configuration verification failure")
1443 3ac3f5e4 Andrea Spadaccini
CV_ECLUSTERDANGLINGNODES = \
1444 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ECLUSTERDANGLINGNODES",
1445 3ac3f5e4 Andrea Spadaccini
   "Some nodes belong to non-existing groups")
1446 3ac3f5e4 Andrea Spadaccini
CV_ECLUSTERDANGLINGINST = \
1447 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ECLUSTERDANGLINGINST",
1448 3ac3f5e4 Andrea Spadaccini
   "Some instances have a non-existing primary node")
1449 3ac3f5e4 Andrea Spadaccini
CV_EINSTANCEBADNODE = \
1450 3ac3f5e4 Andrea Spadaccini
  (CV_TINSTANCE, "EINSTANCEBADNODE",
1451 3ac3f5e4 Andrea Spadaccini
   "Instance marked as running lives on an offline node")
1452 3ac3f5e4 Andrea Spadaccini
CV_EINSTANCEDOWN = \
1453 3ac3f5e4 Andrea Spadaccini
  (CV_TINSTANCE, "EINSTANCEDOWN", "Instance not running on its primary node")
1454 3ac3f5e4 Andrea Spadaccini
CV_EINSTANCELAYOUT = \
1455 3ac3f5e4 Andrea Spadaccini
  (CV_TINSTANCE, "EINSTANCELAYOUT", "Instance has multiple secondary nodes")
1456 3ac3f5e4 Andrea Spadaccini
CV_EINSTANCEMISSINGDISK = \
1457 3ac3f5e4 Andrea Spadaccini
  (CV_TINSTANCE, "EINSTANCEMISSINGDISK", "Missing volume on an instance")
1458 3ac3f5e4 Andrea Spadaccini
CV_EINSTANCEFAULTYDISK = \
1459 3ac3f5e4 Andrea Spadaccini
  (CV_TINSTANCE, "EINSTANCEFAULTYDISK",
1460 3ac3f5e4 Andrea Spadaccini
   "Impossible to retrieve status for a disk")
1461 3ac3f5e4 Andrea Spadaccini
CV_EINSTANCEWRONGNODE = \
1462 3ac3f5e4 Andrea Spadaccini
  (CV_TINSTANCE, "EINSTANCEWRONGNODE", "Instance running on the wrong node")
1463 3ac3f5e4 Andrea Spadaccini
CV_EINSTANCESPLITGROUPS = \
1464 3ac3f5e4 Andrea Spadaccini
  (CV_TINSTANCE, "EINSTANCESPLITGROUPS",
1465 3ac3f5e4 Andrea Spadaccini
   "Instance with primary and secondary nodes in different groups")
1466 38c37a51 Agata Murawska
CV_EINSTANCEPOLICY = \
1467 38c37a51 Agata Murawska
  (CV_TINSTANCE, "EINSTANCEPOLICY",
1468 38c37a51 Agata Murawska
   "Instance does not meet policy")
1469 3ac3f5e4 Andrea Spadaccini
CV_ENODEDRBD = \
1470 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ENODEDRBD", "Error parsing the DRBD status file")
1471 3ac3f5e4 Andrea Spadaccini
CV_ENODEDRBDHELPER = \
1472 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ENODEDRBDHELPER", "Error caused by the DRBD helper")
1473 3ac3f5e4 Andrea Spadaccini
CV_ENODEFILECHECK = \
1474 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ENODEFILECHECK",
1475 3ac3f5e4 Andrea Spadaccini
   "Error retrieving the checksum of the node files")
1476 3ac3f5e4 Andrea Spadaccini
CV_ENODEHOOKS = \
1477 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ENODEHOOKS", "Communication failure in hooks execution")
1478 3ac3f5e4 Andrea Spadaccini
CV_ENODEHV = \
1479 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ENODEHV", "Hypervisor parameters verification failure")
1480 3ac3f5e4 Andrea Spadaccini
CV_ENODELVM = \
1481 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ENODELVM", "LVM-related node error")
1482 3ac3f5e4 Andrea Spadaccini
CV_ENODEN1 = \
1483 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ENODEN1", "Not enough memory to accommodate instance failovers")
1484 3ac3f5e4 Andrea Spadaccini
CV_ENODENET = \
1485 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ENODENET", "Network-related node error")
1486 3ac3f5e4 Andrea Spadaccini
CV_ENODEOS = \
1487 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ENODEOS", "OS-related node error")
1488 3ac3f5e4 Andrea Spadaccini
CV_ENODEORPHANINSTANCE = \
1489 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ENODEORPHANINSTANCE", "Unknown intance running on a node")
1490 3ac3f5e4 Andrea Spadaccini
CV_ENODEORPHANLV = \
1491 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ENODEORPHANLV", "Unknown LVM logical volume")
1492 3ac3f5e4 Andrea Spadaccini
CV_ENODERPC = \
1493 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ENODERPC",
1494 3ac3f5e4 Andrea Spadaccini
   "Error during connection to the primary node of an instance")
1495 3ac3f5e4 Andrea Spadaccini
CV_ENODESSH = \
1496 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ENODESSH", "SSH-related node error")
1497 3ac3f5e4 Andrea Spadaccini
CV_ENODEVERSION = \
1498 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ENODEVERSION",
1499 3ac3f5e4 Andrea Spadaccini
   "Protocol version mismatch or Ganeti version mismatch")
1500 3ac3f5e4 Andrea Spadaccini
CV_ENODESETUP = \
1501 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ENODESETUP", "Node setup error")
1502 3ac3f5e4 Andrea Spadaccini
CV_ENODETIME = \
1503 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ENODETIME", "Node returned invalid time")
1504 3ac3f5e4 Andrea Spadaccini
CV_ENODEOOBPATH = \
1505 3ac3f5e4 Andrea Spadaccini
  (CV_TNODE, "ENODEOOBPATH", "Invalid Out Of Band path")
1506 17b0b812 Andrea Spadaccini
CV_ENODEUSERSCRIPTS = \
1507 17b0b812 Andrea Spadaccini
  (CV_TNODE, "ENODEUSERSCRIPTS", "User scripts not present or not executable")
1508 72b35807 Michael Hanselmann
CV_ENODEFILESTORAGEPATHS = \
1509 72b35807 Michael Hanselmann
  (CV_TNODE, "ENODEFILESTORAGEPATHS", "Detected bad file storage paths")
1510 eedf99b5 Andrea Spadaccini
1511 b8028dcf Michael Hanselmann
CV_ALL_ECODES = compat.UniqueFrozenset([
1512 eedf99b5 Andrea Spadaccini
  CV_ECLUSTERCFG,
1513 eedf99b5 Andrea Spadaccini
  CV_ECLUSTERCERT,
1514 eedf99b5 Andrea Spadaccini
  CV_ECLUSTERFILECHECK,
1515 eedf99b5 Andrea Spadaccini
  CV_ECLUSTERDANGLINGNODES,
1516 eedf99b5 Andrea Spadaccini
  CV_ECLUSTERDANGLINGINST,
1517 eedf99b5 Andrea Spadaccini
  CV_EINSTANCEBADNODE,
1518 eedf99b5 Andrea Spadaccini
  CV_EINSTANCEDOWN,
1519 eedf99b5 Andrea Spadaccini
  CV_EINSTANCELAYOUT,
1520 eedf99b5 Andrea Spadaccini
  CV_EINSTANCEMISSINGDISK,
1521 eedf99b5 Andrea Spadaccini
  CV_EINSTANCEFAULTYDISK,
1522 eedf99b5 Andrea Spadaccini
  CV_EINSTANCEWRONGNODE,
1523 eedf99b5 Andrea Spadaccini
  CV_EINSTANCESPLITGROUPS,
1524 38c37a51 Agata Murawska
  CV_EINSTANCEPOLICY,
1525 eedf99b5 Andrea Spadaccini
  CV_ENODEDRBD,
1526 eedf99b5 Andrea Spadaccini
  CV_ENODEDRBDHELPER,
1527 eedf99b5 Andrea Spadaccini
  CV_ENODEFILECHECK,
1528 eedf99b5 Andrea Spadaccini
  CV_ENODEHOOKS,
1529 eedf99b5 Andrea Spadaccini
  CV_ENODEHV,
1530 eedf99b5 Andrea Spadaccini
  CV_ENODELVM,
1531 eedf99b5 Andrea Spadaccini
  CV_ENODEN1,
1532 eedf99b5 Andrea Spadaccini
  CV_ENODENET,
1533 eedf99b5 Andrea Spadaccini
  CV_ENODEOS,
1534 eedf99b5 Andrea Spadaccini
  CV_ENODEORPHANINSTANCE,
1535 eedf99b5 Andrea Spadaccini
  CV_ENODEORPHANLV,
1536 eedf99b5 Andrea Spadaccini
  CV_ENODERPC,
1537 eedf99b5 Andrea Spadaccini
  CV_ENODESSH,
1538 eedf99b5 Andrea Spadaccini
  CV_ENODEVERSION,
1539 eedf99b5 Andrea Spadaccini
  CV_ENODESETUP,
1540 eedf99b5 Andrea Spadaccini
  CV_ENODETIME,
1541 eedf99b5 Andrea Spadaccini
  CV_ENODEOOBPATH,
1542 17b0b812 Andrea Spadaccini
  CV_ENODEUSERSCRIPTS,
1543 72b35807 Michael Hanselmann
  CV_ENODEFILESTORAGEPATHS,
1544 eedf99b5 Andrea Spadaccini
  ])
1545 eedf99b5 Andrea Spadaccini
1546 b8028dcf Michael Hanselmann
CV_ALL_ECODES_STRINGS = \
1547 b8028dcf Michael Hanselmann
  compat.UniqueFrozenset(estr for (_, estr, _) in CV_ALL_ECODES)
1548 eedf99b5 Andrea Spadaccini
1549 25361b9a Iustin Pop
# Node verify constants
1550 7ef40fbe Luca Bigliardi
NV_DRBDHELPER = "drbd-helper"
1551 b0d85178 Iustin Pop
NV_DRBDLIST = "drbd-list"
1552 25361b9a Iustin Pop
NV_FILELIST = "filelist"
1553 25361b9a Iustin Pop
NV_HVINFO = "hvinfo"
1554 25361b9a Iustin Pop
NV_HYPERVISOR = "hypervisor"
1555 58a59652 Iustin Pop
NV_HVPARAMS = "hvparms"
1556 25361b9a Iustin Pop
NV_INSTANCELIST = "instancelist"
1557 b0d85178 Iustin Pop
NV_LVLIST = "lvlist"
1558 b0d85178 Iustin Pop
NV_MASTERIP = "master-ip"
1559 25361b9a Iustin Pop
NV_NODELIST = "nodelist"
1560 25361b9a Iustin Pop
NV_NODENETTEST = "node-net-test"
1561 7c0aa8e9 Iustin Pop
NV_NODESETUP = "nodesetup"
1562 b0d85178 Iustin Pop
NV_OSLIST = "oslist"
1563 b0d85178 Iustin Pop
NV_PVLIST = "pvlist"
1564 313b2dd4 Michael Hanselmann
NV_TIME = "time"
1565 b0d85178 Iustin Pop
NV_VERSION = "version"
1566 b0d85178 Iustin Pop
NV_VGLIST = "vglist"
1567 8964ee14 Iustin Pop
NV_VMNODES = "vmnodes"
1568 16f41f24 René Nussbaumer
NV_OOB_PATHS = "oob-paths"
1569 20d317d4 Iustin Pop
NV_BRIDGES = "bridges"
1570 17b0b812 Andrea Spadaccini
NV_USERSCRIPTS = "user-scripts"
1571 72b35807 Michael Hanselmann
NV_FILE_STORAGE_PATHS = "file-storage-paths"
1572 25361b9a Iustin Pop
1573 61a980a9 Michael Hanselmann
# Instance status
1574 61a980a9 Michael Hanselmann
INSTST_RUNNING = "running"
1575 61a980a9 Michael Hanselmann
INSTST_ADMINDOWN = "ADMIN_down"
1576 2e04d454 Agata Murawska
INSTST_ADMINOFFLINE = "ADMIN_offline"
1577 61a980a9 Michael Hanselmann
INSTST_NODEOFFLINE = "ERROR_nodeoffline"
1578 61a980a9 Michael Hanselmann
INSTST_NODEDOWN = "ERROR_nodedown"
1579 61a980a9 Michael Hanselmann
INSTST_WRONGNODE = "ERROR_wrongnode"
1580 61a980a9 Michael Hanselmann
INSTST_ERRORUP = "ERROR_up"
1581 61a980a9 Michael Hanselmann
INSTST_ERRORDOWN = "ERROR_down"
1582 b8028dcf Michael Hanselmann
INSTST_ALL = compat.UniqueFrozenset([
1583 61a980a9 Michael Hanselmann
  INSTST_RUNNING,
1584 61a980a9 Michael Hanselmann
  INSTST_ADMINDOWN,
1585 2e04d454 Agata Murawska
  INSTST_ADMINOFFLINE,
1586 61a980a9 Michael Hanselmann
  INSTST_NODEOFFLINE,
1587 61a980a9 Michael Hanselmann
  INSTST_NODEDOWN,
1588 61a980a9 Michael Hanselmann
  INSTST_WRONGNODE,
1589 61a980a9 Michael Hanselmann
  INSTST_ERRORUP,
1590 61a980a9 Michael Hanselmann
  INSTST_ERRORDOWN,
1591 61a980a9 Michael Hanselmann
  ])
1592 61a980a9 Michael Hanselmann
1593 9ca8a7c5 Agata Murawska
# Admin states
1594 9ca8a7c5 Agata Murawska
ADMINST_UP = "up"
1595 9ca8a7c5 Agata Murawska
ADMINST_DOWN = "down"
1596 9ca8a7c5 Agata Murawska
ADMINST_OFFLINE = "offline"
1597 b8028dcf Michael Hanselmann
ADMINST_ALL = compat.UniqueFrozenset([
1598 9ca8a7c5 Agata Murawska
  ADMINST_UP,
1599 9ca8a7c5 Agata Murawska
  ADMINST_DOWN,
1600 9ca8a7c5 Agata Murawska
  ADMINST_OFFLINE,
1601 9ca8a7c5 Agata Murawska
  ])
1602 9ca8a7c5 Agata Murawska
1603 1e28e3b8 Michael Hanselmann
# Node roles
1604 1e28e3b8 Michael Hanselmann
NR_REGULAR = "R"
1605 1e28e3b8 Michael Hanselmann
NR_MASTER = "M"
1606 1e28e3b8 Michael Hanselmann
NR_MCANDIDATE = "C"
1607 1e28e3b8 Michael Hanselmann
NR_DRAINED = "D"
1608 1e28e3b8 Michael Hanselmann
NR_OFFLINE = "O"
1609 b8028dcf Michael Hanselmann
NR_ALL = compat.UniqueFrozenset([
1610 1e28e3b8 Michael Hanselmann
  NR_REGULAR,
1611 1e28e3b8 Michael Hanselmann
  NR_MASTER,
1612 1e28e3b8 Michael Hanselmann
  NR_MCANDIDATE,
1613 1e28e3b8 Michael Hanselmann
  NR_DRAINED,
1614 1e28e3b8 Michael Hanselmann
  NR_OFFLINE,
1615 1e28e3b8 Michael Hanselmann
  ])
1616 1e28e3b8 Michael Hanselmann
1617 b98bf262 Michael Hanselmann
# SSL certificate check constants (in days)
1618 b98bf262 Michael Hanselmann
SSL_CERT_EXPIRATION_WARN = 30
1619 b98bf262 Michael Hanselmann
SSL_CERT_EXPIRATION_ERROR = 7
1620 b98bf262 Michael Hanselmann
1621 d61df03e Iustin Pop
# Allocator framework constants
1622 77031881 Iustin Pop
IALLOCATOR_VERSION = 2
1623 298fe380 Iustin Pop
IALLOCATOR_DIR_IN = "in"
1624 298fe380 Iustin Pop
IALLOCATOR_DIR_OUT = "out"
1625 b8028dcf Michael Hanselmann
VALID_IALLOCATOR_DIRECTIONS = compat.UniqueFrozenset([
1626 3636400f Iustin Pop
  IALLOCATOR_DIR_IN,
1627 3636400f Iustin Pop
  IALLOCATOR_DIR_OUT,
1628 3636400f Iustin Pop
  ])
1629 298fe380 Iustin Pop
IALLOCATOR_MODE_ALLOC = "allocate"
1630 298fe380 Iustin Pop
IALLOCATOR_MODE_RELOC = "relocate"
1631 60152bbe Michael Hanselmann
IALLOCATOR_MODE_CHG_GROUP = "change-group"
1632 60152bbe Michael Hanselmann
IALLOCATOR_MODE_NODE_EVAC = "node-evacuate"
1633 85d96a3c René Nussbaumer
IALLOCATOR_MODE_MULTI_ALLOC = "multi-allocate"
1634 b8028dcf Michael Hanselmann
VALID_IALLOCATOR_MODES = compat.UniqueFrozenset([
1635 3636400f Iustin Pop
  IALLOCATOR_MODE_ALLOC,
1636 3636400f Iustin Pop
  IALLOCATOR_MODE_RELOC,
1637 60152bbe Michael Hanselmann
  IALLOCATOR_MODE_CHG_GROUP,
1638 60152bbe Michael Hanselmann
  IALLOCATOR_MODE_NODE_EVAC,
1639 85d96a3c René Nussbaumer
  IALLOCATOR_MODE_MULTI_ALLOC,
1640 3636400f Iustin Pop
  ])
1641 298fe380 Iustin Pop
IALLOCATOR_SEARCH_PATH = _autoconf.IALLOCATOR_SEARCH_PATH
1642 43a8f36a Bernardo Dal Seno
DEFAULT_IALLOCATOR_SHORTCUT = "."
1643 5f33b613 Michael Hanselmann
1644 60152bbe Michael Hanselmann
IALLOCATOR_NEVAC_PRI = "primary-only"
1645 60152bbe Michael Hanselmann
IALLOCATOR_NEVAC_SEC = "secondary-only"
1646 60152bbe Michael Hanselmann
IALLOCATOR_NEVAC_ALL = "all"
1647 b8028dcf Michael Hanselmann
IALLOCATOR_NEVAC_MODES = compat.UniqueFrozenset([
1648 60152bbe Michael Hanselmann
  IALLOCATOR_NEVAC_PRI,
1649 60152bbe Michael Hanselmann
  IALLOCATOR_NEVAC_SEC,
1650 60152bbe Michael Hanselmann
  IALLOCATOR_NEVAC_ALL,
1651 60152bbe Michael Hanselmann
  ])
1652 60152bbe Michael Hanselmann
1653 cb92e7a1 Michael Hanselmann
# Node evacuation
1654 cb92e7a1 Michael Hanselmann
NODE_EVAC_PRI = "primary-only"
1655 cb92e7a1 Michael Hanselmann
NODE_EVAC_SEC = "secondary-only"
1656 cb92e7a1 Michael Hanselmann
NODE_EVAC_ALL = "all"
1657 b8028dcf Michael Hanselmann
NODE_EVAC_MODES = compat.UniqueFrozenset([
1658 cb92e7a1 Michael Hanselmann
  NODE_EVAC_PRI,
1659 cb92e7a1 Michael Hanselmann
  NODE_EVAC_SEC,
1660 cb92e7a1 Michael Hanselmann
  NODE_EVAC_ALL,
1661 cb92e7a1 Michael Hanselmann
  ])
1662 cb92e7a1 Michael Hanselmann
1663 f1da30e6 Michael Hanselmann
# Job queue
1664 f1da30e6 Michael Hanselmann
JOB_QUEUE_VERSION = 1
1665 f87b405e Michael Hanselmann
JOB_QUEUE_SIZE_HARD_LIMIT = 5000
1666 f1da30e6 Michael Hanselmann
1667 bac5ffc3 Oleksiy Mishchenko
JOB_ID_TEMPLATE = r"\d+"
1668 cb66225d Michael Hanselmann
JOB_FILE_RE = re.compile(r"^job-(%s)$" % JOB_ID_TEMPLATE)
1669 bac5ffc3 Oleksiy Mishchenko
1670 5c735209 Iustin Pop
# unchanged job return
1671 5c735209 Iustin Pop
JOB_NOTCHANGED = "nochange"
1672 5c735209 Iustin Pop
1673 5f33b613 Michael Hanselmann
# Job status
1674 5f33b613 Michael Hanselmann
JOB_STATUS_QUEUED = "queued"
1675 47099cd1 Michael Hanselmann
JOB_STATUS_WAITING = "waiting"
1676 fbf0262f Michael Hanselmann
JOB_STATUS_CANCELING = "canceling"
1677 5f33b613 Michael Hanselmann
JOB_STATUS_RUNNING = "running"
1678 5f33b613 Michael Hanselmann
JOB_STATUS_CANCELED = "canceled"
1679 5f33b613 Michael Hanselmann
JOB_STATUS_SUCCESS = "success"
1680 5f33b613 Michael Hanselmann
JOB_STATUS_ERROR = "error"
1681 b8028dcf Michael Hanselmann
JOBS_PENDING = compat.UniqueFrozenset([
1682 1eaddbc6 Michael Hanselmann
  JOB_STATUS_QUEUED,
1683 1eaddbc6 Michael Hanselmann
  JOB_STATUS_WAITING,
1684 1eaddbc6 Michael Hanselmann
  JOB_STATUS_CANCELING,
1685 1eaddbc6 Michael Hanselmann
  ])
1686 b8028dcf Michael Hanselmann
JOBS_FINALIZED = compat.UniqueFrozenset([
1687 989a8bee Michael Hanselmann
  JOB_STATUS_CANCELED,
1688 989a8bee Michael Hanselmann
  JOB_STATUS_SUCCESS,
1689 989a8bee Michael Hanselmann
  JOB_STATUS_ERROR,
1690 989a8bee Michael Hanselmann
  ])
1691 b8028dcf Michael Hanselmann
JOB_STATUS_ALL = compat.UniqueFrozenset([
1692 db5bce34 Michael Hanselmann
  JOB_STATUS_RUNNING,
1693 1eaddbc6 Michael Hanselmann
  ]) | JOBS_PENDING | JOBS_FINALIZED
1694 5f33b613 Michael Hanselmann
1695 34327f51 Iustin Pop
# OpCode status
1696 34327f51 Iustin Pop
# not yet finalized
1697 5f33b613 Michael Hanselmann
OP_STATUS_QUEUED = "queued"
1698 47099cd1 Michael Hanselmann
OP_STATUS_WAITING = "waiting"
1699 fbf0262f Michael Hanselmann
OP_STATUS_CANCELING = "canceling"
1700 5f33b613 Michael Hanselmann
OP_STATUS_RUNNING = "running"
1701 34327f51 Iustin Pop
# finalized
1702 4cb1d919 Michael Hanselmann
OP_STATUS_CANCELED = "canceled"
1703 5f33b613 Michael Hanselmann
OP_STATUS_SUCCESS = "success"
1704 5f33b613 Michael Hanselmann
OP_STATUS_ERROR = "error"
1705 b8028dcf Michael Hanselmann
OPS_FINALIZED = compat.UniqueFrozenset([
1706 21daa4a8 Stephen Shirley
  OP_STATUS_CANCELED,
1707 21daa4a8 Stephen Shirley
  OP_STATUS_SUCCESS,
1708 3c286190 Dimitris Aragiorgis
  OP_STATUS_ERROR,
1709 21daa4a8 Stephen Shirley
  ])
1710 f1048938 Iustin Pop
1711 e5d8774b Michael Hanselmann
# OpCode priority
1712 e5d8774b Michael Hanselmann
OP_PRIO_LOWEST = +19
1713 e5d8774b Michael Hanselmann
OP_PRIO_HIGHEST = -20
1714 e5d8774b Michael Hanselmann
1715 e5d8774b Michael Hanselmann
OP_PRIO_LOW = +10
1716 e5d8774b Michael Hanselmann
OP_PRIO_NORMAL = 0
1717 e5d8774b Michael Hanselmann
OP_PRIO_HIGH = -10
1718 e5d8774b Michael Hanselmann
1719 b8028dcf Michael Hanselmann
OP_PRIO_SUBMIT_VALID = compat.UniqueFrozenset([
1720 e71c8147 Michael Hanselmann
  OP_PRIO_LOW,
1721 e71c8147 Michael Hanselmann
  OP_PRIO_NORMAL,
1722 e71c8147 Michael Hanselmann
  OP_PRIO_HIGH,
1723 e71c8147 Michael Hanselmann
  ])
1724 e71c8147 Michael Hanselmann
1725 e5d8774b Michael Hanselmann
OP_PRIO_DEFAULT = OP_PRIO_NORMAL
1726 e5d8774b Michael Hanselmann
1727 0b04b188 Michael Hanselmann
# Lock recalculate mode
1728 0b04b188 Michael Hanselmann
LOCKS_REPLACE = "replace"
1729 0b04b188 Michael Hanselmann
LOCKS_APPEND = "append"
1730 0b04b188 Michael Hanselmann
1731 0b04b188 Michael Hanselmann
# Lock timeout (sum) before we should go into blocking acquire (still
1732 0b04b188 Michael Hanselmann
# can be reset by priority change); computed as max time (10 hours)
1733 0b04b188 Michael Hanselmann
# before we should actually go into blocking acquire given that we
1734 0b04b188 Michael Hanselmann
# start from default priority level; in seconds
1735 0b04b188 Michael Hanselmann
# TODO
1736 0b04b188 Michael Hanselmann
LOCK_ATTEMPTS_TIMEOUT = 10 * 3600 / (OP_PRIO_DEFAULT - OP_PRIO_HIGHEST)
1737 0b04b188 Michael Hanselmann
LOCK_ATTEMPTS_MAXWAIT = 15.0
1738 0b04b188 Michael Hanselmann
LOCK_ATTEMPTS_MINWAIT = 1.0
1739 0b04b188 Michael Hanselmann
1740 f1048938 Iustin Pop
# Execution log types
1741 f1048938 Iustin Pop
ELOG_MESSAGE = "message"
1742 9bf56d77 Michael Hanselmann
ELOG_REMOTE_IMPORT = "remote-import"
1743 e58f87a9 Michael Hanselmann
ELOG_JQUEUE_TEST = "jqueue-test"
1744 e58f87a9 Michael Hanselmann
1745 19ddc57a René Nussbaumer
# /etc/hosts modification
1746 19ddc57a René Nussbaumer
ETC_HOSTS_ADD = "add"
1747 19ddc57a René Nussbaumer
ETC_HOSTS_REMOVE = "remove"
1748 19ddc57a René Nussbaumer
1749 e58f87a9 Michael Hanselmann
# Job queue test
1750 e58f87a9 Michael Hanselmann
JQT_MSGPREFIX = "TESTMSG="
1751 e58f87a9 Michael Hanselmann
JQT_EXPANDNAMES = "expandnames"
1752 e58f87a9 Michael Hanselmann
JQT_EXEC = "exec"
1753 e58f87a9 Michael Hanselmann
JQT_LOGMSG = "logmsg"
1754 f99010b2 Michael Hanselmann
JQT_STARTMSG = "startmsg"
1755 b8028dcf Michael Hanselmann
JQT_ALL = compat.UniqueFrozenset([
1756 e58f87a9 Michael Hanselmann
  JQT_EXPANDNAMES,
1757 e58f87a9 Michael Hanselmann
  JQT_EXEC,
1758 e58f87a9 Michael Hanselmann
  JQT_LOGMSG,
1759 f99010b2 Michael Hanselmann
  JQT_STARTMSG,
1760 e58f87a9 Michael Hanselmann
  ])
1761 d4104181 Iustin Pop
1762 4a917de6 Michael Hanselmann
# Query resources
1763 dff5f600 Michael Hanselmann
QR_CLUSTER = "cluster"
1764 4a917de6 Michael Hanselmann
QR_INSTANCE = "instance"
1765 4a917de6 Michael Hanselmann
QR_NODE = "node"
1766 24d16f76 Michael Hanselmann
QR_LOCK = "lock"
1767 e070c663 Adeodato Simo
QR_GROUP = "group"
1768 be3a4b14 Michael Hanselmann
QR_OS = "os"
1769 9665bb3a Michael Hanselmann
QR_JOB = "job"
1770 0fdf247d Michael Hanselmann
QR_EXPORT = "export"
1771 eaa4c57c Dimitris Aragiorgis
QR_NETWORK = "network"
1772 b954f097 Constantinos Venetsanopoulos
QR_EXTSTORAGE = "extstorage"
1773 4a917de6 Michael Hanselmann
1774 4a917de6 Michael Hanselmann
#: List of resources which can be queried using L{opcodes.OpQuery}
1775 b8028dcf Michael Hanselmann
QR_VIA_OP = compat.UniqueFrozenset([
1776 dff5f600 Michael Hanselmann
  QR_CLUSTER,
1777 0fdf247d Michael Hanselmann
  QR_INSTANCE,
1778 0fdf247d Michael Hanselmann
  QR_NODE,
1779 0fdf247d Michael Hanselmann
  QR_GROUP,
1780 0fdf247d Michael Hanselmann
  QR_OS,
1781 0fdf247d Michael Hanselmann
  QR_EXPORT,
1782 eaa4c57c Dimitris Aragiorgis
  QR_NETWORK,
1783 b954f097 Constantinos Venetsanopoulos
  QR_EXTSTORAGE,
1784 0fdf247d Michael Hanselmann
  ])
1785 4a917de6 Michael Hanselmann
1786 3d5ebbf0 Stephen Shirley
#: List of resources which can be queried using Local UniX Interface
1787 abd66bf8 Michael Hanselmann
QR_VIA_LUXI = QR_VIA_OP.union([
1788 24d16f76 Michael Hanselmann
  QR_LOCK,
1789 9665bb3a Michael Hanselmann
  QR_JOB,
1790 28b71a76 Michael Hanselmann
  ])
1791 28b71a76 Michael Hanselmann
1792 abd66bf8 Michael Hanselmann
#: List of resources which can be queried using RAPI
1793 abd66bf8 Michael Hanselmann
QR_VIA_RAPI = QR_VIA_LUXI
1794 abd66bf8 Michael Hanselmann
1795 4a917de6 Michael Hanselmann
# Query field types
1796 4a917de6 Michael Hanselmann
QFT_UNKNOWN = "unknown"
1797 4a917de6 Michael Hanselmann
QFT_TEXT = "text"
1798 4a917de6 Michael Hanselmann
QFT_BOOL = "bool"
1799 4a917de6 Michael Hanselmann
QFT_NUMBER = "number"
1800 4a917de6 Michael Hanselmann
QFT_UNIT = "unit"
1801 4a917de6 Michael Hanselmann
QFT_TIMESTAMP = "timestamp"
1802 4a917de6 Michael Hanselmann
QFT_OTHER = "other"
1803 4a917de6 Michael Hanselmann
1804 4a917de6 Michael Hanselmann
#: All query field types
1805 b8028dcf Michael Hanselmann
QFT_ALL = compat.UniqueFrozenset([
1806 4a917de6 Michael Hanselmann
  QFT_UNKNOWN,
1807 4a917de6 Michael Hanselmann
  QFT_TEXT,
1808 4a917de6 Michael Hanselmann
  QFT_BOOL,
1809 4a917de6 Michael Hanselmann
  QFT_NUMBER,
1810 4a917de6 Michael Hanselmann
  QFT_UNIT,
1811 4a917de6 Michael Hanselmann
  QFT_TIMESTAMP,
1812 4a917de6 Michael Hanselmann
  QFT_OTHER,
1813 4a917de6 Michael Hanselmann
  ])
1814 4a917de6 Michael Hanselmann
1815 a6070ef7 Michael Hanselmann
# Query result field status (don't change or reuse values as they're used by
1816 a6070ef7 Michael Hanselmann
# clients)
1817 4a917de6 Michael Hanselmann
#: Normal field status
1818 cfb084ae René Nussbaumer
RS_NORMAL = 0
1819 4a917de6 Michael Hanselmann
#: Unknown field
1820 cfb084ae René Nussbaumer
RS_UNKNOWN = 1
1821 cfb084ae René Nussbaumer
#: No data (e.g. RPC error), can be used instead of L{RS_OFFLINE}
1822 cfb084ae René Nussbaumer
RS_NODATA = 2
1823 dcb9946c Iustin Pop
#: Value unavailable/unsupported for item; if this field is supported
1824 e18c6c47 Iustin Pop
#: but we cannot get the data for the moment, RS_NODATA or
1825 e18c6c47 Iustin Pop
#: RS_OFFLINE should be used
1826 cfb084ae René Nussbaumer
RS_UNAVAIL = 3
1827 a6070ef7 Michael Hanselmann
#: Resource marked offline
1828 cfb084ae René Nussbaumer
RS_OFFLINE = 4
1829 cfb084ae René Nussbaumer
1830 b8028dcf Michael Hanselmann
RS_ALL = compat.UniqueFrozenset([
1831 cfb084ae René Nussbaumer
  RS_NORMAL,
1832 cfb084ae René Nussbaumer
  RS_UNKNOWN,
1833 cfb084ae René Nussbaumer
  RS_NODATA,
1834 cfb084ae René Nussbaumer
  RS_UNAVAIL,
1835 cfb084ae René Nussbaumer
  RS_OFFLINE,
1836 ee3aedff Michael Hanselmann
  ])
1837 ee3aedff Michael Hanselmann
1838 f0b1bafe Iustin Pop
#: Dictionary with special field cases and their verbose/terse formatting
1839 f0b1bafe Iustin Pop
RSS_DESCRIPTION = {
1840 f0b1bafe Iustin Pop
  RS_UNKNOWN: ("(unknown)", "??"),
1841 e687ec01 Michael Hanselmann
  RS_NODATA: ("(nodata)", "?"),
1842 f0b1bafe Iustin Pop
  RS_OFFLINE: ("(offline)", "*"),
1843 f0b1bafe Iustin Pop
  RS_UNAVAIL: ("(unavail)", "-"),
1844 f0b1bafe Iustin Pop
  }
1845 f0b1bafe Iustin Pop
1846 c5e489f7 Iustin Pop
# max dynamic devices
1847 24991749 Iustin Pop
MAX_NICS = 8
1848 24991749 Iustin Pop
MAX_DISKS = 16
1849 24991749 Iustin Pop
1850 c09254c2 Iustin Pop
# SSCONF file prefix
1851 c09254c2 Iustin Pop
SSCONF_FILEPREFIX = "ssconf_"
1852 93384844 Iustin Pop
# SSCONF keys
1853 93384844 Iustin Pop
SS_CLUSTER_NAME = "cluster_name"
1854 5d60b3bd Iustin Pop
SS_CLUSTER_TAGS = "cluster_tags"
1855 93384844 Iustin Pop
SS_FILE_STORAGE_DIR = "file_storage_dir"
1856 4b97f902 Apollon Oikonomopoulos
SS_SHARED_FILE_STORAGE_DIR = "shared_file_storage_dir"
1857 f56618e0 Iustin Pop
SS_MASTER_CANDIDATES = "master_candidates"
1858 8113a52e Luca Bigliardi
SS_MASTER_CANDIDATES_IPS = "master_candidates_ips"
1859 93384844 Iustin Pop
SS_MASTER_IP = "master_ip"
1860 93384844 Iustin Pop
SS_MASTER_NETDEV = "master_netdev"
1861 5a8648eb Andrea Spadaccini
SS_MASTER_NETMASK = "master_netmask"
1862 93384844 Iustin Pop
SS_MASTER_NODE = "master_node"
1863 93384844 Iustin Pop
SS_NODE_LIST = "node_list"
1864 f9780ccd Luca Bigliardi
SS_NODE_PRIMARY_IPS = "node_primary_ips"
1865 f9780ccd Luca Bigliardi
SS_NODE_SECONDARY_IPS = "node_secondary_ips"
1866 a3316e4a Iustin Pop
SS_OFFLINE_NODES = "offline_nodes"
1867 81a49123 Iustin Pop
SS_ONLINE_NODES = "online_nodes"
1868 868a98ca Manuel Franceschini
SS_PRIMARY_IP_FAMILY = "primary_ip_family"
1869 81a49123 Iustin Pop
SS_INSTANCE_LIST = "instance_list"
1870 8a113c7a Iustin Pop
SS_RELEASE_VERSION = "release_version"
1871 4f7a6a10 Iustin Pop
SS_HYPERVISOR_LIST = "hypervisor_list"
1872 5c465a95 Iustin Pop
SS_MAINTAIN_NODE_HEALTH = "maintain_node_health"
1873 0fbae49a Balazs Lecz
SS_UID_POOL = "uid_pool"
1874 6f076453 Guido Trotter
SS_NODEGROUPS = "nodegroups"
1875 eaa4c57c Dimitris Aragiorgis
SS_NETWORKS = "networks"
1876 93384844 Iustin Pop
1877 cd57bab6 Michael Hanselmann
SS_FILE_PERMS = 0444
1878 cd57bab6 Michael Hanselmann
1879 7888a614 Alexander Schreiber
# cluster wide default parameters
1880 7888a614 Alexander Schreiber
DEFAULT_ENABLED_HYPERVISOR = HT_XEN_PVM
1881 7888a614 Alexander Schreiber
1882 7888a614 Alexander Schreiber
HVC_DEFAULTS = {
1883 bd0ff7c2 Iustin Pop
  HT_XEN_PVM: {
1884 2f2dbb4b Jun Futagawa
    HV_USE_BOOTLOADER: False,
1885 2f2dbb4b Jun Futagawa
    HV_BOOTLOADER_PATH: XEN_BOOTLOADER,
1886 d0c8c01d Iustin Pop
    HV_BOOTLOADER_ARGS: "",
1887 3c4afa2e Iustin Pop
    HV_KERNEL_PATH: XEN_KERNEL,
1888 d0c8c01d Iustin Pop
    HV_INITRD_PATH: "",
1889 d0c8c01d Iustin Pop
    HV_ROOT_PATH: "/dev/sda1",
1890 d0c8c01d Iustin Pop
    HV_KERNEL_ARGS: "ro",
1891 78411c60 Iustin Pop
    HV_MIGRATION_PORT: 8002,
1892 783a6c0b Iustin Pop
    HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1893 525011bc Maciej Bliziński
    HV_BLOCKDEV_PREFIX: "sd",
1894 990ade2d Stephen Shirley
    HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1895 7e7629c6 Tsachy Shacham
    HV_CPU_MASK: CPU_PINNING_ALL,
1896 8bd977e9 Sébastien Bocahu
    HV_CPU_CAP: 0,
1897 8bd977e9 Sébastien Bocahu
    HV_CPU_WEIGHT: 256,
1898 bd0ff7c2 Iustin Pop
    },
1899 bd0ff7c2 Iustin Pop
  HT_XEN_HVM: {
1900 bd0ff7c2 Iustin Pop
    HV_BOOT_ORDER: "cd",
1901 d0c8c01d Iustin Pop
    HV_CDROM_IMAGE_PATH: "",
1902 d08f6067 Guido Trotter
    HV_NIC_TYPE: HT_NIC_RTL8139,
1903 43440815 Guido Trotter
    HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
1904 9769bb78 Manuel Franceschini
    HV_VNC_BIND_ADDRESS: IP4_ADDRESS_ANY,
1905 9f2265bc Michael Hanselmann
    HV_VNC_PASSWORD_FILE: pathutils.VNC_PASSWORD_FILE,
1906 bd0ff7c2 Iustin Pop
    HV_ACPI: True,
1907 bd0ff7c2 Iustin Pop
    HV_PAE: True,
1908 e2ee1cea Iustin Pop
    HV_KERNEL_PATH: "/usr/lib/xen/boot/hvmloader",
1909 09ea8710 Iustin Pop
    HV_DEVICE_MODEL: "/usr/lib/xen/bin/qemu-dm",
1910 78411c60 Iustin Pop
    HV_MIGRATION_PORT: 8002,
1911 783a6c0b Iustin Pop
    HV_MIGRATION_MODE: HT_MIGRATION_NONLIVE,
1912 6b970cef Jun Futagawa
    HV_USE_LOCALTIME: False,
1913 525011bc Maciej Bliziński
    HV_BLOCKDEV_PREFIX: "hd",
1914 87f0aa48 Jack
    HV_PASSTHROUGH: "",
1915 990ade2d Stephen Shirley
    HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1916 7e7629c6 Tsachy Shacham
    HV_CPU_MASK: CPU_PINNING_ALL,
1917 8bd977e9 Sébastien Bocahu
    HV_CPU_CAP: 0,
1918 8bd977e9 Sébastien Bocahu
    HV_CPU_WEIGHT: 256,
1919 bd0ff7c2 Iustin Pop
    },
1920 bd0ff7c2 Iustin Pop
  HT_KVM: {
1921 b8203e1e Iustin Pop
    HV_KERNEL_PATH: KVM_KERNEL,
1922 d0c8c01d Iustin Pop
    HV_INITRD_PATH: "",
1923 d0c8c01d Iustin Pop
    HV_KERNEL_ARGS: "ro",
1924 d0c8c01d Iustin Pop
    HV_ROOT_PATH: "/dev/vda1",
1925 bd0ff7c2 Iustin Pop
    HV_ACPI: True,
1926 bd0ff7c2 Iustin Pop
    HV_SERIAL_CONSOLE: True,
1927 14fd6c81 Guido Trotter
    HV_SERIAL_SPEED: 38400,
1928 d0c8c01d Iustin Pop
    HV_VNC_BIND_ADDRESS: "",
1929 8b2d1013 Guido Trotter
    HV_VNC_TLS: False,
1930 d0c8c01d Iustin Pop
    HV_VNC_X509: "",
1931 8b2d1013 Guido Trotter
    HV_VNC_X509_VERIFY: False,
1932 d0c8c01d Iustin Pop
    HV_VNC_PASSWORD_FILE: "",
1933 b1cb62bd Andrea Spadaccini
    HV_KVM_SPICE_BIND: "",
1934 b1cb62bd Andrea Spadaccini
    HV_KVM_SPICE_IP_VERSION: IFACE_NO_IP_VERSION_SPECIFIED,
1935 b451c4c7 Andrea Spadaccini
    HV_KVM_SPICE_PASSWORD_FILE: "",
1936 ea064d24 Andrea Spadaccini
    HV_KVM_SPICE_LOSSLESS_IMG_COMPR: "",
1937 ea064d24 Andrea Spadaccini
    HV_KVM_SPICE_JPEG_IMG_COMPR: "",
1938 ea064d24 Andrea Spadaccini
    HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR: "",
1939 ea064d24 Andrea Spadaccini
    HV_KVM_SPICE_STREAMING_VIDEO_DETECTION: "",
1940 ea064d24 Andrea Spadaccini
    HV_KVM_SPICE_AUDIO_COMPR: True,
1941 bfe86c76 Andrea Spadaccini
    HV_KVM_SPICE_USE_TLS: False,
1942 3e40b587 Andrea Spadaccini
    HV_KVM_SPICE_TLS_CIPHERS: OPENSSL_CIPHERS,
1943 3e40b587 Andrea Spadaccini
    HV_KVM_SPICE_USE_VDAGENT: True,
1944 d0c8c01d Iustin Pop
    HV_KVM_FLOPPY_IMAGE_PATH: "",
1945 d0c8c01d Iustin Pop
    HV_CDROM_IMAGE_PATH: "",
1946 d0c8c01d Iustin Pop
    HV_KVM_CDROM2_IMAGE_PATH: "",
1947 835528af Iustin Pop
    HV_BOOT_ORDER: HT_BO_DISK,
1948 43440815 Guido Trotter
    HV_NIC_TYPE: HT_NIC_PARAVIRTUAL,
1949 43440815 Guido Trotter
    HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
1950 d0c8c01d Iustin Pop
    HV_KVM_CDROM_DISK_TYPE: "",
1951 d0c8c01d Iustin Pop
    HV_USB_MOUSE: "",
1952 4f580fef Sébastien Bocahu
    HV_KEYMAP: "",
1953 3c075436 Iustin Pop
    HV_MIGRATION_PORT: 8102,
1954 e43d4f9f Apollon Oikonomopoulos
    HV_MIGRATION_BANDWIDTH: 32, # MiB/s
1955 e43d4f9f Apollon Oikonomopoulos
    HV_MIGRATION_DOWNTIME: 30,  # ms
1956 783a6c0b Iustin Pop
    HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
1957 6b970cef Jun Futagawa
    HV_USE_LOCALTIME: False,
1958 ea0f3d7a Iustin Pop
    HV_DISK_CACHE: HT_CACHE_DEFAULT,
1959 d19d94db Guido Trotter
    HV_SECURITY_MODEL: HT_SM_NONE,
1960 d0c8c01d Iustin Pop
    HV_SECURITY_DOMAIN: "",
1961 7ba594c0 Guido Trotter
    HV_KVM_FLAG: "",
1962 fbe27e2b Guido Trotter
    HV_VHOST_NET: False,
1963 84c08e4e Balazs Lecz
    HV_KVM_USE_CHROOT: False,
1964 4f958b0b Miguel Di Ciurcio Filho
    HV_MEM_PATH: "",
1965 990ade2d Stephen Shirley
    HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED,
1966 7e7629c6 Tsachy Shacham
    HV_CPU_MASK: CPU_PINNING_ALL,
1967 7cb42171 Nikita Staroverov
    HV_CPU_TYPE: "",
1968 4888a609 Guido Trotter
    HV_CPU_CORES: 0,
1969 4888a609 Guido Trotter
    HV_CPU_THREADS: 0,
1970 4888a609 Guido Trotter
    HV_CPU_SOCKETS: 0,
1971 2fddb144 Guido Trotter
    HV_SOUNDHW: "",
1972 156681c1 Guido Trotter
    HV_USB_DEVICES: "",
1973 7589346f Guido Trotter
    HV_VGA: "",
1974 e6f24d89 Guido Trotter
    HV_KVM_EXTRA: "",
1975 bd0ff7c2 Iustin Pop
    },
1976 5ae4945a Iustin Pop
  HT_FAKE: {},
1977 48297fa2 Iustin Pop
  HT_CHROOT: {
1978 48297fa2 Iustin Pop
    HV_INIT_SCRIPT: "/ganeti-chroot",
1979 48297fa2 Iustin Pop
    },
1980 4b5e40a5 Iustin Pop
  HT_LXC: {
1981 e3ed5316 Balazs Lecz
    HV_CPU_MASK: "",
1982 4b5e40a5 Iustin Pop
    },
1983 bd0ff7c2 Iustin Pop
  }
1984 7888a614 Alexander Schreiber
1985 b8028dcf Michael Hanselmann
HVC_GLOBALS = compat.UniqueFrozenset([
1986 7736a5f2 Iustin Pop
  HV_MIGRATION_PORT,
1987 e43d4f9f Apollon Oikonomopoulos
  HV_MIGRATION_BANDWIDTH,
1988 783a6c0b Iustin Pop
  HV_MIGRATION_MODE,
1989 7736a5f2 Iustin Pop
  ])
1990 7736a5f2 Iustin Pop
1991 7888a614 Alexander Schreiber
BEC_DEFAULTS = {
1992 8c72ab2b Guido Trotter
  BE_MINMEM: 128,
1993 8c72ab2b Guido Trotter
  BE_MAXMEM: 128,
1994 bd0ff7c2 Iustin Pop
  BE_VCPUS: 1,
1995 bd0ff7c2 Iustin Pop
  BE_AUTO_BALANCE: True,
1996 11dc66f3 Bernardo Dal Seno
  BE_ALWAYS_FAILOVER: False,
1997 34700f5b René Nussbaumer
  BE_SPINDLE_USE: 1,
1998 bd0ff7c2 Iustin Pop
  }
1999 c3e618cc Guido Trotter
2000 095e71aa René Nussbaumer
NDC_DEFAULTS = {
2001 1df4d430 Iustin Pop
  ND_OOB_PROGRAM: "",
2002 432e8e2f Iustin Pop
  ND_SPINDLE_COUNT: 1,
2003 0ea11dcb Bernardo Dal Seno
  ND_EXCLUSIVE_STORAGE: False,
2004 095e71aa René Nussbaumer
  }
2005 095e71aa René Nussbaumer
2006 bc5d0215 Andrea Spadaccini
DISK_LD_DEFAULTS = {
2007 bc5d0215 Andrea Spadaccini
  LD_DRBD8: {
2008 ac00bf1b Andrea Spadaccini
    LDP_RESYNC_RATE: CLASSIC_DRBD_SYNC_SPEED,
2009 ac00bf1b Andrea Spadaccini
    LDP_BARRIERS: _autoconf.DRBD_BARRIERS,
2010 ac00bf1b Andrea Spadaccini
    LDP_NO_META_FLUSH: _autoconf.DRBD_NO_META_FLUSH,
2011 8002e46b Andrea Spadaccini
    LDP_DEFAULT_METAVG: DEFAULT_VG,
2012 ad1dd4c7 Andrea Spadaccini
    LDP_DISK_CUSTOM: "",
2013 ad1dd4c7 Andrea Spadaccini
    LDP_NET_CUSTOM: "",
2014 f2f57b6e Andrea Spadaccini
    LDP_DYNAMIC_RESYNC: False,
2015 8584e922 Andrea Spadaccini
2016 8584e922 Andrea Spadaccini
    # The default values for the DRBD dynamic resync speed algorithm are taken
2017 8584e922 Andrea Spadaccini
    # from the drbsetup 8.3.11 man page, except for c-plan-ahead (that we
2018 8584e922 Andrea Spadaccini
    # don't need to set to 0, because we have a separate option to enable it)
2019 8584e922 Andrea Spadaccini
    # and for c-max-rate, that we cap to the default value for the static resync
2020 8584e922 Andrea Spadaccini
    # rate.
2021 8584e922 Andrea Spadaccini
    LDP_PLAN_AHEAD: 20, # ds
2022 8584e922 Andrea Spadaccini
    LDP_FILL_TARGET: 0, # sectors
2023 8584e922 Andrea Spadaccini
    LDP_DELAY_TARGET: 1, # ds
2024 8584e922 Andrea Spadaccini
    LDP_MAX_RATE: CLASSIC_DRBD_SYNC_SPEED, # KiB/s
2025 8584e922 Andrea Spadaccini
    LDP_MIN_RATE: 4 * 1024, # KiB/s
2026 bc5d0215 Andrea Spadaccini
    },
2027 bc5d0215 Andrea Spadaccini
  LD_LV: {
2028 ac00bf1b Andrea Spadaccini
    LDP_STRIPES: _autoconf.LVM_STRIPECOUNT
2029 bc5d0215 Andrea Spadaccini
    },
2030 5ae4945a Iustin Pop
  LD_FILE: {},
2031 5ae4945a Iustin Pop
  LD_BLOCKDEV: {},
2032 7181fba0 Constantinos Venetsanopoulos
  LD_RBD: {
2033 7181fba0 Constantinos Venetsanopoulos
    LDP_POOL: "rbd"
2034 7181fba0 Constantinos Venetsanopoulos
    },
2035 376631d1 Constantinos Venetsanopoulos
  LD_EXT: {},
2036 bc5d0215 Andrea Spadaccini
  }
2037 bc5d0215 Andrea Spadaccini
2038 8584e922 Andrea Spadaccini
# readability shortcuts
2039 8584e922 Andrea Spadaccini
_LV_DEFAULTS = DISK_LD_DEFAULTS[LD_LV]
2040 8584e922 Andrea Spadaccini
_DRBD_DEFAULTS = DISK_LD_DEFAULTS[LD_DRBD8]
2041 8584e922 Andrea Spadaccini
2042 bc5d0215 Andrea Spadaccini
DISK_DT_DEFAULTS = {
2043 bc5d0215 Andrea Spadaccini
  DT_PLAIN: {
2044 ac00bf1b Andrea Spadaccini
    LV_STRIPES: DISK_LD_DEFAULTS[LD_LV][LDP_STRIPES],
2045 bc5d0215 Andrea Spadaccini
    },
2046 bc5d0215 Andrea Spadaccini
  DT_DRBD8: {
2047 8584e922 Andrea Spadaccini
    DRBD_RESYNC_RATE: _DRBD_DEFAULTS[LDP_RESYNC_RATE],
2048 8584e922 Andrea Spadaccini
    DRBD_DATA_STRIPES: _LV_DEFAULTS[LDP_STRIPES],
2049 8584e922 Andrea Spadaccini
    DRBD_META_STRIPES: _LV_DEFAULTS[LDP_STRIPES],
2050 8584e922 Andrea Spadaccini
    DRBD_DISK_BARRIERS: _DRBD_DEFAULTS[LDP_BARRIERS],
2051 8584e922 Andrea Spadaccini
    DRBD_META_BARRIERS: _DRBD_DEFAULTS[LDP_NO_META_FLUSH],
2052 8584e922 Andrea Spadaccini
    DRBD_DEFAULT_METAVG: _DRBD_DEFAULTS[LDP_DEFAULT_METAVG],
2053 8584e922 Andrea Spadaccini
    DRBD_DISK_CUSTOM: _DRBD_DEFAULTS[LDP_DISK_CUSTOM],
2054 8584e922 Andrea Spadaccini
    DRBD_NET_CUSTOM: _DRBD_DEFAULTS[LDP_NET_CUSTOM],
2055 8584e922 Andrea Spadaccini
    DRBD_DYNAMIC_RESYNC: _DRBD_DEFAULTS[LDP_DYNAMIC_RESYNC],
2056 8584e922 Andrea Spadaccini
    DRBD_PLAN_AHEAD: _DRBD_DEFAULTS[LDP_PLAN_AHEAD],
2057 8584e922 Andrea Spadaccini
    DRBD_FILL_TARGET: _DRBD_DEFAULTS[LDP_FILL_TARGET],
2058 8584e922 Andrea Spadaccini
    DRBD_DELAY_TARGET: _DRBD_DEFAULTS[LDP_DELAY_TARGET],
2059 8584e922 Andrea Spadaccini
    DRBD_MAX_RATE: _DRBD_DEFAULTS[LDP_MAX_RATE],
2060 8584e922 Andrea Spadaccini
    DRBD_MIN_RATE: _DRBD_DEFAULTS[LDP_MIN_RATE],
2061 bc5d0215 Andrea Spadaccini
    },
2062 5ae4945a Iustin Pop
  DT_DISKLESS: {},
2063 5ae4945a Iustin Pop
  DT_FILE: {},
2064 5ae4945a Iustin Pop
  DT_SHARED_FILE: {},
2065 5ae4945a Iustin Pop
  DT_BLOCK: {},
2066 7181fba0 Constantinos Venetsanopoulos
  DT_RBD: {
2067 7181fba0 Constantinos Venetsanopoulos
    RBD_POOL: DISK_LD_DEFAULTS[LD_RBD][LDP_POOL]
2068 7181fba0 Constantinos Venetsanopoulos
    },
2069 376631d1 Constantinos Venetsanopoulos
  DT_EXT: {},
2070 bc5d0215 Andrea Spadaccini
  }
2071 bc5d0215 Andrea Spadaccini
2072 8584e922 Andrea Spadaccini
# we don't want to export the shortcuts
2073 8584e922 Andrea Spadaccini
del _LV_DEFAULTS, _DRBD_DEFAULTS
2074 8584e922 Andrea Spadaccini
2075 ac061be9 Guido Trotter
NICC_DEFAULTS = {
2076 ac061be9 Guido Trotter
  NIC_MODE: NIC_MODE_BRIDGED,
2077 ac061be9 Guido Trotter
  NIC_LINK: DEFAULT_BRIDGE,
2078 ac061be9 Guido Trotter
  }
2079 ac061be9 Guido Trotter
2080 a194dc28 Iustin Pop
# All of the following values are quite arbitrarily - there are no
2081 a194dc28 Iustin Pop
# "good" defaults, these must be customised per-site
2082 918eb80b Agata Murawska
IPOLICY_DEFAULTS = {
2083 4f725341 Agata Murawska
  ISPECS_MIN: {
2084 4f725341 Agata Murawska
    ISPEC_MEM_SIZE: 128,
2085 4f725341 Agata Murawska
    ISPEC_CPU_COUNT: 1,
2086 4f725341 Agata Murawska
    ISPEC_DISK_COUNT: 1,
2087 4f725341 Agata Murawska
    ISPEC_DISK_SIZE: 1024,
2088 4f725341 Agata Murawska
    ISPEC_NIC_COUNT: 1,
2089 553cb5f7 René Nussbaumer
    ISPEC_SPINDLE_USE: 1,
2090 918eb80b Agata Murawska
    },
2091 4f725341 Agata Murawska
  ISPECS_MAX: {
2092 b32f3c0c Iustin Pop
    ISPEC_MEM_SIZE: 32768,
2093 b32f3c0c Iustin Pop
    ISPEC_CPU_COUNT: 8,
2094 b32f3c0c Iustin Pop
    ISPEC_DISK_COUNT: MAX_DISKS,
2095 b32f3c0c Iustin Pop
    ISPEC_DISK_SIZE: 1024 * 1024,
2096 b32f3c0c Iustin Pop
    ISPEC_NIC_COUNT: MAX_NICS,
2097 553cb5f7 René Nussbaumer
    ISPEC_SPINDLE_USE: 12,
2098 918eb80b Agata Murawska
    },
2099 4f725341 Agata Murawska
  ISPECS_STD: {
2100 4f725341 Agata Murawska
    ISPEC_MEM_SIZE: 128,
2101 4f725341 Agata Murawska
    ISPEC_CPU_COUNT: 1,
2102 4f725341 Agata Murawska
    ISPEC_DISK_COUNT: 1,
2103 4f725341 Agata Murawska
    ISPEC_DISK_SIZE: 1024,
2104 4f725341 Agata Murawska
    ISPEC_NIC_COUNT: 1,
2105 553cb5f7 René Nussbaumer
    ISPEC_SPINDLE_USE: 1,
2106 2cc673a3 Iustin Pop
    },
2107 d04c9d45 Iustin Pop
  IPOLICY_DTS: DISK_TEMPLATES,
2108 ff6c5e55 Iustin Pop
  IPOLICY_VCPU_RATIO: 4.0,
2109 a194dc28 Iustin Pop
  IPOLICY_SPINDLE_RATIO: 32.0,
2110 918eb80b Agata Murawska
  }
2111 918eb80b Agata Murawska
2112 c3e618cc Guido Trotter
MASTER_POOL_SIZE_DEFAULT = 10
2113 ea1518af Guido Trotter
2114 63c73073 Bernardo Dal Seno
# Exclusive storage:
2115 63c73073 Bernardo Dal Seno
# Error margin used to compare physical disks
2116 63c73073 Bernardo Dal Seno
PART_MARGIN = .01
2117 63c73073 Bernardo Dal Seno
# Space reserved when creating instance disks
2118 63c73073 Bernardo Dal Seno
PART_RESERVED = .02
2119 63c73073 Bernardo Dal Seno
2120 ea1518af Guido Trotter
CONFD_PROTOCOL_VERSION = 1
2121 ea1518af Guido Trotter
2122 09444532 Guido Trotter
CONFD_REQ_PING = 0
2123 ea1518af Guido Trotter
CONFD_REQ_NODE_ROLE_BYNAME = 1
2124 ea1518af Guido Trotter
CONFD_REQ_NODE_PIP_BY_INSTANCE_IP = 2
2125 48166551 Guido Trotter
CONFD_REQ_CLUSTER_MASTER = 3
2126 efbb4fd2 Luca Bigliardi
CONFD_REQ_NODE_PIP_LIST = 4
2127 efbb4fd2 Luca Bigliardi
CONFD_REQ_MC_PIP_LIST = 5
2128 d01ae714 Luca Bigliardi
CONFD_REQ_INSTANCES_IPS_LIST = 6
2129 792f8e55 Iustin Pop
CONFD_REQ_NODE_DRBD = 7
2130 ea1518af Guido Trotter
2131 19351457 Guido Trotter
# Confd request query fields. These are used to narrow down queries.
2132 19351457 Guido Trotter
# These must be strings rather than integers, because json-encoding
2133 19351457 Guido Trotter
# converts them to strings anyway, as they're used as dict-keys.
2134 19351457 Guido Trotter
CONFD_REQQ_LINK = "0"
2135 19351457 Guido Trotter
CONFD_REQQ_IP = "1"
2136 19351457 Guido Trotter
CONFD_REQQ_IPLIST = "2"
2137 250554a9 Guido Trotter
CONFD_REQQ_FIELDS = "3"
2138 250554a9 Guido Trotter
2139 250554a9 Guido Trotter
CONFD_REQFIELD_NAME = "0"
2140 250554a9 Guido Trotter
CONFD_REQFIELD_IP = "1"
2141 43dc8496 Guido Trotter
CONFD_REQFIELD_MNODE_PIP = "2"
2142 19351457 Guido Trotter
2143 b8028dcf Michael Hanselmann
CONFD_REQS = compat.UniqueFrozenset([
2144 09444532 Guido Trotter
  CONFD_REQ_PING,
2145 ea1518af Guido Trotter
  CONFD_REQ_NODE_ROLE_BYNAME,
2146 ea1518af Guido Trotter
  CONFD_REQ_NODE_PIP_BY_INSTANCE_IP,
2147 48166551 Guido Trotter
  CONFD_REQ_CLUSTER_MASTER,
2148 efbb4fd2 Luca Bigliardi
  CONFD_REQ_NODE_PIP_LIST,
2149 efbb4fd2 Luca Bigliardi
  CONFD_REQ_MC_PIP_LIST,
2150 d01ae714 Luca Bigliardi
  CONFD_REQ_INSTANCES_IPS_LIST,
2151 792f8e55 Iustin Pop
  CONFD_REQ_NODE_DRBD,
2152 ea1518af Guido Trotter
  ])
2153 ea1518af Guido Trotter
2154 31c2a99e Guido Trotter
CONFD_REPL_STATUS_OK = 0
2155 31c2a99e Guido Trotter
CONFD_REPL_STATUS_ERROR = 1
2156 31c2a99e Guido Trotter
CONFD_REPL_STATUS_NOTIMPLEMENTED = 2
2157 31c2a99e Guido Trotter
2158 b8028dcf Michael Hanselmann
CONFD_REPL_STATUSES = compat.UniqueFrozenset([
2159 31c2a99e Guido Trotter
  CONFD_REPL_STATUS_OK,
2160 31c2a99e Guido Trotter
  CONFD_REPL_STATUS_ERROR,
2161 31c2a99e Guido Trotter
  CONFD_REPL_STATUS_NOTIMPLEMENTED,
2162 31c2a99e Guido Trotter
  ])
2163 31c2a99e Guido Trotter
2164 89c52785 Guido Trotter
(CONFD_NODE_ROLE_MASTER,
2165 89c52785 Guido Trotter
 CONFD_NODE_ROLE_CANDIDATE,
2166 89c52785 Guido Trotter
 CONFD_NODE_ROLE_OFFLINE,
2167 197b0f5d Guido Trotter
 CONFD_NODE_ROLE_DRAINED,
2168 197b0f5d Guido Trotter
 CONFD_NODE_ROLE_REGULAR,
2169 197b0f5d Guido Trotter
 ) = range(5)
2170 89c52785 Guido Trotter
2171 ca2a5b13 Guido Trotter
# A few common errors for confd
2172 ca2a5b13 Guido Trotter
CONFD_ERROR_UNKNOWN_ENTRY = 1
2173 7189e790 Guido Trotter
CONFD_ERROR_INTERNAL = 2
2174 19351457 Guido Trotter
CONFD_ERROR_ARGUMENT = 3
2175 ca2a5b13 Guido Trotter
2176 71f27d19 Guido Trotter
# Each request is "salted" by the current timestamp.
2177 71f27d19 Guido Trotter
# This constants decides how many seconds of skew to accept.
2178 71f27d19 Guido Trotter
# TODO: make this a default and allow the value to be more configurable
2179 313b2dd4 Michael Hanselmann
CONFD_MAX_CLOCK_SKEW = 2 * NODE_MAX_CLOCK_SKEW
2180 84c3ab28 Guido Trotter
2181 84c3ab28 Guido Trotter
# When we haven't reloaded the config for more than this amount of seconds, we
2182 84c3ab28 Guido Trotter
# force a test to see if inotify is betraying us.
2183 84c3ab28 Guido Trotter
CONFD_CONFIG_RELOAD_TIMEOUT = 60
2184 84c3ab28 Guido Trotter
2185 84c3ab28 Guido Trotter
# If we receive more than one update in this amount of seconds, we move to
2186 84c3ab28 Guido Trotter
# polling every RATELIMIT seconds, rather than relying on inotify, to be able
2187 84c3ab28 Guido Trotter
# to serve more requests.
2188 84c3ab28 Guido Trotter
CONFD_CONFIG_RELOAD_RATELIMIT = 2
2189 c8eded0b Guido Trotter
2190 a3758ab2 Guido Trotter
# Magic number prepended to all confd queries.
2191 a3758ab2 Guido Trotter
# This allows us to distinguish different types of confd protocols and handle
2192 a3758ab2 Guido Trotter
# them. For example by changing this we can move the whole payload to be
2193 a3758ab2 Guido Trotter
# compressed, or move away from json.
2194 d0c8c01d Iustin Pop
CONFD_MAGIC_FOURCC = "plj0"
2195 a3758ab2 Guido Trotter
2196 e4ccf6cd Guido Trotter
# By default a confd request is sent to the minimum between this number and all
2197 e4ccf6cd Guido Trotter
# MCs. 6 was chosen because even in the case of a disastrous 50% response rate,
2198 e4ccf6cd Guido Trotter
# we should have enough answers to be able to compare more than one.