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