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