root / src / Ganeti / HsConstants.hs @ dd95d461
History | View | Annotate | Download (35 kB)
1 |
{-| HsConstants contains the Haskell constants |
---|---|
2 |
|
3 |
This is a transitional module complementary to 'Ganeti.Constants'. It |
4 |
is intended to contain the Haskell constants that are meant to be |
5 |
generated in Python. |
6 |
|
7 |
Do not write any definitions in this file other than constants. Do |
8 |
not even write helper functions. The definitions in this module are |
9 |
automatically stripped to build the Makefile.am target |
10 |
'ListConstants.hs'. If there are helper functions in this module, |
11 |
they will also be dragged and it will cause compilation to fail. |
12 |
Therefore, all helper functions should go to a separate module and |
13 |
imported. |
14 |
|
15 |
-} |
16 |
|
17 |
{- |
18 |
|
19 |
Copyright (C) 2013 Google Inc. |
20 |
|
21 |
This program is free software; you can redistribute it and/or modify |
22 |
it under the terms of the GNU General Public License as published by |
23 |
the Free Software Foundation; either version 2 of the License, or |
24 |
(at your option) any later version. |
25 |
|
26 |
This program is distributed in the hope that it will be useful, but |
27 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
28 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
29 |
General Public License for more details. |
30 |
|
31 |
You should have received a copy of the GNU General Public License |
32 |
along with this program; if not, write to the Free Software |
33 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
34 |
02110-1301, USA. |
35 |
|
36 |
-} |
37 |
module Ganeti.HsConstants where |
38 |
|
39 |
import Data.Map (Map) |
40 |
import qualified Data.Map as Map (fromList) |
41 |
|
42 |
import AutoConf |
43 |
import Ganeti.ConstantUtils (FrozenSet, Protocol(..), buildVersion) |
44 |
import qualified Ganeti.ConstantUtils as ConstantUtils |
45 |
import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..), |
46 |
ExtraLogReason(..)) |
47 |
import Ganeti.Logging (SyslogUsage(..)) |
48 |
import qualified Ganeti.Logging as Logging (syslogUsageToRaw) |
49 |
import qualified Ganeti.Runtime as Runtime |
50 |
import Ganeti.Types |
51 |
import qualified Ganeti.Types as Types |
52 |
|
53 |
-- * 'autoconf' constants for Python only ('autotools/build-bash-completion') |
54 |
|
55 |
htoolsProgs :: [String] |
56 |
htoolsProgs = AutoConf.htoolsProgs |
57 |
|
58 |
-- * 'autoconf' constants for Python only ('lib/constants.py') |
59 |
|
60 |
drbdBarriers :: String |
61 |
drbdBarriers = AutoConf.drbdBarriers |
62 |
|
63 |
drbdNoMetaFlush :: Bool |
64 |
drbdNoMetaFlush = AutoConf.drbdNoMetaFlush |
65 |
|
66 |
lvmStripecount :: Int |
67 |
lvmStripecount = AutoConf.lvmStripecount |
68 |
|
69 |
-- * 'autoconf' constants for Python only ('lib/pathutils.py') |
70 |
|
71 |
-- ** Build-time constants |
72 |
|
73 |
exportDir :: String |
74 |
exportDir = AutoConf.exportDir |
75 |
|
76 |
osSearchPath :: [String] |
77 |
osSearchPath = AutoConf.osSearchPath |
78 |
|
79 |
esSearchPath :: [String] |
80 |
esSearchPath = AutoConf.esSearchPath |
81 |
|
82 |
sshConfigDir :: String |
83 |
sshConfigDir = AutoConf.sshConfigDir |
84 |
|
85 |
xenConfigDir :: String |
86 |
xenConfigDir = AutoConf.xenConfigDir |
87 |
|
88 |
sysconfdir :: String |
89 |
sysconfdir = AutoConf.sysconfdir |
90 |
|
91 |
toolsdir :: String |
92 |
toolsdir = AutoConf.toolsdir |
93 |
|
94 |
localstatedir :: String |
95 |
localstatedir = AutoConf.localstatedir |
96 |
|
97 |
-- ** Paths which don't change for a virtual cluster |
98 |
|
99 |
pkglibdir :: String |
100 |
pkglibdir = AutoConf.pkglibdir |
101 |
|
102 |
sharedir :: String |
103 |
sharedir = AutoConf.sharedir |
104 |
|
105 |
-- * 'autoconf' constants for Python only ('lib/build/sphinx_ext.py') |
106 |
|
107 |
manPages :: Map String Int |
108 |
manPages = Map.fromList AutoConf.manPages |
109 |
|
110 |
-- * 'autoconf' constants for QA cluster only ('qa/qa_cluster.py') |
111 |
|
112 |
versionedsharedir :: String |
113 |
versionedsharedir = AutoConf.versionedsharedir |
114 |
|
115 |
-- * 'autoconf' constants for Python only ('tests/py/docs_unittest.py') |
116 |
|
117 |
gntScripts :: [String] |
118 |
gntScripts = AutoConf.gntScripts |
119 |
|
120 |
-- * Various versions |
121 |
|
122 |
releaseVersion :: String |
123 |
releaseVersion = AutoConf.packageVersion |
124 |
|
125 |
versionMajor :: Int |
126 |
versionMajor = AutoConf.versionMajor |
127 |
|
128 |
versionMinor :: Int |
129 |
versionMinor = AutoConf.versionMinor |
130 |
|
131 |
versionRevision :: Int |
132 |
versionRevision = AutoConf.versionRevision |
133 |
|
134 |
dirVersion :: String |
135 |
dirVersion = AutoConf.dirVersion |
136 |
|
137 |
configMajor :: Int |
138 |
configMajor = AutoConf.versionMajor |
139 |
|
140 |
configMinor :: Int |
141 |
configMinor = AutoConf.versionMinor |
142 |
|
143 |
-- | The configuration is supposed to remain stable across |
144 |
-- revisions. Therefore, the revision number is cleared to '0'. |
145 |
configRevision :: Int |
146 |
configRevision = 0 |
147 |
|
148 |
configVersion :: Int |
149 |
configVersion = buildVersion configMajor configMinor configRevision |
150 |
|
151 |
-- | Similarly to the configuration (see 'configRevision'), the |
152 |
-- protocols are supposed to remain stable across revisions. |
153 |
protocolVersion :: Int |
154 |
protocolVersion = buildVersion configMajor configMinor configRevision |
155 |
|
156 |
-- * User separation |
157 |
daemonsGroup :: String |
158 |
daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup) |
159 |
|
160 |
adminGroup :: String |
161 |
adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup) |
162 |
|
163 |
masterdUser :: String |
164 |
masterdUser = Runtime.daemonUser GanetiMasterd |
165 |
|
166 |
masterdGroup :: String |
167 |
masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd) |
168 |
|
169 |
rapiUser :: String |
170 |
rapiUser = Runtime.daemonUser GanetiRapi |
171 |
|
172 |
rapiGroup :: String |
173 |
rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi) |
174 |
|
175 |
confdUser :: String |
176 |
confdUser = Runtime.daemonUser GanetiConfd |
177 |
|
178 |
confdGroup :: String |
179 |
confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd) |
180 |
|
181 |
luxidUser :: String |
182 |
luxidUser = Runtime.daemonUser GanetiLuxid |
183 |
|
184 |
luxidGroup :: String |
185 |
luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid) |
186 |
|
187 |
nodedUser :: String |
188 |
nodedUser = Runtime.daemonUser GanetiNoded |
189 |
|
190 |
nodedGroup :: String |
191 |
nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded) |
192 |
|
193 |
mondUser :: String |
194 |
mondUser = Runtime.daemonUser GanetiMond |
195 |
|
196 |
mondGroup :: String |
197 |
mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond) |
198 |
|
199 |
sshLoginUser :: String |
200 |
sshLoginUser = AutoConf.sshLoginUser |
201 |
|
202 |
sshConsoleUser :: String |
203 |
sshConsoleUser = AutoConf.sshConsoleUser |
204 |
|
205 |
-- * 'autoconf' enable/disable |
206 |
|
207 |
enableConfd :: Bool |
208 |
enableConfd = AutoConf.enableConfd |
209 |
|
210 |
enableMond :: Bool |
211 |
enableMond = AutoConf.enableMond |
212 |
|
213 |
enableRestrictedCommands :: Bool |
214 |
enableRestrictedCommands = AutoConf.enableRestrictedCommands |
215 |
|
216 |
enableSplitQuery :: Bool |
217 |
enableSplitQuery = AutoConf.enableSplitQuery |
218 |
|
219 |
-- * SSH constants |
220 |
|
221 |
ssh :: String |
222 |
ssh = "ssh" |
223 |
|
224 |
scp :: String |
225 |
scp = "scp" |
226 |
|
227 |
-- * Daemons |
228 |
|
229 |
confd :: String |
230 |
confd = Runtime.daemonName GanetiConfd |
231 |
|
232 |
masterd :: String |
233 |
masterd = Runtime.daemonName GanetiMasterd |
234 |
|
235 |
mond :: String |
236 |
mond = Runtime.daemonName GanetiMond |
237 |
|
238 |
noded :: String |
239 |
noded = Runtime.daemonName GanetiNoded |
240 |
|
241 |
luxid :: String |
242 |
luxid = Runtime.daemonName GanetiLuxid |
243 |
|
244 |
rapi :: String |
245 |
rapi = Runtime.daemonName GanetiRapi |
246 |
|
247 |
daemons :: FrozenSet String |
248 |
daemons = |
249 |
ConstantUtils.mkSet [confd, |
250 |
luxid, |
251 |
masterd, |
252 |
mond, |
253 |
noded, |
254 |
rapi] |
255 |
|
256 |
defaultConfdPort :: Int |
257 |
defaultConfdPort = 1814 |
258 |
|
259 |
defaultMondPort :: Int |
260 |
defaultMondPort = 1815 |
261 |
|
262 |
defaultNodedPort :: Int |
263 |
defaultNodedPort = 1811 |
264 |
|
265 |
defaultRapiPort :: Int |
266 |
defaultRapiPort = 5080 |
267 |
|
268 |
daemonsPorts :: Map String (Protocol, Int) |
269 |
daemonsPorts = |
270 |
Map.fromList [(confd, (Udp, defaultConfdPort)), |
271 |
(mond, (Tcp, defaultMondPort)), |
272 |
(noded, (Tcp, defaultNodedPort)), |
273 |
(rapi, (Tcp, defaultRapiPort)), |
274 |
(ssh, (Tcp, 22))] |
275 |
|
276 |
daemonsLogbase :: Map String String |
277 |
daemonsLogbase = |
278 |
Map.fromList |
279 |
[ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ] |
280 |
|
281 |
extraLogreasonAccess :: String |
282 |
extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog |
283 |
|
284 |
extraLogreasonError :: String |
285 |
extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog |
286 |
|
287 |
devConsole :: String |
288 |
devConsole = ConstantUtils.devConsole |
289 |
|
290 |
-- * Syslog |
291 |
|
292 |
syslogUsage :: String |
293 |
syslogUsage = AutoConf.syslogUsage |
294 |
|
295 |
syslogNo :: String |
296 |
syslogNo = Logging.syslogUsageToRaw SyslogNo |
297 |
|
298 |
syslogYes :: String |
299 |
syslogYes = Logging.syslogUsageToRaw SyslogYes |
300 |
|
301 |
syslogOnly :: String |
302 |
syslogOnly = Logging.syslogUsageToRaw SyslogOnly |
303 |
|
304 |
syslogSocket :: String |
305 |
syslogSocket = "/dev/log" |
306 |
|
307 |
-- * Xen |
308 |
|
309 |
xenBootloader :: String |
310 |
xenBootloader = AutoConf.xenBootloader |
311 |
|
312 |
xenCmdXl :: String |
313 |
xenCmdXl = "xl" |
314 |
|
315 |
xenCmdXm :: String |
316 |
xenCmdXm = "xm" |
317 |
|
318 |
xenInitrd :: String |
319 |
xenInitrd = AutoConf.xenInitrd |
320 |
|
321 |
xenKernel :: String |
322 |
xenKernel = AutoConf.xenKernel |
323 |
|
324 |
-- FIXME: perhaps rename to 'validXenCommands' for consistency with |
325 |
-- other constants |
326 |
knownXenCommands :: FrozenSet String |
327 |
knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm] |
328 |
|
329 |
-- * KVM and socat |
330 |
|
331 |
kvmPath :: String |
332 |
kvmPath = AutoConf.kvmPath |
333 |
|
334 |
kvmKernel :: String |
335 |
kvmKernel = AutoConf.kvmKernel |
336 |
|
337 |
socatEscapeCode :: String |
338 |
socatEscapeCode = "0x1d" |
339 |
|
340 |
socatPath :: String |
341 |
socatPath = AutoConf.socatPath |
342 |
|
343 |
socatUseCompress :: Bool |
344 |
socatUseCompress = AutoConf.socatUseCompress |
345 |
|
346 |
socatUseEscape :: Bool |
347 |
socatUseEscape = AutoConf.socatUseEscape |
348 |
|
349 |
-- * Storage types |
350 |
|
351 |
stBlock :: String |
352 |
stBlock = Types.storageTypeToRaw StorageBlock |
353 |
|
354 |
stDiskless :: String |
355 |
stDiskless = Types.storageTypeToRaw StorageDiskless |
356 |
|
357 |
stExt :: String |
358 |
stExt = Types.storageTypeToRaw StorageExt |
359 |
|
360 |
stFile :: String |
361 |
stFile = Types.storageTypeToRaw StorageFile |
362 |
|
363 |
stLvmPv :: String |
364 |
stLvmPv = Types.storageTypeToRaw StorageLvmPv |
365 |
|
366 |
stLvmVg :: String |
367 |
stLvmVg = Types.storageTypeToRaw StorageLvmVg |
368 |
|
369 |
stRados :: String |
370 |
stRados = Types.storageTypeToRaw StorageRados |
371 |
|
372 |
storageTypes :: FrozenSet String |
373 |
storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..] |
374 |
|
375 |
-- * Storage fields |
376 |
-- ** First two are valid in LU context only, not passed to backend |
377 |
|
378 |
sfNode :: String |
379 |
sfNode = "node" |
380 |
|
381 |
sfType :: String |
382 |
sfType = "type" |
383 |
|
384 |
-- ** and the rest are valid in backend |
385 |
|
386 |
sfAllocatable :: String |
387 |
sfAllocatable = Types.storageFieldToRaw SFAllocatable |
388 |
|
389 |
sfFree :: String |
390 |
sfFree = Types.storageFieldToRaw SFFree |
391 |
|
392 |
sfName :: String |
393 |
sfName = Types.storageFieldToRaw SFName |
394 |
|
395 |
sfSize :: String |
396 |
sfSize = Types.storageFieldToRaw SFSize |
397 |
|
398 |
sfUsed :: String |
399 |
sfUsed = Types.storageFieldToRaw SFUsed |
400 |
|
401 |
-- * Disk template types |
402 |
|
403 |
dtDiskless :: String |
404 |
dtDiskless = Types.diskTemplateToRaw DTDiskless |
405 |
|
406 |
dtFile :: String |
407 |
dtFile = Types.diskTemplateToRaw DTFile |
408 |
|
409 |
dtSharedFile :: String |
410 |
dtSharedFile = Types.diskTemplateToRaw DTSharedFile |
411 |
|
412 |
dtPlain :: String |
413 |
dtPlain = Types.diskTemplateToRaw DTPlain |
414 |
|
415 |
dtBlock :: String |
416 |
dtBlock = Types.diskTemplateToRaw DTBlock |
417 |
|
418 |
dtDrbd8 :: String |
419 |
dtDrbd8 = Types.diskTemplateToRaw DTDrbd8 |
420 |
|
421 |
dtRbd :: String |
422 |
dtRbd = Types.diskTemplateToRaw DTRbd |
423 |
|
424 |
dtExt :: String |
425 |
dtExt = Types.diskTemplateToRaw DTExt |
426 |
|
427 |
-- | This is used to order determine the default disk template when |
428 |
-- the list of enabled disk templates is inferred from the current |
429 |
-- state of the cluster. This only happens on an upgrade from a |
430 |
-- version of Ganeti that did not support the 'enabled_disk_templates' |
431 |
-- so far. |
432 |
diskTemplatePreference :: [String] |
433 |
diskTemplatePreference = |
434 |
map Types.diskTemplateToRaw |
435 |
[DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile] |
436 |
|
437 |
diskTemplates :: FrozenSet String |
438 |
diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..] |
439 |
|
440 |
-- | Disk templates that are enabled by default |
441 |
defaultEnabledDiskTemplates :: [String] |
442 |
defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain] |
443 |
|
444 |
-- * File backend driver |
445 |
|
446 |
fdBlktap :: String |
447 |
fdBlktap = Types.fileDriverToRaw FileBlktap |
448 |
|
449 |
fdLoop :: String |
450 |
fdLoop = Types.fileDriverToRaw FileLoop |
451 |
|
452 |
-- * Disk access mode |
453 |
|
454 |
diskRdonly :: String |
455 |
diskRdonly = Types.diskModeToRaw DiskRdOnly |
456 |
|
457 |
diskRdwr :: String |
458 |
diskRdwr = Types.diskModeToRaw DiskRdWr |
459 |
|
460 |
diskAccessSet :: FrozenSet String |
461 |
diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..] |
462 |
|
463 |
-- * Instance export mode |
464 |
|
465 |
exportModeLocal :: String |
466 |
exportModeLocal = Types.exportModeToRaw ExportModeLocal |
467 |
|
468 |
exportModeRemote :: String |
469 |
exportModeRemote = Types.exportModeToRaw ExportModeRemote |
470 |
|
471 |
exportModes :: FrozenSet String |
472 |
exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..] |
473 |
|
474 |
-- * Instance creation modes |
475 |
|
476 |
instanceCreate :: String |
477 |
instanceCreate = Types.instCreateModeToRaw InstCreate |
478 |
|
479 |
instanceImport :: String |
480 |
instanceImport = Types.instCreateModeToRaw InstImport |
481 |
|
482 |
instanceRemoteImport :: String |
483 |
instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport |
484 |
|
485 |
instanceCreateModes :: FrozenSet String |
486 |
instanceCreateModes = |
487 |
ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..] |
488 |
|
489 |
-- * Dynamic device modification |
490 |
|
491 |
ddmAdd :: String |
492 |
ddmAdd = Types.ddmFullToRaw DdmFullAdd |
493 |
|
494 |
ddmModify :: String |
495 |
ddmModify = Types.ddmFullToRaw DdmFullModify |
496 |
|
497 |
ddmRemove :: String |
498 |
ddmRemove = Types.ddmFullToRaw DdmFullRemove |
499 |
|
500 |
ddmsValues :: FrozenSet String |
501 |
ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove] |
502 |
|
503 |
ddmsValuesWithModify :: FrozenSet String |
504 |
ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..] |
505 |
|
506 |
-- * Common exit codes |
507 |
|
508 |
exitSuccess :: Int |
509 |
exitSuccess = 0 |
510 |
|
511 |
exitFailure :: Int |
512 |
exitFailure = ConstantUtils.exitFailure |
513 |
|
514 |
exitNotcluster :: Int |
515 |
exitNotcluster = 5 |
516 |
|
517 |
exitNotmaster :: Int |
518 |
exitNotmaster = 11 |
519 |
|
520 |
exitNodesetupError :: Int |
521 |
exitNodesetupError = 12 |
522 |
|
523 |
-- | Need user confirmation |
524 |
exitConfirmation :: Int |
525 |
exitConfirmation = 13 |
526 |
|
527 |
-- | Exit code for query operations with unknown fields |
528 |
exitUnknownField :: Int |
529 |
exitUnknownField = 14 |
530 |
|
531 |
-- * Tags |
532 |
|
533 |
tagCluster :: String |
534 |
tagCluster = Types.tagKindToRaw TagKindCluster |
535 |
|
536 |
tagInstance :: String |
537 |
tagInstance = Types.tagKindToRaw TagKindInstance |
538 |
|
539 |
tagNetwork :: String |
540 |
tagNetwork = Types.tagKindToRaw TagKindNetwork |
541 |
|
542 |
tagNode :: String |
543 |
tagNode = Types.tagKindToRaw TagKindNode |
544 |
|
545 |
tagNodegroup :: String |
546 |
tagNodegroup = Types.tagKindToRaw TagKindGroup |
547 |
|
548 |
validTagTypes :: FrozenSet String |
549 |
validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..] |
550 |
|
551 |
maxTagLen :: Int |
552 |
maxTagLen = 128 |
553 |
|
554 |
maxTagsPerObj :: Int |
555 |
maxTagsPerObj = 4096 |
556 |
|
557 |
-- | Node clock skew in seconds |
558 |
nodeMaxClockSkew :: Int |
559 |
nodeMaxClockSkew = 150 |
560 |
|
561 |
-- | Disk index separator |
562 |
diskSeparator :: String |
563 |
diskSeparator = AutoConf.diskSeparator |
564 |
|
565 |
ipCommandPath :: String |
566 |
ipCommandPath = AutoConf.ipPath |
567 |
|
568 |
-- * Reboot types |
569 |
|
570 |
instanceRebootSoft :: String |
571 |
instanceRebootSoft = Types.rebootTypeToRaw RebootSoft |
572 |
|
573 |
instanceRebootHard :: String |
574 |
instanceRebootHard = Types.rebootTypeToRaw RebootHard |
575 |
|
576 |
instanceRebootFull :: String |
577 |
instanceRebootFull = Types.rebootTypeToRaw RebootFull |
578 |
|
579 |
rebootTypes :: FrozenSet String |
580 |
rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..] |
581 |
|
582 |
-- * VTypes |
583 |
|
584 |
vtypeBool :: String |
585 |
vtypeBool = Types.vTypeToRaw VTypeBool |
586 |
|
587 |
vtypeInt :: String |
588 |
vtypeInt = Types.vTypeToRaw VTypeInt |
589 |
|
590 |
vtypeMaybeString :: String |
591 |
vtypeMaybeString = Types.vTypeToRaw VTypeMaybeString |
592 |
|
593 |
-- | Size in MiBs |
594 |
vtypeSize :: String |
595 |
vtypeSize = Types.vTypeToRaw VTypeSize |
596 |
|
597 |
vtypeString :: String |
598 |
vtypeString = Types.vTypeToRaw VTypeString |
599 |
|
600 |
enforceableTypes :: FrozenSet String |
601 |
enforceableTypes = ConstantUtils.mkSet $ map Types.vTypeToRaw [minBound..] |
602 |
|
603 |
-- * OOB supported commands |
604 |
|
605 |
oobPowerOn :: String |
606 |
oobPowerOn = Types.oobCommandToRaw OobPowerOn |
607 |
|
608 |
oobPowerOff :: String |
609 |
oobPowerOff = Types.oobCommandToRaw OobPowerOff |
610 |
|
611 |
oobPowerCycle :: String |
612 |
oobPowerCycle = Types.oobCommandToRaw OobPowerCycle |
613 |
|
614 |
oobPowerStatus :: String |
615 |
oobPowerStatus = Types.oobCommandToRaw OobPowerStatus |
616 |
|
617 |
oobHealth :: String |
618 |
oobHealth = Types.oobCommandToRaw OobHealth |
619 |
|
620 |
oobCommands :: FrozenSet String |
621 |
oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..] |
622 |
|
623 |
oobPowerStatusPowered :: String |
624 |
oobPowerStatusPowered = "powered" |
625 |
|
626 |
-- | 60 seconds |
627 |
oobTimeout :: Int |
628 |
oobTimeout = 60 |
629 |
|
630 |
-- | 2 seconds |
631 |
oobPowerDelay :: Double |
632 |
oobPowerDelay = 2.0 |
633 |
|
634 |
oobStatusCritical :: String |
635 |
oobStatusCritical = Types.oobStatusToRaw OobStatusCritical |
636 |
|
637 |
oobStatusOk :: String |
638 |
oobStatusOk = Types.oobStatusToRaw OobStatusOk |
639 |
|
640 |
oobStatusUnknown :: String |
641 |
oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown |
642 |
|
643 |
oobStatusWarning :: String |
644 |
oobStatusWarning = Types.oobStatusToRaw OobStatusWarning |
645 |
|
646 |
oobStatuses :: FrozenSet String |
647 |
oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..] |
648 |
|
649 |
-- * NIC_* constants are used inside the ganeti config |
650 |
|
651 |
nicLink :: String |
652 |
nicLink = "link" |
653 |
|
654 |
nicMode :: String |
655 |
nicMode = "mode" |
656 |
|
657 |
nicVlan :: String |
658 |
nicVlan = "vlan" |
659 |
|
660 |
nicModeBridged :: String |
661 |
nicModeBridged = Types.nICModeToRaw NMBridged |
662 |
|
663 |
nicModeRouted :: String |
664 |
nicModeRouted = Types.nICModeToRaw NMRouted |
665 |
|
666 |
nicModeOvs :: String |
667 |
nicModeOvs = Types.nICModeToRaw NMOvs |
668 |
|
669 |
nicIpPool :: String |
670 |
nicIpPool = Types.nICModeToRaw NMPool |
671 |
|
672 |
nicValidModes :: FrozenSet String |
673 |
nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..] |
674 |
|
675 |
-- * Hypervisor constants |
676 |
|
677 |
htXenPvm :: String |
678 |
htXenPvm = Types.hypervisorToRaw XenPvm |
679 |
|
680 |
htFake :: String |
681 |
htFake = Types.hypervisorToRaw Fake |
682 |
|
683 |
htXenHvm :: String |
684 |
htXenHvm = Types.hypervisorToRaw XenHvm |
685 |
|
686 |
htKvm :: String |
687 |
htKvm = Types.hypervisorToRaw Kvm |
688 |
|
689 |
htChroot :: String |
690 |
htChroot = Types.hypervisorToRaw Chroot |
691 |
|
692 |
htLxc :: String |
693 |
htLxc = Types.hypervisorToRaw Lxc |
694 |
|
695 |
hyperTypes :: FrozenSet String |
696 |
hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..] |
697 |
|
698 |
htsReqPort :: FrozenSet String |
699 |
htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm] |
700 |
|
701 |
-- * Migration type |
702 |
|
703 |
htMigrationLive :: String |
704 |
htMigrationLive = Types.migrationModeToRaw MigrationLive |
705 |
|
706 |
htMigrationNonlive :: String |
707 |
htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive |
708 |
|
709 |
htMigrationModes :: FrozenSet String |
710 |
htMigrationModes = |
711 |
ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..] |
712 |
|
713 |
-- * Cluster verify steps |
714 |
|
715 |
verifyNplusoneMem :: String |
716 |
verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem |
717 |
|
718 |
verifyOptionalChecks :: FrozenSet String |
719 |
verifyOptionalChecks = |
720 |
ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..] |
721 |
|
722 |
-- * Cluster Verify error classes |
723 |
|
724 |
cvTcluster :: String |
725 |
cvTcluster = "cluster" |
726 |
|
727 |
cvTgroup :: String |
728 |
cvTgroup = "group" |
729 |
|
730 |
cvTnode :: String |
731 |
cvTnode = "node" |
732 |
|
733 |
cvTinstance :: String |
734 |
cvTinstance = "instance" |
735 |
|
736 |
-- * Cluster Verify error codes and documentation |
737 |
|
738 |
cvEclustercert :: (String, String, String) |
739 |
cvEclustercert = |
740 |
("cluster", |
741 |
Types.cVErrorCodeToRaw CvECLUSTERCERT, |
742 |
"Cluster certificate files verification failure") |
743 |
|
744 |
cvEclustercfg :: (String, String, String) |
745 |
cvEclustercfg = |
746 |
("cluster", |
747 |
Types.cVErrorCodeToRaw CvECLUSTERCFG, |
748 |
"Cluster configuration verification failure") |
749 |
|
750 |
cvEclusterdanglinginst :: (String, String, String) |
751 |
cvEclusterdanglinginst = |
752 |
("node", |
753 |
Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST, |
754 |
"Some instances have a non-existing primary node") |
755 |
|
756 |
cvEclusterdanglingnodes :: (String, String, String) |
757 |
cvEclusterdanglingnodes = |
758 |
("node", |
759 |
Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES, |
760 |
"Some nodes belong to non-existing groups") |
761 |
|
762 |
cvEclusterfilecheck :: (String, String, String) |
763 |
cvEclusterfilecheck = |
764 |
("cluster", |
765 |
Types.cVErrorCodeToRaw CvECLUSTERFILECHECK, |
766 |
"Cluster configuration verification failure") |
767 |
|
768 |
cvEgroupdifferentpvsize :: (String, String, String) |
769 |
cvEgroupdifferentpvsize = |
770 |
("group", |
771 |
Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE, |
772 |
"PVs in the group have different sizes") |
773 |
|
774 |
cvEinstancebadnode :: (String, String, String) |
775 |
cvEinstancebadnode = |
776 |
("instance", |
777 |
Types.cVErrorCodeToRaw CvEINSTANCEBADNODE, |
778 |
"Instance marked as running lives on an offline node") |
779 |
|
780 |
cvEinstancedown :: (String, String, String) |
781 |
cvEinstancedown = |
782 |
("instance", |
783 |
Types.cVErrorCodeToRaw CvEINSTANCEDOWN, |
784 |
"Instance not running on its primary node") |
785 |
|
786 |
cvEinstancefaultydisk :: (String, String, String) |
787 |
cvEinstancefaultydisk = |
788 |
("instance", |
789 |
Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK, |
790 |
"Impossible to retrieve status for a disk") |
791 |
|
792 |
cvEinstancelayout :: (String, String, String) |
793 |
cvEinstancelayout = |
794 |
("instance", |
795 |
Types.cVErrorCodeToRaw CvEINSTANCELAYOUT, |
796 |
"Instance has multiple secondary nodes") |
797 |
|
798 |
cvEinstancemissingcfgparameter :: (String, String, String) |
799 |
cvEinstancemissingcfgparameter = |
800 |
("instance", |
801 |
Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER, |
802 |
"A configuration parameter for an instance is missing") |
803 |
|
804 |
cvEinstancemissingdisk :: (String, String, String) |
805 |
cvEinstancemissingdisk = |
806 |
("instance", |
807 |
Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK, |
808 |
"Missing volume on an instance") |
809 |
|
810 |
cvEinstancepolicy :: (String, String, String) |
811 |
cvEinstancepolicy = |
812 |
("instance", |
813 |
Types.cVErrorCodeToRaw CvEINSTANCEPOLICY, |
814 |
"Instance does not meet policy") |
815 |
|
816 |
cvEinstancesplitgroups :: (String, String, String) |
817 |
cvEinstancesplitgroups = |
818 |
("instance", |
819 |
Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS, |
820 |
"Instance with primary and secondary nodes in different groups") |
821 |
|
822 |
cvEinstanceunsuitablenode :: (String, String, String) |
823 |
cvEinstanceunsuitablenode = |
824 |
("instance", |
825 |
Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE, |
826 |
"Instance running on nodes that are not suitable for it") |
827 |
|
828 |
cvEinstancewrongnode :: (String, String, String) |
829 |
cvEinstancewrongnode = |
830 |
("instance", |
831 |
Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE, |
832 |
"Instance running on the wrong node") |
833 |
|
834 |
cvEnodedrbd :: (String, String, String) |
835 |
cvEnodedrbd = |
836 |
("node", |
837 |
Types.cVErrorCodeToRaw CvENODEDRBD, |
838 |
"Error parsing the DRBD status file") |
839 |
|
840 |
cvEnodedrbdhelper :: (String, String, String) |
841 |
cvEnodedrbdhelper = |
842 |
("node", |
843 |
Types.cVErrorCodeToRaw CvENODEDRBDHELPER, |
844 |
"Error caused by the DRBD helper") |
845 |
|
846 |
cvEnodedrbdversion :: (String, String, String) |
847 |
cvEnodedrbdversion = |
848 |
("node", |
849 |
Types.cVErrorCodeToRaw CvENODEDRBDVERSION, |
850 |
"DRBD version mismatch within a node group") |
851 |
|
852 |
cvEnodefilecheck :: (String, String, String) |
853 |
cvEnodefilecheck = |
854 |
("node", |
855 |
Types.cVErrorCodeToRaw CvENODEFILECHECK, |
856 |
"Error retrieving the checksum of the node files") |
857 |
|
858 |
cvEnodefilestoragepaths :: (String, String, String) |
859 |
cvEnodefilestoragepaths = |
860 |
("node", |
861 |
Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS, |
862 |
"Detected bad file storage paths") |
863 |
|
864 |
cvEnodefilestoragepathunusable :: (String, String, String) |
865 |
cvEnodefilestoragepathunusable = |
866 |
("node", |
867 |
Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE, |
868 |
"File storage path unusable") |
869 |
|
870 |
cvEnodehooks :: (String, String, String) |
871 |
cvEnodehooks = |
872 |
("node", |
873 |
Types.cVErrorCodeToRaw CvENODEHOOKS, |
874 |
"Communication failure in hooks execution") |
875 |
|
876 |
cvEnodehv :: (String, String, String) |
877 |
cvEnodehv = |
878 |
("node", |
879 |
Types.cVErrorCodeToRaw CvENODEHV, |
880 |
"Hypervisor parameters verification failure") |
881 |
|
882 |
cvEnodelvm :: (String, String, String) |
883 |
cvEnodelvm = |
884 |
("node", |
885 |
Types.cVErrorCodeToRaw CvENODELVM, |
886 |
"LVM-related node error") |
887 |
|
888 |
cvEnoden1 :: (String, String, String) |
889 |
cvEnoden1 = |
890 |
("node", |
891 |
Types.cVErrorCodeToRaw CvENODEN1, |
892 |
"Not enough memory to accommodate instance failovers") |
893 |
|
894 |
cvEnodenet :: (String, String, String) |
895 |
cvEnodenet = |
896 |
("node", |
897 |
Types.cVErrorCodeToRaw CvENODENET, |
898 |
"Network-related node error") |
899 |
|
900 |
cvEnodeoobpath :: (String, String, String) |
901 |
cvEnodeoobpath = |
902 |
("node", |
903 |
Types.cVErrorCodeToRaw CvENODEOOBPATH, |
904 |
"Invalid Out Of Band path") |
905 |
|
906 |
cvEnodeorphaninstance :: (String, String, String) |
907 |
cvEnodeorphaninstance = |
908 |
("node", |
909 |
Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE, |
910 |
"Unknown intance running on a node") |
911 |
|
912 |
cvEnodeorphanlv :: (String, String, String) |
913 |
cvEnodeorphanlv = |
914 |
("node", |
915 |
Types.cVErrorCodeToRaw CvENODEORPHANLV, |
916 |
"Unknown LVM logical volume") |
917 |
|
918 |
cvEnodeos :: (String, String, String) |
919 |
cvEnodeos = |
920 |
("node", |
921 |
Types.cVErrorCodeToRaw CvENODEOS, |
922 |
"OS-related node error") |
923 |
|
924 |
cvEnoderpc :: (String, String, String) |
925 |
cvEnoderpc = |
926 |
("node", |
927 |
Types.cVErrorCodeToRaw CvENODERPC, |
928 |
"Error during connection to the primary node of an instance") |
929 |
|
930 |
cvEnodesetup :: (String, String, String) |
931 |
cvEnodesetup = |
932 |
("node", |
933 |
Types.cVErrorCodeToRaw CvENODESETUP, |
934 |
"Node setup error") |
935 |
|
936 |
cvEnodesharedfilestoragepathunusable :: (String, String, String) |
937 |
cvEnodesharedfilestoragepathunusable = |
938 |
("node", |
939 |
Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE, |
940 |
"Shared file storage path unusable") |
941 |
|
942 |
cvEnodessh :: (String, String, String) |
943 |
cvEnodessh = |
944 |
("node", |
945 |
Types.cVErrorCodeToRaw CvENODESSH, |
946 |
"SSH-related node error") |
947 |
|
948 |
cvEnodetime :: (String, String, String) |
949 |
cvEnodetime = |
950 |
("node", |
951 |
Types.cVErrorCodeToRaw CvENODETIME, |
952 |
"Node returned invalid time") |
953 |
|
954 |
cvEnodeuserscripts :: (String, String, String) |
955 |
cvEnodeuserscripts = |
956 |
("node", |
957 |
Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS, |
958 |
"User scripts not present or not executable") |
959 |
|
960 |
cvEnodeversion :: (String, String, String) |
961 |
cvEnodeversion = |
962 |
("node", |
963 |
Types.cVErrorCodeToRaw CvENODEVERSION, |
964 |
"Protocol version mismatch or Ganeti version mismatch") |
965 |
|
966 |
cvAllEcodes :: FrozenSet (String, String, String) |
967 |
cvAllEcodes = |
968 |
ConstantUtils.mkSet |
969 |
[cvEclustercert, |
970 |
cvEclustercfg, |
971 |
cvEclusterdanglinginst, |
972 |
cvEclusterdanglingnodes, |
973 |
cvEclusterfilecheck, |
974 |
cvEgroupdifferentpvsize, |
975 |
cvEinstancebadnode, |
976 |
cvEinstancedown, |
977 |
cvEinstancefaultydisk, |
978 |
cvEinstancelayout, |
979 |
cvEinstancemissingcfgparameter, |
980 |
cvEinstancemissingdisk, |
981 |
cvEinstancepolicy, |
982 |
cvEinstancesplitgroups, |
983 |
cvEinstanceunsuitablenode, |
984 |
cvEinstancewrongnode, |
985 |
cvEnodedrbd, |
986 |
cvEnodedrbdhelper, |
987 |
cvEnodedrbdversion, |
988 |
cvEnodefilecheck, |
989 |
cvEnodefilestoragepaths, |
990 |
cvEnodefilestoragepathunusable, |
991 |
cvEnodehooks, |
992 |
cvEnodehv, |
993 |
cvEnodelvm, |
994 |
cvEnoden1, |
995 |
cvEnodenet, |
996 |
cvEnodeoobpath, |
997 |
cvEnodeorphaninstance, |
998 |
cvEnodeorphanlv, |
999 |
cvEnodeos, |
1000 |
cvEnoderpc, |
1001 |
cvEnodesetup, |
1002 |
cvEnodesharedfilestoragepathunusable, |
1003 |
cvEnodessh, |
1004 |
cvEnodetime, |
1005 |
cvEnodeuserscripts, |
1006 |
cvEnodeversion] |
1007 |
|
1008 |
cvAllEcodesStrings :: FrozenSet String |
1009 |
cvAllEcodesStrings = |
1010 |
ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..] |
1011 |
|
1012 |
-- * Instance status |
1013 |
|
1014 |
inststAdmindown :: String |
1015 |
inststAdmindown = Types.instanceStatusToRaw StatusDown |
1016 |
|
1017 |
inststAdminoffline :: String |
1018 |
inststAdminoffline = Types.instanceStatusToRaw StatusOffline |
1019 |
|
1020 |
inststErrordown :: String |
1021 |
inststErrordown = Types.instanceStatusToRaw ErrorDown |
1022 |
|
1023 |
inststErrorup :: String |
1024 |
inststErrorup = Types.instanceStatusToRaw ErrorUp |
1025 |
|
1026 |
inststNodedown :: String |
1027 |
inststNodedown = Types.instanceStatusToRaw NodeDown |
1028 |
|
1029 |
inststNodeoffline :: String |
1030 |
inststNodeoffline = Types.instanceStatusToRaw NodeOffline |
1031 |
|
1032 |
inststRunning :: String |
1033 |
inststRunning = Types.instanceStatusToRaw Running |
1034 |
|
1035 |
inststWrongnode :: String |
1036 |
inststWrongnode = Types.instanceStatusToRaw WrongNode |
1037 |
|
1038 |
inststAll :: FrozenSet String |
1039 |
inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..] |
1040 |
|
1041 |
-- * Admin states |
1042 |
|
1043 |
adminstDown :: String |
1044 |
adminstDown = Types.adminStateToRaw AdminDown |
1045 |
|
1046 |
adminstOffline :: String |
1047 |
adminstOffline = Types.adminStateToRaw AdminOffline |
1048 |
|
1049 |
adminstUp :: String |
1050 |
adminstUp = Types.adminStateToRaw AdminUp |
1051 |
|
1052 |
adminstAll :: FrozenSet String |
1053 |
adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..] |
1054 |
|
1055 |
-- * Node roles |
1056 |
|
1057 |
nrDrained :: String |
1058 |
nrDrained = Types.nodeRoleToRaw NRDrained |
1059 |
|
1060 |
nrMaster :: String |
1061 |
nrMaster = Types.nodeRoleToRaw NRMaster |
1062 |
|
1063 |
nrMcandidate :: String |
1064 |
nrMcandidate = Types.nodeRoleToRaw NRCandidate |
1065 |
|
1066 |
nrOffline :: String |
1067 |
nrOffline = Types.nodeRoleToRaw NROffline |
1068 |
|
1069 |
nrRegular :: String |
1070 |
nrRegular = Types.nodeRoleToRaw NRRegular |
1071 |
|
1072 |
nrAll :: FrozenSet String |
1073 |
nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..] |
1074 |
|
1075 |
-- * Allocator framework constants |
1076 |
|
1077 |
iallocatorVersion :: Int |
1078 |
iallocatorVersion = 2 |
1079 |
|
1080 |
iallocatorDirIn :: String |
1081 |
iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn |
1082 |
|
1083 |
iallocatorDirOut :: String |
1084 |
iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut |
1085 |
|
1086 |
validIallocatorDirections :: FrozenSet String |
1087 |
validIallocatorDirections = |
1088 |
ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..] |
1089 |
|
1090 |
iallocatorModeAlloc :: String |
1091 |
iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc |
1092 |
|
1093 |
iallocatorModeChgGroup :: String |
1094 |
iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup |
1095 |
|
1096 |
iallocatorModeMultiAlloc :: String |
1097 |
iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc |
1098 |
|
1099 |
iallocatorModeNodeEvac :: String |
1100 |
iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac |
1101 |
|
1102 |
iallocatorModeReloc :: String |
1103 |
iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc |
1104 |
|
1105 |
validIallocatorModes :: FrozenSet String |
1106 |
validIallocatorModes = |
1107 |
ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..] |
1108 |
|
1109 |
iallocatorSearchPath :: [String] |
1110 |
iallocatorSearchPath = AutoConf.iallocatorSearchPath |
1111 |
|
1112 |
defaultIallocatorShortcut :: String |
1113 |
defaultIallocatorShortcut = "." |
1114 |
|
1115 |
-- * Node evacuation |
1116 |
|
1117 |
nodeEvacPri :: String |
1118 |
nodeEvacPri = Types.evacModeToRaw ChangePrimary |
1119 |
|
1120 |
nodeEvacSec :: String |
1121 |
nodeEvacSec = Types.evacModeToRaw ChangeSecondary |
1122 |
|
1123 |
nodeEvacAll :: String |
1124 |
nodeEvacAll = Types.evacModeToRaw ChangeAll |
1125 |
|
1126 |
nodeEvacModes :: FrozenSet String |
1127 |
nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..] |
1128 |
|
1129 |
-- * Job status |
1130 |
|
1131 |
jobStatusQueued :: String |
1132 |
jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED |
1133 |
|
1134 |
jobStatusWaiting :: String |
1135 |
jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING |
1136 |
|
1137 |
jobStatusCanceling :: String |
1138 |
jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING |
1139 |
|
1140 |
jobStatusRunning :: String |
1141 |
jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING |
1142 |
|
1143 |
jobStatusCanceled :: String |
1144 |
jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED |
1145 |
|
1146 |
jobStatusSuccess :: String |
1147 |
jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS |
1148 |
|
1149 |
jobStatusError :: String |
1150 |
jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR |
1151 |
|
1152 |
jobsPending :: FrozenSet String |
1153 |
jobsPending = |
1154 |
ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling] |
1155 |
|
1156 |
jobsFinalized :: FrozenSet String |
1157 |
jobsFinalized = |
1158 |
ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..] |
1159 |
|
1160 |
jobStatusAll :: FrozenSet String |
1161 |
jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..] |
1162 |
|
1163 |
-- * OpCode status |
1164 |
|
1165 |
-- ** Not yet finalized opcodes |
1166 |
|
1167 |
opStatusCanceling :: String |
1168 |
opStatusCanceling = "canceling" |
1169 |
|
1170 |
opStatusQueued :: String |
1171 |
opStatusQueued = "queued" |
1172 |
|
1173 |
opStatusRunning :: String |
1174 |
opStatusRunning = "running" |
1175 |
|
1176 |
opStatusWaiting :: String |
1177 |
opStatusWaiting = "waiting" |
1178 |
|
1179 |
-- ** Finalized opcodes |
1180 |
|
1181 |
opStatusCanceled :: String |
1182 |
opStatusCanceled = "canceled" |
1183 |
|
1184 |
opStatusError :: String |
1185 |
opStatusError = "error" |
1186 |
|
1187 |
opStatusSuccess :: String |
1188 |
opStatusSuccess = "success" |
1189 |
|
1190 |
opsFinalized :: FrozenSet String |
1191 |
opsFinalized = |
1192 |
ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess] |
1193 |
|
1194 |
-- * OpCode priority |
1195 |
|
1196 |
opPrioLowest :: Int |
1197 |
opPrioLowest = 19 |
1198 |
|
1199 |
opPrioHighest :: Int |
1200 |
opPrioHighest = -20 |
1201 |
|
1202 |
opPrioLow :: Int |
1203 |
opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow |
1204 |
|
1205 |
opPrioNormal :: Int |
1206 |
opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal |
1207 |
|
1208 |
opPrioHigh :: Int |
1209 |
opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh |
1210 |
|
1211 |
opPrioSubmitValid :: FrozenSet Int |
1212 |
opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh] |
1213 |
|
1214 |
opPrioDefault :: Int |
1215 |
opPrioDefault = opPrioNormal |
1216 |
|
1217 |
-- * Execution log types |
1218 |
|
1219 |
elogMessage :: String |
1220 |
elogMessage = Types.eLogTypeToRaw ELogMessage |
1221 |
|
1222 |
elogRemoteImport :: String |
1223 |
elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport |
1224 |
|
1225 |
elogJqueueTest :: String |
1226 |
elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest |
1227 |
|
1228 |
-- * A few common errors for confd |
1229 |
|
1230 |
confdErrorArgument :: Int |
1231 |
confdErrorArgument = 3 |
1232 |
|
1233 |
confdErrorInternal :: Int |
1234 |
confdErrorInternal = 2 |
1235 |
|
1236 |
confdErrorUnknownEntry :: Int |
1237 |
confdErrorUnknownEntry = 1 |
1238 |
|
1239 |
-- Confd request query fields |
1240 |
|
1241 |
confdReqqLink :: String |
1242 |
confdReqqLink = ConstantUtils.confdReqqLink |
1243 |
|
1244 |
confdReqqIp :: String |
1245 |
confdReqqIp = ConstantUtils.confdReqqIp |
1246 |
|
1247 |
confdReqqIplist :: String |
1248 |
confdReqqIplist = ConstantUtils.confdReqqIplist |
1249 |
|
1250 |
confdReqqFields :: String |
1251 |
confdReqqFields = ConstantUtils.confdReqqFields |
1252 |
|
1253 |
-- | Each request is "salted" by the current timestamp. |
1254 |
-- |
1255 |
-- This constant decides how many seconds of skew to accept. |
1256 |
-- |
1257 |
-- TODO: make this a default and allow the value to be more |
1258 |
-- configurable |
1259 |
confdMaxClockSkew :: Int |
1260 |
confdMaxClockSkew = 2 * nodeMaxClockSkew |
1261 |
|
1262 |
-- | When we haven't reloaded the config for more than this amount of |
1263 |
-- seconds, we force a test to see if inotify is betraying us. Using a |
1264 |
-- prime number to ensure we get less chance of 'same wakeup' with |
1265 |
-- other processes. |
1266 |
confdConfigReloadTimeout :: Int |
1267 |
confdConfigReloadTimeout = 17 |
1268 |
|
1269 |
-- | If we receive more than one update in this amount of |
1270 |
-- microseconds, we move to polling every RATELIMIT seconds, rather |
1271 |
-- than relying on inotify, to be able to serve more requests. |
1272 |
confdConfigReloadRatelimit :: Int |
1273 |
confdConfigReloadRatelimit = 250000 |
1274 |
|
1275 |
-- | Magic number prepended to all confd queries. |
1276 |
-- |
1277 |
-- This allows us to distinguish different types of confd protocols |
1278 |
-- and handle them. For example by changing this we can move the whole |
1279 |
-- payload to be compressed, or move away from json. |
1280 |
confdMagicFourcc :: String |
1281 |
confdMagicFourcc = "plj0" |
1282 |
|
1283 |
-- | By default a confd request is sent to the minimum between this |
1284 |
-- number and all MCs. 6 was chosen because even in the case of a |
1285 |
-- disastrous 50% response rate, we should have enough answers to be |
1286 |
-- able to compare more than one. |
1287 |
confdDefaultReqCoverage :: Int |
1288 |
confdDefaultReqCoverage = 6 |
1289 |
|
1290 |
-- | Timeout in seconds to expire pending query request in the confd |
1291 |
-- client library. We don't actually expect any answer more than 10 |
1292 |
-- seconds after we sent a request. |
1293 |
confdClientExpireTimeout :: Int |
1294 |
confdClientExpireTimeout = 10 |
1295 |
|
1296 |
-- * Possible values for NodeGroup.alloc_policy |
1297 |
|
1298 |
allocPolicyLastResort :: String |
1299 |
allocPolicyLastResort = Types.allocPolicyToRaw AllocLastResort |
1300 |
|
1301 |
allocPolicyPreferred :: String |
1302 |
allocPolicyPreferred = Types.allocPolicyToRaw AllocPreferred |
1303 |
|
1304 |
allocPolicyUnallocable :: String |
1305 |
allocPolicyUnallocable = Types.allocPolicyToRaw AllocUnallocable |
1306 |
|
1307 |
validAllocPolicies :: [String] |
1308 |
validAllocPolicies = map Types.allocPolicyToRaw [minBound..] |
1309 |
|
1310 |
-- | Temporary external/shared storage parameters |
1311 |
blockdevDriverManual :: String |
1312 |
blockdevDriverManual = Types.blockDriverToRaw BlockDrvManual |
1313 |
|
1314 |
-- | 'qemu-img' path, required for 'ovfconverter' |
1315 |
qemuimgPath :: String |
1316 |
qemuimgPath = AutoConf.qemuimgPath |
1317 |
|
1318 |
-- | Whether htools was enabled at compilation time |
1319 |
-- |
1320 |
-- FIXME: this should be moved next to the other enable constants, |
1321 |
-- such as, 'enableConfd', and renamed to 'enableHtools'. |
1322 |
htools :: Bool |
1323 |
htools = AutoConf.htools |
1324 |
|
1325 |
-- | Path generating random UUID |
1326 |
randomUuidFile :: String |
1327 |
randomUuidFile = ConstantUtils.randomUuidFile |
1328 |
|
1329 |
-- * Auto-repair tag prefixes |
1330 |
|
1331 |
autoRepairTagPrefix :: String |
1332 |
autoRepairTagPrefix = "ganeti:watcher:autorepair:" |
1333 |
|
1334 |
autoRepairTagEnabled :: String |
1335 |
autoRepairTagEnabled = autoRepairTagPrefix |
1336 |
|
1337 |
autoRepairTagPending :: String |
1338 |
autoRepairTagPending = autoRepairTagPrefix ++ "pending:" |
1339 |
|
1340 |
autoRepairTagResult :: String |
1341 |
autoRepairTagResult = autoRepairTagPrefix ++ "result:" |
1342 |
|
1343 |
autoRepairTagSuspended :: String |
1344 |
autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:" |
1345 |
|
1346 |
-- * Auto-repair levels |
1347 |
|
1348 |
autoRepairFailover :: String |
1349 |
autoRepairFailover = "failover" |
1350 |
|
1351 |
autoRepairFixStorage :: String |
1352 |
autoRepairFixStorage = "fix-storage" |
1353 |
|
1354 |
autoRepairMigrate :: String |
1355 |
autoRepairMigrate = "migrate" |
1356 |
|
1357 |
autoRepairReinstall :: String |
1358 |
autoRepairReinstall = "reinstall" |
1359 |
|
1360 |
autoRepairAllTypes :: FrozenSet String |
1361 |
autoRepairAllTypes = |
1362 |
ConstantUtils.mkSet [autoRepairFailover, |
1363 |
autoRepairFixStorage, |
1364 |
autoRepairMigrate, |
1365 |
autoRepairReinstall] |
1366 |
|
1367 |
-- * Auto-repair results |
1368 |
|
1369 |
autoRepairEnoperm :: String |
1370 |
autoRepairEnoperm = "enoperm" |
1371 |
|
1372 |
autoRepairFailure :: String |
1373 |
autoRepairFailure = "failure" |
1374 |
|
1375 |
autoRepairSuccess :: String |
1376 |
autoRepairSuccess = "success" |
1377 |
|
1378 |
autoRepairAllResults :: FrozenSet String |
1379 |
autoRepairAllResults = |
1380 |
ConstantUtils.mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess] |
1381 |
|
1382 |
-- | The version identifier for builtin data collectors |
1383 |
builtinDataCollectorVersion :: String |
1384 |
builtinDataCollectorVersion = "B" |
1385 |
|
1386 |
-- | The reason trail opcode parameter name |
1387 |
opcodeReason :: String |
1388 |
opcodeReason = "reason" |
1389 |
|
1390 |
diskstatsFile :: String |
1391 |
diskstatsFile = "/proc/diskstats" |
1392 |
|
1393 |
-- | CPU load collector |
1394 |
statFile :: String |
1395 |
statFile = "/proc/stat" |
1396 |
|
1397 |
-- | Mond's variable for periodical data collection |
1398 |
mondTimeInterval :: Int |
1399 |
mondTimeInterval = 5 |
1400 |
|
1401 |
-- * Disk access modes |
1402 |
|
1403 |
diskUserspace :: String |
1404 |
diskUserspace = Types.diskAccessModeToRaw DiskUserspace |
1405 |
|
1406 |
diskKernelspace :: String |
1407 |
diskKernelspace = Types.diskAccessModeToRaw DiskKernelspace |
1408 |
|
1409 |
diskValidAccessModes :: FrozenSet String |
1410 |
diskValidAccessModes = |
1411 |
ConstantUtils.mkSet $ map Types.diskAccessModeToRaw [minBound..] |
1412 |
|
1413 |
-- | Timeout for queue draining in upgrades |
1414 |
upgradeQueueDrainTimeout :: Int |
1415 |
upgradeQueueDrainTimeout = 36 * 60 * 60 -- 1.5 days |
1416 |
|
1417 |
-- | Intervall at which the queue is polled during upgrades |
1418 |
upgradeQueuePollInterval :: Int |
1419 |
upgradeQueuePollInterval = 10 |