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