root / src / Ganeti / Constants.hs @ e1235448
History | View | Annotate | Download (113.7 kB)
1 |
{-# OPTIONS -fno-warn-type-defaults #-} |
---|---|
2 |
{-| Constants contains the Haskell constants |
3 |
|
4 |
The constants in this module are used in Haskell and are also |
5 |
converted to Python. |
6 |
|
7 |
Do not write any definitions in this file other than constants. Do |
8 |
not even write helper functions. The definitions in this module are |
9 |
automatically stripped to build the Makefile.am target |
10 |
'ListConstants.hs'. If there are helper functions in this module, |
11 |
they will also be dragged and it will cause compilation to fail. |
12 |
Therefore, all helper functions should go to a separate module and |
13 |
imported. |
14 |
|
15 |
-} |
16 |
|
17 |
{- |
18 |
|
19 |
Copyright (C) 2013 Google Inc. |
20 |
|
21 |
This program is free software; you can redistribute it and/or modify |
22 |
it under the terms of the GNU General Public License as published by |
23 |
the Free Software Foundation; either version 2 of the License, or |
24 |
(at your option) any later version. |
25 |
|
26 |
This program is distributed in the hope that it will be useful, but |
27 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
28 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
29 |
General Public License for more details. |
30 |
|
31 |
You should have received a copy of the GNU General Public License |
32 |
along with this program; if not, write to the Free Software |
33 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
34 |
02110-1301, USA. |
35 |
|
36 |
-} |
37 |
module Ganeti.Constants where |
38 |
|
39 |
import Control.Arrow ((***)) |
40 |
import Data.List ((\\)) |
41 |
import Data.Map (Map) |
42 |
import qualified Data.Map as Map (empty, fromList, keys, insert) |
43 |
|
44 |
import qualified AutoConf |
45 |
import Ganeti.ConstantUtils (PythonChar(..), PythonNone(..), FrozenSet, |
46 |
Protocol(..), buildVersion) |
47 |
import qualified Ganeti.ConstantUtils as ConstantUtils |
48 |
import Ganeti.HTools.Types (AutoRepairResult(..), AutoRepairType(..)) |
49 |
import qualified Ganeti.HTools.Types as Types |
50 |
import Ganeti.Logging (SyslogUsage(..)) |
51 |
import qualified Ganeti.Logging as Logging (syslogUsageToRaw) |
52 |
import qualified Ganeti.Runtime as Runtime |
53 |
import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..), |
54 |
ExtraLogReason(..)) |
55 |
import Ganeti.THH (PyValueEx(..)) |
56 |
import Ganeti.Types |
57 |
import qualified Ganeti.Types as Types |
58 |
import Ganeti.Confd.Types (ConfdRequestType(..), ConfdReqField(..), |
59 |
ConfdReplyStatus(..), ConfdNodeRole(..), |
60 |
ConfdErrorType(..)) |
61 |
import qualified Ganeti.Confd.Types as Types |
62 |
|
63 |
{-# ANN module "HLint: ignore Use camelCase" #-} |
64 |
|
65 |
-- * 'autoconf' constants for Python only ('autotools/build-bash-completion') |
66 |
|
67 |
htoolsProgs :: [String] |
68 |
htoolsProgs = AutoConf.htoolsProgs |
69 |
|
70 |
-- * 'autoconf' constants for Python only ('lib/constants.py') |
71 |
|
72 |
drbdBarriers :: String |
73 |
drbdBarriers = AutoConf.drbdBarriers |
74 |
|
75 |
drbdNoMetaFlush :: Bool |
76 |
drbdNoMetaFlush = AutoConf.drbdNoMetaFlush |
77 |
|
78 |
lvmStripecount :: Int |
79 |
lvmStripecount = AutoConf.lvmStripecount |
80 |
|
81 |
hasGnuLn :: Bool |
82 |
hasGnuLn = AutoConf.hasGnuLn |
83 |
|
84 |
-- * 'autoconf' constants for Python only ('lib/pathutils.py') |
85 |
|
86 |
-- ** Build-time constants |
87 |
|
88 |
exportDir :: String |
89 |
exportDir = AutoConf.exportDir |
90 |
|
91 |
osSearchPath :: [String] |
92 |
osSearchPath = AutoConf.osSearchPath |
93 |
|
94 |
esSearchPath :: [String] |
95 |
esSearchPath = AutoConf.esSearchPath |
96 |
|
97 |
sshConfigDir :: String |
98 |
sshConfigDir = AutoConf.sshConfigDir |
99 |
|
100 |
xenConfigDir :: String |
101 |
xenConfigDir = AutoConf.xenConfigDir |
102 |
|
103 |
sysconfdir :: String |
104 |
sysconfdir = AutoConf.sysconfdir |
105 |
|
106 |
toolsdir :: String |
107 |
toolsdir = AutoConf.toolsdir |
108 |
|
109 |
localstatedir :: String |
110 |
localstatedir = AutoConf.localstatedir |
111 |
|
112 |
-- ** Paths which don't change for a virtual cluster |
113 |
|
114 |
pkglibdir :: String |
115 |
pkglibdir = AutoConf.pkglibdir |
116 |
|
117 |
sharedir :: String |
118 |
sharedir = AutoConf.sharedir |
119 |
|
120 |
-- * 'autoconf' constants for Python only ('lib/build/sphinx_ext.py') |
121 |
|
122 |
manPages :: Map String Int |
123 |
manPages = Map.fromList AutoConf.manPages |
124 |
|
125 |
-- * 'autoconf' constants for QA cluster only ('qa/qa_cluster.py') |
126 |
|
127 |
versionedsharedir :: String |
128 |
versionedsharedir = AutoConf.versionedsharedir |
129 |
|
130 |
-- * 'autoconf' constants for Python only ('tests/py/docs_unittest.py') |
131 |
|
132 |
gntScripts :: [String] |
133 |
gntScripts = AutoConf.gntScripts |
134 |
|
135 |
-- * Various versions |
136 |
|
137 |
releaseVersion :: String |
138 |
releaseVersion = AutoConf.packageVersion |
139 |
|
140 |
versionMajor :: Int |
141 |
versionMajor = AutoConf.versionMajor |
142 |
|
143 |
versionMinor :: Int |
144 |
versionMinor = AutoConf.versionMinor |
145 |
|
146 |
versionRevision :: Int |
147 |
versionRevision = AutoConf.versionRevision |
148 |
|
149 |
dirVersion :: String |
150 |
dirVersion = AutoConf.dirVersion |
151 |
|
152 |
osApiV10 :: Int |
153 |
osApiV10 = 10 |
154 |
|
155 |
osApiV15 :: Int |
156 |
osApiV15 = 15 |
157 |
|
158 |
osApiV20 :: Int |
159 |
osApiV20 = 20 |
160 |
|
161 |
osApiVersions :: FrozenSet Int |
162 |
osApiVersions = ConstantUtils.mkSet [osApiV10, osApiV15, osApiV20] |
163 |
|
164 |
exportVersion :: Int |
165 |
exportVersion = 0 |
166 |
|
167 |
rapiVersion :: Int |
168 |
rapiVersion = 2 |
169 |
|
170 |
configMajor :: Int |
171 |
configMajor = AutoConf.versionMajor |
172 |
|
173 |
configMinor :: Int |
174 |
configMinor = AutoConf.versionMinor |
175 |
|
176 |
-- | The configuration is supposed to remain stable across |
177 |
-- revisions. Therefore, the revision number is cleared to '0'. |
178 |
configRevision :: Int |
179 |
configRevision = 0 |
180 |
|
181 |
configVersion :: Int |
182 |
configVersion = buildVersion configMajor configMinor configRevision |
183 |
|
184 |
-- | Similarly to the configuration (see 'configRevision'), the |
185 |
-- protocols are supposed to remain stable across revisions. |
186 |
protocolVersion :: Int |
187 |
protocolVersion = buildVersion configMajor configMinor configRevision |
188 |
|
189 |
-- * User separation |
190 |
|
191 |
daemonsGroup :: String |
192 |
daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup) |
193 |
|
194 |
adminGroup :: String |
195 |
adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup) |
196 |
|
197 |
masterdUser :: String |
198 |
masterdUser = Runtime.daemonUser GanetiMasterd |
199 |
|
200 |
masterdGroup :: String |
201 |
masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd) |
202 |
|
203 |
rapiUser :: String |
204 |
rapiUser = Runtime.daemonUser GanetiRapi |
205 |
|
206 |
rapiGroup :: String |
207 |
rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi) |
208 |
|
209 |
confdUser :: String |
210 |
confdUser = Runtime.daemonUser GanetiConfd |
211 |
|
212 |
confdGroup :: String |
213 |
confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd) |
214 |
|
215 |
luxidUser :: String |
216 |
luxidUser = Runtime.daemonUser GanetiLuxid |
217 |
|
218 |
luxidGroup :: String |
219 |
luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid) |
220 |
|
221 |
nodedUser :: String |
222 |
nodedUser = Runtime.daemonUser GanetiNoded |
223 |
|
224 |
nodedGroup :: String |
225 |
nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded) |
226 |
|
227 |
mondUser :: String |
228 |
mondUser = Runtime.daemonUser GanetiMond |
229 |
|
230 |
mondGroup :: String |
231 |
mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond) |
232 |
|
233 |
sshLoginUser :: String |
234 |
sshLoginUser = AutoConf.sshLoginUser |
235 |
|
236 |
sshConsoleUser :: String |
237 |
sshConsoleUser = AutoConf.sshConsoleUser |
238 |
|
239 |
-- * Cpu pinning separators and constants |
240 |
|
241 |
cpuPinningSep :: String |
242 |
cpuPinningSep = ":" |
243 |
|
244 |
cpuPinningAll :: String |
245 |
cpuPinningAll = "all" |
246 |
|
247 |
-- | Internal representation of "all" |
248 |
cpuPinningAllVal :: Int |
249 |
cpuPinningAllVal = -1 |
250 |
|
251 |
-- | One "all" entry in a CPU list means CPU pinning is off |
252 |
cpuPinningOff :: [Int] |
253 |
cpuPinningOff = [cpuPinningAllVal] |
254 |
|
255 |
-- | A Xen-specific implementation detail is that there is no way to |
256 |
-- actually say "use any cpu for pinning" in a Xen configuration file, |
257 |
-- as opposed to the command line, where you can say |
258 |
-- @ |
259 |
-- xm vcpu-pin <domain> <vcpu> all |
260 |
-- @ |
261 |
-- |
262 |
-- The workaround used in Xen is "0-63" (see source code function |
263 |
-- "xm_vcpu_pin" in @<xen-source>/tools/python/xen/xm/main.py@). |
264 |
-- |
265 |
-- To support future changes, the following constant is treated as a |
266 |
-- blackbox string that simply means "use any cpu for pinning under |
267 |
-- xen". |
268 |
cpuPinningAllXen :: String |
269 |
cpuPinningAllXen = "0-63" |
270 |
|
271 |
-- | A KVM-specific implementation detail - the following value is |
272 |
-- used to set CPU affinity to all processors (--0 through --31), per |
273 |
-- taskset man page. |
274 |
-- |
275 |
-- FIXME: This only works for machines with up to 32 CPU cores |
276 |
cpuPinningAllKvm :: Int |
277 |
cpuPinningAllKvm = 0xFFFFFFFF |
278 |
|
279 |
-- * Wipe |
280 |
|
281 |
ddCmd :: String |
282 |
ddCmd = "dd" |
283 |
|
284 |
-- | 1GB |
285 |
maxWipeChunk :: Int |
286 |
maxWipeChunk = 1024 |
287 |
|
288 |
minWipeChunkPercent :: Int |
289 |
minWipeChunkPercent = 10 |
290 |
|
291 |
-- * Directories |
292 |
|
293 |
runDirsMode :: Int |
294 |
runDirsMode = 0o775 |
295 |
|
296 |
secureDirMode :: Int |
297 |
secureDirMode = 0o700 |
298 |
|
299 |
secureFileMode :: Int |
300 |
secureFileMode = 0o600 |
301 |
|
302 |
adoptableBlockdevRoot :: String |
303 |
adoptableBlockdevRoot = "/dev/disk/" |
304 |
|
305 |
-- * 'autoconf' enable/disable |
306 |
|
307 |
enableConfd :: Bool |
308 |
enableConfd = AutoConf.enableConfd |
309 |
|
310 |
enableMond :: Bool |
311 |
enableMond = AutoConf.enableMond |
312 |
|
313 |
enableRestrictedCommands :: Bool |
314 |
enableRestrictedCommands = AutoConf.enableRestrictedCommands |
315 |
|
316 |
enableSplitQuery :: Bool |
317 |
enableSplitQuery = AutoConf.enableSplitQuery |
318 |
|
319 |
-- * SSH constants |
320 |
|
321 |
ssh :: String |
322 |
ssh = "ssh" |
323 |
|
324 |
scp :: String |
325 |
scp = "scp" |
326 |
|
327 |
-- * Daemons |
328 |
|
329 |
confd :: String |
330 |
confd = Runtime.daemonName GanetiConfd |
331 |
|
332 |
masterd :: String |
333 |
masterd = Runtime.daemonName GanetiMasterd |
334 |
|
335 |
mond :: String |
336 |
mond = Runtime.daemonName GanetiMond |
337 |
|
338 |
noded :: String |
339 |
noded = Runtime.daemonName GanetiNoded |
340 |
|
341 |
luxid :: String |
342 |
luxid = Runtime.daemonName GanetiLuxid |
343 |
|
344 |
rapi :: String |
345 |
rapi = Runtime.daemonName GanetiRapi |
346 |
|
347 |
daemons :: FrozenSet String |
348 |
daemons = |
349 |
ConstantUtils.mkSet [confd, |
350 |
luxid, |
351 |
masterd, |
352 |
mond, |
353 |
noded, |
354 |
rapi] |
355 |
|
356 |
defaultConfdPort :: Int |
357 |
defaultConfdPort = 1814 |
358 |
|
359 |
defaultMondPort :: Int |
360 |
defaultMondPort = 1815 |
361 |
|
362 |
defaultNodedPort :: Int |
363 |
defaultNodedPort = 1811 |
364 |
|
365 |
defaultRapiPort :: Int |
366 |
defaultRapiPort = 5080 |
367 |
|
368 |
daemonsPorts :: Map String (Protocol, Int) |
369 |
daemonsPorts = |
370 |
Map.fromList [(confd, (Udp, defaultConfdPort)), |
371 |
(mond, (Tcp, defaultMondPort)), |
372 |
(noded, (Tcp, defaultNodedPort)), |
373 |
(rapi, (Tcp, defaultRapiPort)), |
374 |
(ssh, (Tcp, 22))] |
375 |
|
376 |
firstDrbdPort :: Int |
377 |
firstDrbdPort = 11000 |
378 |
|
379 |
lastDrbdPort :: Int |
380 |
lastDrbdPort = 14999 |
381 |
|
382 |
daemonsLogbase :: Map String String |
383 |
daemonsLogbase = |
384 |
Map.fromList |
385 |
[ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ] |
386 |
|
387 |
daemonsExtraLogbase :: Map String (Map String String) |
388 |
daemonsExtraLogbase = |
389 |
Map.fromList $ |
390 |
map (Runtime.daemonName *** id) |
391 |
[ (GanetiMond, Map.fromList |
392 |
[ ("access", Runtime.daemonsExtraLogbase GanetiMond AccessLog) |
393 |
, ("error", Runtime.daemonsExtraLogbase GanetiMond ErrorLog) |
394 |
]) |
395 |
] |
396 |
|
397 |
extraLogreasonAccess :: String |
398 |
extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog |
399 |
|
400 |
extraLogreasonError :: String |
401 |
extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog |
402 |
|
403 |
devConsole :: String |
404 |
devConsole = ConstantUtils.devConsole |
405 |
|
406 |
procMounts :: String |
407 |
procMounts = "/proc/mounts" |
408 |
|
409 |
-- * Luxi (Local UniX Interface) related constants |
410 |
|
411 |
luxiEom :: PythonChar |
412 |
luxiEom = PythonChar '\x03' |
413 |
|
414 |
-- | Environment variable for the luxi override socket |
415 |
luxiOverride :: String |
416 |
luxiOverride = "FORCE_LUXI_SOCKET" |
417 |
|
418 |
luxiOverrideMaster :: String |
419 |
luxiOverrideMaster = "master" |
420 |
|
421 |
luxiOverrideQuery :: String |
422 |
luxiOverrideQuery = "query" |
423 |
|
424 |
luxiVersion :: Int |
425 |
luxiVersion = configVersion |
426 |
|
427 |
-- * Syslog |
428 |
|
429 |
syslogUsage :: String |
430 |
syslogUsage = AutoConf.syslogUsage |
431 |
|
432 |
syslogNo :: String |
433 |
syslogNo = Logging.syslogUsageToRaw SyslogNo |
434 |
|
435 |
syslogYes :: String |
436 |
syslogYes = Logging.syslogUsageToRaw SyslogYes |
437 |
|
438 |
syslogOnly :: String |
439 |
syslogOnly = Logging.syslogUsageToRaw SyslogOnly |
440 |
|
441 |
syslogSocket :: String |
442 |
syslogSocket = "/dev/log" |
443 |
|
444 |
exportConfFile :: String |
445 |
exportConfFile = "config.ini" |
446 |
|
447 |
-- * Xen |
448 |
|
449 |
xenBootloader :: String |
450 |
xenBootloader = AutoConf.xenBootloader |
451 |
|
452 |
xenCmdXl :: String |
453 |
xenCmdXl = "xl" |
454 |
|
455 |
xenCmdXm :: String |
456 |
xenCmdXm = "xm" |
457 |
|
458 |
xenInitrd :: String |
459 |
xenInitrd = AutoConf.xenInitrd |
460 |
|
461 |
xenKernel :: String |
462 |
xenKernel = AutoConf.xenKernel |
463 |
|
464 |
-- FIXME: perhaps rename to 'validXenCommands' for consistency with |
465 |
-- other constants |
466 |
knownXenCommands :: FrozenSet String |
467 |
knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm] |
468 |
|
469 |
-- * KVM and socat |
470 |
|
471 |
kvmPath :: String |
472 |
kvmPath = AutoConf.kvmPath |
473 |
|
474 |
kvmKernel :: String |
475 |
kvmKernel = AutoConf.kvmKernel |
476 |
|
477 |
socatEscapeCode :: String |
478 |
socatEscapeCode = "0x1d" |
479 |
|
480 |
socatPath :: String |
481 |
socatPath = AutoConf.socatPath |
482 |
|
483 |
socatUseCompress :: Bool |
484 |
socatUseCompress = AutoConf.socatUseCompress |
485 |
|
486 |
socatUseEscape :: Bool |
487 |
socatUseEscape = AutoConf.socatUseEscape |
488 |
|
489 |
-- * Console types |
490 |
|
491 |
-- | Display a message for console access |
492 |
consMessage :: String |
493 |
consMessage = "msg" |
494 |
|
495 |
-- | Console as SPICE server |
496 |
consSpice :: String |
497 |
consSpice = "spice" |
498 |
|
499 |
-- | Console as SSH command |
500 |
consSsh :: String |
501 |
consSsh = "ssh" |
502 |
|
503 |
-- | Console as VNC server |
504 |
consVnc :: String |
505 |
consVnc = "vnc" |
506 |
|
507 |
consAll :: FrozenSet String |
508 |
consAll = ConstantUtils.mkSet [consMessage, consSpice, consSsh, consVnc] |
509 |
|
510 |
-- | RSA key bit length |
511 |
-- |
512 |
-- For RSA keys more bits are better, but they also make operations |
513 |
-- more expensive. NIST SP 800-131 recommends a minimum of 2048 bits |
514 |
-- from the year 2010 on. |
515 |
rsaKeyBits :: Int |
516 |
rsaKeyBits = 2048 |
517 |
|
518 |
-- | Ciphers allowed for SSL connections. |
519 |
-- |
520 |
-- For the format, see ciphers(1). A better way to disable ciphers |
521 |
-- would be to use the exclamation mark (!), but socat versions below |
522 |
-- 1.5 can't parse exclamation marks in options properly. When |
523 |
-- modifying the ciphers, ensure not to accidentially add something |
524 |
-- after it's been removed. Use the "openssl" utility to check the |
525 |
-- allowed ciphers, e.g. "openssl ciphers -v HIGH:-DES". |
526 |
opensslCiphers :: String |
527 |
opensslCiphers = "HIGH:-DES:-3DES:-EXPORT:-ADH" |
528 |
|
529 |
-- * X509 |
530 |
|
531 |
-- | commonName (CN) used in certificates |
532 |
x509CertCn :: String |
533 |
x509CertCn = "ganeti.example.com" |
534 |
|
535 |
-- | Default validity of certificates in days |
536 |
x509CertDefaultValidity :: Int |
537 |
x509CertDefaultValidity = 365 * 5 |
538 |
|
539 |
x509CertSignatureHeader :: String |
540 |
x509CertSignatureHeader = "X-Ganeti-Signature" |
541 |
|
542 |
-- | Digest used to sign certificates ("openssl x509" uses SHA1 by default) |
543 |
x509CertSignDigest :: String |
544 |
x509CertSignDigest = "SHA1" |
545 |
|
546 |
-- * Import/export daemon mode |
547 |
|
548 |
iemExport :: String |
549 |
iemExport = "export" |
550 |
|
551 |
iemImport :: String |
552 |
iemImport = "import" |
553 |
|
554 |
-- * Import/export transport compression |
555 |
|
556 |
iecGzip :: String |
557 |
iecGzip = "gzip" |
558 |
|
559 |
iecNone :: String |
560 |
iecNone = "none" |
561 |
|
562 |
iecAll :: [String] |
563 |
iecAll = [iecGzip, iecNone] |
564 |
|
565 |
ieCustomSize :: String |
566 |
ieCustomSize = "fd" |
567 |
|
568 |
-- * Import/export I/O |
569 |
|
570 |
-- | Direct file I/O, equivalent to a shell's I/O redirection using |
571 |
-- '<' or '>' |
572 |
ieioFile :: String |
573 |
ieioFile = "file" |
574 |
|
575 |
-- | Raw block device I/O using "dd" |
576 |
ieioRawDisk :: String |
577 |
ieioRawDisk = "raw" |
578 |
|
579 |
-- | OS definition import/export script |
580 |
ieioScript :: String |
581 |
ieioScript = "script" |
582 |
|
583 |
-- * Values |
584 |
|
585 |
valueDefault :: String |
586 |
valueDefault = "default" |
587 |
|
588 |
valueAuto :: String |
589 |
valueAuto = "auto" |
590 |
|
591 |
valueGenerate :: String |
592 |
valueGenerate = "generate" |
593 |
|
594 |
valueNone :: String |
595 |
valueNone = "none" |
596 |
|
597 |
valueTrue :: String |
598 |
valueTrue = "true" |
599 |
|
600 |
valueFalse :: String |
601 |
valueFalse = "false" |
602 |
|
603 |
valueHsNothing :: Map String PythonNone |
604 |
valueHsNothing = Map.fromList [("Nothing", PythonNone)] |
605 |
|
606 |
-- * Hooks |
607 |
|
608 |
hooksNameCfgupdate :: String |
609 |
hooksNameCfgupdate = "config-update" |
610 |
|
611 |
hooksNameWatcher :: String |
612 |
hooksNameWatcher = "watcher" |
613 |
|
614 |
hooksPath :: String |
615 |
hooksPath = "/sbin:/bin:/usr/sbin:/usr/bin" |
616 |
|
617 |
hooksPhasePost :: String |
618 |
hooksPhasePost = "post" |
619 |
|
620 |
hooksPhasePre :: String |
621 |
hooksPhasePre = "pre" |
622 |
|
623 |
hooksVersion :: Int |
624 |
hooksVersion = 2 |
625 |
|
626 |
-- * Hooks subject type (what object type does the LU deal with) |
627 |
|
628 |
htypeCluster :: String |
629 |
htypeCluster = "CLUSTER" |
630 |
|
631 |
htypeGroup :: String |
632 |
htypeGroup = "GROUP" |
633 |
|
634 |
htypeInstance :: String |
635 |
htypeInstance = "INSTANCE" |
636 |
|
637 |
htypeNetwork :: String |
638 |
htypeNetwork = "NETWORK" |
639 |
|
640 |
htypeNode :: String |
641 |
htypeNode = "NODE" |
642 |
|
643 |
-- * Hkr |
644 |
|
645 |
hkrSkip :: Int |
646 |
hkrSkip = 0 |
647 |
|
648 |
hkrFail :: Int |
649 |
hkrFail = 1 |
650 |
|
651 |
hkrSuccess :: Int |
652 |
hkrSuccess = 2 |
653 |
|
654 |
-- * Storage types |
655 |
|
656 |
stBlock :: String |
657 |
stBlock = Types.storageTypeToRaw StorageBlock |
658 |
|
659 |
stDiskless :: String |
660 |
stDiskless = Types.storageTypeToRaw StorageDiskless |
661 |
|
662 |
stExt :: String |
663 |
stExt = Types.storageTypeToRaw StorageExt |
664 |
|
665 |
stFile :: String |
666 |
stFile = Types.storageTypeToRaw StorageFile |
667 |
|
668 |
stLvmPv :: String |
669 |
stLvmPv = Types.storageTypeToRaw StorageLvmPv |
670 |
|
671 |
stLvmVg :: String |
672 |
stLvmVg = Types.storageTypeToRaw StorageLvmVg |
673 |
|
674 |
stRados :: String |
675 |
stRados = Types.storageTypeToRaw StorageRados |
676 |
|
677 |
storageTypes :: FrozenSet String |
678 |
storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..] |
679 |
|
680 |
-- | The set of storage types for which storage reporting is available |
681 |
-- |
682 |
-- FIXME: Remove this, once storage reporting is available for all |
683 |
-- types. |
684 |
stsReport :: FrozenSet String |
685 |
stsReport = ConstantUtils.mkSet [stFile, stLvmPv, stLvmVg] |
686 |
|
687 |
-- * Storage fields |
688 |
-- ** First two are valid in LU context only, not passed to backend |
689 |
|
690 |
sfNode :: String |
691 |
sfNode = "node" |
692 |
|
693 |
sfType :: String |
694 |
sfType = "type" |
695 |
|
696 |
-- ** and the rest are valid in backend |
697 |
|
698 |
sfAllocatable :: String |
699 |
sfAllocatable = Types.storageFieldToRaw SFAllocatable |
700 |
|
701 |
sfFree :: String |
702 |
sfFree = Types.storageFieldToRaw SFFree |
703 |
|
704 |
sfName :: String |
705 |
sfName = Types.storageFieldToRaw SFName |
706 |
|
707 |
sfSize :: String |
708 |
sfSize = Types.storageFieldToRaw SFSize |
709 |
|
710 |
sfUsed :: String |
711 |
sfUsed = Types.storageFieldToRaw SFUsed |
712 |
|
713 |
validStorageFields :: FrozenSet String |
714 |
validStorageFields = |
715 |
ConstantUtils.mkSet $ map Types.storageFieldToRaw [minBound..] ++ |
716 |
[sfNode, sfType] |
717 |
|
718 |
modifiableStorageFields :: Map String (FrozenSet String) |
719 |
modifiableStorageFields = |
720 |
Map.fromList [(Types.storageTypeToRaw StorageLvmPv, |
721 |
ConstantUtils.mkSet [sfAllocatable])] |
722 |
|
723 |
-- * Storage operations |
724 |
|
725 |
soFixConsistency :: String |
726 |
soFixConsistency = "fix-consistency" |
727 |
|
728 |
validStorageOperations :: Map String (FrozenSet String) |
729 |
validStorageOperations = |
730 |
Map.fromList [(Types.storageTypeToRaw StorageLvmVg, |
731 |
ConstantUtils.mkSet [soFixConsistency])] |
732 |
|
733 |
-- * Volume fields |
734 |
|
735 |
vfDev :: String |
736 |
vfDev = "dev" |
737 |
|
738 |
vfInstance :: String |
739 |
vfInstance = "instance" |
740 |
|
741 |
vfName :: String |
742 |
vfName = "name" |
743 |
|
744 |
vfNode :: String |
745 |
vfNode = "node" |
746 |
|
747 |
vfPhys :: String |
748 |
vfPhys = "phys" |
749 |
|
750 |
vfSize :: String |
751 |
vfSize = "size" |
752 |
|
753 |
vfVg :: String |
754 |
vfVg = "vg" |
755 |
|
756 |
-- * Local disk status |
757 |
|
758 |
ldsFaulty :: Int |
759 |
ldsFaulty = Types.localDiskStatusToRaw DiskStatusFaulty |
760 |
|
761 |
ldsOkay :: Int |
762 |
ldsOkay = Types.localDiskStatusToRaw DiskStatusOk |
763 |
|
764 |
ldsUnknown :: Int |
765 |
ldsUnknown = Types.localDiskStatusToRaw DiskStatusUnknown |
766 |
|
767 |
ldsNames :: Map Int String |
768 |
ldsNames = |
769 |
Map.fromList [ (Types.localDiskStatusToRaw ds, |
770 |
localDiskStatusName ds) | ds <- [minBound..] ] |
771 |
|
772 |
-- * Disk template types |
773 |
|
774 |
dtDiskless :: String |
775 |
dtDiskless = Types.diskTemplateToRaw DTDiskless |
776 |
|
777 |
dtFile :: String |
778 |
dtFile = Types.diskTemplateToRaw DTFile |
779 |
|
780 |
dtSharedFile :: String |
781 |
dtSharedFile = Types.diskTemplateToRaw DTSharedFile |
782 |
|
783 |
dtPlain :: String |
784 |
dtPlain = Types.diskTemplateToRaw DTPlain |
785 |
|
786 |
dtBlock :: String |
787 |
dtBlock = Types.diskTemplateToRaw DTBlock |
788 |
|
789 |
dtDrbd8 :: String |
790 |
dtDrbd8 = Types.diskTemplateToRaw DTDrbd8 |
791 |
|
792 |
dtRbd :: String |
793 |
dtRbd = Types.diskTemplateToRaw DTRbd |
794 |
|
795 |
dtExt :: String |
796 |
dtExt = Types.diskTemplateToRaw DTExt |
797 |
|
798 |
-- | This is used to order determine the default disk template when |
799 |
-- the list of enabled disk templates is inferred from the current |
800 |
-- state of the cluster. This only happens on an upgrade from a |
801 |
-- version of Ganeti that did not support the 'enabled_disk_templates' |
802 |
-- so far. |
803 |
diskTemplatePreference :: [String] |
804 |
diskTemplatePreference = |
805 |
map Types.diskTemplateToRaw |
806 |
[DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile] |
807 |
|
808 |
diskTemplates :: FrozenSet String |
809 |
diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..] |
810 |
|
811 |
-- | Disk templates that are enabled by default |
812 |
defaultEnabledDiskTemplates :: [String] |
813 |
defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain] |
814 |
|
815 |
-- | Mapping of disk templates to storage types |
816 |
mapDiskTemplateStorageType :: Map String String |
817 |
mapDiskTemplateStorageType = |
818 |
Map.fromList $ |
819 |
map (Types.diskTemplateToRaw *** Types.storageTypeToRaw) |
820 |
[(DTBlock, StorageBlock), |
821 |
(DTDrbd8, StorageLvmVg), |
822 |
(DTExt, StorageExt), |
823 |
(DTSharedFile, StorageFile), |
824 |
(DTFile, StorageFile), |
825 |
(DTDiskless, StorageDiskless), |
826 |
(DTPlain, StorageLvmVg), |
827 |
(DTRbd, StorageRados)] |
828 |
|
829 |
-- | The set of network-mirrored disk templates |
830 |
dtsIntMirror :: FrozenSet String |
831 |
dtsIntMirror = ConstantUtils.mkSet [dtDrbd8] |
832 |
|
833 |
-- | 'DTDiskless' is 'trivially' externally mirrored |
834 |
dtsExtMirror :: FrozenSet String |
835 |
dtsExtMirror = |
836 |
ConstantUtils.mkSet $ |
837 |
map Types.diskTemplateToRaw [DTDiskless, DTBlock, DTExt, DTSharedFile, DTRbd] |
838 |
|
839 |
-- | The set of non-lvm-based disk templates |
840 |
dtsNotLvm :: FrozenSet String |
841 |
dtsNotLvm = |
842 |
ConstantUtils.mkSet $ |
843 |
map Types.diskTemplateToRaw |
844 |
[DTSharedFile, DTDiskless, DTBlock, DTExt, DTFile, DTRbd] |
845 |
|
846 |
-- | The set of disk templates which can be grown |
847 |
dtsGrowable :: FrozenSet String |
848 |
dtsGrowable = |
849 |
ConstantUtils.mkSet $ |
850 |
map Types.diskTemplateToRaw |
851 |
[DTSharedFile, DTDrbd8, DTPlain, DTExt, DTFile, DTRbd] |
852 |
|
853 |
-- | The set of disk templates that allow adoption |
854 |
dtsMayAdopt :: FrozenSet String |
855 |
dtsMayAdopt = |
856 |
ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTBlock, DTPlain] |
857 |
|
858 |
-- | The set of disk templates that *must* use adoption |
859 |
dtsMustAdopt :: FrozenSet String |
860 |
dtsMustAdopt = ConstantUtils.mkSet [Types.diskTemplateToRaw DTBlock] |
861 |
|
862 |
-- | The set of disk templates that allow migrations |
863 |
dtsMirrored :: FrozenSet String |
864 |
dtsMirrored = dtsIntMirror `ConstantUtils.union` dtsExtMirror |
865 |
|
866 |
-- | The set of file based disk templates |
867 |
dtsFilebased :: FrozenSet String |
868 |
dtsFilebased = |
869 |
ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTSharedFile, DTFile] |
870 |
|
871 |
-- | The set of disk templates that can be moved by copying |
872 |
-- |
873 |
-- Note: a requirement is that they're not accessed externally or |
874 |
-- shared between nodes; in particular, sharedfile is not suitable. |
875 |
dtsCopyable :: FrozenSet String |
876 |
dtsCopyable = |
877 |
ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain, DTFile] |
878 |
|
879 |
-- | The set of disk templates that are supported by exclusive_storage |
880 |
dtsExclStorage :: FrozenSet String |
881 |
dtsExclStorage = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain] |
882 |
|
883 |
-- | Templates for which we don't perform checks on free space |
884 |
dtsNoFreeSpaceCheck :: FrozenSet String |
885 |
dtsNoFreeSpaceCheck = |
886 |
ConstantUtils.mkSet $ |
887 |
map Types.diskTemplateToRaw [DTExt, DTSharedFile, DTFile, DTRbd] |
888 |
|
889 |
dtsBlock :: FrozenSet String |
890 |
dtsBlock = |
891 |
ConstantUtils.mkSet $ |
892 |
map Types.diskTemplateToRaw [DTPlain, DTDrbd8, DTBlock, DTRbd, DTExt] |
893 |
|
894 |
-- | The set of lvm-based disk templates |
895 |
dtsLvm :: FrozenSet String |
896 |
dtsLvm = diskTemplates `ConstantUtils.difference` dtsNotLvm |
897 |
|
898 |
-- * Drbd |
899 |
|
900 |
drbdHmacAlg :: String |
901 |
drbdHmacAlg = "md5" |
902 |
|
903 |
drbdDefaultNetProtocol :: String |
904 |
drbdDefaultNetProtocol = "C" |
905 |
|
906 |
drbdMigrationNetProtocol :: String |
907 |
drbdMigrationNetProtocol = "C" |
908 |
|
909 |
drbdStatusFile :: String |
910 |
drbdStatusFile = "/proc/drbd" |
911 |
|
912 |
-- | Size of DRBD meta block device |
913 |
drbdMetaSize :: Int |
914 |
drbdMetaSize = 128 |
915 |
|
916 |
-- * Drbd barrier types |
917 |
|
918 |
drbdBDiskBarriers :: String |
919 |
drbdBDiskBarriers = "b" |
920 |
|
921 |
drbdBDiskDrain :: String |
922 |
drbdBDiskDrain = "d" |
923 |
|
924 |
drbdBDiskFlush :: String |
925 |
drbdBDiskFlush = "f" |
926 |
|
927 |
drbdBNone :: String |
928 |
drbdBNone = "n" |
929 |
|
930 |
-- | Valid barrier combinations: "n" or any non-null subset of "bfd" |
931 |
drbdValidBarrierOpt :: FrozenSet (FrozenSet String) |
932 |
drbdValidBarrierOpt = |
933 |
ConstantUtils.mkSet |
934 |
[ ConstantUtils.mkSet [drbdBNone] |
935 |
, ConstantUtils.mkSet [drbdBDiskBarriers] |
936 |
, ConstantUtils.mkSet [drbdBDiskDrain] |
937 |
, ConstantUtils.mkSet [drbdBDiskFlush] |
938 |
, ConstantUtils.mkSet [drbdBDiskDrain, drbdBDiskFlush] |
939 |
, ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskDrain] |
940 |
, ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskFlush] |
941 |
, ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskFlush, drbdBDiskDrain] |
942 |
] |
943 |
|
944 |
-- | Rbd tool command |
945 |
rbdCmd :: String |
946 |
rbdCmd = "rbd" |
947 |
|
948 |
-- * File backend driver |
949 |
|
950 |
fdBlktap :: String |
951 |
fdBlktap = Types.fileDriverToRaw FileBlktap |
952 |
|
953 |
fdLoop :: String |
954 |
fdLoop = Types.fileDriverToRaw FileLoop |
955 |
|
956 |
fileDriver :: FrozenSet String |
957 |
fileDriver = |
958 |
ConstantUtils.mkSet $ |
959 |
map Types.fileDriverToRaw [minBound..] |
960 |
|
961 |
-- | The set of drbd-like disk types |
962 |
dtsDrbd :: FrozenSet String |
963 |
dtsDrbd = ConstantUtils.mkSet [Types.diskTemplateToRaw DTDrbd8] |
964 |
|
965 |
-- * Disk access mode |
966 |
|
967 |
diskRdonly :: String |
968 |
diskRdonly = Types.diskModeToRaw DiskRdOnly |
969 |
|
970 |
diskRdwr :: String |
971 |
diskRdwr = Types.diskModeToRaw DiskRdWr |
972 |
|
973 |
diskAccessSet :: FrozenSet String |
974 |
diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..] |
975 |
|
976 |
-- * Disk replacement mode |
977 |
|
978 |
replaceDiskAuto :: String |
979 |
replaceDiskAuto = Types.replaceDisksModeToRaw ReplaceAuto |
980 |
|
981 |
replaceDiskChg :: String |
982 |
replaceDiskChg = Types.replaceDisksModeToRaw ReplaceNewSecondary |
983 |
|
984 |
replaceDiskPri :: String |
985 |
replaceDiskPri = Types.replaceDisksModeToRaw ReplaceOnPrimary |
986 |
|
987 |
replaceDiskSec :: String |
988 |
replaceDiskSec = Types.replaceDisksModeToRaw ReplaceOnSecondary |
989 |
|
990 |
replaceModes :: FrozenSet String |
991 |
replaceModes = |
992 |
ConstantUtils.mkSet $ map Types.replaceDisksModeToRaw [minBound..] |
993 |
|
994 |
-- * Instance export mode |
995 |
|
996 |
exportModeLocal :: String |
997 |
exportModeLocal = Types.exportModeToRaw ExportModeLocal |
998 |
|
999 |
exportModeRemote :: String |
1000 |
exportModeRemote = Types.exportModeToRaw ExportModeRemote |
1001 |
|
1002 |
exportModes :: FrozenSet String |
1003 |
exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..] |
1004 |
|
1005 |
-- * Instance creation modes |
1006 |
|
1007 |
instanceCreate :: String |
1008 |
instanceCreate = Types.instCreateModeToRaw InstCreate |
1009 |
|
1010 |
instanceImport :: String |
1011 |
instanceImport = Types.instCreateModeToRaw InstImport |
1012 |
|
1013 |
instanceRemoteImport :: String |
1014 |
instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport |
1015 |
|
1016 |
instanceCreateModes :: FrozenSet String |
1017 |
instanceCreateModes = |
1018 |
ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..] |
1019 |
|
1020 |
-- * Remote import/export handshake message and version |
1021 |
|
1022 |
rieHandshake :: String |
1023 |
rieHandshake = "Hi, I'm Ganeti" |
1024 |
|
1025 |
rieVersion :: Int |
1026 |
rieVersion = 0 |
1027 |
|
1028 |
-- | Remote import/export certificate validity (seconds) |
1029 |
rieCertValidity :: Int |
1030 |
rieCertValidity = 24 * 60 * 60 |
1031 |
|
1032 |
-- | Export only: how long to wait per connection attempt (seconds) |
1033 |
rieConnectAttemptTimeout :: Int |
1034 |
rieConnectAttemptTimeout = 20 |
1035 |
|
1036 |
-- | Export only: number of attempts to connect |
1037 |
rieConnectRetries :: Int |
1038 |
rieConnectRetries = 10 |
1039 |
|
1040 |
-- | Overall timeout for establishing connection |
1041 |
rieConnectTimeout :: Int |
1042 |
rieConnectTimeout = 180 |
1043 |
|
1044 |
-- | Give child process up to 5 seconds to exit after sending a signal |
1045 |
childLingerTimeout :: Double |
1046 |
childLingerTimeout = 5.0 |
1047 |
|
1048 |
-- * Import/export config options |
1049 |
|
1050 |
inisectBep :: String |
1051 |
inisectBep = "backend" |
1052 |
|
1053 |
inisectExp :: String |
1054 |
inisectExp = "export" |
1055 |
|
1056 |
inisectHyp :: String |
1057 |
inisectHyp = "hypervisor" |
1058 |
|
1059 |
inisectIns :: String |
1060 |
inisectIns = "instance" |
1061 |
|
1062 |
inisectOsp :: String |
1063 |
inisectOsp = "os" |
1064 |
|
1065 |
-- * Dynamic device modification |
1066 |
|
1067 |
ddmAdd :: String |
1068 |
ddmAdd = Types.ddmFullToRaw DdmFullAdd |
1069 |
|
1070 |
ddmModify :: String |
1071 |
ddmModify = Types.ddmFullToRaw DdmFullModify |
1072 |
|
1073 |
ddmRemove :: String |
1074 |
ddmRemove = Types.ddmFullToRaw DdmFullRemove |
1075 |
|
1076 |
ddmsValues :: FrozenSet String |
1077 |
ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove] |
1078 |
|
1079 |
ddmsValuesWithModify :: FrozenSet String |
1080 |
ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..] |
1081 |
|
1082 |
-- * Common exit codes |
1083 |
|
1084 |
exitSuccess :: Int |
1085 |
exitSuccess = 0 |
1086 |
|
1087 |
exitFailure :: Int |
1088 |
exitFailure = ConstantUtils.exitFailure |
1089 |
|
1090 |
exitNotcluster :: Int |
1091 |
exitNotcluster = 5 |
1092 |
|
1093 |
exitNotmaster :: Int |
1094 |
exitNotmaster = 11 |
1095 |
|
1096 |
exitNodesetupError :: Int |
1097 |
exitNodesetupError = 12 |
1098 |
|
1099 |
-- | Need user confirmation |
1100 |
exitConfirmation :: Int |
1101 |
exitConfirmation = 13 |
1102 |
|
1103 |
-- | Exit code for query operations with unknown fields |
1104 |
exitUnknownField :: Int |
1105 |
exitUnknownField = 14 |
1106 |
|
1107 |
-- * Tags |
1108 |
|
1109 |
tagCluster :: String |
1110 |
tagCluster = Types.tagKindToRaw TagKindCluster |
1111 |
|
1112 |
tagInstance :: String |
1113 |
tagInstance = Types.tagKindToRaw TagKindInstance |
1114 |
|
1115 |
tagNetwork :: String |
1116 |
tagNetwork = Types.tagKindToRaw TagKindNetwork |
1117 |
|
1118 |
tagNode :: String |
1119 |
tagNode = Types.tagKindToRaw TagKindNode |
1120 |
|
1121 |
tagNodegroup :: String |
1122 |
tagNodegroup = Types.tagKindToRaw TagKindGroup |
1123 |
|
1124 |
validTagTypes :: FrozenSet String |
1125 |
validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..] |
1126 |
|
1127 |
maxTagLen :: Int |
1128 |
maxTagLen = 128 |
1129 |
|
1130 |
maxTagsPerObj :: Int |
1131 |
maxTagsPerObj = 4096 |
1132 |
|
1133 |
-- * Others |
1134 |
|
1135 |
defaultBridge :: String |
1136 |
defaultBridge = "xen-br0" |
1137 |
|
1138 |
defaultOvs :: String |
1139 |
defaultOvs = "switch1" |
1140 |
|
1141 |
-- | 60 MiB/s, expressed in KiB/s |
1142 |
classicDrbdSyncSpeed :: Int |
1143 |
classicDrbdSyncSpeed = 60 * 1024 |
1144 |
|
1145 |
ip4AddressAny :: String |
1146 |
ip4AddressAny = "0.0.0.0" |
1147 |
|
1148 |
ip4AddressLocalhost :: String |
1149 |
ip4AddressLocalhost = "127.0.0.1" |
1150 |
|
1151 |
ip6AddressAny :: String |
1152 |
ip6AddressAny = "::" |
1153 |
|
1154 |
ip6AddressLocalhost :: String |
1155 |
ip6AddressLocalhost = "::1" |
1156 |
|
1157 |
ip4Version :: Int |
1158 |
ip4Version = 4 |
1159 |
|
1160 |
ip6Version :: Int |
1161 |
ip6Version = 6 |
1162 |
|
1163 |
validIpVersions :: FrozenSet Int |
1164 |
validIpVersions = ConstantUtils.mkSet [ip4Version, ip6Version] |
1165 |
|
1166 |
tcpPingTimeout :: Int |
1167 |
tcpPingTimeout = 10 |
1168 |
|
1169 |
defaultVg :: String |
1170 |
defaultVg = "xenvg" |
1171 |
|
1172 |
defaultDrbdHelper :: String |
1173 |
defaultDrbdHelper = "/bin/true" |
1174 |
|
1175 |
minVgSize :: Int |
1176 |
minVgSize = 20480 |
1177 |
|
1178 |
defaultMacPrefix :: String |
1179 |
defaultMacPrefix = "aa:00:00" |
1180 |
|
1181 |
-- | Default maximum instance wait time (seconds) |
1182 |
defaultShutdownTimeout :: Int |
1183 |
defaultShutdownTimeout = 120 |
1184 |
|
1185 |
-- | Node clock skew (seconds) |
1186 |
nodeMaxClockSkew :: Int |
1187 |
nodeMaxClockSkew = 150 |
1188 |
|
1189 |
-- | Time for an intra-cluster disk transfer to wait for a connection |
1190 |
diskTransferConnectTimeout :: Int |
1191 |
diskTransferConnectTimeout = 60 |
1192 |
|
1193 |
-- | Disk index separator |
1194 |
diskSeparator :: String |
1195 |
diskSeparator = AutoConf.diskSeparator |
1196 |
|
1197 |
ipCommandPath :: String |
1198 |
ipCommandPath = AutoConf.ipPath |
1199 |
|
1200 |
-- | Key for job IDs in opcode result |
1201 |
jobIdsKey :: String |
1202 |
jobIdsKey = "jobs" |
1203 |
|
1204 |
-- * Runparts results |
1205 |
|
1206 |
runpartsErr :: Int |
1207 |
runpartsErr = 2 |
1208 |
|
1209 |
runpartsRun :: Int |
1210 |
runpartsRun = 1 |
1211 |
|
1212 |
runpartsSkip :: Int |
1213 |
runpartsSkip = 0 |
1214 |
|
1215 |
runpartsStatus :: [Int] |
1216 |
runpartsStatus = [runpartsErr, runpartsRun, runpartsSkip] |
1217 |
|
1218 |
-- * RPC |
1219 |
|
1220 |
rpcEncodingNone :: Int |
1221 |
rpcEncodingNone = 0 |
1222 |
|
1223 |
rpcEncodingZlibBase64 :: Int |
1224 |
rpcEncodingZlibBase64 = 1 |
1225 |
|
1226 |
-- * Timeout table |
1227 |
-- |
1228 |
-- Various time constants for the timeout table |
1229 |
|
1230 |
rpcTmoUrgent :: Int |
1231 |
rpcTmoUrgent = Types.rpcTimeoutToRaw Urgent |
1232 |
|
1233 |
rpcTmoFast :: Int |
1234 |
rpcTmoFast = Types.rpcTimeoutToRaw Fast |
1235 |
|
1236 |
rpcTmoNormal :: Int |
1237 |
rpcTmoNormal = Types.rpcTimeoutToRaw Normal |
1238 |
|
1239 |
rpcTmoSlow :: Int |
1240 |
rpcTmoSlow = Types.rpcTimeoutToRaw Slow |
1241 |
|
1242 |
-- | 'rpcTmo_4hrs' contains an underscore to circumvent a limitation |
1243 |
-- in the 'Ganeti.THH.deCamelCase' function and generate the correct |
1244 |
-- Python name. |
1245 |
rpcTmo_4hrs :: Int |
1246 |
rpcTmo_4hrs = Types.rpcTimeoutToRaw FourHours |
1247 |
|
1248 |
-- | 'rpcTmo_1day' contains an underscore to circumvent a limitation |
1249 |
-- in the 'Ganeti.THH.deCamelCase' function and generate the correct |
1250 |
-- Python name. |
1251 |
rpcTmo_1day :: Int |
1252 |
rpcTmo_1day = Types.rpcTimeoutToRaw OneDay |
1253 |
|
1254 |
-- | Timeout for connecting to nodes (seconds) |
1255 |
rpcConnectTimeout :: Int |
1256 |
rpcConnectTimeout = 5 |
1257 |
|
1258 |
-- OS |
1259 |
|
1260 |
osScriptCreate :: String |
1261 |
osScriptCreate = "create" |
1262 |
|
1263 |
osScriptExport :: String |
1264 |
osScriptExport = "export" |
1265 |
|
1266 |
osScriptImport :: String |
1267 |
osScriptImport = "import" |
1268 |
|
1269 |
osScriptRename :: String |
1270 |
osScriptRename = "rename" |
1271 |
|
1272 |
osScriptVerify :: String |
1273 |
osScriptVerify = "verify" |
1274 |
|
1275 |
osScripts :: [String] |
1276 |
osScripts = [osScriptCreate, osScriptExport, osScriptImport, osScriptRename, |
1277 |
osScriptVerify] |
1278 |
|
1279 |
osApiFile :: String |
1280 |
osApiFile = "ganeti_api_version" |
1281 |
|
1282 |
osVariantsFile :: String |
1283 |
osVariantsFile = "variants.list" |
1284 |
|
1285 |
osParametersFile :: String |
1286 |
osParametersFile = "parameters.list" |
1287 |
|
1288 |
osValidateParameters :: String |
1289 |
osValidateParameters = "parameters" |
1290 |
|
1291 |
osValidateCalls :: FrozenSet String |
1292 |
osValidateCalls = ConstantUtils.mkSet [osValidateParameters] |
1293 |
|
1294 |
-- | External Storage (ES) related constants |
1295 |
|
1296 |
esActionAttach :: String |
1297 |
esActionAttach = "attach" |
1298 |
|
1299 |
esActionCreate :: String |
1300 |
esActionCreate = "create" |
1301 |
|
1302 |
esActionDetach :: String |
1303 |
esActionDetach = "detach" |
1304 |
|
1305 |
esActionGrow :: String |
1306 |
esActionGrow = "grow" |
1307 |
|
1308 |
esActionRemove :: String |
1309 |
esActionRemove = "remove" |
1310 |
|
1311 |
esActionSetinfo :: String |
1312 |
esActionSetinfo = "setinfo" |
1313 |
|
1314 |
esActionVerify :: String |
1315 |
esActionVerify = "verify" |
1316 |
|
1317 |
esScriptCreate :: String |
1318 |
esScriptCreate = esActionCreate |
1319 |
|
1320 |
esScriptRemove :: String |
1321 |
esScriptRemove = esActionRemove |
1322 |
|
1323 |
esScriptGrow :: String |
1324 |
esScriptGrow = esActionGrow |
1325 |
|
1326 |
esScriptAttach :: String |
1327 |
esScriptAttach = esActionAttach |
1328 |
|
1329 |
esScriptDetach :: String |
1330 |
esScriptDetach = esActionDetach |
1331 |
|
1332 |
esScriptSetinfo :: String |
1333 |
esScriptSetinfo = esActionSetinfo |
1334 |
|
1335 |
esScriptVerify :: String |
1336 |
esScriptVerify = esActionVerify |
1337 |
|
1338 |
esScripts :: FrozenSet String |
1339 |
esScripts = |
1340 |
ConstantUtils.mkSet [esScriptAttach, |
1341 |
esScriptCreate, |
1342 |
esScriptDetach, |
1343 |
esScriptGrow, |
1344 |
esScriptRemove, |
1345 |
esScriptSetinfo, |
1346 |
esScriptVerify] |
1347 |
|
1348 |
esParametersFile :: String |
1349 |
esParametersFile = "parameters.list" |
1350 |
|
1351 |
-- * Reboot types |
1352 |
|
1353 |
instanceRebootSoft :: String |
1354 |
instanceRebootSoft = Types.rebootTypeToRaw RebootSoft |
1355 |
|
1356 |
instanceRebootHard :: String |
1357 |
instanceRebootHard = Types.rebootTypeToRaw RebootHard |
1358 |
|
1359 |
instanceRebootFull :: String |
1360 |
instanceRebootFull = Types.rebootTypeToRaw RebootFull |
1361 |
|
1362 |
rebootTypes :: FrozenSet String |
1363 |
rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..] |
1364 |
|
1365 |
-- * Instance reboot behaviors |
1366 |
|
1367 |
instanceRebootAllowed :: String |
1368 |
instanceRebootAllowed = "reboot" |
1369 |
|
1370 |
instanceRebootExit :: String |
1371 |
instanceRebootExit = "exit" |
1372 |
|
1373 |
rebootBehaviors :: [String] |
1374 |
rebootBehaviors = [instanceRebootAllowed, instanceRebootExit] |
1375 |
|
1376 |
-- * VTypes |
1377 |
|
1378 |
vtypeBool :: VType |
1379 |
vtypeBool = VTypeBool |
1380 |
|
1381 |
vtypeInt :: VType |
1382 |
vtypeInt = VTypeInt |
1383 |
|
1384 |
vtypeMaybeString :: VType |
1385 |
vtypeMaybeString = VTypeMaybeString |
1386 |
|
1387 |
-- | Size in MiBs |
1388 |
vtypeSize :: VType |
1389 |
vtypeSize = VTypeSize |
1390 |
|
1391 |
vtypeString :: VType |
1392 |
vtypeString = VTypeString |
1393 |
|
1394 |
enforceableTypes :: FrozenSet VType |
1395 |
enforceableTypes = ConstantUtils.mkSet [minBound..] |
1396 |
|
1397 |
-- | Constant representing that the user does not specify any IP version |
1398 |
ifaceNoIpVersionSpecified :: Int |
1399 |
ifaceNoIpVersionSpecified = 0 |
1400 |
|
1401 |
validSerialSpeeds :: [Int] |
1402 |
validSerialSpeeds = |
1403 |
[75, |
1404 |
110, |
1405 |
300, |
1406 |
600, |
1407 |
1200, |
1408 |
1800, |
1409 |
2400, |
1410 |
4800, |
1411 |
9600, |
1412 |
14400, |
1413 |
19200, |
1414 |
28800, |
1415 |
38400, |
1416 |
57600, |
1417 |
115200, |
1418 |
230400, |
1419 |
345600, |
1420 |
460800] |
1421 |
|
1422 |
-- * HV parameter names (global namespace) |
1423 |
|
1424 |
hvAcpi :: String |
1425 |
hvAcpi = "acpi" |
1426 |
|
1427 |
hvBlockdevPrefix :: String |
1428 |
hvBlockdevPrefix = "blockdev_prefix" |
1429 |
|
1430 |
hvBootloaderArgs :: String |
1431 |
hvBootloaderArgs = "bootloader_args" |
1432 |
|
1433 |
hvBootloaderPath :: String |
1434 |
hvBootloaderPath = "bootloader_path" |
1435 |
|
1436 |
hvBootOrder :: String |
1437 |
hvBootOrder = "boot_order" |
1438 |
|
1439 |
hvCdromImagePath :: String |
1440 |
hvCdromImagePath = "cdrom_image_path" |
1441 |
|
1442 |
hvCpuCap :: String |
1443 |
hvCpuCap = "cpu_cap" |
1444 |
|
1445 |
hvCpuCores :: String |
1446 |
hvCpuCores = "cpu_cores" |
1447 |
|
1448 |
hvCpuMask :: String |
1449 |
hvCpuMask = "cpu_mask" |
1450 |
|
1451 |
hvCpuSockets :: String |
1452 |
hvCpuSockets = "cpu_sockets" |
1453 |
|
1454 |
hvCpuThreads :: String |
1455 |
hvCpuThreads = "cpu_threads" |
1456 |
|
1457 |
hvCpuType :: String |
1458 |
hvCpuType = "cpu_type" |
1459 |
|
1460 |
hvCpuWeight :: String |
1461 |
hvCpuWeight = "cpu_weight" |
1462 |
|
1463 |
hvDeviceModel :: String |
1464 |
hvDeviceModel = "device_model" |
1465 |
|
1466 |
hvDiskCache :: String |
1467 |
hvDiskCache = "disk_cache" |
1468 |
|
1469 |
hvDiskType :: String |
1470 |
hvDiskType = "disk_type" |
1471 |
|
1472 |
hvInitrdPath :: String |
1473 |
hvInitrdPath = "initrd_path" |
1474 |
|
1475 |
hvInitScript :: String |
1476 |
hvInitScript = "init_script" |
1477 |
|
1478 |
hvKernelArgs :: String |
1479 |
hvKernelArgs = "kernel_args" |
1480 |
|
1481 |
hvKernelPath :: String |
1482 |
hvKernelPath = "kernel_path" |
1483 |
|
1484 |
hvKeymap :: String |
1485 |
hvKeymap = "keymap" |
1486 |
|
1487 |
hvKvmCdrom2ImagePath :: String |
1488 |
hvKvmCdrom2ImagePath = "cdrom2_image_path" |
1489 |
|
1490 |
hvKvmCdromDiskType :: String |
1491 |
hvKvmCdromDiskType = "cdrom_disk_type" |
1492 |
|
1493 |
hvKvmExtra :: String |
1494 |
hvKvmExtra = "kvm_extra" |
1495 |
|
1496 |
hvKvmFlag :: String |
1497 |
hvKvmFlag = "kvm_flag" |
1498 |
|
1499 |
hvKvmFloppyImagePath :: String |
1500 |
hvKvmFloppyImagePath = "floppy_image_path" |
1501 |
|
1502 |
hvKvmMachineVersion :: String |
1503 |
hvKvmMachineVersion = "machine_version" |
1504 |
|
1505 |
hvKvmPath :: String |
1506 |
hvKvmPath = "kvm_path" |
1507 |
|
1508 |
hvKvmSpiceAudioCompr :: String |
1509 |
hvKvmSpiceAudioCompr = "spice_playback_compression" |
1510 |
|
1511 |
hvKvmSpiceBind :: String |
1512 |
hvKvmSpiceBind = "spice_bind" |
1513 |
|
1514 |
hvKvmSpiceIpVersion :: String |
1515 |
hvKvmSpiceIpVersion = "spice_ip_version" |
1516 |
|
1517 |
hvKvmSpiceJpegImgCompr :: String |
1518 |
hvKvmSpiceJpegImgCompr = "spice_jpeg_wan_compression" |
1519 |
|
1520 |
hvKvmSpiceLosslessImgCompr :: String |
1521 |
hvKvmSpiceLosslessImgCompr = "spice_image_compression" |
1522 |
|
1523 |
hvKvmSpicePasswordFile :: String |
1524 |
hvKvmSpicePasswordFile = "spice_password_file" |
1525 |
|
1526 |
hvKvmSpiceStreamingVideoDetection :: String |
1527 |
hvKvmSpiceStreamingVideoDetection = "spice_streaming_video" |
1528 |
|
1529 |
hvKvmSpiceTlsCiphers :: String |
1530 |
hvKvmSpiceTlsCiphers = "spice_tls_ciphers" |
1531 |
|
1532 |
hvKvmSpiceUseTls :: String |
1533 |
hvKvmSpiceUseTls = "spice_use_tls" |
1534 |
|
1535 |
hvKvmSpiceUseVdagent :: String |
1536 |
hvKvmSpiceUseVdagent = "spice_use_vdagent" |
1537 |
|
1538 |
hvKvmSpiceZlibGlzImgCompr :: String |
1539 |
hvKvmSpiceZlibGlzImgCompr = "spice_zlib_glz_wan_compression" |
1540 |
|
1541 |
hvKvmUseChroot :: String |
1542 |
hvKvmUseChroot = "use_chroot" |
1543 |
|
1544 |
hvMemPath :: String |
1545 |
hvMemPath = "mem_path" |
1546 |
|
1547 |
hvMigrationBandwidth :: String |
1548 |
hvMigrationBandwidth = "migration_bandwidth" |
1549 |
|
1550 |
hvMigrationDowntime :: String |
1551 |
hvMigrationDowntime = "migration_downtime" |
1552 |
|
1553 |
hvMigrationMode :: String |
1554 |
hvMigrationMode = "migration_mode" |
1555 |
|
1556 |
hvMigrationPort :: String |
1557 |
hvMigrationPort = "migration_port" |
1558 |
|
1559 |
hvNicType :: String |
1560 |
hvNicType = "nic_type" |
1561 |
|
1562 |
hvPae :: String |
1563 |
hvPae = "pae" |
1564 |
|
1565 |
hvPassthrough :: String |
1566 |
hvPassthrough = "pci_pass" |
1567 |
|
1568 |
hvRebootBehavior :: String |
1569 |
hvRebootBehavior = "reboot_behavior" |
1570 |
|
1571 |
hvRootPath :: String |
1572 |
hvRootPath = "root_path" |
1573 |
|
1574 |
hvSecurityDomain :: String |
1575 |
hvSecurityDomain = "security_domain" |
1576 |
|
1577 |
hvSecurityModel :: String |
1578 |
hvSecurityModel = "security_model" |
1579 |
|
1580 |
hvSerialConsole :: String |
1581 |
hvSerialConsole = "serial_console" |
1582 |
|
1583 |
hvSerialSpeed :: String |
1584 |
hvSerialSpeed = "serial_speed" |
1585 |
|
1586 |
hvSoundhw :: String |
1587 |
hvSoundhw = "soundhw" |
1588 |
|
1589 |
hvUsbDevices :: String |
1590 |
hvUsbDevices = "usb_devices" |
1591 |
|
1592 |
hvUsbMouse :: String |
1593 |
hvUsbMouse = "usb_mouse" |
1594 |
|
1595 |
hvUseBootloader :: String |
1596 |
hvUseBootloader = "use_bootloader" |
1597 |
|
1598 |
hvUseLocaltime :: String |
1599 |
hvUseLocaltime = "use_localtime" |
1600 |
|
1601 |
hvVga :: String |
1602 |
hvVga = "vga" |
1603 |
|
1604 |
hvVhostNet :: String |
1605 |
hvVhostNet = "vhost_net" |
1606 |
|
1607 |
hvVifScript :: String |
1608 |
hvVifScript = "vif_script" |
1609 |
|
1610 |
hvVifType :: String |
1611 |
hvVifType = "vif_type" |
1612 |
|
1613 |
hvViridian :: String |
1614 |
hvViridian = "viridian" |
1615 |
|
1616 |
hvVncBindAddress :: String |
1617 |
hvVncBindAddress = "vnc_bind_address" |
1618 |
|
1619 |
hvVncPasswordFile :: String |
1620 |
hvVncPasswordFile = "vnc_password_file" |
1621 |
|
1622 |
hvVncTls :: String |
1623 |
hvVncTls = "vnc_tls" |
1624 |
|
1625 |
hvVncX509 :: String |
1626 |
hvVncX509 = "vnc_x509_path" |
1627 |
|
1628 |
hvVncX509Verify :: String |
1629 |
hvVncX509Verify = "vnc_x509_verify" |
1630 |
|
1631 |
hvVnetHdr :: String |
1632 |
hvVnetHdr = "vnet_hdr" |
1633 |
|
1634 |
hvXenCmd :: String |
1635 |
hvXenCmd = "xen_cmd" |
1636 |
|
1637 |
hvXenCpuid :: String |
1638 |
hvXenCpuid = "cpuid" |
1639 |
|
1640 |
hvsParameterTitles :: Map String String |
1641 |
hvsParameterTitles = |
1642 |
Map.fromList |
1643 |
[(hvAcpi, "ACPI"), |
1644 |
(hvBootOrder, "Boot_order"), |
1645 |
(hvCdromImagePath, "CDROM_image_path"), |
1646 |
(hvCpuType, "cpu_type"), |
1647 |
(hvDiskType, "Disk_type"), |
1648 |
(hvInitrdPath, "Initrd_path"), |
1649 |
(hvKernelPath, "Kernel_path"), |
1650 |
(hvNicType, "NIC_type"), |
1651 |
(hvPae, "PAE"), |
1652 |
(hvPassthrough, "pci_pass"), |
1653 |
(hvVncBindAddress, "VNC_bind_address")] |
1654 |
|
1655 |
hvsParameters :: FrozenSet String |
1656 |
hvsParameters = ConstantUtils.mkSet $ Map.keys hvsParameterTypes |
1657 |
|
1658 |
hvsParameterTypes :: Map String VType |
1659 |
hvsParameterTypes = Map.fromList |
1660 |
[ (hvAcpi, VTypeBool) |
1661 |
, (hvBlockdevPrefix, VTypeString) |
1662 |
, (hvBootloaderArgs, VTypeString) |
1663 |
, (hvBootloaderPath, VTypeString) |
1664 |
, (hvBootOrder, VTypeString) |
1665 |
, (hvCdromImagePath, VTypeString) |
1666 |
, (hvCpuCap, VTypeInt) |
1667 |
, (hvCpuCores, VTypeInt) |
1668 |
, (hvCpuMask, VTypeString) |
1669 |
, (hvCpuSockets, VTypeInt) |
1670 |
, (hvCpuThreads, VTypeInt) |
1671 |
, (hvCpuType, VTypeString) |
1672 |
, (hvCpuWeight, VTypeInt) |
1673 |
, (hvDeviceModel, VTypeString) |
1674 |
, (hvDiskCache, VTypeString) |
1675 |
, (hvDiskType, VTypeString) |
1676 |
, (hvInitrdPath, VTypeString) |
1677 |
, (hvInitScript, VTypeString) |
1678 |
, (hvKernelArgs, VTypeString) |
1679 |
, (hvKernelPath, VTypeString) |
1680 |
, (hvKeymap, VTypeString) |
1681 |
, (hvKvmCdrom2ImagePath, VTypeString) |
1682 |
, (hvKvmCdromDiskType, VTypeString) |
1683 |
, (hvKvmExtra, VTypeString) |
1684 |
, (hvKvmFlag, VTypeString) |
1685 |
, (hvKvmFloppyImagePath, VTypeString) |
1686 |
, (hvKvmMachineVersion, VTypeString) |
1687 |
, (hvKvmPath, VTypeString) |
1688 |
, (hvKvmSpiceAudioCompr, VTypeBool) |
1689 |
, (hvKvmSpiceBind, VTypeString) |
1690 |
, (hvKvmSpiceIpVersion, VTypeInt) |
1691 |
, (hvKvmSpiceJpegImgCompr, VTypeString) |
1692 |
, (hvKvmSpiceLosslessImgCompr, VTypeString) |
1693 |
, (hvKvmSpicePasswordFile, VTypeString) |
1694 |
, (hvKvmSpiceStreamingVideoDetection, VTypeString) |
1695 |
, (hvKvmSpiceTlsCiphers, VTypeString) |
1696 |
, (hvKvmSpiceUseTls, VTypeBool) |
1697 |
, (hvKvmSpiceUseVdagent, VTypeBool) |
1698 |
, (hvKvmSpiceZlibGlzImgCompr, VTypeString) |
1699 |
, (hvKvmUseChroot, VTypeBool) |
1700 |
, (hvMemPath, VTypeString) |
1701 |
, (hvMigrationBandwidth, VTypeInt) |
1702 |
, (hvMigrationDowntime, VTypeInt) |
1703 |
, (hvMigrationMode, VTypeString) |
1704 |
, (hvMigrationPort, VTypeInt) |
1705 |
, (hvNicType, VTypeString) |
1706 |
, (hvPae, VTypeBool) |
1707 |
, (hvPassthrough, VTypeString) |
1708 |
, (hvRebootBehavior, VTypeString) |
1709 |
, (hvRootPath, VTypeMaybeString) |
1710 |
, (hvSecurityDomain, VTypeString) |
1711 |
, (hvSecurityModel, VTypeString) |
1712 |
, (hvSerialConsole, VTypeBool) |
1713 |
, (hvSerialSpeed, VTypeInt) |
1714 |
, (hvSoundhw, VTypeString) |
1715 |
, (hvUsbDevices, VTypeString) |
1716 |
, (hvUsbMouse, VTypeString) |
1717 |
, (hvUseBootloader, VTypeBool) |
1718 |
, (hvUseLocaltime, VTypeBool) |
1719 |
, (hvVga, VTypeString) |
1720 |
, (hvVhostNet, VTypeBool) |
1721 |
, (hvVifScript, VTypeString) |
1722 |
, (hvVifType, VTypeString) |
1723 |
, (hvViridian, VTypeBool) |
1724 |
, (hvVncBindAddress, VTypeString) |
1725 |
, (hvVncPasswordFile, VTypeString) |
1726 |
, (hvVncTls, VTypeBool) |
1727 |
, (hvVncX509, VTypeString) |
1728 |
, (hvVncX509Verify, VTypeBool) |
1729 |
, (hvVnetHdr, VTypeBool) |
1730 |
, (hvXenCmd, VTypeString) |
1731 |
, (hvXenCpuid, VTypeString) |
1732 |
] |
1733 |
|
1734 |
-- * Migration statuses |
1735 |
|
1736 |
hvMigrationActive :: String |
1737 |
hvMigrationActive = "active" |
1738 |
|
1739 |
hvMigrationCancelled :: String |
1740 |
hvMigrationCancelled = "cancelled" |
1741 |
|
1742 |
hvMigrationCompleted :: String |
1743 |
hvMigrationCompleted = "completed" |
1744 |
|
1745 |
hvMigrationFailed :: String |
1746 |
hvMigrationFailed = "failed" |
1747 |
|
1748 |
hvMigrationValidStatuses :: FrozenSet String |
1749 |
hvMigrationValidStatuses = |
1750 |
ConstantUtils.mkSet [hvMigrationActive, |
1751 |
hvMigrationCancelled, |
1752 |
hvMigrationCompleted, |
1753 |
hvMigrationFailed] |
1754 |
|
1755 |
hvMigrationFailedStatuses :: FrozenSet String |
1756 |
hvMigrationFailedStatuses = |
1757 |
ConstantUtils.mkSet [hvMigrationFailed, hvMigrationCancelled] |
1758 |
|
1759 |
-- | KVM-specific statuses |
1760 |
-- |
1761 |
-- FIXME: this constant seems unnecessary |
1762 |
hvKvmMigrationValidStatuses :: FrozenSet String |
1763 |
hvKvmMigrationValidStatuses = hvMigrationValidStatuses |
1764 |
|
1765 |
-- | Node info keys |
1766 |
hvNodeinfoKeyVersion :: String |
1767 |
hvNodeinfoKeyVersion = "hv_version" |
1768 |
|
1769 |
-- * Hypervisor state |
1770 |
|
1771 |
hvstCpuNode :: String |
1772 |
hvstCpuNode = "cpu_node" |
1773 |
|
1774 |
hvstCpuTotal :: String |
1775 |
hvstCpuTotal = "cpu_total" |
1776 |
|
1777 |
hvstMemoryHv :: String |
1778 |
hvstMemoryHv = "mem_hv" |
1779 |
|
1780 |
hvstMemoryNode :: String |
1781 |
hvstMemoryNode = "mem_node" |
1782 |
|
1783 |
hvstMemoryTotal :: String |
1784 |
hvstMemoryTotal = "mem_total" |
1785 |
|
1786 |
hvstsParameters :: FrozenSet String |
1787 |
hvstsParameters = |
1788 |
ConstantUtils.mkSet [hvstCpuNode, |
1789 |
hvstCpuTotal, |
1790 |
hvstMemoryHv, |
1791 |
hvstMemoryNode, |
1792 |
hvstMemoryTotal] |
1793 |
|
1794 |
hvstDefaults :: Map String Int |
1795 |
hvstDefaults = |
1796 |
Map.fromList |
1797 |
[(hvstCpuNode, 1), |
1798 |
(hvstCpuTotal, 1), |
1799 |
(hvstMemoryHv, 0), |
1800 |
(hvstMemoryTotal, 0), |
1801 |
(hvstMemoryNode, 0)] |
1802 |
|
1803 |
hvstsParameterTypes :: Map String VType |
1804 |
hvstsParameterTypes = |
1805 |
Map.fromList [(hvstMemoryTotal, VTypeInt), |
1806 |
(hvstMemoryNode, VTypeInt), |
1807 |
(hvstMemoryHv, VTypeInt), |
1808 |
(hvstCpuTotal, VTypeInt), |
1809 |
(hvstCpuNode, VTypeInt)] |
1810 |
|
1811 |
-- * Disk state |
1812 |
|
1813 |
dsDiskOverhead :: String |
1814 |
dsDiskOverhead = "disk_overhead" |
1815 |
|
1816 |
dsDiskReserved :: String |
1817 |
dsDiskReserved = "disk_reserved" |
1818 |
|
1819 |
dsDiskTotal :: String |
1820 |
dsDiskTotal = "disk_total" |
1821 |
|
1822 |
dsDefaults :: Map String Int |
1823 |
dsDefaults = |
1824 |
Map.fromList |
1825 |
[(dsDiskTotal, 0), |
1826 |
(dsDiskReserved, 0), |
1827 |
(dsDiskOverhead, 0)] |
1828 |
|
1829 |
dssParameterTypes :: Map String VType |
1830 |
dssParameterTypes = |
1831 |
Map.fromList [(dsDiskTotal, VTypeInt), |
1832 |
(dsDiskReserved, VTypeInt), |
1833 |
(dsDiskOverhead, VTypeInt)] |
1834 |
|
1835 |
dssParameters :: FrozenSet String |
1836 |
dssParameters = |
1837 |
ConstantUtils.mkSet [dsDiskTotal, dsDiskReserved, dsDiskOverhead] |
1838 |
|
1839 |
dsValidTypes :: FrozenSet String |
1840 |
dsValidTypes = ConstantUtils.mkSet [Types.diskTemplateToRaw DTPlain] |
1841 |
|
1842 |
-- Backend parameter names |
1843 |
|
1844 |
beAlwaysFailover :: String |
1845 |
beAlwaysFailover = "always_failover" |
1846 |
|
1847 |
beAutoBalance :: String |
1848 |
beAutoBalance = "auto_balance" |
1849 |
|
1850 |
beMaxmem :: String |
1851 |
beMaxmem = "maxmem" |
1852 |
|
1853 |
-- | Deprecated and replaced by max and min mem |
1854 |
beMemory :: String |
1855 |
beMemory = "memory" |
1856 |
|
1857 |
beMinmem :: String |
1858 |
beMinmem = "minmem" |
1859 |
|
1860 |
beSpindleUse :: String |
1861 |
beSpindleUse = "spindle_use" |
1862 |
|
1863 |
beVcpus :: String |
1864 |
beVcpus = "vcpus" |
1865 |
|
1866 |
besParameterTypes :: Map String VType |
1867 |
besParameterTypes = |
1868 |
Map.fromList [(beAlwaysFailover, VTypeBool), |
1869 |
(beAutoBalance, VTypeBool), |
1870 |
(beMaxmem, VTypeSize), |
1871 |
(beMinmem, VTypeSize), |
1872 |
(beSpindleUse, VTypeInt), |
1873 |
(beVcpus, VTypeInt)] |
1874 |
|
1875 |
besParameterTitles :: Map String String |
1876 |
besParameterTitles = |
1877 |
Map.fromList [(beAutoBalance, "Auto_balance"), |
1878 |
(beMinmem, "ConfigMinMem"), |
1879 |
(beVcpus, "ConfigVCPUs"), |
1880 |
(beMaxmem, "ConfigMaxMem")] |
1881 |
|
1882 |
besParameterCompat :: Map String VType |
1883 |
besParameterCompat = Map.insert beMemory VTypeSize besParameterTypes |
1884 |
|
1885 |
besParameters :: FrozenSet String |
1886 |
besParameters = |
1887 |
ConstantUtils.mkSet [beAlwaysFailover, |
1888 |
beAutoBalance, |
1889 |
beMaxmem, |
1890 |
beMinmem, |
1891 |
beSpindleUse, |
1892 |
beVcpus] |
1893 |
|
1894 |
-- | Instance specs |
1895 |
-- |
1896 |
-- FIXME: these should be associated with 'Ganeti.HTools.Types.ISpec' |
1897 |
|
1898 |
ispecMemSize :: String |
1899 |
ispecMemSize = ConstantUtils.ispecMemSize |
1900 |
|
1901 |
ispecCpuCount :: String |
1902 |
ispecCpuCount = ConstantUtils.ispecCpuCount |
1903 |
|
1904 |
ispecDiskCount :: String |
1905 |
ispecDiskCount = ConstantUtils.ispecDiskCount |
1906 |
|
1907 |
ispecDiskSize :: String |
1908 |
ispecDiskSize = ConstantUtils.ispecDiskSize |
1909 |
|
1910 |
ispecNicCount :: String |
1911 |
ispecNicCount = ConstantUtils.ispecNicCount |
1912 |
|
1913 |
ispecSpindleUse :: String |
1914 |
ispecSpindleUse = ConstantUtils.ispecSpindleUse |
1915 |
|
1916 |
ispecsParameterTypes :: Map String VType |
1917 |
ispecsParameterTypes = |
1918 |
Map.fromList |
1919 |
[(ConstantUtils.ispecDiskSize, VTypeInt), |
1920 |
(ConstantUtils.ispecCpuCount, VTypeInt), |
1921 |
(ConstantUtils.ispecSpindleUse, VTypeInt), |
1922 |
(ConstantUtils.ispecMemSize, VTypeInt), |
1923 |
(ConstantUtils.ispecNicCount, VTypeInt), |
1924 |
(ConstantUtils.ispecDiskCount, VTypeInt)] |
1925 |
|
1926 |
ispecsParameters :: FrozenSet String |
1927 |
ispecsParameters = |
1928 |
ConstantUtils.mkSet [ConstantUtils.ispecCpuCount, |
1929 |
ConstantUtils.ispecDiskCount, |
1930 |
ConstantUtils.ispecDiskSize, |
1931 |
ConstantUtils.ispecMemSize, |
1932 |
ConstantUtils.ispecNicCount, |
1933 |
ConstantUtils.ispecSpindleUse] |
1934 |
|
1935 |
ispecsMinmax :: String |
1936 |
ispecsMinmax = ConstantUtils.ispecsMinmax |
1937 |
|
1938 |
ispecsMax :: String |
1939 |
ispecsMax = "max" |
1940 |
|
1941 |
ispecsMin :: String |
1942 |
ispecsMin = "min" |
1943 |
|
1944 |
ispecsStd :: String |
1945 |
ispecsStd = ConstantUtils.ispecsStd |
1946 |
|
1947 |
ipolicyDts :: String |
1948 |
ipolicyDts = ConstantUtils.ipolicyDts |
1949 |
|
1950 |
ipolicyVcpuRatio :: String |
1951 |
ipolicyVcpuRatio = ConstantUtils.ipolicyVcpuRatio |
1952 |
|
1953 |
ipolicySpindleRatio :: String |
1954 |
ipolicySpindleRatio = ConstantUtils.ipolicySpindleRatio |
1955 |
|
1956 |
ispecsMinmaxKeys :: FrozenSet String |
1957 |
ispecsMinmaxKeys = ConstantUtils.mkSet [ispecsMax, ispecsMin] |
1958 |
|
1959 |
ipolicyParameters :: FrozenSet String |
1960 |
ipolicyParameters = |
1961 |
ConstantUtils.mkSet [ConstantUtils.ipolicyVcpuRatio, |
1962 |
ConstantUtils.ipolicySpindleRatio] |
1963 |
|
1964 |
ipolicyAllKeys :: FrozenSet String |
1965 |
ipolicyAllKeys = |
1966 |
ConstantUtils.union ipolicyParameters $ |
1967 |
ConstantUtils.mkSet [ConstantUtils.ipolicyDts, |
1968 |
ConstantUtils.ispecsMinmax, |
1969 |
ispecsStd] |
1970 |
|
1971 |
-- | Node parameter names |
1972 |
|
1973 |
ndExclusiveStorage :: String |
1974 |
ndExclusiveStorage = "exclusive_storage" |
1975 |
|
1976 |
ndOobProgram :: String |
1977 |
ndOobProgram = "oob_program" |
1978 |
|
1979 |
ndSpindleCount :: String |
1980 |
ndSpindleCount = "spindle_count" |
1981 |
|
1982 |
ndOvs :: String |
1983 |
ndOvs = "ovs" |
1984 |
|
1985 |
ndOvsLink :: String |
1986 |
ndOvsLink = "ovs_link" |
1987 |
|
1988 |
ndOvsName :: String |
1989 |
ndOvsName = "ovs_name" |
1990 |
|
1991 |
ndsParameterTypes :: Map String VType |
1992 |
ndsParameterTypes = |
1993 |
Map.fromList |
1994 |
[(ndExclusiveStorage, VTypeBool), |
1995 |
(ndOobProgram, VTypeString), |
1996 |
(ndOvs, VTypeBool), |
1997 |
(ndOvsLink, VTypeMaybeString), |
1998 |
(ndOvsName, VTypeMaybeString), |
1999 |
(ndSpindleCount, VTypeInt)] |
2000 |
|
2001 |
ndsParameters :: FrozenSet String |
2002 |
ndsParameters = ConstantUtils.mkSet (Map.keys ndsParameterTypes) |
2003 |
|
2004 |
ndsParameterTitles :: Map String String |
2005 |
ndsParameterTitles = |
2006 |
Map.fromList |
2007 |
[(ndExclusiveStorage, "ExclusiveStorage"), |
2008 |
(ndOobProgram, "OutOfBandProgram"), |
2009 |
(ndOvs, "OpenvSwitch"), |
2010 |
(ndOvsLink, "OpenvSwitchLink"), |
2011 |
(ndOvsName, "OpenvSwitchName"), |
2012 |
(ndSpindleCount, "SpindleCount")] |
2013 |
|
2014 |
-- * Logical Disks parameters |
2015 |
|
2016 |
ldpAccess :: String |
2017 |
ldpAccess = "access" |
2018 |
|
2019 |
ldpBarriers :: String |
2020 |
ldpBarriers = "disabled-barriers" |
2021 |
|
2022 |
ldpDefaultMetavg :: String |
2023 |
ldpDefaultMetavg = "default-metavg" |
2024 |
|
2025 |
ldpDelayTarget :: String |
2026 |
ldpDelayTarget = "c-delay-target" |
2027 |
|
2028 |
ldpDiskCustom :: String |
2029 |
ldpDiskCustom = "disk-custom" |
2030 |
|
2031 |
ldpDynamicResync :: String |
2032 |
ldpDynamicResync = "dynamic-resync" |
2033 |
|
2034 |
ldpFillTarget :: String |
2035 |
ldpFillTarget = "c-fill-target" |
2036 |
|
2037 |
ldpMaxRate :: String |
2038 |
ldpMaxRate = "c-max-rate" |
2039 |
|
2040 |
ldpMinRate :: String |
2041 |
ldpMinRate = "c-min-rate" |
2042 |
|
2043 |
ldpNetCustom :: String |
2044 |
ldpNetCustom = "net-custom" |
2045 |
|
2046 |
ldpNoMetaFlush :: String |
2047 |
ldpNoMetaFlush = "disable-meta-flush" |
2048 |
|
2049 |
ldpPlanAhead :: String |
2050 |
ldpPlanAhead = "c-plan-ahead" |
2051 |
|
2052 |
ldpPool :: String |
2053 |
ldpPool = "pool" |
2054 |
|
2055 |
ldpProtocol :: String |
2056 |
ldpProtocol = "protocol" |
2057 |
|
2058 |
ldpResyncRate :: String |
2059 |
ldpResyncRate = "resync-rate" |
2060 |
|
2061 |
ldpStripes :: String |
2062 |
ldpStripes = "stripes" |
2063 |
|
2064 |
diskLdTypes :: Map String VType |
2065 |
diskLdTypes = |
2066 |
Map.fromList |
2067 |
[(ldpAccess, VTypeString), |
2068 |
(ldpResyncRate, VTypeInt), |
2069 |
(ldpStripes, VTypeInt), |
2070 |
(ldpBarriers, VTypeString), |
2071 |
(ldpNoMetaFlush, VTypeBool), |
2072 |
(ldpDefaultMetavg, VTypeString), |
2073 |
(ldpDiskCustom, VTypeString), |
2074 |
(ldpNetCustom, VTypeString), |
2075 |
(ldpProtocol, VTypeString), |
2076 |
(ldpDynamicResync, VTypeBool), |
2077 |
(ldpPlanAhead, VTypeInt), |
2078 |
(ldpFillTarget, VTypeInt), |
2079 |
(ldpDelayTarget, VTypeInt), |
2080 |
(ldpMaxRate, VTypeInt), |
2081 |
(ldpMinRate, VTypeInt), |
2082 |
(ldpPool, VTypeString)] |
2083 |
|
2084 |
diskLdParameters :: FrozenSet String |
2085 |
diskLdParameters = ConstantUtils.mkSet (Map.keys diskLdTypes) |
2086 |
|
2087 |
-- * Disk template parameters |
2088 |
-- |
2089 |
-- Disk template parameters can be set/changed by the user via |
2090 |
-- gnt-cluster and gnt-group) |
2091 |
|
2092 |
drbdResyncRate :: String |
2093 |
drbdResyncRate = "resync-rate" |
2094 |
|
2095 |
drbdDataStripes :: String |
2096 |
drbdDataStripes = "data-stripes" |
2097 |
|
2098 |
drbdMetaStripes :: String |
2099 |
drbdMetaStripes = "meta-stripes" |
2100 |
|
2101 |
drbdDiskBarriers :: String |
2102 |
drbdDiskBarriers = "disk-barriers" |
2103 |
|
2104 |
drbdMetaBarriers :: String |
2105 |
drbdMetaBarriers = "meta-barriers" |
2106 |
|
2107 |
drbdDefaultMetavg :: String |
2108 |
drbdDefaultMetavg = "metavg" |
2109 |
|
2110 |
drbdDiskCustom :: String |
2111 |
drbdDiskCustom = "disk-custom" |
2112 |
|
2113 |
drbdNetCustom :: String |
2114 |
drbdNetCustom = "net-custom" |
2115 |
|
2116 |
drbdProtocol :: String |
2117 |
drbdProtocol = "protocol" |
2118 |
|
2119 |
drbdDynamicResync :: String |
2120 |
drbdDynamicResync = "dynamic-resync" |
2121 |
|
2122 |
drbdPlanAhead :: String |
2123 |
drbdPlanAhead = "c-plan-ahead" |
2124 |
|
2125 |
drbdFillTarget :: String |
2126 |
drbdFillTarget = "c-fill-target" |
2127 |
|
2128 |
drbdDelayTarget :: String |
2129 |
drbdDelayTarget = "c-delay-target" |
2130 |
|
2131 |
drbdMaxRate :: String |
2132 |
drbdMaxRate = "c-max-rate" |
2133 |
|
2134 |
drbdMinRate :: String |
2135 |
drbdMinRate = "c-min-rate" |
2136 |
|
2137 |
lvStripes :: String |
2138 |
lvStripes = "stripes" |
2139 |
|
2140 |
rbdAccess :: String |
2141 |
rbdAccess = "access" |
2142 |
|
2143 |
rbdPool :: String |
2144 |
rbdPool = "pool" |
2145 |
|
2146 |
diskDtTypes :: Map String VType |
2147 |
diskDtTypes = |
2148 |
Map.fromList [(drbdResyncRate, VTypeInt), |
2149 |
(drbdDataStripes, VTypeInt), |
2150 |
(drbdMetaStripes, VTypeInt), |
2151 |
(drbdDiskBarriers, VTypeString), |
2152 |
(drbdMetaBarriers, VTypeBool), |
2153 |
(drbdDefaultMetavg, VTypeString), |
2154 |
(drbdDiskCustom, VTypeString), |
2155 |
(drbdNetCustom, VTypeString), |
2156 |
(drbdProtocol, VTypeString), |
2157 |
(drbdDynamicResync, VTypeBool), |
2158 |
(drbdPlanAhead, VTypeInt), |
2159 |
(drbdFillTarget, VTypeInt), |
2160 |
(drbdDelayTarget, VTypeInt), |
2161 |
(drbdMaxRate, VTypeInt), |
2162 |
(drbdMinRate, VTypeInt), |
2163 |
(lvStripes, VTypeInt), |
2164 |
(rbdAccess, VTypeString), |
2165 |
(rbdPool, VTypeString)] |
2166 |
|
2167 |
diskDtParameters :: FrozenSet String |
2168 |
diskDtParameters = ConstantUtils.mkSet (Map.keys diskDtTypes) |
2169 |
|
2170 |
-- * Dynamic disk parameters |
2171 |
|
2172 |
ddpLocalIp :: String |
2173 |
ddpLocalIp = "local-ip" |
2174 |
|
2175 |
ddpRemoteIp :: String |
2176 |
ddpRemoteIp = "remote-ip" |
2177 |
|
2178 |
ddpPort :: String |
2179 |
ddpPort = "port" |
2180 |
|
2181 |
ddpLocalMinor :: String |
2182 |
ddpLocalMinor = "local-minor" |
2183 |
|
2184 |
ddpRemoteMinor :: String |
2185 |
ddpRemoteMinor = "remote-minor" |
2186 |
|
2187 |
-- * OOB supported commands |
2188 |
|
2189 |
oobPowerOn :: String |
2190 |
oobPowerOn = Types.oobCommandToRaw OobPowerOn |
2191 |
|
2192 |
oobPowerOff :: String |
2193 |
oobPowerOff = Types.oobCommandToRaw OobPowerOff |
2194 |
|
2195 |
oobPowerCycle :: String |
2196 |
oobPowerCycle = Types.oobCommandToRaw OobPowerCycle |
2197 |
|
2198 |
oobPowerStatus :: String |
2199 |
oobPowerStatus = Types.oobCommandToRaw OobPowerStatus |
2200 |
|
2201 |
oobHealth :: String |
2202 |
oobHealth = Types.oobCommandToRaw OobHealth |
2203 |
|
2204 |
oobCommands :: FrozenSet String |
2205 |
oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..] |
2206 |
|
2207 |
oobPowerStatusPowered :: String |
2208 |
oobPowerStatusPowered = "powered" |
2209 |
|
2210 |
-- | 60 seconds |
2211 |
oobTimeout :: Int |
2212 |
oobTimeout = 60 |
2213 |
|
2214 |
-- | 2 seconds |
2215 |
oobPowerDelay :: Double |
2216 |
oobPowerDelay = 2.0 |
2217 |
|
2218 |
oobStatusCritical :: String |
2219 |
oobStatusCritical = Types.oobStatusToRaw OobStatusCritical |
2220 |
|
2221 |
oobStatusOk :: String |
2222 |
oobStatusOk = Types.oobStatusToRaw OobStatusOk |
2223 |
|
2224 |
oobStatusUnknown :: String |
2225 |
oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown |
2226 |
|
2227 |
oobStatusWarning :: String |
2228 |
oobStatusWarning = Types.oobStatusToRaw OobStatusWarning |
2229 |
|
2230 |
oobStatuses :: FrozenSet String |
2231 |
oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..] |
2232 |
|
2233 |
-- | Instance Parameters Profile |
2234 |
ppDefault :: String |
2235 |
ppDefault = "default" |
2236 |
|
2237 |
-- * nic* constants are used inside the ganeti config |
2238 |
|
2239 |
nicLink :: String |
2240 |
nicLink = "link" |
2241 |
|
2242 |
nicMode :: String |
2243 |
nicMode = "mode" |
2244 |
|
2245 |
nicVlan :: String |
2246 |
nicVlan = "vlan" |
2247 |
|
2248 |
nicsParameterTypes :: Map String VType |
2249 |
nicsParameterTypes = |
2250 |
Map.fromList [(nicMode, vtypeString), |
2251 |
(nicLink, vtypeString), |
2252 |
(nicVlan, vtypeMaybeString)] |
2253 |
|
2254 |
nicsParameters :: FrozenSet String |
2255 |
nicsParameters = ConstantUtils.mkSet (Map.keys nicsParameterTypes) |
2256 |
|
2257 |
nicModeBridged :: String |
2258 |
nicModeBridged = Types.nICModeToRaw NMBridged |
2259 |
|
2260 |
nicModeRouted :: String |
2261 |
nicModeRouted = Types.nICModeToRaw NMRouted |
2262 |
|
2263 |
nicModeOvs :: String |
2264 |
nicModeOvs = Types.nICModeToRaw NMOvs |
2265 |
|
2266 |
nicIpPool :: String |
2267 |
nicIpPool = Types.nICModeToRaw NMPool |
2268 |
|
2269 |
nicValidModes :: FrozenSet String |
2270 |
nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..] |
2271 |
|
2272 |
releaseAction :: String |
2273 |
releaseAction = "release" |
2274 |
|
2275 |
reserveAction :: String |
2276 |
reserveAction = "reserve" |
2277 |
|
2278 |
-- * idisk* constants are used in opcodes, to create/change disks |
2279 |
|
2280 |
idiskAdopt :: String |
2281 |
idiskAdopt = "adopt" |
2282 |
|
2283 |
idiskMetavg :: String |
2284 |
idiskMetavg = "metavg" |
2285 |
|
2286 |
idiskMode :: String |
2287 |
idiskMode = "mode" |
2288 |
|
2289 |
idiskName :: String |
2290 |
idiskName = "name" |
2291 |
|
2292 |
idiskSize :: String |
2293 |
idiskSize = "size" |
2294 |
|
2295 |
idiskSpindles :: String |
2296 |
idiskSpindles = "spindles" |
2297 |
|
2298 |
idiskVg :: String |
2299 |
idiskVg = "vg" |
2300 |
|
2301 |
idiskProvider :: String |
2302 |
idiskProvider = "provider" |
2303 |
|
2304 |
idiskParamsTypes :: Map String VType |
2305 |
idiskParamsTypes = |
2306 |
Map.fromList [(idiskSize, VTypeSize), |
2307 |
(idiskSpindles, VTypeInt), |
2308 |
(idiskMode, VTypeString), |
2309 |
(idiskAdopt, VTypeString), |
2310 |
(idiskVg, VTypeString), |
2311 |
(idiskMetavg, VTypeString), |
2312 |
(idiskProvider, VTypeString), |
2313 |
(idiskName, VTypeMaybeString)] |
2314 |
|
2315 |
idiskParams :: FrozenSet String |
2316 |
idiskParams = ConstantUtils.mkSet (Map.keys idiskParamsTypes) |
2317 |
|
2318 |
-- * inic* constants are used in opcodes, to create/change nics |
2319 |
|
2320 |
inicBridge :: String |
2321 |
inicBridge = "bridge" |
2322 |
|
2323 |
inicIp :: String |
2324 |
inicIp = "ip" |
2325 |
|
2326 |
inicLink :: String |
2327 |
inicLink = "link" |
2328 |
|
2329 |
inicMac :: String |
2330 |
inicMac = "mac" |
2331 |
|
2332 |
inicMode :: String |
2333 |
inicMode = "mode" |
2334 |
|
2335 |
inicName :: String |
2336 |
inicName = "name" |
2337 |
|
2338 |
inicNetwork :: String |
2339 |
inicNetwork = "network" |
2340 |
|
2341 |
inicVlan :: String |
2342 |
inicVlan = "vlan" |
2343 |
|
2344 |
inicParamsTypes :: Map String VType |
2345 |
inicParamsTypes = |
2346 |
Map.fromList [(inicBridge, VTypeMaybeString), |
2347 |
(inicIp, VTypeMaybeString), |
2348 |
(inicLink, VTypeString), |
2349 |
(inicMac, VTypeString), |
2350 |
(inicMode, VTypeString), |
2351 |
(inicName, VTypeMaybeString), |
2352 |
(inicNetwork, VTypeMaybeString), |
2353 |
(inicVlan, VTypeMaybeString)] |
2354 |
|
2355 |
inicParams :: FrozenSet String |
2356 |
inicParams = ConstantUtils.mkSet (Map.keys inicParamsTypes) |
2357 |
|
2358 |
-- * Hypervisor constants |
2359 |
|
2360 |
htXenPvm :: String |
2361 |
htXenPvm = Types.hypervisorToRaw XenPvm |
2362 |
|
2363 |
htFake :: String |
2364 |
htFake = Types.hypervisorToRaw Fake |
2365 |
|
2366 |
htXenHvm :: String |
2367 |
htXenHvm = Types.hypervisorToRaw XenHvm |
2368 |
|
2369 |
htKvm :: String |
2370 |
htKvm = Types.hypervisorToRaw Kvm |
2371 |
|
2372 |
htChroot :: String |
2373 |
htChroot = Types.hypervisorToRaw Chroot |
2374 |
|
2375 |
htLxc :: String |
2376 |
htLxc = Types.hypervisorToRaw Lxc |
2377 |
|
2378 |
hyperTypes :: FrozenSet String |
2379 |
hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..] |
2380 |
|
2381 |
htsReqPort :: FrozenSet String |
2382 |
htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm] |
2383 |
|
2384 |
vncBasePort :: Int |
2385 |
vncBasePort = 5900 |
2386 |
|
2387 |
vncDefaultBindAddress :: String |
2388 |
vncDefaultBindAddress = ip4AddressAny |
2389 |
|
2390 |
-- * NIC types |
2391 |
|
2392 |
htNicE1000 :: String |
2393 |
htNicE1000 = "e1000" |
2394 |
|
2395 |
htNicI82551 :: String |
2396 |
htNicI82551 = "i82551" |
2397 |
|
2398 |
htNicI8259er :: String |
2399 |
htNicI8259er = "i82559er" |
2400 |
|
2401 |
htNicI85557b :: String |
2402 |
htNicI85557b = "i82557b" |
2403 |
|
2404 |
htNicNe2kIsa :: String |
2405 |
htNicNe2kIsa = "ne2k_isa" |
2406 |
|
2407 |
htNicNe2kPci :: String |
2408 |
htNicNe2kPci = "ne2k_pci" |
2409 |
|
2410 |
htNicParavirtual :: String |
2411 |
htNicParavirtual = "paravirtual" |
2412 |
|
2413 |
htNicPcnet :: String |
2414 |
htNicPcnet = "pcnet" |
2415 |
|
2416 |
htNicRtl8139 :: String |
2417 |
htNicRtl8139 = "rtl8139" |
2418 |
|
2419 |
htHvmValidNicTypes :: FrozenSet String |
2420 |
htHvmValidNicTypes = |
2421 |
ConstantUtils.mkSet [htNicE1000, |
2422 |
htNicNe2kIsa, |
2423 |
htNicNe2kPci, |
2424 |
htNicParavirtual, |
2425 |
htNicRtl8139] |
2426 |
|
2427 |
htKvmValidNicTypes :: FrozenSet String |
2428 |
htKvmValidNicTypes = |
2429 |
ConstantUtils.mkSet [htNicE1000, |
2430 |
htNicI82551, |
2431 |
htNicI8259er, |
2432 |
htNicI85557b, |
2433 |
htNicNe2kIsa, |
2434 |
htNicNe2kPci, |
2435 |
htNicParavirtual, |
2436 |
htNicPcnet, |
2437 |
htNicRtl8139] |
2438 |
|
2439 |
-- * Vif types |
2440 |
|
2441 |
-- | Default vif type in xen-hvm |
2442 |
htHvmVifIoemu :: String |
2443 |
htHvmVifIoemu = "ioemu" |
2444 |
|
2445 |
htHvmVifVif :: String |
2446 |
htHvmVifVif = "vif" |
2447 |
|
2448 |
htHvmValidVifTypes :: FrozenSet String |
2449 |
htHvmValidVifTypes = ConstantUtils.mkSet [htHvmVifIoemu, htHvmVifVif] |
2450 |
|
2451 |
-- * Disk types |
2452 |
|
2453 |
htDiskIde :: String |
2454 |
htDiskIde = "ide" |
2455 |
|
2456 |
htDiskIoemu :: String |
2457 |
htDiskIoemu = "ioemu" |
2458 |
|
2459 |
htDiskMtd :: String |
2460 |
htDiskMtd = "mtd" |
2461 |
|
2462 |
htDiskParavirtual :: String |
2463 |
htDiskParavirtual = "paravirtual" |
2464 |
|
2465 |
htDiskPflash :: String |
2466 |
htDiskPflash = "pflash" |
2467 |
|
2468 |
htDiskScsi :: String |
2469 |
htDiskScsi = "scsi" |
2470 |
|
2471 |
htDiskSd :: String |
2472 |
htDiskSd = "sd" |
2473 |
|
2474 |
htHvmValidDiskTypes :: FrozenSet String |
2475 |
htHvmValidDiskTypes = ConstantUtils.mkSet [htDiskIoemu, htDiskParavirtual] |
2476 |
|
2477 |
htKvmValidDiskTypes :: FrozenSet String |
2478 |
htKvmValidDiskTypes = |
2479 |
ConstantUtils.mkSet [htDiskIde, |
2480 |
htDiskMtd, |
2481 |
htDiskParavirtual, |
2482 |
htDiskPflash, |
2483 |
htDiskScsi, |
2484 |
htDiskSd] |
2485 |
|
2486 |
htCacheDefault :: String |
2487 |
htCacheDefault = "default" |
2488 |
|
2489 |
htCacheNone :: String |
2490 |
htCacheNone = "none" |
2491 |
|
2492 |
htCacheWback :: String |
2493 |
htCacheWback = "writeback" |
2494 |
|
2495 |
htCacheWthrough :: String |
2496 |
htCacheWthrough = "writethrough" |
2497 |
|
2498 |
htValidCacheTypes :: FrozenSet String |
2499 |
htValidCacheTypes = |
2500 |
ConstantUtils.mkSet [htCacheDefault, |
2501 |
htCacheNone, |
2502 |
htCacheWback, |
2503 |
htCacheWthrough] |
2504 |
|
2505 |
-- * Mouse types |
2506 |
|
2507 |
htMouseMouse :: String |
2508 |
htMouseMouse = "mouse" |
2509 |
|
2510 |
htMouseTablet :: String |
2511 |
htMouseTablet = "tablet" |
2512 |
|
2513 |
htKvmValidMouseTypes :: FrozenSet String |
2514 |
htKvmValidMouseTypes = ConstantUtils.mkSet [htMouseMouse, htMouseTablet] |
2515 |
|
2516 |
-- * Boot order |
2517 |
|
2518 |
htBoCdrom :: String |
2519 |
htBoCdrom = "cdrom" |
2520 |
|
2521 |
htBoDisk :: String |
2522 |
htBoDisk = "disk" |
2523 |
|
2524 |
htBoFloppy :: String |
2525 |
htBoFloppy = "floppy" |
2526 |
|
2527 |
htBoNetwork :: String |
2528 |
htBoNetwork = "network" |
2529 |
|
2530 |
htKvmValidBoTypes :: FrozenSet String |
2531 |
htKvmValidBoTypes = |
2532 |
ConstantUtils.mkSet [htBoCdrom, htBoDisk, htBoFloppy, htBoNetwork] |
2533 |
|
2534 |
-- * SPICE lossless image compression options |
2535 |
|
2536 |
htKvmSpiceLosslessImgComprAutoGlz :: String |
2537 |
htKvmSpiceLosslessImgComprAutoGlz = "auto_glz" |
2538 |
|
2539 |
htKvmSpiceLosslessImgComprAutoLz :: String |
2540 |
htKvmSpiceLosslessImgComprAutoLz = "auto_lz" |
2541 |
|
2542 |
htKvmSpiceLosslessImgComprGlz :: String |
2543 |
htKvmSpiceLosslessImgComprGlz = "glz" |
2544 |
|
2545 |
htKvmSpiceLosslessImgComprLz :: String |
2546 |
htKvmSpiceLosslessImgComprLz = "lz" |
2547 |
|
2548 |
htKvmSpiceLosslessImgComprOff :: String |
2549 |
htKvmSpiceLosslessImgComprOff = "off" |
2550 |
|
2551 |
htKvmSpiceLosslessImgComprQuic :: String |
2552 |
htKvmSpiceLosslessImgComprQuic = "quic" |
2553 |
|
2554 |
htKvmSpiceValidLosslessImgComprOptions :: FrozenSet String |
2555 |
htKvmSpiceValidLosslessImgComprOptions = |
2556 |
ConstantUtils.mkSet [htKvmSpiceLosslessImgComprAutoGlz, |
2557 |
htKvmSpiceLosslessImgComprAutoLz, |
2558 |
htKvmSpiceLosslessImgComprGlz, |
2559 |
htKvmSpiceLosslessImgComprLz, |
2560 |
htKvmSpiceLosslessImgComprOff, |
2561 |
htKvmSpiceLosslessImgComprQuic] |
2562 |
|
2563 |
htKvmSpiceLossyImgComprAlways :: String |
2564 |
htKvmSpiceLossyImgComprAlways = "always" |
2565 |
|
2566 |
htKvmSpiceLossyImgComprAuto :: String |
2567 |
htKvmSpiceLossyImgComprAuto = "auto" |
2568 |
|
2569 |
htKvmSpiceLossyImgComprNever :: String |
2570 |
htKvmSpiceLossyImgComprNever = "never" |
2571 |
|
2572 |
htKvmSpiceValidLossyImgComprOptions :: FrozenSet String |
2573 |
htKvmSpiceValidLossyImgComprOptions = |
2574 |
ConstantUtils.mkSet [htKvmSpiceLossyImgComprAlways, |
2575 |
htKvmSpiceLossyImgComprAuto, |
2576 |
htKvmSpiceLossyImgComprNever] |
2577 |
|
2578 |
-- * SPICE video stream detection |
2579 |
|
2580 |
htKvmSpiceVideoStreamDetectionAll :: String |
2581 |
htKvmSpiceVideoStreamDetectionAll = "all" |
2582 |
|
2583 |
htKvmSpiceVideoStreamDetectionFilter :: String |
2584 |
htKvmSpiceVideoStreamDetectionFilter = "filter" |
2585 |
|
2586 |
htKvmSpiceVideoStreamDetectionOff :: String |
2587 |
htKvmSpiceVideoStreamDetectionOff = "off" |
2588 |
|
2589 |
htKvmSpiceValidVideoStreamDetectionOptions :: FrozenSet String |
2590 |
htKvmSpiceValidVideoStreamDetectionOptions = |
2591 |
ConstantUtils.mkSet [htKvmSpiceVideoStreamDetectionAll, |
2592 |
htKvmSpiceVideoStreamDetectionFilter, |
2593 |
htKvmSpiceVideoStreamDetectionOff] |
2594 |
|
2595 |
-- * Security models |
2596 |
|
2597 |
htSmNone :: String |
2598 |
htSmNone = "none" |
2599 |
|
2600 |
htSmPool :: String |
2601 |
htSmPool = "pool" |
2602 |
|
2603 |
htSmUser :: String |
2604 |
htSmUser = "user" |
2605 |
|
2606 |
htKvmValidSmTypes :: FrozenSet String |
2607 |
htKvmValidSmTypes = ConstantUtils.mkSet [htSmNone, htSmPool, htSmUser] |
2608 |
|
2609 |
-- * Kvm flag values |
2610 |
|
2611 |
htKvmDisabled :: String |
2612 |
htKvmDisabled = "disabled" |
2613 |
|
2614 |
htKvmEnabled :: String |
2615 |
htKvmEnabled = "enabled" |
2616 |
|
2617 |
htKvmFlagValues :: FrozenSet String |
2618 |
htKvmFlagValues = ConstantUtils.mkSet [htKvmDisabled, htKvmEnabled] |
2619 |
|
2620 |
-- * Migration type |
2621 |
|
2622 |
htMigrationLive :: String |
2623 |
htMigrationLive = Types.migrationModeToRaw MigrationLive |
2624 |
|
2625 |
htMigrationNonlive :: String |
2626 |
htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive |
2627 |
|
2628 |
htMigrationModes :: FrozenSet String |
2629 |
htMigrationModes = |
2630 |
ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..] |
2631 |
|
2632 |
-- * Cluster verify steps |
2633 |
|
2634 |
verifyNplusoneMem :: String |
2635 |
verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem |
2636 |
|
2637 |
verifyOptionalChecks :: FrozenSet String |
2638 |
verifyOptionalChecks = |
2639 |
ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..] |
2640 |
|
2641 |
-- * Cluster Verify error classes |
2642 |
|
2643 |
cvTcluster :: String |
2644 |
cvTcluster = "cluster" |
2645 |
|
2646 |
cvTgroup :: String |
2647 |
cvTgroup = "group" |
2648 |
|
2649 |
cvTnode :: String |
2650 |
cvTnode = "node" |
2651 |
|
2652 |
cvTinstance :: String |
2653 |
cvTinstance = "instance" |
2654 |
|
2655 |
-- * Cluster Verify error codes and documentation |
2656 |
|
2657 |
cvEclustercert :: (String, String, String) |
2658 |
cvEclustercert = |
2659 |
("cluster", |
2660 |
Types.cVErrorCodeToRaw CvECLUSTERCERT, |
2661 |
"Cluster certificate files verification failure") |
2662 |
|
2663 |
cvEclustercfg :: (String, String, String) |
2664 |
cvEclustercfg = |
2665 |
("cluster", |
2666 |
Types.cVErrorCodeToRaw CvECLUSTERCFG, |
2667 |
"Cluster configuration verification failure") |
2668 |
|
2669 |
cvEclusterdanglinginst :: (String, String, String) |
2670 |
cvEclusterdanglinginst = |
2671 |
("node", |
2672 |
Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST, |
2673 |
"Some instances have a non-existing primary node") |
2674 |
|
2675 |
cvEclusterdanglingnodes :: (String, String, String) |
2676 |
cvEclusterdanglingnodes = |
2677 |
("node", |
2678 |
Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES, |
2679 |
"Some nodes belong to non-existing groups") |
2680 |
|
2681 |
cvEclusterfilecheck :: (String, String, String) |
2682 |
cvEclusterfilecheck = |
2683 |
("cluster", |
2684 |
Types.cVErrorCodeToRaw CvECLUSTERFILECHECK, |
2685 |
"Cluster configuration verification failure") |
2686 |
|
2687 |
cvEgroupdifferentpvsize :: (String, String, String) |
2688 |
cvEgroupdifferentpvsize = |
2689 |
("group", |
2690 |
Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE, |
2691 |
"PVs in the group have different sizes") |
2692 |
|
2693 |
cvEinstancebadnode :: (String, String, String) |
2694 |
cvEinstancebadnode = |
2695 |
("instance", |
2696 |
Types.cVErrorCodeToRaw CvEINSTANCEBADNODE, |
2697 |
"Instance marked as running lives on an offline node") |
2698 |
|
2699 |
cvEinstancedown :: (String, String, String) |
2700 |
cvEinstancedown = |
2701 |
("instance", |
2702 |
Types.cVErrorCodeToRaw CvEINSTANCEDOWN, |
2703 |
"Instance not running on its primary node") |
2704 |
|
2705 |
cvEinstancefaultydisk :: (String, String, String) |
2706 |
cvEinstancefaultydisk = |
2707 |
("instance", |
2708 |
Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK, |
2709 |
"Impossible to retrieve status for a disk") |
2710 |
|
2711 |
cvEinstancelayout :: (String, String, String) |
2712 |
cvEinstancelayout = |
2713 |
("instance", |
2714 |
Types.cVErrorCodeToRaw CvEINSTANCELAYOUT, |
2715 |
"Instance has multiple secondary nodes") |
2716 |
|
2717 |
cvEinstancemissingcfgparameter :: (String, String, String) |
2718 |
cvEinstancemissingcfgparameter = |
2719 |
("instance", |
2720 |
Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER, |
2721 |
"A configuration parameter for an instance is missing") |
2722 |
|
2723 |
cvEinstancemissingdisk :: (String, String, String) |
2724 |
cvEinstancemissingdisk = |
2725 |
("instance", |
2726 |
Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK, |
2727 |
"Missing volume on an instance") |
2728 |
|
2729 |
cvEinstancepolicy :: (String, String, String) |
2730 |
cvEinstancepolicy = |
2731 |
("instance", |
2732 |
Types.cVErrorCodeToRaw CvEINSTANCEPOLICY, |
2733 |
"Instance does not meet policy") |
2734 |
|
2735 |
cvEinstancesplitgroups :: (String, String, String) |
2736 |
cvEinstancesplitgroups = |
2737 |
("instance", |
2738 |
Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS, |
2739 |
"Instance with primary and secondary nodes in different groups") |
2740 |
|
2741 |
cvEinstanceunsuitablenode :: (String, String, String) |
2742 |
cvEinstanceunsuitablenode = |
2743 |
("instance", |
2744 |
Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE, |
2745 |
"Instance running on nodes that are not suitable for it") |
2746 |
|
2747 |
cvEinstancewrongnode :: (String, String, String) |
2748 |
cvEinstancewrongnode = |
2749 |
("instance", |
2750 |
Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE, |
2751 |
"Instance running on the wrong node") |
2752 |
|
2753 |
cvEnodedrbd :: (String, String, String) |
2754 |
cvEnodedrbd = |
2755 |
("node", |
2756 |
Types.cVErrorCodeToRaw CvENODEDRBD, |
2757 |
"Error parsing the DRBD status file") |
2758 |
|
2759 |
cvEnodedrbdhelper :: (String, String, String) |
2760 |
cvEnodedrbdhelper = |
2761 |
("node", |
2762 |
Types.cVErrorCodeToRaw CvENODEDRBDHELPER, |
2763 |
"Error caused by the DRBD helper") |
2764 |
|
2765 |
cvEnodedrbdversion :: (String, String, String) |
2766 |
cvEnodedrbdversion = |
2767 |
("node", |
2768 |
Types.cVErrorCodeToRaw CvENODEDRBDVERSION, |
2769 |
"DRBD version mismatch within a node group") |
2770 |
|
2771 |
cvEnodefilecheck :: (String, String, String) |
2772 |
cvEnodefilecheck = |
2773 |
("node", |
2774 |
Types.cVErrorCodeToRaw CvENODEFILECHECK, |
2775 |
"Error retrieving the checksum of the node files") |
2776 |
|
2777 |
cvEnodefilestoragepaths :: (String, String, String) |
2778 |
cvEnodefilestoragepaths = |
2779 |
("node", |
2780 |
Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS, |
2781 |
"Detected bad file storage paths") |
2782 |
|
2783 |
cvEnodefilestoragepathunusable :: (String, String, String) |
2784 |
cvEnodefilestoragepathunusable = |
2785 |
("node", |
2786 |
Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE, |
2787 |
"File storage path unusable") |
2788 |
|
2789 |
cvEnodehooks :: (String, String, String) |
2790 |
cvEnodehooks = |
2791 |
("node", |
2792 |
Types.cVErrorCodeToRaw CvENODEHOOKS, |
2793 |
"Communication failure in hooks execution") |
2794 |
|
2795 |
cvEnodehv :: (String, String, String) |
2796 |
cvEnodehv = |
2797 |
("node", |
2798 |
Types.cVErrorCodeToRaw CvENODEHV, |
2799 |
"Hypervisor parameters verification failure") |
2800 |
|
2801 |
cvEnodelvm :: (String, String, String) |
2802 |
cvEnodelvm = |
2803 |
("node", |
2804 |
Types.cVErrorCodeToRaw CvENODELVM, |
2805 |
"LVM-related node error") |
2806 |
|
2807 |
cvEnoden1 :: (String, String, String) |
2808 |
cvEnoden1 = |
2809 |
("node", |
2810 |
Types.cVErrorCodeToRaw CvENODEN1, |
2811 |
"Not enough memory to accommodate instance failovers") |
2812 |
|
2813 |
cvEnodenet :: (String, String, String) |
2814 |
cvEnodenet = |
2815 |
("node", |
2816 |
Types.cVErrorCodeToRaw CvENODENET, |
2817 |
"Network-related node error") |
2818 |
|
2819 |
cvEnodeoobpath :: (String, String, String) |
2820 |
cvEnodeoobpath = |
2821 |
("node", |
2822 |
Types.cVErrorCodeToRaw CvENODEOOBPATH, |
2823 |
"Invalid Out Of Band path") |
2824 |
|
2825 |
cvEnodeorphaninstance :: (String, String, String) |
2826 |
cvEnodeorphaninstance = |
2827 |
("node", |
2828 |
Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE, |
2829 |
"Unknown intance running on a node") |
2830 |
|
2831 |
cvEnodeorphanlv :: (String, String, String) |
2832 |
cvEnodeorphanlv = |
2833 |
("node", |
2834 |
Types.cVErrorCodeToRaw CvENODEORPHANLV, |
2835 |
"Unknown LVM logical volume") |
2836 |
|
2837 |
cvEnodeos :: (String, String, String) |
2838 |
cvEnodeos = |
2839 |
("node", |
2840 |
Types.cVErrorCodeToRaw CvENODEOS, |
2841 |
"OS-related node error") |
2842 |
|
2843 |
cvEnoderpc :: (String, String, String) |
2844 |
cvEnoderpc = |
2845 |
("node", |
2846 |
Types.cVErrorCodeToRaw CvENODERPC, |
2847 |
"Error during connection to the primary node of an instance") |
2848 |
|
2849 |
cvEnodesetup :: (String, String, String) |
2850 |
cvEnodesetup = |
2851 |
("node", |
2852 |
Types.cVErrorCodeToRaw CvENODESETUP, |
2853 |
"Node setup error") |
2854 |
|
2855 |
cvEnodesharedfilestoragepathunusable :: (String, String, String) |
2856 |
cvEnodesharedfilestoragepathunusable = |
2857 |
("node", |
2858 |
Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE, |
2859 |
"Shared file storage path unusable") |
2860 |
|
2861 |
cvEnodessh :: (String, String, String) |
2862 |
cvEnodessh = |
2863 |
("node", |
2864 |
Types.cVErrorCodeToRaw CvENODESSH, |
2865 |
"SSH-related node error") |
2866 |
|
2867 |
cvEnodetime :: (String, String, String) |
2868 |
cvEnodetime = |
2869 |
("node", |
2870 |
Types.cVErrorCodeToRaw CvENODETIME, |
2871 |
"Node returned invalid time") |
2872 |
|
2873 |
cvEnodeuserscripts :: (String, String, String) |
2874 |
cvEnodeuserscripts = |
2875 |
("node", |
2876 |
Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS, |
2877 |
"User scripts not present or not executable") |
2878 |
|
2879 |
cvEnodeversion :: (String, String, String) |
2880 |
cvEnodeversion = |
2881 |
("node", |
2882 |
Types.cVErrorCodeToRaw CvENODEVERSION, |
2883 |
"Protocol version mismatch or Ganeti version mismatch") |
2884 |
|
2885 |
cvAllEcodes :: FrozenSet (String, String, String) |
2886 |
cvAllEcodes = |
2887 |
ConstantUtils.mkSet |
2888 |
[cvEclustercert, |
2889 |
cvEclustercfg, |
2890 |
cvEclusterdanglinginst, |
2891 |
cvEclusterdanglingnodes, |
2892 |
cvEclusterfilecheck, |
2893 |
cvEgroupdifferentpvsize, |
2894 |
cvEinstancebadnode, |
2895 |
cvEinstancedown, |
2896 |
cvEinstancefaultydisk, |
2897 |
cvEinstancelayout, |
2898 |
cvEinstancemissingcfgparameter, |
2899 |
cvEinstancemissingdisk, |
2900 |
cvEinstancepolicy, |
2901 |
cvEinstancesplitgroups, |
2902 |
cvEinstanceunsuitablenode, |
2903 |
cvEinstancewrongnode, |
2904 |
cvEnodedrbd, |
2905 |
cvEnodedrbdhelper, |
2906 |
cvEnodedrbdversion, |
2907 |
cvEnodefilecheck, |
2908 |
cvEnodefilestoragepaths, |
2909 |
cvEnodefilestoragepathunusable, |
2910 |
cvEnodehooks, |
2911 |
cvEnodehv, |
2912 |
cvEnodelvm, |
2913 |
cvEnoden1, |
2914 |
cvEnodenet, |
2915 |
cvEnodeoobpath, |
2916 |
cvEnodeorphaninstance, |
2917 |
cvEnodeorphanlv, |
2918 |
cvEnodeos, |
2919 |
cvEnoderpc, |
2920 |
cvEnodesetup, |
2921 |
cvEnodesharedfilestoragepathunusable, |
2922 |
cvEnodessh, |
2923 |
cvEnodetime, |
2924 |
cvEnodeuserscripts, |
2925 |
cvEnodeversion] |
2926 |
|
2927 |
cvAllEcodesStrings :: FrozenSet String |
2928 |
cvAllEcodesStrings = |
2929 |
ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..] |
2930 |
|
2931 |
-- * Node verify constants |
2932 |
|
2933 |
nvBridges :: String |
2934 |
nvBridges = "bridges" |
2935 |
|
2936 |
nvDrbdhelper :: String |
2937 |
nvDrbdhelper = "drbd-helper" |
2938 |
|
2939 |
nvDrbdversion :: String |
2940 |
nvDrbdversion = "drbd-version" |
2941 |
|
2942 |
nvDrbdlist :: String |
2943 |
nvDrbdlist = "drbd-list" |
2944 |
|
2945 |
nvExclusivepvs :: String |
2946 |
nvExclusivepvs = "exclusive-pvs" |
2947 |
|
2948 |
nvFilelist :: String |
2949 |
nvFilelist = "filelist" |
2950 |
|
2951 |
nvAcceptedStoragePaths :: String |
2952 |
nvAcceptedStoragePaths = "allowed-file-storage-paths" |
2953 |
|
2954 |
nvFileStoragePath :: String |
2955 |
nvFileStoragePath = "file-storage-path" |
2956 |
|
2957 |
nvSharedFileStoragePath :: String |
2958 |
nvSharedFileStoragePath = "shared-file-storage-path" |
2959 |
|
2960 |
nvHvinfo :: String |
2961 |
nvHvinfo = "hvinfo" |
2962 |
|
2963 |
nvHvparams :: String |
2964 |
nvHvparams = "hvparms" |
2965 |
|
2966 |
nvHypervisor :: String |
2967 |
nvHypervisor = "hypervisor" |
2968 |
|
2969 |
nvInstancelist :: String |
2970 |
nvInstancelist = "instancelist" |
2971 |
|
2972 |
nvLvlist :: String |
2973 |
nvLvlist = "lvlist" |
2974 |
|
2975 |
nvMasterip :: String |
2976 |
nvMasterip = "master-ip" |
2977 |
|
2978 |
nvNodelist :: String |
2979 |
nvNodelist = "nodelist" |
2980 |
|
2981 |
nvNodenettest :: String |
2982 |
nvNodenettest = "node-net-test" |
2983 |
|
2984 |
nvNodesetup :: String |
2985 |
nvNodesetup = "nodesetup" |
2986 |
|
2987 |
nvOobPaths :: String |
2988 |
nvOobPaths = "oob-paths" |
2989 |
|
2990 |
nvOslist :: String |
2991 |
nvOslist = "oslist" |
2992 |
|
2993 |
nvPvlist :: String |
2994 |
nvPvlist = "pvlist" |
2995 |
|
2996 |
nvTime :: String |
2997 |
nvTime = "time" |
2998 |
|
2999 |
nvUserscripts :: String |
3000 |
nvUserscripts = "user-scripts" |
3001 |
|
3002 |
nvVersion :: String |
3003 |
nvVersion = "version" |
3004 |
|
3005 |
nvVglist :: String |
3006 |
nvVglist = "vglist" |
3007 |
|
3008 |
nvVmnodes :: String |
3009 |
nvVmnodes = "vmnodes" |
3010 |
|
3011 |
-- * Instance status |
3012 |
|
3013 |
inststAdmindown :: String |
3014 |
inststAdmindown = Types.instanceStatusToRaw StatusDown |
3015 |
|
3016 |
inststAdminoffline :: String |
3017 |
inststAdminoffline = Types.instanceStatusToRaw StatusOffline |
3018 |
|
3019 |
inststErrordown :: String |
3020 |
inststErrordown = Types.instanceStatusToRaw ErrorDown |
3021 |
|
3022 |
inststErrorup :: String |
3023 |
inststErrorup = Types.instanceStatusToRaw ErrorUp |
3024 |
|
3025 |
inststNodedown :: String |
3026 |
inststNodedown = Types.instanceStatusToRaw NodeDown |
3027 |
|
3028 |
inststNodeoffline :: String |
3029 |
inststNodeoffline = Types.instanceStatusToRaw NodeOffline |
3030 |
|
3031 |
inststRunning :: String |
3032 |
inststRunning = Types.instanceStatusToRaw Running |
3033 |
|
3034 |
inststWrongnode :: String |
3035 |
inststWrongnode = Types.instanceStatusToRaw WrongNode |
3036 |
|
3037 |
inststAll :: FrozenSet String |
3038 |
inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..] |
3039 |
|
3040 |
-- * Admin states |
3041 |
|
3042 |
adminstDown :: String |
3043 |
adminstDown = Types.adminStateToRaw AdminDown |
3044 |
|
3045 |
adminstOffline :: String |
3046 |
adminstOffline = Types.adminStateToRaw AdminOffline |
3047 |
|
3048 |
adminstUp :: String |
3049 |
adminstUp = Types.adminStateToRaw AdminUp |
3050 |
|
3051 |
adminstAll :: FrozenSet String |
3052 |
adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..] |
3053 |
|
3054 |
-- * Node roles |
3055 |
|
3056 |
nrDrained :: String |
3057 |
nrDrained = Types.nodeRoleToRaw NRDrained |
3058 |
|
3059 |
nrMaster :: String |
3060 |
nrMaster = Types.nodeRoleToRaw NRMaster |
3061 |
|
3062 |
nrMcandidate :: String |
3063 |
nrMcandidate = Types.nodeRoleToRaw NRCandidate |
3064 |
|
3065 |
nrOffline :: String |
3066 |
nrOffline = Types.nodeRoleToRaw NROffline |
3067 |
|
3068 |
nrRegular :: String |
3069 |
nrRegular = Types.nodeRoleToRaw NRRegular |
3070 |
|
3071 |
nrAll :: FrozenSet String |
3072 |
nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..] |
3073 |
|
3074 |
-- * SSL certificate check constants (in days) |
3075 |
|
3076 |
sslCertExpirationError :: Int |
3077 |
sslCertExpirationError = 7 |
3078 |
|
3079 |
sslCertExpirationWarn :: Int |
3080 |
sslCertExpirationWarn = 30 |
3081 |
|
3082 |
-- * Allocator framework constants |
3083 |
|
3084 |
iallocatorVersion :: Int |
3085 |
iallocatorVersion = 2 |
3086 |
|
3087 |
iallocatorDirIn :: String |
3088 |
iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn |
3089 |
|
3090 |
iallocatorDirOut :: String |
3091 |
iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut |
3092 |
|
3093 |
validIallocatorDirections :: FrozenSet String |
3094 |
validIallocatorDirections = |
3095 |
ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..] |
3096 |
|
3097 |
iallocatorModeAlloc :: String |
3098 |
iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc |
3099 |
|
3100 |
iallocatorModeChgGroup :: String |
3101 |
iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup |
3102 |
|
3103 |
iallocatorModeMultiAlloc :: String |
3104 |
iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc |
3105 |
|
3106 |
iallocatorModeNodeEvac :: String |
3107 |
iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac |
3108 |
|
3109 |
iallocatorModeReloc :: String |
3110 |
iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc |
3111 |
|
3112 |
validIallocatorModes :: FrozenSet String |
3113 |
validIallocatorModes = |
3114 |
ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..] |
3115 |
|
3116 |
iallocatorSearchPath :: [String] |
3117 |
iallocatorSearchPath = AutoConf.iallocatorSearchPath |
3118 |
|
3119 |
defaultIallocatorShortcut :: String |
3120 |
defaultIallocatorShortcut = "." |
3121 |
|
3122 |
-- * Node evacuation |
3123 |
|
3124 |
nodeEvacPri :: String |
3125 |
nodeEvacPri = Types.evacModeToRaw ChangePrimary |
3126 |
|
3127 |
nodeEvacSec :: String |
3128 |
nodeEvacSec = Types.evacModeToRaw ChangeSecondary |
3129 |
|
3130 |
nodeEvacAll :: String |
3131 |
nodeEvacAll = Types.evacModeToRaw ChangeAll |
3132 |
|
3133 |
nodeEvacModes :: FrozenSet String |
3134 |
nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..] |
3135 |
|
3136 |
-- * Job queue |
3137 |
|
3138 |
jobQueueVersion :: Int |
3139 |
jobQueueVersion = 1 |
3140 |
|
3141 |
jobQueueSizeHardLimit :: Int |
3142 |
jobQueueSizeHardLimit = 5000 |
3143 |
|
3144 |
jobQueueFilesPerms :: Int |
3145 |
jobQueueFilesPerms = 0o640 |
3146 |
|
3147 |
-- * Unchanged job return |
3148 |
|
3149 |
jobNotchanged :: String |
3150 |
jobNotchanged = "nochange" |
3151 |
|
3152 |
-- * Job status |
3153 |
|
3154 |
jobStatusQueued :: String |
3155 |
jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED |
3156 |
|
3157 |
jobStatusWaiting :: String |
3158 |
jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING |
3159 |
|
3160 |
jobStatusCanceling :: String |
3161 |
jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING |
3162 |
|
3163 |
jobStatusRunning :: String |
3164 |
jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING |
3165 |
|
3166 |
jobStatusCanceled :: String |
3167 |
jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED |
3168 |
|
3169 |
jobStatusSuccess :: String |
3170 |
jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS |
3171 |
|
3172 |
jobStatusError :: String |
3173 |
jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR |
3174 |
|
3175 |
jobsPending :: FrozenSet String |
3176 |
jobsPending = |
3177 |
ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling] |
3178 |
|
3179 |
jobsFinalized :: FrozenSet String |
3180 |
jobsFinalized = |
3181 |
ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..] |
3182 |
|
3183 |
jobStatusAll :: FrozenSet String |
3184 |
jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..] |
3185 |
|
3186 |
-- * OpCode status |
3187 |
|
3188 |
-- ** Not yet finalized opcodes |
3189 |
|
3190 |
opStatusCanceling :: String |
3191 |
opStatusCanceling = "canceling" |
3192 |
|
3193 |
opStatusQueued :: String |
3194 |
opStatusQueued = "queued" |
3195 |
|
3196 |
opStatusRunning :: String |
3197 |
opStatusRunning = "running" |
3198 |
|
3199 |
opStatusWaiting :: String |
3200 |
opStatusWaiting = "waiting" |
3201 |
|
3202 |
-- ** Finalized opcodes |
3203 |
|
3204 |
opStatusCanceled :: String |
3205 |
opStatusCanceled = "canceled" |
3206 |
|
3207 |
opStatusError :: String |
3208 |
opStatusError = "error" |
3209 |
|
3210 |
opStatusSuccess :: String |
3211 |
opStatusSuccess = "success" |
3212 |
|
3213 |
opsFinalized :: FrozenSet String |
3214 |
opsFinalized = |
3215 |
ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess] |
3216 |
|
3217 |
-- * OpCode priority |
3218 |
|
3219 |
opPrioLowest :: Int |
3220 |
opPrioLowest = 19 |
3221 |
|
3222 |
opPrioHighest :: Int |
3223 |
opPrioHighest = -20 |
3224 |
|
3225 |
opPrioLow :: Int |
3226 |
opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow |
3227 |
|
3228 |
opPrioNormal :: Int |
3229 |
opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal |
3230 |
|
3231 |
opPrioHigh :: Int |
3232 |
opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh |
3233 |
|
3234 |
opPrioSubmitValid :: FrozenSet Int |
3235 |
opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh] |
3236 |
|
3237 |
opPrioDefault :: Int |
3238 |
opPrioDefault = opPrioNormal |
3239 |
|
3240 |
-- * Lock recalculate mode |
3241 |
|
3242 |
locksAppend :: String |
3243 |
locksAppend = "append" |
3244 |
|
3245 |
locksReplace :: String |
3246 |
locksReplace = "replace" |
3247 |
|
3248 |
-- * Lock timeout |
3249 |
-- |
3250 |
-- The lock timeout (sum) before we transition into blocking acquire |
3251 |
-- (this can still be reset by priority change). Computed as max time |
3252 |
-- (10 hours) before we should actually go into blocking acquire, |
3253 |
-- given that we start from the default priority level. |
3254 |
|
3255 |
lockAttemptsMaxwait :: Double |
3256 |
lockAttemptsMaxwait = 15.0 |
3257 |
|
3258 |
lockAttemptsMinwait :: Double |
3259 |
lockAttemptsMinwait = 1.0 |
3260 |
|
3261 |
lockAttemptsTimeout :: Int |
3262 |
lockAttemptsTimeout = (10 * 3600) `div` (opPrioDefault - opPrioHighest) |
3263 |
|
3264 |
-- * Execution log types |
3265 |
|
3266 |
elogMessage :: String |
3267 |
elogMessage = Types.eLogTypeToRaw ELogMessage |
3268 |
|
3269 |
elogRemoteImport :: String |
3270 |
elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport |
3271 |
|
3272 |
elogJqueueTest :: String |
3273 |
elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest |
3274 |
|
3275 |
-- * /etc/hosts modification |
3276 |
|
3277 |
etcHostsAdd :: String |
3278 |
etcHostsAdd = "add" |
3279 |
|
3280 |
etcHostsRemove :: String |
3281 |
etcHostsRemove = "remove" |
3282 |
|
3283 |
-- * Job queue test |
3284 |
|
3285 |
jqtMsgprefix :: String |
3286 |
jqtMsgprefix = "TESTMSG=" |
3287 |
|
3288 |
jqtExec :: String |
3289 |
jqtExec = "exec" |
3290 |
|
3291 |
jqtExpandnames :: String |
3292 |
jqtExpandnames = "expandnames" |
3293 |
|
3294 |
jqtLogmsg :: String |
3295 |
jqtLogmsg = "logmsg" |
3296 |
|
3297 |
jqtStartmsg :: String |
3298 |
jqtStartmsg = "startmsg" |
3299 |
|
3300 |
jqtAll :: FrozenSet String |
3301 |
jqtAll = ConstantUtils.mkSet [jqtExec, jqtExpandnames, jqtLogmsg, jqtStartmsg] |
3302 |
|
3303 |
-- * Query resources |
3304 |
|
3305 |
qrCluster :: String |
3306 |
qrCluster = "cluster" |
3307 |
|
3308 |
qrExport :: String |
3309 |
qrExport = "export" |
3310 |
|
3311 |
qrExtstorage :: String |
3312 |
qrExtstorage = "extstorage" |
3313 |
|
3314 |
qrGroup :: String |
3315 |
qrGroup = "group" |
3316 |
|
3317 |
qrInstance :: String |
3318 |
qrInstance = "instance" |
3319 |
|
3320 |
qrJob :: String |
3321 |
qrJob = "job" |
3322 |
|
3323 |
qrLock :: String |
3324 |
qrLock = "lock" |
3325 |
|
3326 |
qrNetwork :: String |
3327 |
qrNetwork = "network" |
3328 |
|
3329 |
qrNode :: String |
3330 |
qrNode = "node" |
3331 |
|
3332 |
qrOs :: String |
3333 |
qrOs = "os" |
3334 |
|
3335 |
-- | List of resources which can be queried using 'Ganeti.OpCodes.OpQuery' |
3336 |
qrViaOp :: FrozenSet String |
3337 |
qrViaOp = |
3338 |
ConstantUtils.mkSet [qrCluster, |
3339 |
qrInstance, |
3340 |
qrNode, |
3341 |
qrGroup, |
3342 |
qrOs, |
3343 |
qrExport, |
3344 |
qrNetwork, |
3345 |
qrExtstorage] |
3346 |
|
3347 |
-- | List of resources which can be queried using Local UniX Interface |
3348 |
qrViaLuxi :: FrozenSet String |
3349 |
qrViaLuxi = ConstantUtils.mkSet [qrLock, qrJob] |
3350 |
|
3351 |
-- | List of resources which can be queried using RAPI |
3352 |
qrViaRapi :: FrozenSet String |
3353 |
qrViaRapi = qrViaLuxi |
3354 |
|
3355 |
-- * Query field types |
3356 |
|
3357 |
qftBool :: String |
3358 |
qftBool = "bool" |
3359 |
|
3360 |
qftNumber :: String |
3361 |
qftNumber = "number" |
3362 |
|
3363 |
qftOther :: String |
3364 |
qftOther = "other" |
3365 |
|
3366 |
qftText :: String |
3367 |
qftText = "text" |
3368 |
|
3369 |
qftTimestamp :: String |
3370 |
qftTimestamp = "timestamp" |
3371 |
|
3372 |
qftUnit :: String |
3373 |
qftUnit = "unit" |
3374 |
|
3375 |
qftUnknown :: String |
3376 |
qftUnknown = "unknown" |
3377 |
|
3378 |
qftAll :: FrozenSet String |
3379 |
qftAll = |
3380 |
ConstantUtils.mkSet [qftBool, |
3381 |
qftNumber, |
3382 |
qftOther, |
3383 |
qftText, |
3384 |
qftTimestamp, |
3385 |
qftUnit, |
3386 |
qftUnknown] |
3387 |
|
3388 |
-- * Query result field status |
3389 |
-- |
3390 |
-- Don't change or reuse values as they're used by clients. |
3391 |
-- |
3392 |
-- FIXME: link with 'Ganeti.Query.Language.ResultStatus' |
3393 |
|
3394 |
-- | No data (e.g. RPC error), can be used instead of 'rsOffline' |
3395 |
rsNodata :: Int |
3396 |
rsNodata = 2 |
3397 |
|
3398 |
rsNormal :: Int |
3399 |
rsNormal = 0 |
3400 |
|
3401 |
-- | Resource marked offline |
3402 |
rsOffline :: Int |
3403 |
rsOffline = 4 |
3404 |
|
3405 |
-- | Value unavailable/unsupported for item; if this field is |
3406 |
-- supported but we cannot get the data for the moment, 'rsNodata' or |
3407 |
-- 'rsOffline' should be used |
3408 |
rsUnavail :: Int |
3409 |
rsUnavail = 3 |
3410 |
|
3411 |
rsUnknown :: Int |
3412 |
rsUnknown = 1 |
3413 |
|
3414 |
rsAll :: FrozenSet Int |
3415 |
rsAll = |
3416 |
ConstantUtils.mkSet [rsNodata, |
3417 |
rsNormal, |
3418 |
rsOffline, |
3419 |
rsUnavail, |
3420 |
rsUnknown] |
3421 |
|
3422 |
-- | Special field cases and their verbose/terse formatting |
3423 |
rssDescription :: Map Int (String, String) |
3424 |
rssDescription = |
3425 |
Map.fromList [(rsUnknown, ("(unknown)", "??")), |
3426 |
(rsNodata, ("(nodata)", "?")), |
3427 |
(rsOffline, ("(offline)", "*")), |
3428 |
(rsUnavail, ("(unavail)", "-"))] |
3429 |
|
3430 |
-- * Max dynamic devices |
3431 |
|
3432 |
maxDisks :: Int |
3433 |
maxDisks = Types.maxDisks |
3434 |
|
3435 |
maxNics :: Int |
3436 |
maxNics = Types.maxNics |
3437 |
|
3438 |
-- | SSCONF file prefix |
3439 |
ssconfFileprefix :: String |
3440 |
ssconfFileprefix = "ssconf_" |
3441 |
|
3442 |
-- * SSCONF keys |
3443 |
|
3444 |
ssClusterName :: String |
3445 |
ssClusterName = "cluster_name" |
3446 |
|
3447 |
ssClusterTags :: String |
3448 |
ssClusterTags = "cluster_tags" |
3449 |
|
3450 |
ssFileStorageDir :: String |
3451 |
ssFileStorageDir = "file_storage_dir" |
3452 |
|
3453 |
ssSharedFileStorageDir :: String |
3454 |
ssSharedFileStorageDir = "shared_file_storage_dir" |
3455 |
|
3456 |
ssMasterCandidates :: String |
3457 |
ssMasterCandidates = "master_candidates" |
3458 |
|
3459 |
ssMasterCandidatesIps :: String |
3460 |
ssMasterCandidatesIps = "master_candidates_ips" |
3461 |
|
3462 |
ssMasterIp :: String |
3463 |
ssMasterIp = "master_ip" |
3464 |
|
3465 |
ssMasterNetdev :: String |
3466 |
ssMasterNetdev = "master_netdev" |
3467 |
|
3468 |
ssMasterNetmask :: String |
3469 |
ssMasterNetmask = "master_netmask" |
3470 |
|
3471 |
ssMasterNode :: String |
3472 |
ssMasterNode = "master_node" |
3473 |
|
3474 |
ssNodeList :: String |
3475 |
ssNodeList = "node_list" |
3476 |
|
3477 |
ssNodePrimaryIps :: String |
3478 |
ssNodePrimaryIps = "node_primary_ips" |
3479 |
|
3480 |
ssNodeSecondaryIps :: String |
3481 |
ssNodeSecondaryIps = "node_secondary_ips" |
3482 |
|
3483 |
ssOfflineNodes :: String |
3484 |
ssOfflineNodes = "offline_nodes" |
3485 |
|
3486 |
ssOnlineNodes :: String |
3487 |
ssOnlineNodes = "online_nodes" |
3488 |
|
3489 |
ssPrimaryIpFamily :: String |
3490 |
ssPrimaryIpFamily = "primary_ip_family" |
3491 |
|
3492 |
ssInstanceList :: String |
3493 |
ssInstanceList = "instance_list" |
3494 |
|
3495 |
ssReleaseVersion :: String |
3496 |
ssReleaseVersion = "release_version" |
3497 |
|
3498 |
ssHypervisorList :: String |
3499 |
ssHypervisorList = "hypervisor_list" |
3500 |
|
3501 |
ssMaintainNodeHealth :: String |
3502 |
ssMaintainNodeHealth = "maintain_node_health" |
3503 |
|
3504 |
ssUidPool :: String |
3505 |
ssUidPool = "uid_pool" |
3506 |
|
3507 |
ssNodegroups :: String |
3508 |
ssNodegroups = "nodegroups" |
3509 |
|
3510 |
ssNetworks :: String |
3511 |
ssNetworks = "networks" |
3512 |
|
3513 |
-- | This is not a complete SSCONF key, but the prefix for the |
3514 |
-- hypervisor keys |
3515 |
ssHvparamsPref :: String |
3516 |
ssHvparamsPref = "hvparams_" |
3517 |
|
3518 |
-- * Hvparams keys |
3519 |
|
3520 |
ssHvparamsXenChroot :: String |
3521 |
ssHvparamsXenChroot = ssHvparamsPref ++ htChroot |
3522 |
|
3523 |
ssHvparamsXenFake :: String |
3524 |
ssHvparamsXenFake = ssHvparamsPref ++ htFake |
3525 |
|
3526 |
ssHvparamsXenHvm :: String |
3527 |
ssHvparamsXenHvm = ssHvparamsPref ++ htXenHvm |
3528 |
|
3529 |
ssHvparamsXenKvm :: String |
3530 |
ssHvparamsXenKvm = ssHvparamsPref ++ htKvm |
3531 |
|
3532 |
ssHvparamsXenLxc :: String |
3533 |
ssHvparamsXenLxc = ssHvparamsPref ++ htLxc |
3534 |
|
3535 |
ssHvparamsXenPvm :: String |
3536 |
ssHvparamsXenPvm = ssHvparamsPref ++ htXenPvm |
3537 |
|
3538 |
validSsHvparamsKeys :: FrozenSet String |
3539 |
validSsHvparamsKeys = |
3540 |
ConstantUtils.mkSet [ssHvparamsXenChroot, |
3541 |
ssHvparamsXenLxc, |
3542 |
ssHvparamsXenFake, |
3543 |
ssHvparamsXenHvm, |
3544 |
ssHvparamsXenKvm, |
3545 |
ssHvparamsXenPvm] |
3546 |
|
3547 |
ssFilePerms :: Int |
3548 |
ssFilePerms = 0o444 |
3549 |
|
3550 |
-- | Cluster wide default parameters |
3551 |
defaultEnabledHypervisor :: String |
3552 |
defaultEnabledHypervisor = htXenPvm |
3553 |
|
3554 |
hvcDefaults :: Map Hypervisor (Map String PyValueEx) |
3555 |
hvcDefaults = |
3556 |
Map.fromList |
3557 |
[ (XenPvm, Map.fromList |
3558 |
[ (hvUseBootloader, PyValueEx False) |
3559 |
, (hvBootloaderPath, PyValueEx xenBootloader) |
3560 |
, (hvBootloaderArgs, PyValueEx "") |
3561 |
, (hvKernelPath, PyValueEx xenKernel) |
3562 |
, (hvInitrdPath, PyValueEx "") |
3563 |
, (hvRootPath, PyValueEx "/dev/xvda1") |
3564 |
, (hvKernelArgs, PyValueEx "ro") |
3565 |
, (hvMigrationPort, PyValueEx (8002 :: Int)) |
3566 |
, (hvMigrationMode, PyValueEx htMigrationLive) |
3567 |
, (hvBlockdevPrefix, PyValueEx "sd") |
3568 |
, (hvRebootBehavior, PyValueEx instanceRebootAllowed) |
3569 |
, (hvCpuMask, PyValueEx cpuPinningAll) |
3570 |
, (hvCpuCap, PyValueEx (0 :: Int)) |
3571 |
, (hvCpuWeight, PyValueEx (256 :: Int)) |
3572 |
, (hvVifScript, PyValueEx "") |
3573 |
, (hvXenCmd, PyValueEx xenCmdXm) |
3574 |
, (hvXenCpuid, PyValueEx "") |
3575 |
, (hvSoundhw, PyValueEx "") |
3576 |
]) |
3577 |
, (XenHvm, Map.fromList |
3578 |
[ (hvBootOrder, PyValueEx "cd") |
3579 |
, (hvCdromImagePath, PyValueEx "") |
3580 |
, (hvNicType, PyValueEx htNicRtl8139) |
3581 |
, (hvDiskType, PyValueEx htDiskParavirtual) |
3582 |
, (hvVncBindAddress, PyValueEx ip4AddressAny) |
3583 |
, (hvAcpi, PyValueEx True) |
3584 |
, (hvPae, PyValueEx True) |
3585 |
, (hvKernelPath, PyValueEx "/usr/lib/xen/boot/hvmloader") |
3586 |
, (hvDeviceModel, PyValueEx "/usr/lib/xen/bin/qemu-dm") |
3587 |
, (hvMigrationPort, PyValueEx (8002 :: Int)) |
3588 |
, (hvMigrationMode, PyValueEx htMigrationNonlive) |
3589 |
, (hvUseLocaltime, PyValueEx False) |
3590 |
, (hvBlockdevPrefix, PyValueEx "hd") |
3591 |
, (hvPassthrough, PyValueEx "") |
3592 |
, (hvRebootBehavior, PyValueEx instanceRebootAllowed) |
3593 |
, (hvCpuMask, PyValueEx cpuPinningAll) |
3594 |
, (hvCpuCap, PyValueEx (0 :: Int)) |
3595 |
, (hvCpuWeight, PyValueEx (256 :: Int)) |
3596 |
, (hvVifType, PyValueEx htHvmVifIoemu) |
3597 |
, (hvVifScript, PyValueEx "") |
3598 |
, (hvViridian, PyValueEx False) |
3599 |
, (hvXenCmd, PyValueEx xenCmdXm) |
3600 |
, (hvXenCpuid, PyValueEx "") |
3601 |
, (hvSoundhw, PyValueEx "") |
3602 |
]) |
3603 |
, (Kvm, Map.fromList |
3604 |
[ (hvKvmPath, PyValueEx kvmPath) |
3605 |
, (hvKernelPath, PyValueEx kvmKernel) |
3606 |
, (hvInitrdPath, PyValueEx "") |
3607 |
, (hvKernelArgs, PyValueEx "ro") |
3608 |
, (hvRootPath, PyValueEx "/dev/vda1") |
3609 |
, (hvAcpi, PyValueEx True) |
3610 |
, (hvSerialConsole, PyValueEx True) |
3611 |
, (hvSerialSpeed, PyValueEx (38400 :: Int)) |
3612 |
, (hvVncBindAddress, PyValueEx "") |
3613 |
, (hvVncTls, PyValueEx False) |
3614 |
, (hvVncX509, PyValueEx "") |
3615 |
, (hvVncX509Verify, PyValueEx False) |
3616 |
, (hvVncPasswordFile, PyValueEx "") |
3617 |
, (hvKvmSpiceBind, PyValueEx "") |
3618 |
, (hvKvmSpiceIpVersion, PyValueEx ifaceNoIpVersionSpecified) |
3619 |
, (hvKvmSpicePasswordFile, PyValueEx "") |
3620 |
, (hvKvmSpiceLosslessImgCompr, PyValueEx "") |
3621 |
, (hvKvmSpiceJpegImgCompr, PyValueEx "") |
3622 |
, (hvKvmSpiceZlibGlzImgCompr, PyValueEx "") |
3623 |
, (hvKvmSpiceStreamingVideoDetection, PyValueEx "") |
3624 |
, (hvKvmSpiceAudioCompr, PyValueEx True) |
3625 |
, (hvKvmSpiceUseTls, PyValueEx False) |
3626 |
, (hvKvmSpiceTlsCiphers, PyValueEx opensslCiphers) |
3627 |
, (hvKvmSpiceUseVdagent, PyValueEx True) |
3628 |
, (hvKvmFloppyImagePath, PyValueEx "") |
3629 |
, (hvCdromImagePath, PyValueEx "") |
3630 |
, (hvKvmCdrom2ImagePath, PyValueEx "") |
3631 |
, (hvBootOrder, PyValueEx htBoDisk) |
3632 |
, (hvNicType, PyValueEx htNicParavirtual) |
3633 |
, (hvDiskType, PyValueEx htDiskParavirtual) |
3634 |
, (hvKvmCdromDiskType, PyValueEx "") |
3635 |
, (hvUsbMouse, PyValueEx "") |
3636 |
, (hvKeymap, PyValueEx "") |
3637 |
, (hvMigrationPort, PyValueEx (8102 :: Int)) |
3638 |
, (hvMigrationBandwidth, PyValueEx (32 :: Int)) |
3639 |
, (hvMigrationDowntime, PyValueEx (30 :: Int)) |
3640 |
, (hvMigrationMode, PyValueEx htMigrationLive) |
3641 |
, (hvUseLocaltime, PyValueEx False) |
3642 |
, (hvDiskCache, PyValueEx htCacheDefault) |
3643 |
, (hvSecurityModel, PyValueEx htSmNone) |
3644 |
, (hvSecurityDomain, PyValueEx "") |
3645 |
, (hvKvmFlag, PyValueEx "") |
3646 |
, (hvVhostNet, PyValueEx False) |
3647 |
, (hvKvmUseChroot, PyValueEx False) |
3648 |
, (hvMemPath, PyValueEx "") |
3649 |
, (hvRebootBehavior, PyValueEx instanceRebootAllowed) |
3650 |
, (hvCpuMask, PyValueEx cpuPinningAll) |
3651 |
, (hvCpuType, PyValueEx "") |
3652 |
, (hvCpuCores, PyValueEx (0 :: Int)) |
3653 |
, (hvCpuThreads, PyValueEx (0 :: Int)) |
3654 |
, (hvCpuSockets, PyValueEx (0 :: Int)) |
3655 |
, (hvSoundhw, PyValueEx "") |
3656 |
, (hvUsbDevices, PyValueEx "") |
3657 |
, (hvVga, PyValueEx "") |
3658 |
, (hvKvmExtra, PyValueEx "") |
3659 |
, (hvKvmMachineVersion, PyValueEx "") |
3660 |
, (hvVnetHdr, PyValueEx True)]) |
3661 |
, (Fake, Map.fromList [(hvMigrationMode, PyValueEx htMigrationLive)]) |
3662 |
, (Chroot, Map.fromList [(hvInitScript, PyValueEx "/ganeti-chroot")]) |
3663 |
, (Lxc, Map.fromList [(hvCpuMask, PyValueEx "")]) |
3664 |
] |
3665 |
|
3666 |
hvcGlobals :: FrozenSet String |
3667 |
hvcGlobals = |
3668 |
ConstantUtils.mkSet [hvMigrationBandwidth, |
3669 |
hvMigrationMode, |
3670 |
hvMigrationPort, |
3671 |
hvXenCmd] |
3672 |
|
3673 |
becDefaults :: Map String PyValueEx |
3674 |
becDefaults = |
3675 |
Map.fromList |
3676 |
[ (beMinmem, PyValueEx (128 :: Int)) |
3677 |
, (beMaxmem, PyValueEx (128 :: Int)) |
3678 |
, (beVcpus, PyValueEx (1 :: Int)) |
3679 |
, (beAutoBalance, PyValueEx True) |
3680 |
, (beAlwaysFailover, PyValueEx False) |
3681 |
, (beSpindleUse, PyValueEx (1 :: Int)) |
3682 |
] |
3683 |
|
3684 |
ndcDefaults :: Map String PyValueEx |
3685 |
ndcDefaults = |
3686 |
Map.fromList |
3687 |
[ (ndOobProgram, PyValueEx "") |
3688 |
, (ndSpindleCount, PyValueEx (1 :: Int)) |
3689 |
, (ndExclusiveStorage, PyValueEx False) |
3690 |
, (ndOvs, PyValueEx False) |
3691 |
, (ndOvsName, PyValueEx defaultOvs) |
3692 |
, (ndOvsLink, PyValueEx "") |
3693 |
] |
3694 |
|
3695 |
ndcGlobals :: FrozenSet String |
3696 |
ndcGlobals = ConstantUtils.mkSet [ndExclusiveStorage] |
3697 |
|
3698 |
-- | Default delay target measured in sectors |
3699 |
defaultDelayTarget :: Int |
3700 |
defaultDelayTarget = 1 |
3701 |
|
3702 |
defaultDiskCustom :: String |
3703 |
defaultDiskCustom = "" |
3704 |
|
3705 |
defaultDiskResync :: Bool |
3706 |
defaultDiskResync = False |
3707 |
|
3708 |
-- | Default fill target measured in sectors |
3709 |
defaultFillTarget :: Int |
3710 |
defaultFillTarget = 0 |
3711 |
|
3712 |
-- | Default mininum rate measured in KiB/s |
3713 |
defaultMinRate :: Int |
3714 |
defaultMinRate = 4 * 1024 |
3715 |
|
3716 |
defaultNetCustom :: String |
3717 |
defaultNetCustom = "" |
3718 |
|
3719 |
-- | Default plan ahead measured in sectors |
3720 |
-- |
3721 |
-- The default values for the DRBD dynamic resync speed algorithm are |
3722 |
-- taken from the drbsetup 8.3.11 man page, except for c-plan-ahead |
3723 |
-- (that we don't need to set to 0, because we have a separate option |
3724 |
-- to enable it) and for c-max-rate, that we cap to the default value |
3725 |
-- for the static resync rate. |
3726 |
defaultPlanAhead :: Int |
3727 |
defaultPlanAhead = 20 |
3728 |
|
3729 |
defaultRbdPool :: String |
3730 |
defaultRbdPool = "rbd" |
3731 |
|
3732 |
diskLdDefaults :: Map DiskTemplate (Map String PyValueEx) |
3733 |
diskLdDefaults = |
3734 |
Map.fromList |
3735 |
[ (DTBlock, Map.empty) |
3736 |
, (DTDrbd8, Map.fromList |
3737 |
[ (ldpBarriers, PyValueEx drbdBarriers) |
3738 |
, (ldpDefaultMetavg, PyValueEx defaultVg) |
3739 |
, (ldpDelayTarget, PyValueEx defaultDelayTarget) |
3740 |
, (ldpDiskCustom, PyValueEx defaultDiskCustom) |
3741 |
, (ldpDynamicResync, PyValueEx defaultDiskResync) |
3742 |
, (ldpFillTarget, PyValueEx defaultFillTarget) |
3743 |
, (ldpMaxRate, PyValueEx classicDrbdSyncSpeed) |
3744 |
, (ldpMinRate, PyValueEx defaultMinRate) |
3745 |
, (ldpNetCustom, PyValueEx defaultNetCustom) |
3746 |
, (ldpNoMetaFlush, PyValueEx drbdNoMetaFlush) |
3747 |
, (ldpPlanAhead, PyValueEx defaultPlanAhead) |
3748 |
, (ldpProtocol, PyValueEx drbdDefaultNetProtocol) |
3749 |
, (ldpResyncRate, PyValueEx classicDrbdSyncSpeed) |
3750 |
]) |
3751 |
, (DTExt, Map.empty) |
3752 |
, (DTFile, Map.empty) |
3753 |
, (DTPlain, Map.fromList [(ldpStripes, PyValueEx lvmStripecount)]) |
3754 |
, (DTRbd, Map.fromList |
3755 |
[ (ldpPool, PyValueEx defaultRbdPool) |
3756 |
, (ldpAccess, PyValueEx diskKernelspace) |
3757 |
]) |
3758 |
, (DTSharedFile, Map.empty) |
3759 |
] |
3760 |
|
3761 |
diskDtDefaults :: Map DiskTemplate (Map String PyValueEx) |
3762 |
diskDtDefaults = |
3763 |
Map.fromList |
3764 |
[ (DTBlock, Map.empty) |
3765 |
, (DTDiskless, Map.empty) |
3766 |
, (DTDrbd8, Map.fromList |
3767 |
[ (drbdDataStripes, PyValueEx lvmStripecount) |
3768 |
, (drbdDefaultMetavg, PyValueEx defaultVg) |
3769 |
, (drbdDelayTarget, PyValueEx defaultDelayTarget) |
3770 |
, (drbdDiskBarriers, PyValueEx drbdBarriers) |
3771 |
, (drbdDiskCustom, PyValueEx defaultDiskCustom) |
3772 |
, (drbdDynamicResync, PyValueEx defaultDiskResync) |
3773 |
, (drbdFillTarget, PyValueEx defaultFillTarget) |
3774 |
, (drbdMaxRate, PyValueEx classicDrbdSyncSpeed) |
3775 |
, (drbdMetaBarriers, PyValueEx drbdNoMetaFlush) |
3776 |
, (drbdMetaStripes, PyValueEx lvmStripecount) |
3777 |
, (drbdMinRate, PyValueEx defaultMinRate) |
3778 |
, (drbdNetCustom, PyValueEx defaultNetCustom) |
3779 |
, (drbdPlanAhead, PyValueEx defaultPlanAhead) |
3780 |
, (drbdProtocol, PyValueEx drbdDefaultNetProtocol) |
3781 |
, (drbdResyncRate, PyValueEx classicDrbdSyncSpeed) |
3782 |
]) |
3783 |
, (DTExt, Map.empty) |
3784 |
, (DTFile, Map.empty) |
3785 |
, (DTPlain, Map.fromList [(lvStripes, PyValueEx lvmStripecount)]) |
3786 |
, (DTRbd, Map.fromList |
3787 |
[ (rbdPool, PyValueEx defaultRbdPool) |
3788 |
, (rbdAccess, PyValueEx diskKernelspace) |
3789 |
]) |
3790 |
, (DTSharedFile, Map.empty) |
3791 |
] |
3792 |
|
3793 |
niccDefaults :: Map String PyValueEx |
3794 |
niccDefaults = |
3795 |
Map.fromList |
3796 |
[ (nicMode, PyValueEx nicModeBridged) |
3797 |
, (nicLink, PyValueEx defaultBridge) |
3798 |
, (nicVlan, PyValueEx valueHsNothing) |
3799 |
] |
3800 |
|
3801 |
-- | All of the following values are quite arbitrary - there are no |
3802 |
-- "good" defaults, these must be customised per-site |
3803 |
ispecsMinmaxDefaults :: Map String (Map String Int) |
3804 |
ispecsMinmaxDefaults = |
3805 |
Map.fromList |
3806 |
[(ispecsMin, |
3807 |
Map.fromList |
3808 |
[(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMinISpec), |
3809 |
(ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMinISpec), |
3810 |
(ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMinISpec), |
3811 |
(ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMinISpec), |
3812 |
(ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMinISpec), |
3813 |
(ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMinISpec)]), |
3814 |
(ispecsMax, |
3815 |
Map.fromList |
3816 |
[(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMaxISpec), |
3817 |
(ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMaxISpec), |
3818 |
(ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMaxISpec), |
3819 |
(ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMaxISpec), |
3820 |
(ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMaxISpec), |
3821 |
(ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMaxISpec)])] |
3822 |
|
3823 |
ipolicyDefaults :: Map String PyValueEx |
3824 |
ipolicyDefaults = |
3825 |
Map.fromList |
3826 |
[ (ispecsMinmax, PyValueEx [ispecsMinmaxDefaults]) |
3827 |
, (ispecsStd, PyValueEx (Map.fromList |
3828 |
[ (ispecMemSize, 128) |
3829 |
, (ispecCpuCount, 1) |
3830 |
, (ispecDiskCount, 1) |
3831 |
, (ispecDiskSize, 1024) |
3832 |
, (ispecNicCount, 1) |
3833 |
, (ispecSpindleUse, 1) |
3834 |
] :: Map String Int)) |
3835 |
, (ipolicyDts, PyValueEx (ConstantUtils.toList diskTemplates)) |
3836 |
, (ipolicyVcpuRatio, PyValueEx (4.0 :: Double)) |
3837 |
, (ipolicySpindleRatio, PyValueEx (32.0 :: Double)) |
3838 |
] |
3839 |
|
3840 |
masterPoolSizeDefault :: Int |
3841 |
masterPoolSizeDefault = 10 |
3842 |
|
3843 |
-- * Exclusive storage |
3844 |
|
3845 |
-- | Error margin used to compare physical disks |
3846 |
partMargin :: Double |
3847 |
partMargin = 0.01 |
3848 |
|
3849 |
-- | Space reserved when creating instance disks |
3850 |
partReserved :: Double |
3851 |
partReserved = 0.02 |
3852 |
|
3853 |
-- * Confd |
3854 |
|
3855 |
confdProtocolVersion :: Int |
3856 |
confdProtocolVersion = ConstantUtils.confdProtocolVersion |
3857 |
|
3858 |
-- Confd request type |
3859 |
|
3860 |
confdReqPing :: Int |
3861 |
confdReqPing = Types.confdRequestTypeToRaw ReqPing |
3862 |
|
3863 |
confdReqNodeRoleByname :: Int |
3864 |
confdReqNodeRoleByname = Types.confdRequestTypeToRaw ReqNodeRoleByName |
3865 |
|
3866 |
confdReqNodePipByInstanceIp :: Int |
3867 |
confdReqNodePipByInstanceIp = Types.confdRequestTypeToRaw ReqNodePipByInstPip |
3868 |
|
3869 |
confdReqClusterMaster :: Int |
3870 |
confdReqClusterMaster = Types.confdRequestTypeToRaw ReqClusterMaster |
3871 |
|
3872 |
confdReqNodePipList :: Int |
3873 |
confdReqNodePipList = Types.confdRequestTypeToRaw ReqNodePipList |
3874 |
|
3875 |
confdReqMcPipList :: Int |
3876 |
confdReqMcPipList = Types.confdRequestTypeToRaw ReqMcPipList |
3877 |
|
3878 |
confdReqInstancesIpsList :: Int |
3879 |
confdReqInstancesIpsList = Types.confdRequestTypeToRaw ReqInstIpsList |
3880 |
|
3881 |
confdReqNodeDrbd :: Int |
3882 |
confdReqNodeDrbd = Types.confdRequestTypeToRaw ReqNodeDrbd |
3883 |
|
3884 |
confdReqNodeInstances :: Int |
3885 |
confdReqNodeInstances = Types.confdRequestTypeToRaw ReqNodeInstances |
3886 |
|
3887 |
confdReqs :: FrozenSet Int |
3888 |
confdReqs = |
3889 |
ConstantUtils.mkSet . |
3890 |
map Types.confdRequestTypeToRaw $ |
3891 |
[minBound..] \\ [ReqNodeInstances] |
3892 |
|
3893 |
-- * Confd request type |
3894 |
|
3895 |
confdReqfieldName :: Int |
3896 |
confdReqfieldName = Types.confdReqFieldToRaw ReqFieldName |
3897 |
|
3898 |
confdReqfieldIp :: Int |
3899 |
confdReqfieldIp = Types.confdReqFieldToRaw ReqFieldIp |
3900 |
|
3901 |
confdReqfieldMnodePip :: Int |
3902 |
confdReqfieldMnodePip = Types.confdReqFieldToRaw ReqFieldMNodePip |
3903 |
|
3904 |
-- * Confd repl status |
3905 |
|
3906 |
confdReplStatusOk :: Int |
3907 |
confdReplStatusOk = Types.confdReplyStatusToRaw ReplyStatusOk |
3908 |
|
3909 |
confdReplStatusError :: Int |
3910 |
confdReplStatusError = Types.confdReplyStatusToRaw ReplyStatusError |
3911 |
|
3912 |
confdReplStatusNotimplemented :: Int |
3913 |
confdReplStatusNotimplemented = Types.confdReplyStatusToRaw ReplyStatusNotImpl |
3914 |
|
3915 |
confdReplStatuses :: FrozenSet Int |
3916 |
confdReplStatuses = |
3917 |
ConstantUtils.mkSet $ map Types.confdReplyStatusToRaw [minBound..] |
3918 |
|
3919 |
-- * Confd node role |
3920 |
|
3921 |
confdNodeRoleMaster :: Int |
3922 |
confdNodeRoleMaster = Types.confdNodeRoleToRaw NodeRoleMaster |
3923 |
|
3924 |
confdNodeRoleCandidate :: Int |
3925 |
confdNodeRoleCandidate = Types.confdNodeRoleToRaw NodeRoleCandidate |
3926 |
|
3927 |
confdNodeRoleOffline :: Int |
3928 |
confdNodeRoleOffline = Types.confdNodeRoleToRaw NodeRoleOffline |
3929 |
|
3930 |
confdNodeRoleDrained :: Int |
3931 |
confdNodeRoleDrained = Types.confdNodeRoleToRaw NodeRoleDrained |
3932 |
|
3933 |
confdNodeRoleRegular :: Int |
3934 |
confdNodeRoleRegular = Types.confdNodeRoleToRaw NodeRoleRegular |
3935 |
|
3936 |
-- * A few common errors for confd |
3937 |
|
3938 |
confdErrorUnknownEntry :: Int |
3939 |
confdErrorUnknownEntry = Types.confdErrorTypeToRaw ConfdErrorUnknownEntry |
3940 |
|
3941 |
confdErrorInternal :: Int |
3942 |
confdErrorInternal = Types.confdErrorTypeToRaw ConfdErrorInternal |
3943 |
|
3944 |
confdErrorArgument :: Int |
3945 |
confdErrorArgument = Types.confdErrorTypeToRaw ConfdErrorArgument |
3946 |
|
3947 |
-- * Confd request query fields |
3948 |
|
3949 |
confdReqqLink :: String |
3950 |
confdReqqLink = ConstantUtils.confdReqqLink |
3951 |
|
3952 |
confdReqqIp :: String |
3953 |
confdReqqIp = ConstantUtils.confdReqqIp |
3954 |
|
3955 |
confdReqqIplist :: String |
3956 |
confdReqqIplist = ConstantUtils.confdReqqIplist |
3957 |
|
3958 |
confdReqqFields :: String |
3959 |
confdReqqFields = ConstantUtils.confdReqqFields |
3960 |
|
3961 |
-- | Each request is "salted" by the current timestamp. |
3962 |
-- |
3963 |
-- This constant decides how many seconds of skew to accept. |
3964 |
-- |
3965 |
-- TODO: make this a default and allow the value to be more |
3966 |
-- configurable |
3967 |
confdMaxClockSkew :: Int |
3968 |
confdMaxClockSkew = 2 * nodeMaxClockSkew |
3969 |
|
3970 |
-- | When we haven't reloaded the config for more than this amount of |
3971 |
-- seconds, we force a test to see if inotify is betraying us. Using a |
3972 |
-- prime number to ensure we get less chance of 'same wakeup' with |
3973 |
-- other processes. |
3974 |
confdConfigReloadTimeout :: Int |
3975 |
confdConfigReloadTimeout = 17 |
3976 |
|
3977 |
-- | If we receive more than one update in this amount of |
3978 |
-- microseconds, we move to polling every RATELIMIT seconds, rather |
3979 |
-- than relying on inotify, to be able to serve more requests. |
3980 |
confdConfigReloadRatelimit :: Int |
3981 |
confdConfigReloadRatelimit = 250000 |
3982 |
|
3983 |
-- | Magic number prepended to all confd queries. |
3984 |
-- |
3985 |
-- This allows us to distinguish different types of confd protocols |
3986 |
-- and handle them. For example by changing this we can move the whole |
3987 |
-- payload to be compressed, or move away from json. |
3988 |
confdMagicFourcc :: String |
3989 |
confdMagicFourcc = "plj0" |
3990 |
|
3991 |
-- | By default a confd request is sent to the minimum between this |
3992 |
-- number and all MCs. 6 was chosen because even in the case of a |
3993 |
-- disastrous 50% response rate, we should have enough answers to be |
3994 |
-- able to compare more than one. |
3995 |
confdDefaultReqCoverage :: Int |
3996 |
confdDefaultReqCoverage = 6 |
3997 |
|
3998 |
-- | Timeout in seconds to expire pending query request in the confd |
3999 |
-- client library. We don't actually expect any answer more than 10 |
4000 |
-- seconds after we sent a request. |
4001 |
confdClientExpireTimeout :: Int |
4002 |
confdClientExpireTimeout = 10 |
4003 |
|
4004 |
-- | Maximum UDP datagram size. |
4005 |
-- |
4006 |
-- On IPv4: 64K - 20 (ip header size) - 8 (udp header size) = 65507 |
4007 |
-- On IPv6: 64K - 40 (ip6 header size) - 8 (udp header size) = 65487 |
4008 |
-- (assuming we can't use jumbo frames) |
4009 |
-- We just set this to 60K, which should be enough |
4010 |
maxUdpDataSize :: Int |
4011 |
maxUdpDataSize = 61440 |
4012 |
|
4013 |
-- * User-id pool minimum/maximum acceptable user-ids |
4014 |
|
4015 |
uidpoolUidMin :: Int |
4016 |
uidpoolUidMin = 0 |
4017 |
|
4018 |
-- | Assuming 32 bit user-ids |
4019 |
uidpoolUidMax :: Integer |
4020 |
uidpoolUidMax = 2 ^ 32 - 1 |
4021 |
|
4022 |
-- | Name or path of the pgrep command |
4023 |
pgrep :: String |
4024 |
pgrep = "pgrep" |
4025 |
|
4026 |
-- | Name of the node group that gets created at cluster init or |
4027 |
-- upgrade |
4028 |
initialNodeGroupName :: String |
4029 |
initialNodeGroupName = "default" |
4030 |
|
4031 |
-- * Possible values for NodeGroup.alloc_policy |
4032 |
|
4033 |
allocPolicyLastResort :: String |
4034 |
allocPolicyLastResort = Types.allocPolicyToRaw AllocLastResort |
4035 |
|
4036 |
allocPolicyPreferred :: String |
4037 |
allocPolicyPreferred = Types.allocPolicyToRaw AllocPreferred |
4038 |
|
4039 |
allocPolicyUnallocable :: String |
4040 |
allocPolicyUnallocable = Types.allocPolicyToRaw AllocUnallocable |
4041 |
|
4042 |
validAllocPolicies :: [String] |
4043 |
validAllocPolicies = map Types.allocPolicyToRaw [minBound..] |
4044 |
|
4045 |
-- | Temporary external/shared storage parameters |
4046 |
blockdevDriverManual :: String |
4047 |
blockdevDriverManual = Types.blockDriverToRaw BlockDrvManual |
4048 |
|
4049 |
-- | 'qemu-img' path, required for 'ovfconverter' |
4050 |
qemuimgPath :: String |
4051 |
qemuimgPath = AutoConf.qemuimgPath |
4052 |
|
4053 |
-- | Whether htools was enabled at compilation time |
4054 |
-- |
4055 |
-- FIXME: this should be moved next to the other enable constants, |
4056 |
-- such as, 'enableConfd', and renamed to 'enableHtools'. |
4057 |
htools :: Bool |
4058 |
htools = AutoConf.htools |
4059 |
|
4060 |
-- | The hail iallocator |
4061 |
iallocHail :: String |
4062 |
iallocHail = "hail" |
4063 |
|
4064 |
-- * Fake opcodes for functions that have hooks attached to them via |
4065 |
-- backend.RunLocalHooks |
4066 |
|
4067 |
fakeOpMasterTurndown :: String |
4068 |
fakeOpMasterTurndown = "OP_CLUSTER_IP_TURNDOWN" |
4069 |
|
4070 |
fakeOpMasterTurnup :: String |
4071 |
fakeOpMasterTurnup = "OP_CLUSTER_IP_TURNUP" |
4072 |
|
4073 |
-- * SSH key types |
4074 |
|
4075 |
sshkDsa :: String |
4076 |
sshkDsa = "dsa" |
4077 |
|
4078 |
sshkRsa :: String |
4079 |
sshkRsa = "rsa" |
4080 |
|
4081 |
sshkAll :: FrozenSet String |
4082 |
sshkAll = ConstantUtils.mkSet [sshkRsa, sshkDsa] |
4083 |
|
4084 |
-- * SSH authorized key types |
4085 |
|
4086 |
sshakDss :: String |
4087 |
sshakDss = "ssh-dss" |
4088 |
|
4089 |
sshakRsa :: String |
4090 |
sshakRsa = "ssh-rsa" |
4091 |
|
4092 |
sshakAll :: FrozenSet String |
4093 |
sshakAll = ConstantUtils.mkSet [sshakDss, sshakRsa] |
4094 |
|
4095 |
-- * SSH setup |
4096 |
|
4097 |
sshsClusterName :: String |
4098 |
sshsClusterName = "cluster_name" |
4099 |
|
4100 |
sshsSshHostKey :: String |
4101 |
sshsSshHostKey = "ssh_host_key" |
4102 |
|
4103 |
sshsSshRootKey :: String |
4104 |
sshsSshRootKey = "ssh_root_key" |
4105 |
|
4106 |
sshsNodeDaemonCertificate :: String |
4107 |
sshsNodeDaemonCertificate = "node_daemon_certificate" |
4108 |
|
4109 |
-- * Key files for SSH daemon |
4110 |
|
4111 |
sshHostDsaPriv :: String |
4112 |
sshHostDsaPriv = sshConfigDir ++ "/ssh_host_dsa_key" |
4113 |
|
4114 |
sshHostDsaPub :: String |
4115 |
sshHostDsaPub = sshHostDsaPriv ++ ".pub" |
4116 |
|
4117 |
sshHostRsaPriv :: String |
4118 |
sshHostRsaPriv = sshConfigDir ++ "/ssh_host_rsa_key" |
4119 |
|
4120 |
sshHostRsaPub :: String |
4121 |
sshHostRsaPub = sshHostRsaPriv ++ ".pub" |
4122 |
|
4123 |
sshDaemonKeyfiles :: Map String (String, String) |
4124 |
sshDaemonKeyfiles = |
4125 |
Map.fromList [ (sshkRsa, (sshHostRsaPriv, sshHostRsaPub)) |
4126 |
, (sshkDsa, (sshHostDsaPriv, sshHostDsaPub)) |
4127 |
] |
4128 |
|
4129 |
-- * Node daemon setup |
4130 |
|
4131 |
ndsClusterName :: String |
4132 |
ndsClusterName = "cluster_name" |
4133 |
|
4134 |
ndsNodeDaemonCertificate :: String |
4135 |
ndsNodeDaemonCertificate = "node_daemon_certificate" |
4136 |
|
4137 |
ndsSsconf :: String |
4138 |
ndsSsconf = "ssconf" |
4139 |
|
4140 |
ndsStartNodeDaemon :: String |
4141 |
ndsStartNodeDaemon = "start_node_daemon" |
4142 |
|
4143 |
-- * The source reasons for the execution of an OpCode |
4144 |
|
4145 |
opcodeReasonSrcClient :: String |
4146 |
opcodeReasonSrcClient = "gnt:client" |
4147 |
|
4148 |
opcodeReasonSrcNoded :: String |
4149 |
opcodeReasonSrcNoded = "gnt:daemon:noded" |
4150 |
|
4151 |
opcodeReasonSrcOpcode :: String |
4152 |
opcodeReasonSrcOpcode = "gnt:opcode" |
4153 |
|
4154 |
opcodeReasonSrcRlib2 :: String |
4155 |
opcodeReasonSrcRlib2 = "gnt:library:rlib2" |
4156 |
|
4157 |
opcodeReasonSrcUser :: String |
4158 |
opcodeReasonSrcUser = "gnt:user" |
4159 |
|
4160 |
opcodeReasonSources :: FrozenSet String |
4161 |
opcodeReasonSources = |
4162 |
ConstantUtils.mkSet [opcodeReasonSrcClient, |
4163 |
opcodeReasonSrcNoded, |
4164 |
opcodeReasonSrcOpcode, |
4165 |
opcodeReasonSrcRlib2, |
4166 |
opcodeReasonSrcUser] |
4167 |
|
4168 |
-- | Path generating random UUID |
4169 |
randomUuidFile :: String |
4170 |
randomUuidFile = ConstantUtils.randomUuidFile |
4171 |
|
4172 |
-- * Auto-repair tag prefixes |
4173 |
|
4174 |
autoRepairTagPrefix :: String |
4175 |
autoRepairTagPrefix = "ganeti:watcher:autorepair:" |
4176 |
|
4177 |
autoRepairTagEnabled :: String |
4178 |
autoRepairTagEnabled = autoRepairTagPrefix |
4179 |
|
4180 |
autoRepairTagPending :: String |
4181 |
autoRepairTagPending = autoRepairTagPrefix ++ "pending:" |
4182 |
|
4183 |
autoRepairTagResult :: String |
4184 |
autoRepairTagResult = autoRepairTagPrefix ++ "result:" |
4185 |
|
4186 |
autoRepairTagSuspended :: String |
4187 |
autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:" |
4188 |
|
4189 |
-- * Auto-repair levels |
4190 |
|
4191 |
autoRepairFailover :: String |
4192 |
autoRepairFailover = Types.autoRepairTypeToRaw ArFailover |
4193 |
|
4194 |
autoRepairFixStorage :: String |
4195 |
autoRepairFixStorage = Types.autoRepairTypeToRaw ArFixStorage |
4196 |
|
4197 |
autoRepairMigrate :: String |
4198 |
autoRepairMigrate = Types.autoRepairTypeToRaw ArMigrate |
4199 |
|
4200 |
autoRepairReinstall :: String |
4201 |
autoRepairReinstall = Types.autoRepairTypeToRaw ArReinstall |
4202 |
|
4203 |
autoRepairAllTypes :: FrozenSet String |
4204 |
autoRepairAllTypes = |
4205 |
ConstantUtils.mkSet [autoRepairFailover, |
4206 |
autoRepairFixStorage, |
4207 |
autoRepairMigrate, |
4208 |
autoRepairReinstall] |
4209 |
|
4210 |
-- * Auto-repair results |
4211 |
|
4212 |
autoRepairEnoperm :: String |
4213 |
autoRepairEnoperm = Types.autoRepairResultToRaw ArEnoperm |
4214 |
|
4215 |
autoRepairFailure :: String |
4216 |
autoRepairFailure = Types.autoRepairResultToRaw ArFailure |
4217 |
|
4218 |
autoRepairSuccess :: String |
4219 |
autoRepairSuccess = Types.autoRepairResultToRaw ArSuccess |
4220 |
|
4221 |
autoRepairAllResults :: FrozenSet String |
4222 |
autoRepairAllResults = |
4223 |
ConstantUtils.mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess] |
4224 |
|
4225 |
-- | The version identifier for builtin data collectors |
4226 |
builtinDataCollectorVersion :: String |
4227 |
builtinDataCollectorVersion = "B" |
4228 |
|
4229 |
-- | The reason trail opcode parameter name |
4230 |
opcodeReason :: String |
4231 |
opcodeReason = "reason" |
4232 |
|
4233 |
diskstatsFile :: String |
4234 |
diskstatsFile = "/proc/diskstats" |
4235 |
|
4236 |
-- * CPU load collector |
4237 |
|
4238 |
statFile :: String |
4239 |
statFile = "/proc/stat" |
4240 |
|
4241 |
cpuavgloadBufferSize :: Int |
4242 |
cpuavgloadBufferSize = 150 |
4243 |
|
4244 |
cpuavgloadWindowSize :: Int |
4245 |
cpuavgloadWindowSize = 600 |
4246 |
|
4247 |
-- * Monitoring daemon |
4248 |
|
4249 |
-- | Mond's variable for periodical data collection |
4250 |
mondTimeInterval :: Int |
4251 |
mondTimeInterval = 5 |
4252 |
|
4253 |
-- | Mond's latest API version |
4254 |
mondLatestApiVersion :: Int |
4255 |
mondLatestApiVersion = 1 |
4256 |
|
4257 |
-- * Disk access modes |
4258 |
|
4259 |
diskUserspace :: String |
4260 |
diskUserspace = Types.diskAccessModeToRaw DiskUserspace |
4261 |
|
4262 |
diskKernelspace :: String |
4263 |
diskKernelspace = Types.diskAccessModeToRaw DiskKernelspace |
4264 |
|
4265 |
diskValidAccessModes :: FrozenSet String |
4266 |
diskValidAccessModes = |
4267 |
ConstantUtils.mkSet $ map Types.diskAccessModeToRaw [minBound..] |
4268 |
|
4269 |
-- | Timeout for queue draining in upgrades |
4270 |
upgradeQueueDrainTimeout :: Int |
4271 |
upgradeQueueDrainTimeout = 36 * 60 * 60 -- 1.5 days |
4272 |
|
4273 |
-- | Intervall at which the queue is polled during upgrades |
4274 |
upgradeQueuePollInterval :: Int |
4275 |
upgradeQueuePollInterval = 10 |
4276 |
|
4277 |
-- * Hotplug Actions |
4278 |
|
4279 |
hotplugActionAdd :: String |
4280 |
hotplugActionAdd = Types.hotplugActionToRaw HAAdd |
4281 |
|
4282 |
hotplugActionRemove :: String |
4283 |
hotplugActionRemove = Types.hotplugActionToRaw HARemove |
4284 |
|
4285 |
hotplugActionModify :: String |
4286 |
hotplugActionModify = Types.hotplugActionToRaw HAMod |
4287 |
|
4288 |
hotplugAllActions :: FrozenSet String |
4289 |
hotplugAllActions = |
4290 |
ConstantUtils.mkSet $ map Types.hotplugActionToRaw [minBound..] |
4291 |
|
4292 |
-- * Hotplug Device Targets |
4293 |
|
4294 |
hotplugTargetNic :: String |
4295 |
hotplugTargetNic = Types.hotplugTargetToRaw HTNic |
4296 |
|
4297 |
hotplugTargetDisk :: String |
4298 |
hotplugTargetDisk = Types.hotplugTargetToRaw HTDisk |
4299 |
|
4300 |
hotplugAllTargets :: FrozenSet String |
4301 |
hotplugAllTargets = |
4302 |
ConstantUtils.mkSet $ map Types.hotplugTargetToRaw [minBound..] |
4303 |
|
4304 |
-- | Timeout for disk removal (seconds) |
4305 |
diskRemoveRetryTimeout :: Int |
4306 |
diskRemoveRetryTimeout = 30 |
4307 |
|
4308 |
-- | Interval between disk removal retries (seconds) |
4309 |
diskRemoveRetryInterval :: Int |
4310 |
diskRemoveRetryInterval = 3 |
4311 |
|
4312 |
-- * UUID regex |
4313 |
|
4314 |
uuidRegex :: String |
4315 |
uuidRegex = "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$" |
4316 |
|
4317 |
-- * Luxi constants |
4318 |
|
4319 |
luxiKeyMethod :: String |
4320 |
luxiKeyMethod = "method" |
4321 |
|
4322 |
luxiKeyArgs :: String |
4323 |
luxiKeyArgs = "args" |
4324 |
|
4325 |
luxiKeySuccess :: String |
4326 |
luxiKeySuccess = "success" |
4327 |
|
4328 |
luxiKeyResult :: String |
4329 |
luxiKeyResult = "result" |
4330 |
|
4331 |
luxiKeyVersion :: String |
4332 |
luxiKeyVersion = "version" |
4333 |
|
4334 |
luxiReqSubmitJob :: String |
4335 |
luxiReqSubmitJob = "SubmitJob" |
4336 |
|
4337 |
luxiReqSubmitJobToDrainedQueue :: String |
4338 |
luxiReqSubmitJobToDrainedQueue = "SubmitJobToDrainedQueue" |
4339 |
|
4340 |
luxiReqSubmitManyJobs :: String |
4341 |
luxiReqSubmitManyJobs = "SubmitManyJobs" |
4342 |
|
4343 |
luxiReqWaitForJobChange :: String |
4344 |
luxiReqWaitForJobChange = "WaitForJobChange" |
4345 |
|
4346 |
luxiReqCancelJob :: String |
4347 |
luxiReqCancelJob = "CancelJob" |
4348 |
|
4349 |
luxiReqArchiveJob :: String |
4350 |
luxiReqArchiveJob = "ArchiveJob" |
4351 |
|
4352 |
luxiReqChangeJobPriority :: String |
4353 |
luxiReqChangeJobPriority = "ChangeJobPriority" |
4354 |
|
4355 |
luxiReqAutoArchiveJobs :: String |
4356 |
luxiReqAutoArchiveJobs = "AutoArchiveJobs" |
4357 |
|
4358 |
luxiReqQuery :: String |
4359 |
luxiReqQuery = "Query" |
4360 |
|
4361 |
luxiReqQueryFields :: String |
4362 |
luxiReqQueryFields = "QueryFields" |
4363 |
|
4364 |
luxiReqQueryJobs :: String |
4365 |
luxiReqQueryJobs = "QueryJobs" |
4366 |
|
4367 |
luxiReqQueryInstances :: String |
4368 |
luxiReqQueryInstances = "QueryInstances" |
4369 |
|
4370 |
luxiReqQueryNodes :: String |
4371 |
luxiReqQueryNodes = "QueryNodes" |
4372 |
|
4373 |
luxiReqQueryGroups :: String |
4374 |
luxiReqQueryGroups = "QueryGroups" |
4375 |
|
4376 |
luxiReqQueryNetworks :: String |
4377 |
luxiReqQueryNetworks = "QueryNetworks" |
4378 |
|
4379 |
luxiReqQueryExports :: String |
4380 |
luxiReqQueryExports = "QueryExports" |
4381 |
|
4382 |
luxiReqQueryConfigValues :: String |
4383 |
luxiReqQueryConfigValues = "QueryConfigValues" |
4384 |
|
4385 |
luxiReqQueryClusterInfo :: String |
4386 |
luxiReqQueryClusterInfo = "QueryClusterInfo" |
4387 |
|
4388 |
luxiReqQueryTags :: String |
4389 |
luxiReqQueryTags = "QueryTags" |
4390 |
|
4391 |
luxiReqSetDrainFlag :: String |
4392 |
luxiReqSetDrainFlag = "SetDrainFlag" |
4393 |
|
4394 |
luxiReqSetWatcherPause :: String |
4395 |
luxiReqSetWatcherPause = "SetWatcherPause" |
4396 |
|
4397 |
luxiReqAll :: FrozenSet String |
4398 |
luxiReqAll = |
4399 |
ConstantUtils.mkSet |
4400 |
[ luxiReqArchiveJob |
4401 |
, luxiReqAutoArchiveJobs |
4402 |
, luxiReqCancelJob |
4403 |
, luxiReqChangeJobPriority |
4404 |
, luxiReqQuery |
4405 |
, luxiReqQueryClusterInfo |
4406 |
, luxiReqQueryConfigValues |
4407 |
, luxiReqQueryExports |
4408 |
, luxiReqQueryFields |
4409 |
, luxiReqQueryGroups |
4410 |
, luxiReqQueryInstances |
4411 |
, luxiReqQueryJobs |
4412 |
, luxiReqQueryNodes |
4413 |
, luxiReqQueryNetworks |
4414 |
, luxiReqQueryTags |
4415 |
, luxiReqSetDrainFlag |
4416 |
, luxiReqSetWatcherPause |
4417 |
, luxiReqSubmitJob |
4418 |
, luxiReqSubmitJobToDrainedQueue |
4419 |
, luxiReqSubmitManyJobs |
4420 |
, luxiReqWaitForJobChange |
4421 |
] |
4422 |
|
4423 |
luxiDefCtmo :: Int |
4424 |
luxiDefCtmo = 10 |
4425 |
|
4426 |
luxiDefRwto :: Int |
4427 |
luxiDefRwto = 60 |
4428 |
|
4429 |
-- | 'WaitForJobChange' timeout |
4430 |
luxiWfjcTimeout :: Int |
4431 |
luxiWfjcTimeout = (luxiDefRwto - 1) `div` 2 |
4432 |
|
4433 |
-- * Query language constants |
4434 |
|
4435 |
-- ** Logic operators with one or more operands, each of which is a |
4436 |
-- filter on its own |
4437 |
|
4438 |
qlangOpAnd :: String |
4439 |
qlangOpAnd = "&" |
4440 |
|
4441 |
qlangOpOr :: String |
4442 |
qlangOpOr = "|" |
4443 |
|
4444 |
-- ** Unary operators with exactly one operand |
4445 |
|
4446 |
qlangOpNot :: String |
4447 |
qlangOpNot = "!" |
4448 |
|
4449 |
qlangOpTrue :: String |
4450 |
qlangOpTrue = "?" |
4451 |
|
4452 |
-- ** Binary operators with exactly two operands, the field name and |
4453 |
-- an operator-specific value |
4454 |
|
4455 |
qlangOpContains :: String |
4456 |
qlangOpContains = "=[]" |
4457 |
|
4458 |
qlangOpEqual :: String |
4459 |
qlangOpEqual = "=" |
4460 |
|
4461 |
qlangOpGe :: String |
4462 |
qlangOpGe = ">=" |
4463 |
|
4464 |
qlangOpGt :: String |
4465 |
qlangOpGt = ">" |
4466 |
|
4467 |
qlangOpLe :: String |
4468 |
qlangOpLe = "<=" |
4469 |
|
4470 |
qlangOpLt :: String |
4471 |
qlangOpLt = "<" |
4472 |
|
4473 |
qlangOpNotEqual :: String |
4474 |
qlangOpNotEqual = "!=" |
4475 |
|
4476 |
qlangOpRegexp :: String |
4477 |
qlangOpRegexp = "=~" |
4478 |
|
4479 |
-- | Characters used for detecting user-written filters (see |
4480 |
-- L{_CheckFilter}) |
4481 |
|
4482 |
qlangFilterDetectionChars :: FrozenSet String |
4483 |
qlangFilterDetectionChars = |
4484 |
ConstantUtils.mkSet ["!", " ", "\"", "\'", |
4485 |
")", "(", "\x0b", "\n", |
4486 |
"\r", "\x0c", "/", "<", |
4487 |
"\t", ">", "=", "\\", "~"] |
4488 |
|
4489 |
-- | Characters used to detect globbing filters |
4490 |
qlangGlobDetectionChars :: FrozenSet String |
4491 |
qlangGlobDetectionChars = ConstantUtils.mkSet ["*", "?"] |
4492 |
|
4493 |
-- * Error related constants |
4494 |
-- |
4495 |
-- 'OpPrereqError' failure types |
4496 |
|
4497 |
-- | Environment error (e.g. node disk error) |
4498 |
errorsEcodeEnviron :: String |
4499 |
errorsEcodeEnviron = "environment_error" |
4500 |
|
4501 |
-- | Entity already exists |
4502 |
errorsEcodeExists :: String |
4503 |
errorsEcodeExists = "already_exists" |
4504 |
|
4505 |
-- | Internal cluster error |
4506 |
errorsEcodeFault :: String |
4507 |
errorsEcodeFault = "internal_error" |
4508 |
|
4509 |
-- | Wrong arguments (at syntax level) |
4510 |
errorsEcodeInval :: String |
4511 |
errorsEcodeInval = "wrong_input" |
4512 |
|
4513 |
-- | Entity not found |
4514 |
errorsEcodeNoent :: String |
4515 |
errorsEcodeNoent = "unknown_entity" |
4516 |
|
4517 |
-- | Not enough resources (iallocator failure, disk space, memory, etc) |
4518 |
errorsEcodeNores :: String |
4519 |
errorsEcodeNores = "insufficient_resources" |
4520 |
|
4521 |
-- | Resource not unique (e.g. MAC or IP duplication) |
4522 |
errorsEcodeNotunique :: String |
4523 |
errorsEcodeNotunique = "resource_not_unique" |
4524 |
|
4525 |
-- | Resolver errors |
4526 |
errorsEcodeResolver :: String |
4527 |
errorsEcodeResolver = "resolver_error" |
4528 |
|
4529 |
-- | Wrong entity state |
4530 |
errorsEcodeState :: String |
4531 |
errorsEcodeState = "wrong_state" |
4532 |
|
4533 |
-- | Temporarily out of resources; operation can be tried again |
4534 |
errorsEcodeTempNores :: String |
4535 |
errorsEcodeTempNores = "temp_insufficient_resources" |
4536 |
|
4537 |
errorsEcodeAll :: FrozenSet String |
4538 |
errorsEcodeAll = |
4539 |
ConstantUtils.mkSet [ errorsEcodeNores |
4540 |
, errorsEcodeExists |
4541 |
, errorsEcodeState |
4542 |
, errorsEcodeNotunique |
4543 |
, errorsEcodeTempNores |
4544 |
, errorsEcodeNoent |
4545 |
, errorsEcodeFault |
4546 |
, errorsEcodeResolver |
4547 |
, errorsEcodeInval |
4548 |
, errorsEcodeEnviron |
4549 |
] |
4550 |
|
4551 |
-- * Jstore related constants |
4552 |
|
4553 |
jstoreJobsPerArchiveDirectory :: Int |
4554 |
jstoreJobsPerArchiveDirectory = 10000 |