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