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