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