Statistics
| Branch: | Tag: | Revision:

root / lib / constants.py @ b2e233a5

History | View | Annotate | Download (47.2 kB)

1 2f31098c Iustin Pop
#
2 a8083063 Iustin Pop
#
3 a8083063 Iustin Pop
4 dcb9946c Iustin Pop
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Google Inc.
5 a8083063 Iustin Pop
#
6 a8083063 Iustin Pop
# This program is free software; you can redistribute it and/or modify
7 a8083063 Iustin Pop
# it under the terms of the GNU General Public License as published by
8 a8083063 Iustin Pop
# the Free Software Foundation; either version 2 of the License, or
9 a8083063 Iustin Pop
# (at your option) any later version.
10 a8083063 Iustin Pop
#
11 a8083063 Iustin Pop
# This program is distributed in the hope that it will be useful, but
12 a8083063 Iustin Pop
# WITHOUT ANY WARRANTY; without even the implied warranty of
13 a8083063 Iustin Pop
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 a8083063 Iustin Pop
# General Public License for more details.
15 a8083063 Iustin Pop
#
16 a8083063 Iustin Pop
# You should have received a copy of the GNU General Public License
17 a8083063 Iustin Pop
# along with this program; if not, write to the Free Software
18 a8083063 Iustin Pop
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 a8083063 Iustin Pop
# 02110-1301, USA.
20 a8083063 Iustin Pop
21 a8083063 Iustin Pop
22 a8083063 Iustin Pop
"""Module holding different constants."""
23 a8083063 Iustin Pop
24 4fe80ef2 Iustin Pop
import re
25 4fe80ef2 Iustin Pop
26 2ec08468 Michael Hanselmann
from ganeti import _autoconf
27 13aeae6a Iustin Pop
from ganeti import _vcsversion
28 7c18ef8e Michael Hanselmann
29 a8083063 Iustin Pop
# various versions
30 2ec08468 Michael Hanselmann
RELEASE_VERSION = _autoconf.PACKAGE_VERSION
31 d1a7d66f Guido Trotter
OS_API_V10 = 10
32 d1a7d66f Guido Trotter
OS_API_V15 = 15
33 b41b3516 Iustin Pop
OS_API_V20 = 20
34 b41b3516 Iustin Pop
OS_API_VERSIONS = frozenset([OS_API_V10, OS_API_V15, OS_API_V20])
35 13aeae6a Iustin Pop
VCS_VERSION = _vcsversion.VCS_VERSION
36 a8083063 Iustin Pop
EXPORT_VERSION = 0
37 bac5ffc3 Oleksiy Mishchenko
RAPI_VERSION = 2
38 a8083063 Iustin Pop
39 1b45f4e5 Michael Hanselmann
40 243cdbcc Michael Hanselmann
# Format for CONFIG_VERSION:
41 243cdbcc Michael Hanselmann
#   01 03 0123 = 01030123
42 243cdbcc Michael Hanselmann
#   ^^ ^^ ^^^^
43 243cdbcc Michael Hanselmann
#   |  |  + Configuration version/revision
44 243cdbcc Michael Hanselmann
#   |  + Minor version
45 243cdbcc Michael Hanselmann
#   + Major version
46 243cdbcc Michael Hanselmann
#
47 243cdbcc Michael Hanselmann
# It stored as an integer. Make sure not to write an octal number.
48 1b45f4e5 Michael Hanselmann
49 1b45f4e5 Michael Hanselmann
# BuildVersion and SplitVersion must be in here because we can't import other
50 1b45f4e5 Michael Hanselmann
# modules. The cfgupgrade tool must be able to read and write version numbers
51 1b45f4e5 Michael Hanselmann
# and thus requires these functions. To avoid code duplication, they're kept in
52 1b45f4e5 Michael Hanselmann
# here.
53 1b45f4e5 Michael Hanselmann
54 1b45f4e5 Michael Hanselmann
def BuildVersion(major, minor, revision):
55 1b45f4e5 Michael Hanselmann
  """Calculates int version number from major, minor and revision numbers.
56 1b45f4e5 Michael Hanselmann

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

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

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

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