Statistics
| Branch: | Tag: | Revision:

root / lib / constants.py @ a002ed79

History | View | Annotate | Download (45.4 kB)

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

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

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

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

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