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