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