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