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