root / src / Ganeti / HsConstants.hs @ 81ae485c
History | View | Annotate | Download (89.9 kB)
1 |
{-# OPTIONS -fno-warn-type-defaults #-} |
---|---|
2 |
{-| HsConstants contains the Haskell constants |
3 |
|
4 |
This is a transitional module complementary to 'Ganeti.Constants'. It |
5 |
is intended to contain the Haskell constants that are meant to be |
6 |
generated in Python. |
7 |
|
8 |
Do not write any definitions in this file other than constants. Do |
9 |
not even write helper functions. The definitions in this module are |
10 |
automatically stripped to build the Makefile.am target |
11 |
'ListConstants.hs'. If there are helper functions in this module, |
12 |
they will also be dragged and it will cause compilation to fail. |
13 |
Therefore, all helper functions should go to a separate module and |
14 |
imported. |
15 |
|
16 |
-} |
17 |
|
18 |
{- |
19 |
|
20 |
Copyright (C) 2013 Google Inc. |
21 |
|
22 |
This program is free software; you can redistribute it and/or modify |
23 |
it under the terms of the GNU General Public License as published by |
24 |
the Free Software Foundation; either version 2 of the License, or |
25 |
(at your option) any later version. |
26 |
|
27 |
This program is distributed in the hope that it will be useful, but |
28 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
29 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
30 |
General Public License for more details. |
31 |
|
32 |
You should have received a copy of the GNU General Public License |
33 |
along with this program; if not, write to the Free Software |
34 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
35 |
02110-1301, USA. |
36 |
|
37 |
-} |
38 |
module Ganeti.HsConstants where |
39 |
|
40 |
import Control.Arrow ((***)) |
41 |
import Data.List ((\\)) |
42 |
import Data.Map (Map) |
43 |
import qualified Data.Map as Map (fromList, keys, insert) |
44 |
|
45 |
import AutoConf |
46 |
import Ganeti.ConstantUtils (PythonChar(..), FrozenSet, Protocol(..), |
47 |
buildVersion) |
48 |
import qualified Ganeti.ConstantUtils as ConstantUtils |
49 |
import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..), |
50 |
ExtraLogReason(..)) |
51 |
import Ganeti.HTools.Types (AutoRepairResult(..), AutoRepairType(..)) |
52 |
import qualified Ganeti.HTools.Types as Types |
53 |
import Ganeti.Logging (SyslogUsage(..)) |
54 |
import qualified Ganeti.Logging as Logging (syslogUsageToRaw) |
55 |
import qualified Ganeti.Runtime as Runtime |
56 |
import Ganeti.Types |
57 |
import qualified Ganeti.Types as Types |
58 |
import Ganeti.Confd.Types (ConfdRequestType(..), ConfdReqField(..), |
59 |
ConfdReplyStatus(..), ConfdNodeRole(..), |
60 |
ConfdErrorType(..)) |
61 |
import qualified Ganeti.Confd.Types as Types |
62 |
|
63 |
{-# ANN module "HLint: ignore Use camelCase" #-} |
64 |
|
65 |
-- * 'autoconf' constants for Python only ('autotools/build-bash-completion') |
66 |
|
67 |
htoolsProgs :: [String] |
68 |
htoolsProgs = AutoConf.htoolsProgs |
69 |
|
70 |
-- * 'autoconf' constants for Python only ('lib/constants.py') |
71 |
|
72 |
drbdBarriers :: String |
73 |
drbdBarriers = AutoConf.drbdBarriers |
74 |
|
75 |
drbdNoMetaFlush :: Bool |
76 |
drbdNoMetaFlush = AutoConf.drbdNoMetaFlush |
77 |
|
78 |
lvmStripecount :: Int |
79 |
lvmStripecount = AutoConf.lvmStripecount |
80 |
|
81 |
-- * 'autoconf' constants for Python only ('lib/pathutils.py') |
82 |
|
83 |
-- ** Build-time constants |
84 |
|
85 |
exportDir :: String |
86 |
exportDir = AutoConf.exportDir |
87 |
|
88 |
osSearchPath :: [String] |
89 |
osSearchPath = AutoConf.osSearchPath |
90 |
|
91 |
esSearchPath :: [String] |
92 |
esSearchPath = AutoConf.esSearchPath |
93 |
|
94 |
sshConfigDir :: String |
95 |
sshConfigDir = AutoConf.sshConfigDir |
96 |
|
97 |
xenConfigDir :: String |
98 |
xenConfigDir = AutoConf.xenConfigDir |
99 |
|
100 |
sysconfdir :: String |
101 |
sysconfdir = AutoConf.sysconfdir |
102 |
|
103 |
toolsdir :: String |
104 |
toolsdir = AutoConf.toolsdir |
105 |
|
106 |
localstatedir :: String |
107 |
localstatedir = AutoConf.localstatedir |
108 |
|
109 |
-- ** Paths which don't change for a virtual cluster |
110 |
|
111 |
pkglibdir :: String |
112 |
pkglibdir = AutoConf.pkglibdir |
113 |
|
114 |
sharedir :: String |
115 |
sharedir = AutoConf.sharedir |
116 |
|
117 |
-- * 'autoconf' constants for Python only ('lib/build/sphinx_ext.py') |
118 |
|
119 |
manPages :: Map String Int |
120 |
manPages = Map.fromList AutoConf.manPages |
121 |
|
122 |
-- * 'autoconf' constants for QA cluster only ('qa/qa_cluster.py') |
123 |
|
124 |
versionedsharedir :: String |
125 |
versionedsharedir = AutoConf.versionedsharedir |
126 |
|
127 |
-- * 'autoconf' constants for Python only ('tests/py/docs_unittest.py') |
128 |
|
129 |
gntScripts :: [String] |
130 |
gntScripts = AutoConf.gntScripts |
131 |
|
132 |
-- * Various versions |
133 |
|
134 |
releaseVersion :: String |
135 |
releaseVersion = AutoConf.packageVersion |
136 |
|
137 |
versionMajor :: Int |
138 |
versionMajor = AutoConf.versionMajor |
139 |
|
140 |
versionMinor :: Int |
141 |
versionMinor = AutoConf.versionMinor |
142 |
|
143 |
versionRevision :: Int |
144 |
versionRevision = AutoConf.versionRevision |
145 |
|
146 |
dirVersion :: String |
147 |
dirVersion = AutoConf.dirVersion |
148 |
|
149 |
osApiV10 :: Int |
150 |
osApiV10 = 10 |
151 |
|
152 |
osApiV15 :: Int |
153 |
osApiV15 = 15 |
154 |
|
155 |
osApiV20 :: Int |
156 |
osApiV20 = 20 |
157 |
|
158 |
osApiVersions :: FrozenSet Int |
159 |
osApiVersions = ConstantUtils.mkSet [osApiV10, osApiV15, osApiV20] |
160 |
|
161 |
exportVersion :: Int |
162 |
exportVersion = 0 |
163 |
|
164 |
rapiVersion :: Int |
165 |
rapiVersion = 2 |
166 |
|
167 |
configMajor :: Int |
168 |
configMajor = AutoConf.versionMajor |
169 |
|
170 |
configMinor :: Int |
171 |
configMinor = AutoConf.versionMinor |
172 |
|
173 |
-- | The configuration is supposed to remain stable across |
174 |
-- revisions. Therefore, the revision number is cleared to '0'. |
175 |
configRevision :: Int |
176 |
configRevision = 0 |
177 |
|
178 |
configVersion :: Int |
179 |
configVersion = buildVersion configMajor configMinor configRevision |
180 |
|
181 |
-- | Similarly to the configuration (see 'configRevision'), the |
182 |
-- protocols are supposed to remain stable across revisions. |
183 |
protocolVersion :: Int |
184 |
protocolVersion = buildVersion configMajor configMinor configRevision |
185 |
|
186 |
-- * User separation |
187 |
|
188 |
daemonsGroup :: String |
189 |
daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup) |
190 |
|
191 |
adminGroup :: String |
192 |
adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup) |
193 |
|
194 |
masterdUser :: String |
195 |
masterdUser = Runtime.daemonUser GanetiMasterd |
196 |
|
197 |
masterdGroup :: String |
198 |
masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd) |
199 |
|
200 |
rapiUser :: String |
201 |
rapiUser = Runtime.daemonUser GanetiRapi |
202 |
|
203 |
rapiGroup :: String |
204 |
rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi) |
205 |
|
206 |
confdUser :: String |
207 |
confdUser = Runtime.daemonUser GanetiConfd |
208 |
|
209 |
confdGroup :: String |
210 |
confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd) |
211 |
|
212 |
luxidUser :: String |
213 |
luxidUser = Runtime.daemonUser GanetiLuxid |
214 |
|
215 |
luxidGroup :: String |
216 |
luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid) |
217 |
|
218 |
nodedUser :: String |
219 |
nodedUser = Runtime.daemonUser GanetiNoded |
220 |
|
221 |
nodedGroup :: String |
222 |
nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded) |
223 |
|
224 |
mondUser :: String |
225 |
mondUser = Runtime.daemonUser GanetiMond |
226 |
|
227 |
mondGroup :: String |
228 |
mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond) |
229 |
|
230 |
sshLoginUser :: String |
231 |
sshLoginUser = AutoConf.sshLoginUser |
232 |
|
233 |
sshConsoleUser :: String |
234 |
sshConsoleUser = AutoConf.sshConsoleUser |
235 |
|
236 |
-- * Cpu pinning separators and constants |
237 |
|
238 |
cpuPinningSep :: String |
239 |
cpuPinningSep = ":" |
240 |
|
241 |
cpuPinningAll :: String |
242 |
cpuPinningAll = "all" |
243 |
|
244 |
-- | Internal representation of "all" |
245 |
cpuPinningAllVal :: Int |
246 |
cpuPinningAllVal = -1 |
247 |
|
248 |
-- | One "all" entry in a CPU list means CPU pinning is off |
249 |
cpuPinningOff :: [Int] |
250 |
cpuPinningOff = [cpuPinningAllVal] |
251 |
|
252 |
-- | A Xen-specific implementation detail is that there is no way to |
253 |
-- actually say "use any cpu for pinning" in a Xen configuration file, |
254 |
-- as opposed to the command line, where you can say |
255 |
-- @ |
256 |
-- xm vcpu-pin <domain> <vcpu> all |
257 |
-- @ |
258 |
-- |
259 |
-- The workaround used in Xen is "0-63" (see source code function |
260 |
-- "xm_vcpu_pin" in @<xen-source>/tools/python/xen/xm/main.py@). |
261 |
-- |
262 |
-- To support future changes, the following constant is treated as a |
263 |
-- blackbox string that simply means "use any cpu for pinning under |
264 |
-- xen". |
265 |
cpuPinningAllXen :: String |
266 |
cpuPinningAllXen = "0-63" |
267 |
|
268 |
-- | A KVM-specific implementation detail - the following value is |
269 |
-- used to set CPU affinity to all processors (--0 through --31), per |
270 |
-- taskset man page. |
271 |
-- |
272 |
-- FIXME: This only works for machines with up to 32 CPU cores |
273 |
cpuPinningAllKvm :: Int |
274 |
cpuPinningAllKvm = 0xFFFFFFFF |
275 |
|
276 |
-- * Wipe |
277 |
|
278 |
ddCmd :: String |
279 |
ddCmd = "dd" |
280 |
|
281 |
-- | 1GB |
282 |
maxWipeChunk :: Int |
283 |
maxWipeChunk = 1024 |
284 |
|
285 |
minWipeChunkPercent :: Int |
286 |
minWipeChunkPercent = 10 |
287 |
|
288 |
-- * Directories |
289 |
|
290 |
runDirsMode :: Int |
291 |
runDirsMode = 0o775 |
292 |
|
293 |
secureDirMode :: Int |
294 |
secureDirMode = 0o700 |
295 |
|
296 |
secureFileMode :: Int |
297 |
secureFileMode = 0o600 |
298 |
|
299 |
adoptableBlockdevRoot :: String |
300 |
adoptableBlockdevRoot = "/dev/disk/" |
301 |
|
302 |
-- * 'autoconf' enable/disable |
303 |
|
304 |
enableConfd :: Bool |
305 |
enableConfd = AutoConf.enableConfd |
306 |
|
307 |
enableMond :: Bool |
308 |
enableMond = AutoConf.enableMond |
309 |
|
310 |
enableRestrictedCommands :: Bool |
311 |
enableRestrictedCommands = AutoConf.enableRestrictedCommands |
312 |
|
313 |
enableSplitQuery :: Bool |
314 |
enableSplitQuery = AutoConf.enableSplitQuery |
315 |
|
316 |
-- * SSH constants |
317 |
|
318 |
ssh :: String |
319 |
ssh = "ssh" |
320 |
|
321 |
scp :: String |
322 |
scp = "scp" |
323 |
|
324 |
-- * Daemons |
325 |
|
326 |
confd :: String |
327 |
confd = Runtime.daemonName GanetiConfd |
328 |
|
329 |
masterd :: String |
330 |
masterd = Runtime.daemonName GanetiMasterd |
331 |
|
332 |
mond :: String |
333 |
mond = Runtime.daemonName GanetiMond |
334 |
|
335 |
noded :: String |
336 |
noded = Runtime.daemonName GanetiNoded |
337 |
|
338 |
luxid :: String |
339 |
luxid = Runtime.daemonName GanetiLuxid |
340 |
|
341 |
rapi :: String |
342 |
rapi = Runtime.daemonName GanetiRapi |
343 |
|
344 |
daemons :: FrozenSet String |
345 |
daemons = |
346 |
ConstantUtils.mkSet [confd, |
347 |
luxid, |
348 |
masterd, |
349 |
mond, |
350 |
noded, |
351 |
rapi] |
352 |
|
353 |
defaultConfdPort :: Int |
354 |
defaultConfdPort = 1814 |
355 |
|
356 |
defaultMondPort :: Int |
357 |
defaultMondPort = 1815 |
358 |
|
359 |
defaultNodedPort :: Int |
360 |
defaultNodedPort = 1811 |
361 |
|
362 |
defaultRapiPort :: Int |
363 |
defaultRapiPort = 5080 |
364 |
|
365 |
daemonsPorts :: Map String (Protocol, Int) |
366 |
daemonsPorts = |
367 |
Map.fromList [(confd, (Udp, defaultConfdPort)), |
368 |
(mond, (Tcp, defaultMondPort)), |
369 |
(noded, (Tcp, defaultNodedPort)), |
370 |
(rapi, (Tcp, defaultRapiPort)), |
371 |
(ssh, (Tcp, 22))] |
372 |
|
373 |
firstDrbdPort :: Int |
374 |
firstDrbdPort = 11000 |
375 |
|
376 |
lastDrbdPort :: Int |
377 |
lastDrbdPort = 14999 |
378 |
|
379 |
daemonsLogbase :: Map String String |
380 |
daemonsLogbase = |
381 |
Map.fromList |
382 |
[ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ] |
383 |
|
384 |
extraLogreasonAccess :: String |
385 |
extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog |
386 |
|
387 |
extraLogreasonError :: String |
388 |
extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog |
389 |
|
390 |
devConsole :: String |
391 |
devConsole = ConstantUtils.devConsole |
392 |
|
393 |
procMounts :: String |
394 |
procMounts = "/proc/mounts" |
395 |
|
396 |
-- * Luxi (Local UniX Interface) related constants |
397 |
|
398 |
luxiEom :: PythonChar |
399 |
luxiEom = PythonChar '\x03' |
400 |
|
401 |
-- | Environment variable for the luxi override socket |
402 |
luxiOverride :: String |
403 |
luxiOverride = "FORCE_LUXI_SOCKET" |
404 |
|
405 |
luxiOverrideMaster :: String |
406 |
luxiOverrideMaster = "master" |
407 |
|
408 |
luxiOverrideQuery :: String |
409 |
luxiOverrideQuery = "query" |
410 |
|
411 |
luxiVersion :: Int |
412 |
luxiVersion = configVersion |
413 |
|
414 |
-- * Syslog |
415 |
|
416 |
syslogUsage :: String |
417 |
syslogUsage = AutoConf.syslogUsage |
418 |
|
419 |
syslogNo :: String |
420 |
syslogNo = Logging.syslogUsageToRaw SyslogNo |
421 |
|
422 |
syslogYes :: String |
423 |
syslogYes = Logging.syslogUsageToRaw SyslogYes |
424 |
|
425 |
syslogOnly :: String |
426 |
syslogOnly = Logging.syslogUsageToRaw SyslogOnly |
427 |
|
428 |
syslogSocket :: String |
429 |
syslogSocket = "/dev/log" |
430 |
|
431 |
exportConfFile :: String |
432 |
exportConfFile = "config.ini" |
433 |
|
434 |
-- * Xen |
435 |
|
436 |
xenBootloader :: String |
437 |
xenBootloader = AutoConf.xenBootloader |
438 |
|
439 |
xenCmdXl :: String |
440 |
xenCmdXl = "xl" |
441 |
|
442 |
xenCmdXm :: String |
443 |
xenCmdXm = "xm" |
444 |
|
445 |
xenInitrd :: String |
446 |
xenInitrd = AutoConf.xenInitrd |
447 |
|
448 |
xenKernel :: String |
449 |
xenKernel = AutoConf.xenKernel |
450 |
|
451 |
-- FIXME: perhaps rename to 'validXenCommands' for consistency with |
452 |
-- other constants |
453 |
knownXenCommands :: FrozenSet String |
454 |
knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm] |
455 |
|
456 |
-- * KVM and socat |
457 |
|
458 |
kvmPath :: String |
459 |
kvmPath = AutoConf.kvmPath |
460 |
|
461 |
kvmKernel :: String |
462 |
kvmKernel = AutoConf.kvmKernel |
463 |
|
464 |
socatEscapeCode :: String |
465 |
socatEscapeCode = "0x1d" |
466 |
|
467 |
socatPath :: String |
468 |
socatPath = AutoConf.socatPath |
469 |
|
470 |
socatUseCompress :: Bool |
471 |
socatUseCompress = AutoConf.socatUseCompress |
472 |
|
473 |
socatUseEscape :: Bool |
474 |
socatUseEscape = AutoConf.socatUseEscape |
475 |
|
476 |
-- * Console types |
477 |
|
478 |
-- | Display a message for console access |
479 |
consMessage :: String |
480 |
consMessage = "msg" |
481 |
|
482 |
-- | Console as SPICE server |
483 |
consSpice :: String |
484 |
consSpice = "spice" |
485 |
|
486 |
-- | Console as SSH command |
487 |
consSsh :: String |
488 |
consSsh = "ssh" |
489 |
|
490 |
-- | Console as VNC server |
491 |
consVnc :: String |
492 |
consVnc = "vnc" |
493 |
|
494 |
consAll :: FrozenSet String |
495 |
consAll = ConstantUtils.mkSet [consMessage, consSpice, consSsh, consVnc] |
496 |
|
497 |
-- | RSA key bit length |
498 |
-- |
499 |
-- For RSA keys more bits are better, but they also make operations |
500 |
-- more expensive. NIST SP 800-131 recommends a minimum of 2048 bits |
501 |
-- from the year 2010 on. |
502 |
rsaKeyBits :: Int |
503 |
rsaKeyBits = 2048 |
504 |
|
505 |
-- | Ciphers allowed for SSL connections. |
506 |
-- |
507 |
-- For the format, see ciphers(1). A better way to disable ciphers |
508 |
-- would be to use the exclamation mark (!), but socat versions below |
509 |
-- 1.5 can't parse exclamation marks in options properly. When |
510 |
-- modifying the ciphers, ensure not to accidentially add something |
511 |
-- after it's been removed. Use the "openssl" utility to check the |
512 |
-- allowed ciphers, e.g. "openssl ciphers -v HIGH:-DES". |
513 |
opensslCiphers :: String |
514 |
opensslCiphers = "HIGH:-DES:-3DES:-EXPORT:-ADH" |
515 |
|
516 |
-- * X509 |
517 |
|
518 |
-- | commonName (CN) used in certificates |
519 |
x509CertCn :: String |
520 |
x509CertCn = "ganeti.example.com" |
521 |
|
522 |
-- | Default validity of certificates in days |
523 |
x509CertDefaultValidity :: Int |
524 |
x509CertDefaultValidity = 365 * 5 |
525 |
|
526 |
x509CertSignatureHeader :: String |
527 |
x509CertSignatureHeader = "X-Ganeti-Signature" |
528 |
|
529 |
-- | Digest used to sign certificates ("openssl x509" uses SHA1 by default) |
530 |
x509CertSignDigest :: String |
531 |
x509CertSignDigest = "SHA1" |
532 |
|
533 |
-- * Import/export daemon mode |
534 |
|
535 |
iemExport :: String |
536 |
iemExport = "export" |
537 |
|
538 |
iemImport :: String |
539 |
iemImport = "import" |
540 |
|
541 |
-- * Import/export transport compression |
542 |
|
543 |
iecGzip :: String |
544 |
iecGzip = "gzip" |
545 |
|
546 |
iecNone :: String |
547 |
iecNone = "none" |
548 |
|
549 |
iecAll :: [String] |
550 |
iecAll = [iecGzip, iecNone] |
551 |
|
552 |
ieCustomSize :: String |
553 |
ieCustomSize = "fd" |
554 |
|
555 |
-- * Import/export I/O |
556 |
|
557 |
-- | Direct file I/O, equivalent to a shell's I/O redirection using |
558 |
-- '<' or '>' |
559 |
ieioFile :: String |
560 |
ieioFile = "file" |
561 |
|
562 |
-- | Raw block device I/O using "dd" |
563 |
ieioRawDisk :: String |
564 |
ieioRawDisk = "raw" |
565 |
|
566 |
-- | OS definition import/export script |
567 |
ieioScript :: String |
568 |
ieioScript = "script" |
569 |
|
570 |
-- * Hooks |
571 |
|
572 |
hooksNameCfgupdate :: String |
573 |
hooksNameCfgupdate = "config-update" |
574 |
|
575 |
hooksNameWatcher :: String |
576 |
hooksNameWatcher = "watcher" |
577 |
|
578 |
hooksPath :: String |
579 |
hooksPath = "/sbin:/bin:/usr/sbin:/usr/bin" |
580 |
|
581 |
hooksPhasePost :: String |
582 |
hooksPhasePost = "post" |
583 |
|
584 |
hooksPhasePre :: String |
585 |
hooksPhasePre = "pre" |
586 |
|
587 |
hooksVersion :: Int |
588 |
hooksVersion = 2 |
589 |
|
590 |
-- * Hooks subject type (what object type does the LU deal with) |
591 |
|
592 |
htypeCluster :: String |
593 |
htypeCluster = "CLUSTER" |
594 |
|
595 |
htypeGroup :: String |
596 |
htypeGroup = "GROUP" |
597 |
|
598 |
htypeInstance :: String |
599 |
htypeInstance = "INSTANCE" |
600 |
|
601 |
htypeNetwork :: String |
602 |
htypeNetwork = "NETWORK" |
603 |
|
604 |
htypeNode :: String |
605 |
htypeNode = "NODE" |
606 |
|
607 |
-- * Hkr |
608 |
|
609 |
hkrSkip :: Int |
610 |
hkrSkip = 0 |
611 |
|
612 |
hkrFail :: Int |
613 |
hkrFail = 1 |
614 |
|
615 |
hkrSuccess :: Int |
616 |
hkrSuccess = 2 |
617 |
|
618 |
-- * Storage types |
619 |
|
620 |
stBlock :: String |
621 |
stBlock = Types.storageTypeToRaw StorageBlock |
622 |
|
623 |
stDiskless :: String |
624 |
stDiskless = Types.storageTypeToRaw StorageDiskless |
625 |
|
626 |
stExt :: String |
627 |
stExt = Types.storageTypeToRaw StorageExt |
628 |
|
629 |
stFile :: String |
630 |
stFile = Types.storageTypeToRaw StorageFile |
631 |
|
632 |
stLvmPv :: String |
633 |
stLvmPv = Types.storageTypeToRaw StorageLvmPv |
634 |
|
635 |
stLvmVg :: String |
636 |
stLvmVg = Types.storageTypeToRaw StorageLvmVg |
637 |
|
638 |
stRados :: String |
639 |
stRados = Types.storageTypeToRaw StorageRados |
640 |
|
641 |
storageTypes :: FrozenSet String |
642 |
storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..] |
643 |
|
644 |
-- | The set of storage types for which storage reporting is available |
645 |
-- |
646 |
-- FIXME: Remove this, once storage reporting is available for all |
647 |
-- types. |
648 |
stsReport :: FrozenSet String |
649 |
stsReport = ConstantUtils.mkSet [stFile, stLvmPv, stLvmVg] |
650 |
|
651 |
-- * Storage fields |
652 |
-- ** First two are valid in LU context only, not passed to backend |
653 |
|
654 |
sfNode :: String |
655 |
sfNode = "node" |
656 |
|
657 |
sfType :: String |
658 |
sfType = "type" |
659 |
|
660 |
-- ** and the rest are valid in backend |
661 |
|
662 |
sfAllocatable :: String |
663 |
sfAllocatable = Types.storageFieldToRaw SFAllocatable |
664 |
|
665 |
sfFree :: String |
666 |
sfFree = Types.storageFieldToRaw SFFree |
667 |
|
668 |
sfName :: String |
669 |
sfName = Types.storageFieldToRaw SFName |
670 |
|
671 |
sfSize :: String |
672 |
sfSize = Types.storageFieldToRaw SFSize |
673 |
|
674 |
sfUsed :: String |
675 |
sfUsed = Types.storageFieldToRaw SFUsed |
676 |
|
677 |
validStorageFields :: FrozenSet String |
678 |
validStorageFields = |
679 |
ConstantUtils.mkSet $ map Types.storageFieldToRaw [minBound..] ++ |
680 |
[sfNode, sfType] |
681 |
|
682 |
modifiableStorageFields :: Map String (FrozenSet String) |
683 |
modifiableStorageFields = |
684 |
Map.fromList [(Types.storageTypeToRaw StorageLvmPv, |
685 |
ConstantUtils.mkSet [sfAllocatable])] |
686 |
|
687 |
-- * Storage operations |
688 |
|
689 |
soFixConsistency :: String |
690 |
soFixConsistency = "fix-consistency" |
691 |
|
692 |
validStorageOperations :: Map String (FrozenSet String) |
693 |
validStorageOperations = |
694 |
Map.fromList [(Types.storageTypeToRaw StorageLvmVg, |
695 |
ConstantUtils.mkSet [soFixConsistency])] |
696 |
|
697 |
-- * Volume fields |
698 |
|
699 |
vfDev :: String |
700 |
vfDev = "dev" |
701 |
|
702 |
vfInstance :: String |
703 |
vfInstance = "instance" |
704 |
|
705 |
vfName :: String |
706 |
vfName = "name" |
707 |
|
708 |
vfNode :: String |
709 |
vfNode = "node" |
710 |
|
711 |
vfPhys :: String |
712 |
vfPhys = "phys" |
713 |
|
714 |
vfSize :: String |
715 |
vfSize = "size" |
716 |
|
717 |
vfVg :: String |
718 |
vfVg = "vg" |
719 |
|
720 |
-- * Local disk status |
721 |
|
722 |
ldsFaulty :: Int |
723 |
ldsFaulty = Types.localDiskStatusToRaw DiskStatusFaulty |
724 |
|
725 |
ldsOkay :: Int |
726 |
ldsOkay = Types.localDiskStatusToRaw DiskStatusOk |
727 |
|
728 |
ldsUnknown :: Int |
729 |
ldsUnknown = Types.localDiskStatusToRaw DiskStatusUnknown |
730 |
|
731 |
ldsNames :: Map Int String |
732 |
ldsNames = |
733 |
Map.fromList [ (Types.localDiskStatusToRaw ds, |
734 |
localDiskStatusName ds) | ds <- [minBound..] ] |
735 |
|
736 |
-- * Disk template types |
737 |
|
738 |
dtDiskless :: String |
739 |
dtDiskless = Types.diskTemplateToRaw DTDiskless |
740 |
|
741 |
dtFile :: String |
742 |
dtFile = Types.diskTemplateToRaw DTFile |
743 |
|
744 |
dtSharedFile :: String |
745 |
dtSharedFile = Types.diskTemplateToRaw DTSharedFile |
746 |
|
747 |
dtPlain :: String |
748 |
dtPlain = Types.diskTemplateToRaw DTPlain |
749 |
|
750 |
dtBlock :: String |
751 |
dtBlock = Types.diskTemplateToRaw DTBlock |
752 |
|
753 |
dtDrbd8 :: String |
754 |
dtDrbd8 = Types.diskTemplateToRaw DTDrbd8 |
755 |
|
756 |
dtRbd :: String |
757 |
dtRbd = Types.diskTemplateToRaw DTRbd |
758 |
|
759 |
dtExt :: String |
760 |
dtExt = Types.diskTemplateToRaw DTExt |
761 |
|
762 |
-- | This is used to order determine the default disk template when |
763 |
-- the list of enabled disk templates is inferred from the current |
764 |
-- state of the cluster. This only happens on an upgrade from a |
765 |
-- version of Ganeti that did not support the 'enabled_disk_templates' |
766 |
-- so far. |
767 |
diskTemplatePreference :: [String] |
768 |
diskTemplatePreference = |
769 |
map Types.diskTemplateToRaw |
770 |
[DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile] |
771 |
|
772 |
diskTemplates :: FrozenSet String |
773 |
diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..] |
774 |
|
775 |
-- | Disk templates that are enabled by default |
776 |
defaultEnabledDiskTemplates :: [String] |
777 |
defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain] |
778 |
|
779 |
-- | Mapping of disk templates to storage types |
780 |
mapDiskTemplateStorageType :: Map String String |
781 |
mapDiskTemplateStorageType = |
782 |
Map.fromList $ |
783 |
map (Types.diskTemplateToRaw *** Types.storageTypeToRaw) |
784 |
[(DTBlock, StorageBlock), |
785 |
(DTDrbd8, StorageLvmVg), |
786 |
(DTExt, StorageExt), |
787 |
(DTSharedFile, StorageFile), |
788 |
(DTFile, StorageFile), |
789 |
(DTDiskless, StorageDiskless), |
790 |
(DTPlain, StorageLvmVg), |
791 |
(DTRbd, StorageRados)] |
792 |
|
793 |
-- | The set of network-mirrored disk templates |
794 |
dtsIntMirror :: FrozenSet String |
795 |
dtsIntMirror = ConstantUtils.mkSet [dtDrbd8] |
796 |
|
797 |
-- | 'DTDiskless' is 'trivially' externally mirrored |
798 |
dtsExtMirror :: FrozenSet String |
799 |
dtsExtMirror = |
800 |
ConstantUtils.mkSet $ |
801 |
map Types.diskTemplateToRaw [DTDiskless, DTBlock, DTExt, DTSharedFile, DTRbd] |
802 |
|
803 |
-- | The set of non-lvm-based disk templates |
804 |
dtsNotLvm :: FrozenSet String |
805 |
dtsNotLvm = |
806 |
ConstantUtils.mkSet $ |
807 |
map Types.diskTemplateToRaw |
808 |
[DTSharedFile, DTDiskless, DTBlock, DTExt, DTFile, DTRbd] |
809 |
|
810 |
-- | The set of disk templates which can be grown |
811 |
dtsGrowable :: FrozenSet String |
812 |
dtsGrowable = |
813 |
ConstantUtils.mkSet $ |
814 |
map Types.diskTemplateToRaw |
815 |
[DTSharedFile, DTDrbd8, DTPlain, DTExt, DTFile, DTRbd] |
816 |
|
817 |
-- | The set of disk templates that allow adoption |
818 |
dtsMayAdopt :: FrozenSet String |
819 |
dtsMayAdopt = |
820 |
ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTBlock, DTPlain] |
821 |
|
822 |
-- | The set of disk templates that *must* use adoption |
823 |
dtsMustAdopt :: FrozenSet String |
824 |
dtsMustAdopt = ConstantUtils.mkSet [Types.diskTemplateToRaw DTBlock] |
825 |
|
826 |
-- | The set of disk templates that allow migrations |
827 |
dtsMirrored :: FrozenSet String |
828 |
dtsMirrored = dtsIntMirror `ConstantUtils.union` dtsExtMirror |
829 |
|
830 |
-- | The set of file based disk templates |
831 |
dtsFilebased :: FrozenSet String |
832 |
dtsFilebased = |
833 |
ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTSharedFile, DTFile] |
834 |
|
835 |
-- | The set of disk templates that can be moved by copying |
836 |
-- |
837 |
-- Note: a requirement is that they're not accessed externally or |
838 |
-- shared between nodes; in particular, sharedfile is not suitable. |
839 |
dtsCopyable :: FrozenSet String |
840 |
dtsCopyable = |
841 |
ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain, DTFile] |
842 |
|
843 |
-- | The set of disk templates that are supported by exclusive_storage |
844 |
dtsExclStorage :: FrozenSet String |
845 |
dtsExclStorage = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain] |
846 |
|
847 |
-- | Templates for which we don't perform checks on free space |
848 |
dtsNoFreeSpaceCheck :: FrozenSet String |
849 |
dtsNoFreeSpaceCheck = |
850 |
ConstantUtils.mkSet $ |
851 |
map Types.diskTemplateToRaw [DTExt, DTSharedFile, DTFile, DTRbd] |
852 |
|
853 |
dtsBlock :: FrozenSet String |
854 |
dtsBlock = |
855 |
ConstantUtils.mkSet $ |
856 |
map Types.diskTemplateToRaw [DTPlain, DTDrbd8, DTBlock, DTRbd, DTExt] |
857 |
|
858 |
-- * Drbd |
859 |
|
860 |
drbdHmacAlg :: String |
861 |
drbdHmacAlg = "md5" |
862 |
|
863 |
drbdDefaultNetProtocol :: String |
864 |
drbdDefaultNetProtocol = "C" |
865 |
|
866 |
drbdMigrationNetProtocol :: String |
867 |
drbdMigrationNetProtocol = "C" |
868 |
|
869 |
drbdStatusFile :: String |
870 |
drbdStatusFile = "/proc/drbd" |
871 |
|
872 |
-- | Size of DRBD meta block device |
873 |
drbdMetaSize :: Int |
874 |
drbdMetaSize = 128 |
875 |
|
876 |
-- * Drbd barrier types |
877 |
|
878 |
drbdBDiskBarriers :: String |
879 |
drbdBDiskBarriers = "b" |
880 |
|
881 |
drbdBDiskDrain :: String |
882 |
drbdBDiskDrain = "d" |
883 |
|
884 |
drbdBDiskFlush :: String |
885 |
drbdBDiskFlush = "f" |
886 |
|
887 |
drbdBNone :: String |
888 |
drbdBNone = "n" |
889 |
|
890 |
-- | Rbd tool command |
891 |
rbdCmd :: String |
892 |
rbdCmd = "rbd" |
893 |
|
894 |
-- * File backend driver |
895 |
|
896 |
fdBlktap :: String |
897 |
fdBlktap = Types.fileDriverToRaw FileBlktap |
898 |
|
899 |
fdLoop :: String |
900 |
fdLoop = Types.fileDriverToRaw FileLoop |
901 |
|
902 |
fileDriver :: FrozenSet String |
903 |
fileDriver = |
904 |
ConstantUtils.mkSet $ |
905 |
map Types.fileDriverToRaw [minBound..] |
906 |
|
907 |
-- | The set of drbd-like disk types |
908 |
ldsDrbd :: FrozenSet String |
909 |
ldsDrbd = ConstantUtils.mkSet [Types.diskTemplateToRaw DTDrbd8] |
910 |
|
911 |
-- * Disk access mode |
912 |
|
913 |
diskRdonly :: String |
914 |
diskRdonly = Types.diskModeToRaw DiskRdOnly |
915 |
|
916 |
diskRdwr :: String |
917 |
diskRdwr = Types.diskModeToRaw DiskRdWr |
918 |
|
919 |
diskAccessSet :: FrozenSet String |
920 |
diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..] |
921 |
|
922 |
-- * Disk replacement mode |
923 |
|
924 |
replaceDiskAuto :: String |
925 |
replaceDiskAuto = Types.replaceDisksModeToRaw ReplaceAuto |
926 |
|
927 |
replaceDiskChg :: String |
928 |
replaceDiskChg = Types.replaceDisksModeToRaw ReplaceNewSecondary |
929 |
|
930 |
replaceDiskPri :: String |
931 |
replaceDiskPri = Types.replaceDisksModeToRaw ReplaceOnPrimary |
932 |
|
933 |
replaceDiskSec :: String |
934 |
replaceDiskSec = Types.replaceDisksModeToRaw ReplaceOnSecondary |
935 |
|
936 |
replaceModes :: FrozenSet String |
937 |
replaceModes = |
938 |
ConstantUtils.mkSet $ map Types.replaceDisksModeToRaw [minBound..] |
939 |
|
940 |
-- * Instance export mode |
941 |
|
942 |
exportModeLocal :: String |
943 |
exportModeLocal = Types.exportModeToRaw ExportModeLocal |
944 |
|
945 |
exportModeRemote :: String |
946 |
exportModeRemote = Types.exportModeToRaw ExportModeRemote |
947 |
|
948 |
exportModes :: FrozenSet String |
949 |
exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..] |
950 |
|
951 |
-- * Instance creation modes |
952 |
|
953 |
instanceCreate :: String |
954 |
instanceCreate = Types.instCreateModeToRaw InstCreate |
955 |
|
956 |
instanceImport :: String |
957 |
instanceImport = Types.instCreateModeToRaw InstImport |
958 |
|
959 |
instanceRemoteImport :: String |
960 |
instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport |
961 |
|
962 |
instanceCreateModes :: FrozenSet String |
963 |
instanceCreateModes = |
964 |
ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..] |
965 |
|
966 |
-- * Remote import/export handshake message and version |
967 |
|
968 |
rieHandshake :: String |
969 |
rieHandshake = "Hi, I'm Ganeti" |
970 |
|
971 |
rieVersion :: Int |
972 |
rieVersion = 0 |
973 |
|
974 |
-- | Remote import/export certificate validity in seconds |
975 |
rieCertValidity :: Int |
976 |
rieCertValidity = 24 * 60 * 60 |
977 |
|
978 |
-- | Export only: how long to wait per connection attempt (seconds) |
979 |
rieConnectAttemptTimeout :: Int |
980 |
rieConnectAttemptTimeout = 20 |
981 |
|
982 |
-- | Export only: number of attempts to connect |
983 |
rieConnectRetries :: Int |
984 |
rieConnectRetries = 10 |
985 |
|
986 |
-- | Overall timeout for establishing connection |
987 |
rieConnectTimeout :: Int |
988 |
rieConnectTimeout = 180 |
989 |
|
990 |
-- | Give child process up to 5 seconds to exit after sending a signal |
991 |
childLingerTimeout :: Double |
992 |
childLingerTimeout = 5.0 |
993 |
|
994 |
-- * Import/export config options |
995 |
|
996 |
inisectBep :: String |
997 |
inisectBep = "backend" |
998 |
|
999 |
inisectExp :: String |
1000 |
inisectExp = "export" |
1001 |
|
1002 |
inisectHyp :: String |
1003 |
inisectHyp = "hypervisor" |
1004 |
|
1005 |
inisectIns :: String |
1006 |
inisectIns = "instance" |
1007 |
|
1008 |
inisectOsp :: String |
1009 |
inisectOsp = "os" |
1010 |
|
1011 |
-- * Dynamic device modification |
1012 |
|
1013 |
ddmAdd :: String |
1014 |
ddmAdd = Types.ddmFullToRaw DdmFullAdd |
1015 |
|
1016 |
ddmModify :: String |
1017 |
ddmModify = Types.ddmFullToRaw DdmFullModify |
1018 |
|
1019 |
ddmRemove :: String |
1020 |
ddmRemove = Types.ddmFullToRaw DdmFullRemove |
1021 |
|
1022 |
ddmsValues :: FrozenSet String |
1023 |
ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove] |
1024 |
|
1025 |
ddmsValuesWithModify :: FrozenSet String |
1026 |
ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..] |
1027 |
|
1028 |
-- * Common exit codes |
1029 |
|
1030 |
exitSuccess :: Int |
1031 |
exitSuccess = 0 |
1032 |
|
1033 |
exitFailure :: Int |
1034 |
exitFailure = ConstantUtils.exitFailure |
1035 |
|
1036 |
exitNotcluster :: Int |
1037 |
exitNotcluster = 5 |
1038 |
|
1039 |
exitNotmaster :: Int |
1040 |
exitNotmaster = 11 |
1041 |
|
1042 |
exitNodesetupError :: Int |
1043 |
exitNodesetupError = 12 |
1044 |
|
1045 |
-- | Need user confirmation |
1046 |
exitConfirmation :: Int |
1047 |
exitConfirmation = 13 |
1048 |
|
1049 |
-- | Exit code for query operations with unknown fields |
1050 |
exitUnknownField :: Int |
1051 |
exitUnknownField = 14 |
1052 |
|
1053 |
-- * Tags |
1054 |
|
1055 |
tagCluster :: String |
1056 |
tagCluster = Types.tagKindToRaw TagKindCluster |
1057 |
|
1058 |
tagInstance :: String |
1059 |
tagInstance = Types.tagKindToRaw TagKindInstance |
1060 |
|
1061 |
tagNetwork :: String |
1062 |
tagNetwork = Types.tagKindToRaw TagKindNetwork |
1063 |
|
1064 |
tagNode :: String |
1065 |
tagNode = Types.tagKindToRaw TagKindNode |
1066 |
|
1067 |
tagNodegroup :: String |
1068 |
tagNodegroup = Types.tagKindToRaw TagKindGroup |
1069 |
|
1070 |
validTagTypes :: FrozenSet String |
1071 |
validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..] |
1072 |
|
1073 |
maxTagLen :: Int |
1074 |
maxTagLen = 128 |
1075 |
|
1076 |
maxTagsPerObj :: Int |
1077 |
maxTagsPerObj = 4096 |
1078 |
|
1079 |
-- * Others |
1080 |
|
1081 |
defaultBridge :: String |
1082 |
defaultBridge = "xen-br0" |
1083 |
|
1084 |
defaultOvs :: String |
1085 |
defaultOvs = "switch1" |
1086 |
|
1087 |
-- | 60 MiB, expressed in KiB |
1088 |
classicDrbdSyncSpeed :: Int |
1089 |
classicDrbdSyncSpeed = 60 * 1024 |
1090 |
|
1091 |
ip4AddressAny :: String |
1092 |
ip4AddressAny = "0.0.0.0" |
1093 |
|
1094 |
ip4AddressLocalhost :: String |
1095 |
ip4AddressLocalhost = "127.0.0.1" |
1096 |
|
1097 |
ip6AddressAny :: String |
1098 |
ip6AddressAny = "::" |
1099 |
|
1100 |
ip6AddressLocalhost :: String |
1101 |
ip6AddressLocalhost = "::1" |
1102 |
|
1103 |
ip4Version :: Int |
1104 |
ip4Version = 4 |
1105 |
|
1106 |
ip6Version :: Int |
1107 |
ip6Version = 6 |
1108 |
|
1109 |
validIpVersions :: FrozenSet Int |
1110 |
validIpVersions = ConstantUtils.mkSet [ip4Version, ip6Version] |
1111 |
|
1112 |
tcpPingTimeout :: Int |
1113 |
tcpPingTimeout = 10 |
1114 |
|
1115 |
defaultVg :: String |
1116 |
defaultVg = "xenvg" |
1117 |
|
1118 |
defaultDrbdHelper :: String |
1119 |
defaultDrbdHelper = "/bin/true" |
1120 |
|
1121 |
minVgSize :: Int |
1122 |
minVgSize = 20480 |
1123 |
|
1124 |
defaultMacPrefix :: String |
1125 |
defaultMacPrefix = "aa:00:00" |
1126 |
|
1127 |
-- | Default maximum instance wait time, in seconds. |
1128 |
defaultShutdownTimeout :: Int |
1129 |
defaultShutdownTimeout = 120 |
1130 |
|
1131 |
-- | Node clock skew in seconds |
1132 |
nodeMaxClockSkew :: Int |
1133 |
nodeMaxClockSkew = 150 |
1134 |
|
1135 |
-- | Time for an intra-cluster disk transfer to wait for a connection |
1136 |
diskTransferConnectTimeout :: Int |
1137 |
diskTransferConnectTimeout = 60 |
1138 |
|
1139 |
-- | Disk index separator |
1140 |
diskSeparator :: String |
1141 |
diskSeparator = AutoConf.diskSeparator |
1142 |
|
1143 |
ipCommandPath :: String |
1144 |
ipCommandPath = AutoConf.ipPath |
1145 |
|
1146 |
-- | Key for job IDs in opcode result |
1147 |
jobIdsKey :: String |
1148 |
jobIdsKey = "jobs" |
1149 |
|
1150 |
-- * Runparts results |
1151 |
|
1152 |
runpartsErr :: Int |
1153 |
runpartsErr = 2 |
1154 |
|
1155 |
runpartsRun :: Int |
1156 |
runpartsRun = 1 |
1157 |
|
1158 |
runpartsSkip :: Int |
1159 |
runpartsSkip = 0 |
1160 |
|
1161 |
runpartsStatus :: [Int] |
1162 |
runpartsStatus = [runpartsErr, runpartsRun, runpartsSkip] |
1163 |
|
1164 |
-- * RPC |
1165 |
|
1166 |
rpcEncodingNone :: Int |
1167 |
rpcEncodingNone = 0 |
1168 |
|
1169 |
rpcEncodingZlibBase64 :: Int |
1170 |
rpcEncodingZlibBase64 = 1 |
1171 |
|
1172 |
-- * Timeout table |
1173 |
-- |
1174 |
-- Various time constants for the timeout table |
1175 |
|
1176 |
rpcTmoUrgent :: Int |
1177 |
rpcTmoUrgent = Types.rpcTimeoutToRaw Urgent |
1178 |
|
1179 |
rpcTmoFast :: Int |
1180 |
rpcTmoFast = Types.rpcTimeoutToRaw Fast |
1181 |
|
1182 |
rpcTmoNormal :: Int |
1183 |
rpcTmoNormal = Types.rpcTimeoutToRaw Normal |
1184 |
|
1185 |
rpcTmoSlow :: Int |
1186 |
rpcTmoSlow = Types.rpcTimeoutToRaw Slow |
1187 |
|
1188 |
-- | 'rpcTmo_4hrs' contains an underscore to circumvent a limitation |
1189 |
-- in the 'Ganeti.THH.deCamelCase' function and generate the correct |
1190 |
-- Python name. |
1191 |
rpcTmo_4hrs :: Int |
1192 |
rpcTmo_4hrs = Types.rpcTimeoutToRaw FourHours |
1193 |
|
1194 |
-- | 'rpcTmo_1day' contains an underscore to circumvent a limitation |
1195 |
-- in the 'Ganeti.THH.deCamelCase' function and generate the correct |
1196 |
-- Python name. |
1197 |
rpcTmo_1day :: Int |
1198 |
rpcTmo_1day = Types.rpcTimeoutToRaw OneDay |
1199 |
|
1200 |
-- | Timeout for connecting to nodes (seconds) |
1201 |
rpcConnectTimeout :: Int |
1202 |
rpcConnectTimeout = 5 |
1203 |
|
1204 |
-- OS |
1205 |
|
1206 |
osScriptCreate :: String |
1207 |
osScriptCreate = "create" |
1208 |
|
1209 |
osScriptExport :: String |
1210 |
osScriptExport = "export" |
1211 |
|
1212 |
osScriptImport :: String |
1213 |
osScriptImport = "import" |
1214 |
|
1215 |
osScriptRename :: String |
1216 |
osScriptRename = "rename" |
1217 |
|
1218 |
osScriptVerify :: String |
1219 |
osScriptVerify = "verify" |
1220 |
|
1221 |
osScripts :: [String] |
1222 |
osScripts = [osScriptCreate, osScriptExport, osScriptImport, osScriptRename, |
1223 |
osScriptVerify] |
1224 |
|
1225 |
osApiFile :: String |
1226 |
osApiFile = "ganeti_api_version" |
1227 |
|
1228 |
osVariantsFile :: String |
1229 |
osVariantsFile = "variants.list" |
1230 |
|
1231 |
osParametersFile :: String |
1232 |
osParametersFile = "parameters.list" |
1233 |
|
1234 |
osValidateParameters :: String |
1235 |
osValidateParameters = "parameters" |
1236 |
|
1237 |
osValidateCalls :: FrozenSet String |
1238 |
osValidateCalls = ConstantUtils.mkSet [osValidateParameters] |
1239 |
|
1240 |
-- | External Storage (ES) related constants |
1241 |
|
1242 |
esActionAttach :: String |
1243 |
esActionAttach = "attach" |
1244 |
|
1245 |
esActionCreate :: String |
1246 |
esActionCreate = "create" |
1247 |
|
1248 |
esActionDetach :: String |
1249 |
esActionDetach = "detach" |
1250 |
|
1251 |
esActionGrow :: String |
1252 |
esActionGrow = "grow" |
1253 |
|
1254 |
esActionRemove :: String |
1255 |
esActionRemove = "remove" |
1256 |
|
1257 |
esActionSetinfo :: String |
1258 |
esActionSetinfo = "setinfo" |
1259 |
|
1260 |
esActionVerify :: String |
1261 |
esActionVerify = "verify" |
1262 |
|
1263 |
esScriptCreate :: String |
1264 |
esScriptCreate = esActionCreate |
1265 |
|
1266 |
esScriptRemove :: String |
1267 |
esScriptRemove = esActionRemove |
1268 |
|
1269 |
esScriptGrow :: String |
1270 |
esScriptGrow = esActionGrow |
1271 |
|
1272 |
esScriptAttach :: String |
1273 |
esScriptAttach = esActionAttach |
1274 |
|
1275 |
esScriptDetach :: String |
1276 |
esScriptDetach = esActionDetach |
1277 |
|
1278 |
esScriptSetinfo :: String |
1279 |
esScriptSetinfo = esActionSetinfo |
1280 |
|
1281 |
esScriptVerify :: String |
1282 |
esScriptVerify = esActionVerify |
1283 |
|
1284 |
esScripts :: FrozenSet String |
1285 |
esScripts = |
1286 |
ConstantUtils.mkSet [esScriptAttach, |
1287 |
esScriptCreate, |
1288 |
esScriptDetach, |
1289 |
esScriptGrow, |
1290 |
esScriptRemove, |
1291 |
esScriptSetinfo, |
1292 |
esScriptVerify] |
1293 |
|
1294 |
esParametersFile :: String |
1295 |
esParametersFile = "parameters.list" |
1296 |
|
1297 |
-- * Reboot types |
1298 |
|
1299 |
instanceRebootSoft :: String |
1300 |
instanceRebootSoft = Types.rebootTypeToRaw RebootSoft |
1301 |
|
1302 |
instanceRebootHard :: String |
1303 |
instanceRebootHard = Types.rebootTypeToRaw RebootHard |
1304 |
|
1305 |
instanceRebootFull :: String |
1306 |
instanceRebootFull = Types.rebootTypeToRaw RebootFull |
1307 |
|
1308 |
rebootTypes :: FrozenSet String |
1309 |
rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..] |
1310 |
|
1311 |
-- * Instance reboot behaviors |
1312 |
|
1313 |
instanceRebootAllowed :: String |
1314 |
instanceRebootAllowed = "reboot" |
1315 |
|
1316 |
instanceRebootExit :: String |
1317 |
instanceRebootExit = "exit" |
1318 |
|
1319 |
rebootBehaviors :: [String] |
1320 |
rebootBehaviors = [instanceRebootAllowed, instanceRebootExit] |
1321 |
|
1322 |
-- * VTypes |
1323 |
|
1324 |
vtypeBool :: VType |
1325 |
vtypeBool = VTypeBool |
1326 |
|
1327 |
vtypeInt :: VType |
1328 |
vtypeInt = VTypeInt |
1329 |
|
1330 |
vtypeMaybeString :: VType |
1331 |
vtypeMaybeString = VTypeMaybeString |
1332 |
|
1333 |
-- | Size in MiBs |
1334 |
vtypeSize :: VType |
1335 |
vtypeSize = VTypeSize |
1336 |
|
1337 |
vtypeString :: VType |
1338 |
vtypeString = VTypeString |
1339 |
|
1340 |
enforceableTypes :: FrozenSet VType |
1341 |
enforceableTypes = ConstantUtils.mkSet [minBound..] |
1342 |
|
1343 |
-- | Constant representing that the user does not specify any IP version |
1344 |
ifaceNoIpVersionSpecified :: Int |
1345 |
ifaceNoIpVersionSpecified = 0 |
1346 |
|
1347 |
validSerialSpeeds :: [Int] |
1348 |
validSerialSpeeds = |
1349 |
[75, |
1350 |
110, |
1351 |
300, |
1352 |
600, |
1353 |
1200, |
1354 |
1800, |
1355 |
2400, |
1356 |
4800, |
1357 |
9600, |
1358 |
14400, |
1359 |
19200, |
1360 |
28800, |
1361 |
38400, |
1362 |
57600, |
1363 |
115200, |
1364 |
230400, |
1365 |
345600, |
1366 |
460800] |
1367 |
|
1368 |
-- * HV parameter names (global namespace) |
1369 |
|
1370 |
hvAcpi :: String |
1371 |
hvAcpi = "acpi" |
1372 |
|
1373 |
hvBlockdevPrefix :: String |
1374 |
hvBlockdevPrefix = "blockdev_prefix" |
1375 |
|
1376 |
hvBootloaderArgs :: String |
1377 |
hvBootloaderArgs = "bootloader_args" |
1378 |
|
1379 |
hvBootloaderPath :: String |
1380 |
hvBootloaderPath = "bootloader_path" |
1381 |
|
1382 |
hvBootOrder :: String |
1383 |
hvBootOrder = "boot_order" |
1384 |
|
1385 |
hvCdromImagePath :: String |
1386 |
hvCdromImagePath = "cdrom_image_path" |
1387 |
|
1388 |
hvCpuCap :: String |
1389 |
hvCpuCap = "cpu_cap" |
1390 |
|
1391 |
hvCpuCores :: String |
1392 |
hvCpuCores = "cpu_cores" |
1393 |
|
1394 |
hvCpuMask :: String |
1395 |
hvCpuMask = "cpu_mask" |
1396 |
|
1397 |
hvCpuSockets :: String |
1398 |
hvCpuSockets = "cpu_sockets" |
1399 |
|
1400 |
hvCpuThreads :: String |
1401 |
hvCpuThreads = "cpu_threads" |
1402 |
|
1403 |
hvCpuType :: String |
1404 |
hvCpuType = "cpu_type" |
1405 |
|
1406 |
hvCpuWeight :: String |
1407 |
hvCpuWeight = "cpu_weight" |
1408 |
|
1409 |
hvDeviceModel :: String |
1410 |
hvDeviceModel = "device_model" |
1411 |
|
1412 |
hvDiskCache :: String |
1413 |
hvDiskCache = "disk_cache" |
1414 |
|
1415 |
hvDiskType :: String |
1416 |
hvDiskType = "disk_type" |
1417 |
|
1418 |
hvInitrdPath :: String |
1419 |
hvInitrdPath = "initrd_path" |
1420 |
|
1421 |
hvInitScript :: String |
1422 |
hvInitScript = "init_script" |
1423 |
|
1424 |
hvKernelArgs :: String |
1425 |
hvKernelArgs = "kernel_args" |
1426 |
|
1427 |
hvKernelPath :: String |
1428 |
hvKernelPath = "kernel_path" |
1429 |
|
1430 |
hvKeymap :: String |
1431 |
hvKeymap = "keymap" |
1432 |
|
1433 |
hvKvmCdrom2ImagePath :: String |
1434 |
hvKvmCdrom2ImagePath = "cdrom2_image_path" |
1435 |
|
1436 |
hvKvmCdromDiskType :: String |
1437 |
hvKvmCdromDiskType = "cdrom_disk_type" |
1438 |
|
1439 |
hvKvmExtra :: String |
1440 |
hvKvmExtra = "kvm_extra" |
1441 |
|
1442 |
hvKvmFlag :: String |
1443 |
hvKvmFlag = "kvm_flag" |
1444 |
|
1445 |
hvKvmFloppyImagePath :: String |
1446 |
hvKvmFloppyImagePath = "floppy_image_path" |
1447 |
|
1448 |
hvKvmMachineVersion :: String |
1449 |
hvKvmMachineVersion = "machine_version" |
1450 |
|
1451 |
hvKvmPath :: String |
1452 |
hvKvmPath = "kvm_path" |
1453 |
|
1454 |
hvKvmSpiceAudioCompr :: String |
1455 |
hvKvmSpiceAudioCompr = "spice_playback_compression" |
1456 |
|
1457 |
hvKvmSpiceBind :: String |
1458 |
hvKvmSpiceBind = "spice_bind" |
1459 |
|
1460 |
hvKvmSpiceIpVersion :: String |
1461 |
hvKvmSpiceIpVersion = "spice_ip_version" |
1462 |
|
1463 |
hvKvmSpiceJpegImgCompr :: String |
1464 |
hvKvmSpiceJpegImgCompr = "spice_jpeg_wan_compression" |
1465 |
|
1466 |
hvKvmSpiceLosslessImgCompr :: String |
1467 |
hvKvmSpiceLosslessImgCompr = "spice_image_compression" |
1468 |
|
1469 |
hvKvmSpicePasswordFile :: String |
1470 |
hvKvmSpicePasswordFile = "spice_password_file" |
1471 |
|
1472 |
hvKvmSpiceStreamingVideoDetection :: String |
1473 |
hvKvmSpiceStreamingVideoDetection = "spice_streaming_video" |
1474 |
|
1475 |
hvKvmSpiceTlsCiphers :: String |
1476 |
hvKvmSpiceTlsCiphers = "spice_tls_ciphers" |
1477 |
|
1478 |
hvKvmSpiceUseTls :: String |
1479 |
hvKvmSpiceUseTls = "spice_use_tls" |
1480 |
|
1481 |
hvKvmSpiceUseVdagent :: String |
1482 |
hvKvmSpiceUseVdagent = "spice_use_vdagent" |
1483 |
|
1484 |
hvKvmSpiceZlibGlzImgCompr :: String |
1485 |
hvKvmSpiceZlibGlzImgCompr = "spice_zlib_glz_wan_compression" |
1486 |
|
1487 |
hvKvmUseChroot :: String |
1488 |
hvKvmUseChroot = "use_chroot" |
1489 |
|
1490 |
hvMemPath :: String |
1491 |
hvMemPath = "mem_path" |
1492 |
|
1493 |
hvMigrationBandwidth :: String |
1494 |
hvMigrationBandwidth = "migration_bandwidth" |
1495 |
|
1496 |
hvMigrationDowntime :: String |
1497 |
hvMigrationDowntime = "migration_downtime" |
1498 |
|
1499 |
hvMigrationMode :: String |
1500 |
hvMigrationMode = "migration_mode" |
1501 |
|
1502 |
hvMigrationPort :: String |
1503 |
hvMigrationPort = "migration_port" |
1504 |
|
1505 |
hvNicType :: String |
1506 |
hvNicType = "nic_type" |
1507 |
|
1508 |
hvPae :: String |
1509 |
hvPae = "pae" |
1510 |
|
1511 |
hvPassthrough :: String |
1512 |
hvPassthrough = "pci_pass" |
1513 |
|
1514 |
hvRebootBehavior :: String |
1515 |
hvRebootBehavior = "reboot_behavior" |
1516 |
|
1517 |
hvRootPath :: String |
1518 |
hvRootPath = "root_path" |
1519 |
|
1520 |
hvSecurityDomain :: String |
1521 |
hvSecurityDomain = "security_domain" |
1522 |
|
1523 |
hvSecurityModel :: String |
1524 |
hvSecurityModel = "security_model" |
1525 |
|
1526 |
hvSerialConsole :: String |
1527 |
hvSerialConsole = "serial_console" |
1528 |
|
1529 |
hvSerialSpeed :: String |
1530 |
hvSerialSpeed = "serial_speed" |
1531 |
|
1532 |
hvSoundhw :: String |
1533 |
hvSoundhw = "soundhw" |
1534 |
|
1535 |
hvUsbDevices :: String |
1536 |
hvUsbDevices = "usb_devices" |
1537 |
|
1538 |
hvUsbMouse :: String |
1539 |
hvUsbMouse = "usb_mouse" |
1540 |
|
1541 |
hvUseBootloader :: String |
1542 |
hvUseBootloader = "use_bootloader" |
1543 |
|
1544 |
hvUseLocaltime :: String |
1545 |
hvUseLocaltime = "use_localtime" |
1546 |
|
1547 |
hvVga :: String |
1548 |
hvVga = "vga" |
1549 |
|
1550 |
hvVhostNet :: String |
1551 |
hvVhostNet = "vhost_net" |
1552 |
|
1553 |
hvVifScript :: String |
1554 |
hvVifScript = "vif_script" |
1555 |
|
1556 |
hvVifType :: String |
1557 |
hvVifType = "vif_type" |
1558 |
|
1559 |
hvViridian :: String |
1560 |
hvViridian = "viridian" |
1561 |
|
1562 |
hvVncBindAddress :: String |
1563 |
hvVncBindAddress = "vnc_bind_address" |
1564 |
|
1565 |
hvVncPasswordFile :: String |
1566 |
hvVncPasswordFile = "vnc_password_file" |
1567 |
|
1568 |
hvVncTls :: String |
1569 |
hvVncTls = "vnc_tls" |
1570 |
|
1571 |
hvVncX509 :: String |
1572 |
hvVncX509 = "vnc_x509_path" |
1573 |
|
1574 |
hvVncX509Verify :: String |
1575 |
hvVncX509Verify = "vnc_x509_verify" |
1576 |
|
1577 |
hvVnetHdr :: String |
1578 |
hvVnetHdr = "vnet_hdr" |
1579 |
|
1580 |
hvXenCmd :: String |
1581 |
hvXenCmd = "xen_cmd" |
1582 |
|
1583 |
hvXenCpuid :: String |
1584 |
hvXenCpuid = "cpuid" |
1585 |
|
1586 |
hvsParameterTitles :: Map String String |
1587 |
hvsParameterTitles = |
1588 |
Map.fromList |
1589 |
[(hvAcpi, "ACPI"), |
1590 |
(hvBootOrder, "Boot_order"), |
1591 |
(hvCdromImagePath, "CDROM_image_path"), |
1592 |
(hvCpuType, "cpu_type"), |
1593 |
(hvDiskType, "Disk_type"), |
1594 |
(hvInitrdPath, "Initrd_path"), |
1595 |
(hvKernelPath, "Kernel_path"), |
1596 |
(hvNicType, "NIC_type"), |
1597 |
(hvPae, "PAE"), |
1598 |
(hvPassthrough, "pci_pass"), |
1599 |
(hvVncBindAddress, "VNC_bind_address")] |
1600 |
|
1601 |
-- * Migration statuses |
1602 |
|
1603 |
hvMigrationActive :: String |
1604 |
hvMigrationActive = "active" |
1605 |
|
1606 |
hvMigrationCancelled :: String |
1607 |
hvMigrationCancelled = "cancelled" |
1608 |
|
1609 |
hvMigrationCompleted :: String |
1610 |
hvMigrationCompleted = "completed" |
1611 |
|
1612 |
hvMigrationFailed :: String |
1613 |
hvMigrationFailed = "failed" |
1614 |
|
1615 |
hvMigrationValidStatuses :: FrozenSet String |
1616 |
hvMigrationValidStatuses = |
1617 |
ConstantUtils.mkSet [hvMigrationActive, |
1618 |
hvMigrationCancelled, |
1619 |
hvMigrationCompleted, |
1620 |
hvMigrationFailed] |
1621 |
|
1622 |
hvMigrationFailedStatuses :: FrozenSet String |
1623 |
hvMigrationFailedStatuses = |
1624 |
ConstantUtils.mkSet [hvMigrationFailed, hvMigrationCancelled] |
1625 |
|
1626 |
-- | KVM-specific statuses |
1627 |
-- |
1628 |
-- FIXME: this constant seems unnecessary |
1629 |
hvKvmMigrationValidStatuses :: FrozenSet String |
1630 |
hvKvmMigrationValidStatuses = hvMigrationValidStatuses |
1631 |
|
1632 |
-- | Node info keys |
1633 |
hvNodeinfoKeyVersion :: String |
1634 |
hvNodeinfoKeyVersion = "hv_version" |
1635 |
|
1636 |
-- * Hypervisor state |
1637 |
|
1638 |
hvstCpuNode :: String |
1639 |
hvstCpuNode = "cpu_node" |
1640 |
|
1641 |
hvstCpuTotal :: String |
1642 |
hvstCpuTotal = "cpu_total" |
1643 |
|
1644 |
hvstMemoryHv :: String |
1645 |
hvstMemoryHv = "mem_hv" |
1646 |
|
1647 |
hvstMemoryNode :: String |
1648 |
hvstMemoryNode = "mem_node" |
1649 |
|
1650 |
hvstMemoryTotal :: String |
1651 |
hvstMemoryTotal = "mem_total" |
1652 |
|
1653 |
hvstsParameters :: FrozenSet String |
1654 |
hvstsParameters = |
1655 |
ConstantUtils.mkSet [hvstCpuNode, |
1656 |
hvstCpuTotal, |
1657 |
hvstMemoryHv, |
1658 |
hvstMemoryNode, |
1659 |
hvstMemoryTotal] |
1660 |
|
1661 |
hvstDefaults :: Map String Int |
1662 |
hvstDefaults = |
1663 |
Map.fromList |
1664 |
[(hvstCpuNode, 1), |
1665 |
(hvstCpuTotal, 1), |
1666 |
(hvstMemoryHv, 0), |
1667 |
(hvstMemoryTotal, 0), |
1668 |
(hvstMemoryNode, 0)] |
1669 |
|
1670 |
hvstsParameterTypes :: Map String VType |
1671 |
hvstsParameterTypes = |
1672 |
Map.fromList [(hvstMemoryTotal, VTypeInt), |
1673 |
(hvstMemoryNode, VTypeInt), |
1674 |
(hvstMemoryHv, VTypeInt), |
1675 |
(hvstCpuTotal, VTypeInt), |
1676 |
(hvstCpuNode, VTypeInt)] |
1677 |
|
1678 |
-- * Disk state |
1679 |
|
1680 |
dsDiskOverhead :: String |
1681 |
dsDiskOverhead = "disk_overhead" |
1682 |
|
1683 |
dsDiskReserved :: String |
1684 |
dsDiskReserved = "disk_reserved" |
1685 |
|
1686 |
dsDiskTotal :: String |
1687 |
dsDiskTotal = "disk_total" |
1688 |
|
1689 |
dsDefaults :: Map String Int |
1690 |
dsDefaults = |
1691 |
Map.fromList |
1692 |
[(dsDiskTotal, 0), |
1693 |
(dsDiskReserved, 0), |
1694 |
(dsDiskOverhead, 0)] |
1695 |
|
1696 |
dssParameterTypes :: Map String VType |
1697 |
dssParameterTypes = |
1698 |
Map.fromList [(dsDiskTotal, VTypeInt), |
1699 |
(dsDiskReserved, VTypeInt), |
1700 |
(dsDiskOverhead, VTypeInt)] |
1701 |
|
1702 |
dssParameters :: FrozenSet String |
1703 |
dssParameters = |
1704 |
ConstantUtils.mkSet [dsDiskTotal, dsDiskReserved, dsDiskOverhead] |
1705 |
|
1706 |
dsValidTypes :: FrozenSet String |
1707 |
dsValidTypes = ConstantUtils.mkSet [Types.diskTemplateToRaw DTPlain] |
1708 |
|
1709 |
-- Backend parameter names |
1710 |
|
1711 |
beAlwaysFailover :: String |
1712 |
beAlwaysFailover = "always_failover" |
1713 |
|
1714 |
beAutoBalance :: String |
1715 |
beAutoBalance = "auto_balance" |
1716 |
|
1717 |
beMaxmem :: String |
1718 |
beMaxmem = "maxmem" |
1719 |
|
1720 |
-- | Deprecated and replaced by max and min mem |
1721 |
beMemory :: String |
1722 |
beMemory = "memory" |
1723 |
|
1724 |
beMinmem :: String |
1725 |
beMinmem = "minmem" |
1726 |
|
1727 |
beSpindleUse :: String |
1728 |
beSpindleUse = "spindle_use" |
1729 |
|
1730 |
beVcpus :: String |
1731 |
beVcpus = "vcpus" |
1732 |
|
1733 |
besParameterTypes :: Map String VType |
1734 |
besParameterTypes = |
1735 |
Map.fromList [(beAlwaysFailover, VTypeBool), |
1736 |
(beAutoBalance, VTypeBool), |
1737 |
(beMaxmem, VTypeSize), |
1738 |
(beMinmem, VTypeSize), |
1739 |
(beSpindleUse, VTypeInt), |
1740 |
(beVcpus, VTypeInt)] |
1741 |
|
1742 |
besParameterTitles :: Map String String |
1743 |
besParameterTitles = |
1744 |
Map.fromList [(beAutoBalance, "Auto_balance"), |
1745 |
(beMinmem, "ConfigMinMem"), |
1746 |
(beVcpus, "ConfigVCPUs"), |
1747 |
(beMaxmem, "ConfigMaxMem")] |
1748 |
|
1749 |
besParameterCompat :: Map String VType |
1750 |
besParameterCompat = Map.insert beMemory VTypeSize besParameterTypes |
1751 |
|
1752 |
besParameters :: FrozenSet String |
1753 |
besParameters = |
1754 |
ConstantUtils.mkSet [beAlwaysFailover, |
1755 |
beAutoBalance, |
1756 |
beMaxmem, |
1757 |
beMinmem, |
1758 |
beSpindleUse, |
1759 |
beVcpus] |
1760 |
|
1761 |
-- | Instance specs |
1762 |
-- |
1763 |
-- FIXME: these should be associated with 'Ganeti.HTools.Types.ISpec' |
1764 |
|
1765 |
ispecMemSize :: String |
1766 |
ispecMemSize = ConstantUtils.ispecMemSize |
1767 |
|
1768 |
ispecCpuCount :: String |
1769 |
ispecCpuCount = ConstantUtils.ispecCpuCount |
1770 |
|
1771 |
ispecDiskCount :: String |
1772 |
ispecDiskCount = ConstantUtils.ispecDiskCount |
1773 |
|
1774 |
ispecDiskSize :: String |
1775 |
ispecDiskSize = ConstantUtils.ispecDiskSize |
1776 |
|
1777 |
ispecNicCount :: String |
1778 |
ispecNicCount = ConstantUtils.ispecNicCount |
1779 |
|
1780 |
ispecSpindleUse :: String |
1781 |
ispecSpindleUse = ConstantUtils.ispecSpindleUse |
1782 |
|
1783 |
ispecsParameterTypes :: Map String VType |
1784 |
ispecsParameterTypes = |
1785 |
Map.fromList |
1786 |
[(ConstantUtils.ispecDiskSize, VTypeInt), |
1787 |
(ConstantUtils.ispecCpuCount, VTypeInt), |
1788 |
(ConstantUtils.ispecSpindleUse, VTypeInt), |
1789 |
(ConstantUtils.ispecMemSize, VTypeInt), |
1790 |
(ConstantUtils.ispecNicCount, VTypeInt), |
1791 |
(ConstantUtils.ispecDiskCount, VTypeInt)] |
1792 |
|
1793 |
ispecsParameters :: FrozenSet String |
1794 |
ispecsParameters = |
1795 |
ConstantUtils.mkSet [ConstantUtils.ispecCpuCount, |
1796 |
ConstantUtils.ispecDiskCount, |
1797 |
ConstantUtils.ispecDiskSize, |
1798 |
ConstantUtils.ispecMemSize, |
1799 |
ConstantUtils.ispecNicCount, |
1800 |
ConstantUtils.ispecSpindleUse] |
1801 |
|
1802 |
ispecsMinmax :: String |
1803 |
ispecsMinmax = ConstantUtils.ispecsMinmax |
1804 |
|
1805 |
ispecsMax :: String |
1806 |
ispecsMax = "max" |
1807 |
|
1808 |
ispecsMin :: String |
1809 |
ispecsMin = "min" |
1810 |
|
1811 |
ispecsStd :: String |
1812 |
ispecsStd = ConstantUtils.ispecsStd |
1813 |
|
1814 |
ipolicyDts :: String |
1815 |
ipolicyDts = ConstantUtils.ipolicyDts |
1816 |
|
1817 |
ipolicyVcpuRatio :: String |
1818 |
ipolicyVcpuRatio = ConstantUtils.ipolicyVcpuRatio |
1819 |
|
1820 |
ipolicySpindleRatio :: String |
1821 |
ipolicySpindleRatio = ConstantUtils.ipolicySpindleRatio |
1822 |
|
1823 |
ispecsMinmaxKeys :: FrozenSet String |
1824 |
ispecsMinmaxKeys = ConstantUtils.mkSet [ispecsMax, ispecsMin] |
1825 |
|
1826 |
ipolicyParameters :: FrozenSet String |
1827 |
ipolicyParameters = |
1828 |
ConstantUtils.mkSet [ConstantUtils.ipolicyVcpuRatio, |
1829 |
ConstantUtils.ipolicySpindleRatio] |
1830 |
|
1831 |
ipolicyAllKeys :: FrozenSet String |
1832 |
ipolicyAllKeys = |
1833 |
ConstantUtils.union ipolicyParameters $ |
1834 |
ConstantUtils.mkSet [ConstantUtils.ipolicyDts, |
1835 |
ConstantUtils.ispecsMinmax, |
1836 |
ispecsStd] |
1837 |
|
1838 |
-- | Node parameter names |
1839 |
|
1840 |
ndExclusiveStorage :: String |
1841 |
ndExclusiveStorage = "exclusive_storage" |
1842 |
|
1843 |
ndOobProgram :: String |
1844 |
ndOobProgram = "oob_program" |
1845 |
|
1846 |
ndSpindleCount :: String |
1847 |
ndSpindleCount = "spindle_count" |
1848 |
|
1849 |
ndOvs :: String |
1850 |
ndOvs = "ovs" |
1851 |
|
1852 |
ndOvsLink :: String |
1853 |
ndOvsLink = "ovs_link" |
1854 |
|
1855 |
ndOvsName :: String |
1856 |
ndOvsName = "ovs_name" |
1857 |
|
1858 |
ndsParameterTypes :: Map String VType |
1859 |
ndsParameterTypes = |
1860 |
Map.fromList |
1861 |
[(ndExclusiveStorage, VTypeBool), |
1862 |
(ndOobProgram, VTypeString), |
1863 |
(ndOvs, VTypeBool), |
1864 |
(ndOvsLink, VTypeMaybeString), |
1865 |
(ndOvsName, VTypeMaybeString), |
1866 |
(ndSpindleCount, VTypeInt)] |
1867 |
|
1868 |
ndsParameters :: FrozenSet String |
1869 |
ndsParameters = ConstantUtils.mkSet (Map.keys ndsParameterTypes) |
1870 |
|
1871 |
ndsParameterTitles :: Map String String |
1872 |
ndsParameterTitles = |
1873 |
Map.fromList |
1874 |
[(ndExclusiveStorage, "ExclusiveStorage"), |
1875 |
(ndOobProgram, "OutOfBandProgram"), |
1876 |
(ndOvs, "OpenvSwitch"), |
1877 |
(ndOvsLink, "OpenvSwitchLink"), |
1878 |
(ndOvsName, "OpenvSwitchName"), |
1879 |
(ndSpindleCount, "SpindleCount")] |
1880 |
|
1881 |
-- * Logical Disks parameters |
1882 |
|
1883 |
ldpAccess :: String |
1884 |
ldpAccess = "access" |
1885 |
|
1886 |
ldpBarriers :: String |
1887 |
ldpBarriers = "disabled-barriers" |
1888 |
|
1889 |
ldpDefaultMetavg :: String |
1890 |
ldpDefaultMetavg = "default-metavg" |
1891 |
|
1892 |
ldpDelayTarget :: String |
1893 |
ldpDelayTarget = "c-delay-target" |
1894 |
|
1895 |
ldpDiskCustom :: String |
1896 |
ldpDiskCustom = "disk-custom" |
1897 |
|
1898 |
ldpDynamicResync :: String |
1899 |
ldpDynamicResync = "dynamic-resync" |
1900 |
|
1901 |
ldpFillTarget :: String |
1902 |
ldpFillTarget = "c-fill-target" |
1903 |
|
1904 |
ldpMaxRate :: String |
1905 |
ldpMaxRate = "c-max-rate" |
1906 |
|
1907 |
ldpMinRate :: String |
1908 |
ldpMinRate = "c-min-rate" |
1909 |
|
1910 |
ldpNetCustom :: String |
1911 |
ldpNetCustom = "net-custom" |
1912 |
|
1913 |
ldpNoMetaFlush :: String |
1914 |
ldpNoMetaFlush = "disable-meta-flush" |
1915 |
|
1916 |
ldpPlanAhead :: String |
1917 |
ldpPlanAhead = "c-plan-ahead" |
1918 |
|
1919 |
ldpPool :: String |
1920 |
ldpPool = "pool" |
1921 |
|
1922 |
ldpProtocol :: String |
1923 |
ldpProtocol = "protocol" |
1924 |
|
1925 |
ldpResyncRate :: String |
1926 |
ldpResyncRate = "resync-rate" |
1927 |
|
1928 |
ldpStripes :: String |
1929 |
ldpStripes = "stripes" |
1930 |
|
1931 |
diskLdTypes :: Map String VType |
1932 |
diskLdTypes = |
1933 |
Map.fromList |
1934 |
[(ldpAccess, VTypeString), |
1935 |
(ldpResyncRate, VTypeInt), |
1936 |
(ldpStripes, VTypeInt), |
1937 |
(ldpBarriers, VTypeString), |
1938 |
(ldpNoMetaFlush, VTypeBool), |
1939 |
(ldpDefaultMetavg, VTypeString), |
1940 |
(ldpDiskCustom, VTypeString), |
1941 |
(ldpNetCustom, VTypeString), |
1942 |
(ldpProtocol, VTypeString), |
1943 |
(ldpDynamicResync, VTypeBool), |
1944 |
(ldpPlanAhead, VTypeInt), |
1945 |
(ldpFillTarget, VTypeInt), |
1946 |
(ldpDelayTarget, VTypeInt), |
1947 |
(ldpMaxRate, VTypeInt), |
1948 |
(ldpMinRate, VTypeInt), |
1949 |
(ldpPool, VTypeString)] |
1950 |
|
1951 |
diskLdParameters :: FrozenSet String |
1952 |
diskLdParameters = ConstantUtils.mkSet (Map.keys diskLdTypes) |
1953 |
|
1954 |
-- * Disk template parameters |
1955 |
-- |
1956 |
-- Disk template parameters can be set/changed by the user via |
1957 |
-- gnt-cluster and gnt-group) |
1958 |
|
1959 |
drbdResyncRate :: String |
1960 |
drbdResyncRate = "resync-rate" |
1961 |
|
1962 |
drbdDataStripes :: String |
1963 |
drbdDataStripes = "data-stripes" |
1964 |
|
1965 |
drbdMetaStripes :: String |
1966 |
drbdMetaStripes = "meta-stripes" |
1967 |
|
1968 |
drbdDiskBarriers :: String |
1969 |
drbdDiskBarriers = "disk-barriers" |
1970 |
|
1971 |
drbdMetaBarriers :: String |
1972 |
drbdMetaBarriers = "meta-barriers" |
1973 |
|
1974 |
drbdDefaultMetavg :: String |
1975 |
drbdDefaultMetavg = "metavg" |
1976 |
|
1977 |
drbdDiskCustom :: String |
1978 |
drbdDiskCustom = "disk-custom" |
1979 |
|
1980 |
drbdNetCustom :: String |
1981 |
drbdNetCustom = "net-custom" |
1982 |
|
1983 |
drbdProtocol :: String |
1984 |
drbdProtocol = "protocol" |
1985 |
|
1986 |
drbdDynamicResync :: String |
1987 |
drbdDynamicResync = "dynamic-resync" |
1988 |
|
1989 |
drbdPlanAhead :: String |
1990 |
drbdPlanAhead = "c-plan-ahead" |
1991 |
|
1992 |
drbdFillTarget :: String |
1993 |
drbdFillTarget = "c-fill-target" |
1994 |
|
1995 |
drbdDelayTarget :: String |
1996 |
drbdDelayTarget = "c-delay-target" |
1997 |
|
1998 |
drbdMaxRate :: String |
1999 |
drbdMaxRate = "c-max-rate" |
2000 |
|
2001 |
drbdMinRate :: String |
2002 |
drbdMinRate = "c-min-rate" |
2003 |
|
2004 |
lvStripes :: String |
2005 |
lvStripes = "stripes" |
2006 |
|
2007 |
rbdAccess :: String |
2008 |
rbdAccess = "access" |
2009 |
|
2010 |
rbdPool :: String |
2011 |
rbdPool = "pool" |
2012 |
|
2013 |
diskDtTypes :: Map String VType |
2014 |
diskDtTypes = |
2015 |
Map.fromList [(drbdResyncRate, VTypeInt), |
2016 |
(drbdDataStripes, VTypeInt), |
2017 |
(drbdMetaStripes, VTypeInt), |
2018 |
(drbdDiskBarriers, VTypeString), |
2019 |
(drbdMetaBarriers, VTypeBool), |
2020 |
(drbdDefaultMetavg, VTypeString), |
2021 |
(drbdDiskCustom, VTypeString), |
2022 |
(drbdNetCustom, VTypeString), |
2023 |
(drbdProtocol, VTypeString), |
2024 |
(drbdDynamicResync, VTypeBool), |
2025 |
(drbdPlanAhead, VTypeInt), |
2026 |
(drbdFillTarget, VTypeInt), |
2027 |
(drbdDelayTarget, VTypeInt), |
2028 |
(drbdMaxRate, VTypeInt), |
2029 |
(drbdMinRate, VTypeInt), |
2030 |
(lvStripes, VTypeInt), |
2031 |
(rbdAccess, VTypeString), |
2032 |
(rbdPool, VTypeString)] |
2033 |
|
2034 |
diskDtParameters :: FrozenSet String |
2035 |
diskDtParameters = ConstantUtils.mkSet (Map.keys diskDtTypes) |
2036 |
|
2037 |
-- * Dynamic disk parameters |
2038 |
|
2039 |
ddpLocalIp :: String |
2040 |
ddpLocalIp = "local-ip" |
2041 |
|
2042 |
ddpRemoteIp :: String |
2043 |
ddpRemoteIp = "remote-ip" |
2044 |
|
2045 |
ddpPort :: String |
2046 |
ddpPort = "port" |
2047 |
|
2048 |
ddpLocalMinor :: String |
2049 |
ddpLocalMinor = "local-minor" |
2050 |
|
2051 |
ddpRemoteMinor :: String |
2052 |
ddpRemoteMinor = "remote-minor" |
2053 |
|
2054 |
-- * OOB supported commands |
2055 |
|
2056 |
oobPowerOn :: String |
2057 |
oobPowerOn = Types.oobCommandToRaw OobPowerOn |
2058 |
|
2059 |
oobPowerOff :: String |
2060 |
oobPowerOff = Types.oobCommandToRaw OobPowerOff |
2061 |
|
2062 |
oobPowerCycle :: String |
2063 |
oobPowerCycle = Types.oobCommandToRaw OobPowerCycle |
2064 |
|
2065 |
oobPowerStatus :: String |
2066 |
oobPowerStatus = Types.oobCommandToRaw OobPowerStatus |
2067 |
|
2068 |
oobHealth :: String |
2069 |
oobHealth = Types.oobCommandToRaw OobHealth |
2070 |
|
2071 |
oobCommands :: FrozenSet String |
2072 |
oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..] |
2073 |
|
2074 |
oobPowerStatusPowered :: String |
2075 |
oobPowerStatusPowered = "powered" |
2076 |
|
2077 |
-- | 60 seconds |
2078 |
oobTimeout :: Int |
2079 |
oobTimeout = 60 |
2080 |
|
2081 |
-- | 2 seconds |
2082 |
oobPowerDelay :: Double |
2083 |
oobPowerDelay = 2.0 |
2084 |
|
2085 |
oobStatusCritical :: String |
2086 |
oobStatusCritical = Types.oobStatusToRaw OobStatusCritical |
2087 |
|
2088 |
oobStatusOk :: String |
2089 |
oobStatusOk = Types.oobStatusToRaw OobStatusOk |
2090 |
|
2091 |
oobStatusUnknown :: String |
2092 |
oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown |
2093 |
|
2094 |
oobStatusWarning :: String |
2095 |
oobStatusWarning = Types.oobStatusToRaw OobStatusWarning |
2096 |
|
2097 |
oobStatuses :: FrozenSet String |
2098 |
oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..] |
2099 |
|
2100 |
-- | Instance Parameters Profile |
2101 |
ppDefault :: String |
2102 |
ppDefault = "default" |
2103 |
|
2104 |
-- * nic* constants are used inside the ganeti config |
2105 |
|
2106 |
nicLink :: String |
2107 |
nicLink = "link" |
2108 |
|
2109 |
nicMode :: String |
2110 |
nicMode = "mode" |
2111 |
|
2112 |
nicVlan :: String |
2113 |
nicVlan = "vlan" |
2114 |
|
2115 |
nicsParameterTypes :: Map String VType |
2116 |
nicsParameterTypes = |
2117 |
Map.fromList [(nicMode, vtypeString), |
2118 |
(nicLink, vtypeString), |
2119 |
(nicVlan, vtypeMaybeString)] |
2120 |
|
2121 |
nicsParameters :: FrozenSet String |
2122 |
nicsParameters = ConstantUtils.mkSet (Map.keys nicsParameterTypes) |
2123 |
|
2124 |
nicModeBridged :: String |
2125 |
nicModeBridged = Types.nICModeToRaw NMBridged |
2126 |
|
2127 |
nicModeRouted :: String |
2128 |
nicModeRouted = Types.nICModeToRaw NMRouted |
2129 |
|
2130 |
nicModeOvs :: String |
2131 |
nicModeOvs = Types.nICModeToRaw NMOvs |
2132 |
|
2133 |
nicIpPool :: String |
2134 |
nicIpPool = Types.nICModeToRaw NMPool |
2135 |
|
2136 |
nicValidModes :: FrozenSet String |
2137 |
nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..] |
2138 |
|
2139 |
releaseAction :: String |
2140 |
releaseAction = "release" |
2141 |
|
2142 |
reserveAction :: String |
2143 |
reserveAction = "reserve" |
2144 |
|
2145 |
-- * idisk* constants are used in opcodes, to create/change disks |
2146 |
|
2147 |
idiskAdopt :: String |
2148 |
idiskAdopt = "adopt" |
2149 |
|
2150 |
idiskMetavg :: String |
2151 |
idiskMetavg = "metavg" |
2152 |
|
2153 |
idiskMode :: String |
2154 |
idiskMode = "mode" |
2155 |
|
2156 |
idiskName :: String |
2157 |
idiskName = "name" |
2158 |
|
2159 |
idiskSize :: String |
2160 |
idiskSize = "size" |
2161 |
|
2162 |
idiskSpindles :: String |
2163 |
idiskSpindles = "spindles" |
2164 |
|
2165 |
idiskVg :: String |
2166 |
idiskVg = "vg" |
2167 |
|
2168 |
idiskProvider :: String |
2169 |
idiskProvider = "provider" |
2170 |
|
2171 |
idiskParamsTypes :: Map String VType |
2172 |
idiskParamsTypes = |
2173 |
Map.fromList [(idiskSize, VTypeSize), |
2174 |
(idiskSpindles, VTypeInt), |
2175 |
(idiskMode, VTypeString), |
2176 |
(idiskAdopt, VTypeString), |
2177 |
(idiskVg, VTypeString), |
2178 |
(idiskMetavg, VTypeString), |
2179 |
(idiskProvider, VTypeString), |
2180 |
(idiskName, VTypeMaybeString)] |
2181 |
|
2182 |
idiskParams :: FrozenSet String |
2183 |
idiskParams = ConstantUtils.mkSet (Map.keys idiskParamsTypes) |
2184 |
|
2185 |
-- * inic* constants are used in opcodes, to create/change nics |
2186 |
|
2187 |
inicBridge :: String |
2188 |
inicBridge = "bridge" |
2189 |
|
2190 |
inicIp :: String |
2191 |
inicIp = "ip" |
2192 |
|
2193 |
inicLink :: String |
2194 |
inicLink = "link" |
2195 |
|
2196 |
inicMac :: String |
2197 |
inicMac = "mac" |
2198 |
|
2199 |
inicMode :: String |
2200 |
inicMode = "mode" |
2201 |
|
2202 |
inicName :: String |
2203 |
inicName = "name" |
2204 |
|
2205 |
inicNetwork :: String |
2206 |
inicNetwork = "network" |
2207 |
|
2208 |
inicVlan :: String |
2209 |
inicVlan = "vlan" |
2210 |
|
2211 |
inicParamsTypes :: Map String VType |
2212 |
inicParamsTypes = |
2213 |
Map.fromList [(inicBridge, VTypeMaybeString), |
2214 |
(inicIp, VTypeMaybeString), |
2215 |
(inicLink, VTypeString), |
2216 |
(inicMac, VTypeString), |
2217 |
(inicMode, VTypeString), |
2218 |
(inicName, VTypeMaybeString), |
2219 |
(inicNetwork, VTypeMaybeString), |
2220 |
(inicVlan, VTypeMaybeString)] |
2221 |
|
2222 |
inicParams :: FrozenSet String |
2223 |
inicParams = ConstantUtils.mkSet (Map.keys inicParamsTypes) |
2224 |
|
2225 |
-- * Hypervisor constants |
2226 |
|
2227 |
htXenPvm :: String |
2228 |
htXenPvm = Types.hypervisorToRaw XenPvm |
2229 |
|
2230 |
htFake :: String |
2231 |
htFake = Types.hypervisorToRaw Fake |
2232 |
|
2233 |
htXenHvm :: String |
2234 |
htXenHvm = Types.hypervisorToRaw XenHvm |
2235 |
|
2236 |
htKvm :: String |
2237 |
htKvm = Types.hypervisorToRaw Kvm |
2238 |
|
2239 |
htChroot :: String |
2240 |
htChroot = Types.hypervisorToRaw Chroot |
2241 |
|
2242 |
htLxc :: String |
2243 |
htLxc = Types.hypervisorToRaw Lxc |
2244 |
|
2245 |
hyperTypes :: FrozenSet String |
2246 |
hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..] |
2247 |
|
2248 |
htsReqPort :: FrozenSet String |
2249 |
htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm] |
2250 |
|
2251 |
vncBasePort :: Int |
2252 |
vncBasePort = 5900 |
2253 |
|
2254 |
vncDefaultBindAddress :: String |
2255 |
vncDefaultBindAddress = ip4AddressAny |
2256 |
|
2257 |
-- * NIC types |
2258 |
|
2259 |
htNicE1000 :: String |
2260 |
htNicE1000 = "e1000" |
2261 |
|
2262 |
htNicI82551 :: String |
2263 |
htNicI82551 = "i82551" |
2264 |
|
2265 |
htNicI8259er :: String |
2266 |
htNicI8259er = "i82559er" |
2267 |
|
2268 |
htNicI85557b :: String |
2269 |
htNicI85557b = "i82557b" |
2270 |
|
2271 |
htNicNe2kIsa :: String |
2272 |
htNicNe2kIsa = "ne2k_isa" |
2273 |
|
2274 |
htNicNe2kPci :: String |
2275 |
htNicNe2kPci = "ne2k_pci" |
2276 |
|
2277 |
htNicParavirtual :: String |
2278 |
htNicParavirtual = "paravirtual" |
2279 |
|
2280 |
htNicPcnet :: String |
2281 |
htNicPcnet = "pcnet" |
2282 |
|
2283 |
htNicRtl8139 :: String |
2284 |
htNicRtl8139 = "rtl8139" |
2285 |
|
2286 |
htHvmValidNicTypes :: FrozenSet String |
2287 |
htHvmValidNicTypes = |
2288 |
ConstantUtils.mkSet [htNicE1000, |
2289 |
htNicNe2kIsa, |
2290 |
htNicNe2kPci, |
2291 |
htNicParavirtual, |
2292 |
htNicRtl8139] |
2293 |
|
2294 |
htKvmValidNicTypes :: FrozenSet String |
2295 |
htKvmValidNicTypes = |
2296 |
ConstantUtils.mkSet [htNicE1000, |
2297 |
htNicI82551, |
2298 |
htNicI8259er, |
2299 |
htNicI85557b, |
2300 |
htNicNe2kIsa, |
2301 |
htNicNe2kPci, |
2302 |
htNicParavirtual, |
2303 |
htNicPcnet, |
2304 |
htNicRtl8139] |
2305 |
|
2306 |
-- * Vif types |
2307 |
|
2308 |
-- | Default vif type in xen-hvm |
2309 |
htHvmVifIoemu :: String |
2310 |
htHvmVifIoemu = "ioemu" |
2311 |
|
2312 |
htHvmVifVif :: String |
2313 |
htHvmVifVif = "vif" |
2314 |
|
2315 |
htHvmValidVifTypes :: FrozenSet String |
2316 |
htHvmValidVifTypes = ConstantUtils.mkSet [htHvmVifIoemu, htHvmVifVif] |
2317 |
|
2318 |
-- * Disk types |
2319 |
|
2320 |
htDiskIde :: String |
2321 |
htDiskIde = "ide" |
2322 |
|
2323 |
htDiskIoemu :: String |
2324 |
htDiskIoemu = "ioemu" |
2325 |
|
2326 |
htDiskMtd :: String |
2327 |
htDiskMtd = "mtd" |
2328 |
|
2329 |
htDiskParavirtual :: String |
2330 |
htDiskParavirtual = "paravirtual" |
2331 |
|
2332 |
htDiskPflash :: String |
2333 |
htDiskPflash = "pflash" |
2334 |
|
2335 |
htDiskScsi :: String |
2336 |
htDiskScsi = "scsi" |
2337 |
|
2338 |
htDiskSd :: String |
2339 |
htDiskSd = "sd" |
2340 |
|
2341 |
htHvmValidDiskTypes :: FrozenSet String |
2342 |
htHvmValidDiskTypes = ConstantUtils.mkSet [htDiskIoemu, htDiskParavirtual] |
2343 |
|
2344 |
htKvmValidDiskTypes :: FrozenSet String |
2345 |
htKvmValidDiskTypes = |
2346 |
ConstantUtils.mkSet [htDiskIde, |
2347 |
htDiskMtd, |
2348 |
htDiskParavirtual, |
2349 |
htDiskPflash, |
2350 |
htDiskScsi, |
2351 |
htDiskSd] |
2352 |
|
2353 |
htCacheDefault :: String |
2354 |
htCacheDefault = "default" |
2355 |
|
2356 |
htCacheNone :: String |
2357 |
htCacheNone = "none" |
2358 |
|
2359 |
htCacheWback :: String |
2360 |
htCacheWback = "writeback" |
2361 |
|
2362 |
htCacheWthrough :: String |
2363 |
htCacheWthrough = "writethrough" |
2364 |
|
2365 |
htValidCacheTypes :: FrozenSet String |
2366 |
htValidCacheTypes = |
2367 |
ConstantUtils.mkSet [htCacheDefault, |
2368 |
htCacheNone, |
2369 |
htCacheWback, |
2370 |
htCacheWthrough] |
2371 |
|
2372 |
-- * Mouse types |
2373 |
|
2374 |
htMouseMouse :: String |
2375 |
htMouseMouse = "mouse" |
2376 |
|
2377 |
htMouseTablet :: String |
2378 |
htMouseTablet = "tablet" |
2379 |
|
2380 |
htKvmValidMouseTypes :: FrozenSet String |
2381 |
htKvmValidMouseTypes = ConstantUtils.mkSet [htMouseMouse, htMouseTablet] |
2382 |
|
2383 |
-- * Boot order |
2384 |
|
2385 |
htBoCdrom :: String |
2386 |
htBoCdrom = "cdrom" |
2387 |
|
2388 |
htBoDisk :: String |
2389 |
htBoDisk = "disk" |
2390 |
|
2391 |
htBoFloppy :: String |
2392 |
htBoFloppy = "floppy" |
2393 |
|
2394 |
htBoNetwork :: String |
2395 |
htBoNetwork = "network" |
2396 |
|
2397 |
htKvmValidBoTypes :: FrozenSet String |
2398 |
htKvmValidBoTypes = |
2399 |
ConstantUtils.mkSet [htBoCdrom, htBoDisk, htBoFloppy, htBoNetwork] |
2400 |
|
2401 |
-- * SPICE lossless image compression options |
2402 |
|
2403 |
htKvmSpiceLosslessImgComprAutoGlz :: String |
2404 |
htKvmSpiceLosslessImgComprAutoGlz = "auto_glz" |
2405 |
|
2406 |
htKvmSpiceLosslessImgComprAutoLz :: String |
2407 |
htKvmSpiceLosslessImgComprAutoLz = "auto_lz" |
2408 |
|
2409 |
htKvmSpiceLosslessImgComprGlz :: String |
2410 |
htKvmSpiceLosslessImgComprGlz = "glz" |
2411 |
|
2412 |
htKvmSpiceLosslessImgComprLz :: String |
2413 |
htKvmSpiceLosslessImgComprLz = "lz" |
2414 |
|
2415 |
htKvmSpiceLosslessImgComprOff :: String |
2416 |
htKvmSpiceLosslessImgComprOff = "off" |
2417 |
|
2418 |
htKvmSpiceLosslessImgComprQuic :: String |
2419 |
htKvmSpiceLosslessImgComprQuic = "quic" |
2420 |
|
2421 |
htKvmSpiceValidLosslessImgComprOptions :: FrozenSet String |
2422 |
htKvmSpiceValidLosslessImgComprOptions = |
2423 |
ConstantUtils.mkSet [htKvmSpiceLosslessImgComprAutoGlz, |
2424 |
htKvmSpiceLosslessImgComprAutoLz, |
2425 |
htKvmSpiceLosslessImgComprGlz, |
2426 |
htKvmSpiceLosslessImgComprLz, |
2427 |
htKvmSpiceLosslessImgComprOff, |
2428 |
htKvmSpiceLosslessImgComprQuic] |
2429 |
|
2430 |
htKvmSpiceLossyImgComprAlways :: String |
2431 |
htKvmSpiceLossyImgComprAlways = "always" |
2432 |
|
2433 |
htKvmSpiceLossyImgComprAuto :: String |
2434 |
htKvmSpiceLossyImgComprAuto = "auto" |
2435 |
|
2436 |
htKvmSpiceLossyImgComprNever :: String |
2437 |
htKvmSpiceLossyImgComprNever = "never" |
2438 |
|
2439 |
htKvmSpiceValidLossyImgComprOptions :: FrozenSet String |
2440 |
htKvmSpiceValidLossyImgComprOptions = |
2441 |
ConstantUtils.mkSet [htKvmSpiceLossyImgComprAlways, |
2442 |
htKvmSpiceLossyImgComprAuto, |
2443 |
htKvmSpiceLossyImgComprNever] |
2444 |
|
2445 |
-- * SPICE video stream detection |
2446 |
|
2447 |
htKvmSpiceVideoStreamDetectionAll :: String |
2448 |
htKvmSpiceVideoStreamDetectionAll = "all" |
2449 |
|
2450 |
htKvmSpiceVideoStreamDetectionFilter :: String |
2451 |
htKvmSpiceVideoStreamDetectionFilter = "filter" |
2452 |
|
2453 |
htKvmSpiceVideoStreamDetectionOff :: String |
2454 |
htKvmSpiceVideoStreamDetectionOff = "off" |
2455 |
|
2456 |
htKvmSpiceValidVideoStreamDetectionOptions :: FrozenSet String |
2457 |
htKvmSpiceValidVideoStreamDetectionOptions = |
2458 |
ConstantUtils.mkSet [htKvmSpiceVideoStreamDetectionAll, |
2459 |
htKvmSpiceVideoStreamDetectionFilter, |
2460 |
htKvmSpiceVideoStreamDetectionOff] |
2461 |
|
2462 |
-- * Security models |
2463 |
|
2464 |
htSmNone :: String |
2465 |
htSmNone = "none" |
2466 |
|
2467 |
htSmPool :: String |
2468 |
htSmPool = "pool" |
2469 |
|
2470 |
htSmUser :: String |
2471 |
htSmUser = "user" |
2472 |
|
2473 |
htKvmValidSmTypes :: FrozenSet String |
2474 |
htKvmValidSmTypes = ConstantUtils.mkSet [htSmNone, htSmPool, htSmUser] |
2475 |
|
2476 |
-- * Kvm flag values |
2477 |
|
2478 |
htKvmDisabled :: String |
2479 |
htKvmDisabled = "disabled" |
2480 |
|
2481 |
htKvmEnabled :: String |
2482 |
htKvmEnabled = "enabled" |
2483 |
|
2484 |
htKvmFlagValues :: FrozenSet String |
2485 |
htKvmFlagValues = ConstantUtils.mkSet [htKvmDisabled, htKvmEnabled] |
2486 |
|
2487 |
-- * Migration type |
2488 |
|
2489 |
htMigrationLive :: String |
2490 |
htMigrationLive = Types.migrationModeToRaw MigrationLive |
2491 |
|
2492 |
htMigrationNonlive :: String |
2493 |
htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive |
2494 |
|
2495 |
htMigrationModes :: FrozenSet String |
2496 |
htMigrationModes = |
2497 |
ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..] |
2498 |
|
2499 |
-- * Cluster verify steps |
2500 |
|
2501 |
verifyNplusoneMem :: String |
2502 |
verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem |
2503 |
|
2504 |
verifyOptionalChecks :: FrozenSet String |
2505 |
verifyOptionalChecks = |
2506 |
ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..] |
2507 |
|
2508 |
-- * Cluster Verify error classes |
2509 |
|
2510 |
cvTcluster :: String |
2511 |
cvTcluster = "cluster" |
2512 |
|
2513 |
cvTgroup :: String |
2514 |
cvTgroup = "group" |
2515 |
|
2516 |
cvTnode :: String |
2517 |
cvTnode = "node" |
2518 |
|
2519 |
cvTinstance :: String |
2520 |
cvTinstance = "instance" |
2521 |
|
2522 |
-- * Cluster Verify error codes and documentation |
2523 |
|
2524 |
cvEclustercert :: (String, String, String) |
2525 |
cvEclustercert = |
2526 |
("cluster", |
2527 |
Types.cVErrorCodeToRaw CvECLUSTERCERT, |
2528 |
"Cluster certificate files verification failure") |
2529 |
|
2530 |
cvEclustercfg :: (String, String, String) |
2531 |
cvEclustercfg = |
2532 |
("cluster", |
2533 |
Types.cVErrorCodeToRaw CvECLUSTERCFG, |
2534 |
"Cluster configuration verification failure") |
2535 |
|
2536 |
cvEclusterdanglinginst :: (String, String, String) |
2537 |
cvEclusterdanglinginst = |
2538 |
("node", |
2539 |
Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST, |
2540 |
"Some instances have a non-existing primary node") |
2541 |
|
2542 |
cvEclusterdanglingnodes :: (String, String, String) |
2543 |
cvEclusterdanglingnodes = |
2544 |
("node", |
2545 |
Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES, |
2546 |
"Some nodes belong to non-existing groups") |
2547 |
|
2548 |
cvEclusterfilecheck :: (String, String, String) |
2549 |
cvEclusterfilecheck = |
2550 |
("cluster", |
2551 |
Types.cVErrorCodeToRaw CvECLUSTERFILECHECK, |
2552 |
"Cluster configuration verification failure") |
2553 |
|
2554 |
cvEgroupdifferentpvsize :: (String, String, String) |
2555 |
cvEgroupdifferentpvsize = |
2556 |
("group", |
2557 |
Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE, |
2558 |
"PVs in the group have different sizes") |
2559 |
|
2560 |
cvEinstancebadnode :: (String, String, String) |
2561 |
cvEinstancebadnode = |
2562 |
("instance", |
2563 |
Types.cVErrorCodeToRaw CvEINSTANCEBADNODE, |
2564 |
"Instance marked as running lives on an offline node") |
2565 |
|
2566 |
cvEinstancedown :: (String, String, String) |
2567 |
cvEinstancedown = |
2568 |
("instance", |
2569 |
Types.cVErrorCodeToRaw CvEINSTANCEDOWN, |
2570 |
"Instance not running on its primary node") |
2571 |
|
2572 |
cvEinstancefaultydisk :: (String, String, String) |
2573 |
cvEinstancefaultydisk = |
2574 |
("instance", |
2575 |
Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK, |
2576 |
"Impossible to retrieve status for a disk") |
2577 |
|
2578 |
cvEinstancelayout :: (String, String, String) |
2579 |
cvEinstancelayout = |
2580 |
("instance", |
2581 |
Types.cVErrorCodeToRaw CvEINSTANCELAYOUT, |
2582 |
"Instance has multiple secondary nodes") |
2583 |
|
2584 |
cvEinstancemissingcfgparameter :: (String, String, String) |
2585 |
cvEinstancemissingcfgparameter = |
2586 |
("instance", |
2587 |
Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER, |
2588 |
"A configuration parameter for an instance is missing") |
2589 |
|
2590 |
cvEinstancemissingdisk :: (String, String, String) |
2591 |
cvEinstancemissingdisk = |
2592 |
("instance", |
2593 |
Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK, |
2594 |
"Missing volume on an instance") |
2595 |
|
2596 |
cvEinstancepolicy :: (String, String, String) |
2597 |
cvEinstancepolicy = |
2598 |
("instance", |
2599 |
Types.cVErrorCodeToRaw CvEINSTANCEPOLICY, |
2600 |
"Instance does not meet policy") |
2601 |
|
2602 |
cvEinstancesplitgroups :: (String, String, String) |
2603 |
cvEinstancesplitgroups = |
2604 |
("instance", |
2605 |
Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS, |
2606 |
"Instance with primary and secondary nodes in different groups") |
2607 |
|
2608 |
cvEinstanceunsuitablenode :: (String, String, String) |
2609 |
cvEinstanceunsuitablenode = |
2610 |
("instance", |
2611 |
Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE, |
2612 |
"Instance running on nodes that are not suitable for it") |
2613 |
|
2614 |
cvEinstancewrongnode :: (String, String, String) |
2615 |
cvEinstancewrongnode = |
2616 |
("instance", |
2617 |
Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE, |
2618 |
"Instance running on the wrong node") |
2619 |
|
2620 |
cvEnodedrbd :: (String, String, String) |
2621 |
cvEnodedrbd = |
2622 |
("node", |
2623 |
Types.cVErrorCodeToRaw CvENODEDRBD, |
2624 |
"Error parsing the DRBD status file") |
2625 |
|
2626 |
cvEnodedrbdhelper :: (String, String, String) |
2627 |
cvEnodedrbdhelper = |
2628 |
("node", |
2629 |
Types.cVErrorCodeToRaw CvENODEDRBDHELPER, |
2630 |
"Error caused by the DRBD helper") |
2631 |
|
2632 |
cvEnodedrbdversion :: (String, String, String) |
2633 |
cvEnodedrbdversion = |
2634 |
("node", |
2635 |
Types.cVErrorCodeToRaw CvENODEDRBDVERSION, |
2636 |
"DRBD version mismatch within a node group") |
2637 |
|
2638 |
cvEnodefilecheck :: (String, String, String) |
2639 |
cvEnodefilecheck = |
2640 |
("node", |
2641 |
Types.cVErrorCodeToRaw CvENODEFILECHECK, |
2642 |
"Error retrieving the checksum of the node files") |
2643 |
|
2644 |
cvEnodefilestoragepaths :: (String, String, String) |
2645 |
cvEnodefilestoragepaths = |
2646 |
("node", |
2647 |
Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS, |
2648 |
"Detected bad file storage paths") |
2649 |
|
2650 |
cvEnodefilestoragepathunusable :: (String, String, String) |
2651 |
cvEnodefilestoragepathunusable = |
2652 |
("node", |
2653 |
Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE, |
2654 |
"File storage path unusable") |
2655 |
|
2656 |
cvEnodehooks :: (String, String, String) |
2657 |
cvEnodehooks = |
2658 |
("node", |
2659 |
Types.cVErrorCodeToRaw CvENODEHOOKS, |
2660 |
"Communication failure in hooks execution") |
2661 |
|
2662 |
cvEnodehv :: (String, String, String) |
2663 |
cvEnodehv = |
2664 |
("node", |
2665 |
Types.cVErrorCodeToRaw CvENODEHV, |
2666 |
"Hypervisor parameters verification failure") |
2667 |
|
2668 |
cvEnodelvm :: (String, String, String) |
2669 |
cvEnodelvm = |
2670 |
("node", |
2671 |
Types.cVErrorCodeToRaw CvENODELVM, |
2672 |
"LVM-related node error") |
2673 |
|
2674 |
cvEnoden1 :: (String, String, String) |
2675 |
cvEnoden1 = |
2676 |
("node", |
2677 |
Types.cVErrorCodeToRaw CvENODEN1, |
2678 |
"Not enough memory to accommodate instance failovers") |
2679 |
|
2680 |
cvEnodenet :: (String, String, String) |
2681 |
cvEnodenet = |
2682 |
("node", |
2683 |
Types.cVErrorCodeToRaw CvENODENET, |
2684 |
"Network-related node error") |
2685 |
|
2686 |
cvEnodeoobpath :: (String, String, String) |
2687 |
cvEnodeoobpath = |
2688 |
("node", |
2689 |
Types.cVErrorCodeToRaw CvENODEOOBPATH, |
2690 |
"Invalid Out Of Band path") |
2691 |
|
2692 |
cvEnodeorphaninstance :: (String, String, String) |
2693 |
cvEnodeorphaninstance = |
2694 |
("node", |
2695 |
Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE, |
2696 |
"Unknown intance running on a node") |
2697 |
|
2698 |
cvEnodeorphanlv :: (String, String, String) |
2699 |
cvEnodeorphanlv = |
2700 |
("node", |
2701 |
Types.cVErrorCodeToRaw CvENODEORPHANLV, |
2702 |
"Unknown LVM logical volume") |
2703 |
|
2704 |
cvEnodeos :: (String, String, String) |
2705 |
cvEnodeos = |
2706 |
("node", |
2707 |
Types.cVErrorCodeToRaw CvENODEOS, |
2708 |
"OS-related node error") |
2709 |
|
2710 |
cvEnoderpc :: (String, String, String) |
2711 |
cvEnoderpc = |
2712 |
("node", |
2713 |
Types.cVErrorCodeToRaw CvENODERPC, |
2714 |
"Error during connection to the primary node of an instance") |
2715 |
|
2716 |
cvEnodesetup :: (String, String, String) |
2717 |
cvEnodesetup = |
2718 |
("node", |
2719 |
Types.cVErrorCodeToRaw CvENODESETUP, |
2720 |
"Node setup error") |
2721 |
|
2722 |
cvEnodesharedfilestoragepathunusable :: (String, String, String) |
2723 |
cvEnodesharedfilestoragepathunusable = |
2724 |
("node", |
2725 |
Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE, |
2726 |
"Shared file storage path unusable") |
2727 |
|
2728 |
cvEnodessh :: (String, String, String) |
2729 |
cvEnodessh = |
2730 |
("node", |
2731 |
Types.cVErrorCodeToRaw CvENODESSH, |
2732 |
"SSH-related node error") |
2733 |
|
2734 |
cvEnodetime :: (String, String, String) |
2735 |
cvEnodetime = |
2736 |
("node", |
2737 |
Types.cVErrorCodeToRaw CvENODETIME, |
2738 |
"Node returned invalid time") |
2739 |
|
2740 |
cvEnodeuserscripts :: (String, String, String) |
2741 |
cvEnodeuserscripts = |
2742 |
("node", |
2743 |
Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS, |
2744 |
"User scripts not present or not executable") |
2745 |
|
2746 |
cvEnodeversion :: (String, String, String) |
2747 |
cvEnodeversion = |
2748 |
("node", |
2749 |
Types.cVErrorCodeToRaw CvENODEVERSION, |
2750 |
"Protocol version mismatch or Ganeti version mismatch") |
2751 |
|
2752 |
cvAllEcodes :: FrozenSet (String, String, String) |
2753 |
cvAllEcodes = |
2754 |
ConstantUtils.mkSet |
2755 |
[cvEclustercert, |
2756 |
cvEclustercfg, |
2757 |
cvEclusterdanglinginst, |
2758 |
cvEclusterdanglingnodes, |
2759 |
cvEclusterfilecheck, |
2760 |
cvEgroupdifferentpvsize, |
2761 |
cvEinstancebadnode, |
2762 |
cvEinstancedown, |
2763 |
cvEinstancefaultydisk, |
2764 |
cvEinstancelayout, |
2765 |
cvEinstancemissingcfgparameter, |
2766 |
cvEinstancemissingdisk, |
2767 |
cvEinstancepolicy, |
2768 |
cvEinstancesplitgroups, |
2769 |
cvEinstanceunsuitablenode, |
2770 |
cvEinstancewrongnode, |
2771 |
cvEnodedrbd, |
2772 |
cvEnodedrbdhelper, |
2773 |
cvEnodedrbdversion, |
2774 |
cvEnodefilecheck, |
2775 |
cvEnodefilestoragepaths, |
2776 |
cvEnodefilestoragepathunusable, |
2777 |
cvEnodehooks, |
2778 |
cvEnodehv, |
2779 |
cvEnodelvm, |
2780 |
cvEnoden1, |
2781 |
cvEnodenet, |
2782 |
cvEnodeoobpath, |
2783 |
cvEnodeorphaninstance, |
2784 |
cvEnodeorphanlv, |
2785 |
cvEnodeos, |
2786 |
cvEnoderpc, |
2787 |
cvEnodesetup, |
2788 |
cvEnodesharedfilestoragepathunusable, |
2789 |
cvEnodessh, |
2790 |
cvEnodetime, |
2791 |
cvEnodeuserscripts, |
2792 |
cvEnodeversion] |
2793 |
|
2794 |
cvAllEcodesStrings :: FrozenSet String |
2795 |
cvAllEcodesStrings = |
2796 |
ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..] |
2797 |
|
2798 |
-- * Node verify constants |
2799 |
|
2800 |
nvBridges :: String |
2801 |
nvBridges = "bridges" |
2802 |
|
2803 |
nvDrbdhelper :: String |
2804 |
nvDrbdhelper = "drbd-helper" |
2805 |
|
2806 |
nvDrbdversion :: String |
2807 |
nvDrbdversion = "drbd-version" |
2808 |
|
2809 |
nvDrbdlist :: String |
2810 |
nvDrbdlist = "drbd-list" |
2811 |
|
2812 |
nvExclusivepvs :: String |
2813 |
nvExclusivepvs = "exclusive-pvs" |
2814 |
|
2815 |
nvFilelist :: String |
2816 |
nvFilelist = "filelist" |
2817 |
|
2818 |
nvAcceptedStoragePaths :: String |
2819 |
nvAcceptedStoragePaths = "allowed-file-storage-paths" |
2820 |
|
2821 |
nvFileStoragePath :: String |
2822 |
nvFileStoragePath = "file-storage-path" |
2823 |
|
2824 |
nvSharedFileStoragePath :: String |
2825 |
nvSharedFileStoragePath = "shared-file-storage-path" |
2826 |
|
2827 |
nvHvinfo :: String |
2828 |
nvHvinfo = "hvinfo" |
2829 |
|
2830 |
nvHvparams :: String |
2831 |
nvHvparams = "hvparms" |
2832 |
|
2833 |
nvHypervisor :: String |
2834 |
nvHypervisor = "hypervisor" |
2835 |
|
2836 |
nvInstancelist :: String |
2837 |
nvInstancelist = "instancelist" |
2838 |
|
2839 |
nvLvlist :: String |
2840 |
nvLvlist = "lvlist" |
2841 |
|
2842 |
nvMasterip :: String |
2843 |
nvMasterip = "master-ip" |
2844 |
|
2845 |
nvNodelist :: String |
2846 |
nvNodelist = "nodelist" |
2847 |
|
2848 |
nvNodenettest :: String |
2849 |
nvNodenettest = "node-net-test" |
2850 |
|
2851 |
nvNodesetup :: String |
2852 |
nvNodesetup = "nodesetup" |
2853 |
|
2854 |
nvOobPaths :: String |
2855 |
nvOobPaths = "oob-paths" |
2856 |
|
2857 |
nvOslist :: String |
2858 |
nvOslist = "oslist" |
2859 |
|
2860 |
nvPvlist :: String |
2861 |
nvPvlist = "pvlist" |
2862 |
|
2863 |
nvTime :: String |
2864 |
nvTime = "time" |
2865 |
|
2866 |
nvUserscripts :: String |
2867 |
nvUserscripts = "user-scripts" |
2868 |
|
2869 |
nvVersion :: String |
2870 |
nvVersion = "version" |
2871 |
|
2872 |
nvVglist :: String |
2873 |
nvVglist = "vglist" |
2874 |
|
2875 |
nvVmnodes :: String |
2876 |
nvVmnodes = "vmnodes" |
2877 |
|
2878 |
-- * Instance status |
2879 |
|
2880 |
inststAdmindown :: String |
2881 |
inststAdmindown = Types.instanceStatusToRaw StatusDown |
2882 |
|
2883 |
inststAdminoffline :: String |
2884 |
inststAdminoffline = Types.instanceStatusToRaw StatusOffline |
2885 |
|
2886 |
inststErrordown :: String |
2887 |
inststErrordown = Types.instanceStatusToRaw ErrorDown |
2888 |
|
2889 |
inststErrorup :: String |
2890 |
inststErrorup = Types.instanceStatusToRaw ErrorUp |
2891 |
|
2892 |
inststNodedown :: String |
2893 |
inststNodedown = Types.instanceStatusToRaw NodeDown |
2894 |
|
2895 |
inststNodeoffline :: String |
2896 |
inststNodeoffline = Types.instanceStatusToRaw NodeOffline |
2897 |
|
2898 |
inststRunning :: String |
2899 |
inststRunning = Types.instanceStatusToRaw Running |
2900 |
|
2901 |
inststWrongnode :: String |
2902 |
inststWrongnode = Types.instanceStatusToRaw WrongNode |
2903 |
|
2904 |
inststAll :: FrozenSet String |
2905 |
inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..] |
2906 |
|
2907 |
-- * Admin states |
2908 |
|
2909 |
adminstDown :: String |
2910 |
adminstDown = Types.adminStateToRaw AdminDown |
2911 |
|
2912 |
adminstOffline :: String |
2913 |
adminstOffline = Types.adminStateToRaw AdminOffline |
2914 |
|
2915 |
adminstUp :: String |
2916 |
adminstUp = Types.adminStateToRaw AdminUp |
2917 |
|
2918 |
adminstAll :: FrozenSet String |
2919 |
adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..] |
2920 |
|
2921 |
-- * Node roles |
2922 |
|
2923 |
nrDrained :: String |
2924 |
nrDrained = Types.nodeRoleToRaw NRDrained |
2925 |
|
2926 |
nrMaster :: String |
2927 |
nrMaster = Types.nodeRoleToRaw NRMaster |
2928 |
|
2929 |
nrMcandidate :: String |
2930 |
nrMcandidate = Types.nodeRoleToRaw NRCandidate |
2931 |
|
2932 |
nrOffline :: String |
2933 |
nrOffline = Types.nodeRoleToRaw NROffline |
2934 |
|
2935 |
nrRegular :: String |
2936 |
nrRegular = Types.nodeRoleToRaw NRRegular |
2937 |
|
2938 |
nrAll :: FrozenSet String |
2939 |
nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..] |
2940 |
|
2941 |
-- * SSL certificate check constants (in days) |
2942 |
|
2943 |
sslCertExpirationError :: Int |
2944 |
sslCertExpirationError = 7 |
2945 |
|
2946 |
sslCertExpirationWarn :: Int |
2947 |
sslCertExpirationWarn = 30 |
2948 |
|
2949 |
-- * Allocator framework constants |
2950 |
|
2951 |
iallocatorVersion :: Int |
2952 |
iallocatorVersion = 2 |
2953 |
|
2954 |
iallocatorDirIn :: String |
2955 |
iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn |
2956 |
|
2957 |
iallocatorDirOut :: String |
2958 |
iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut |
2959 |
|
2960 |
validIallocatorDirections :: FrozenSet String |
2961 |
validIallocatorDirections = |
2962 |
ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..] |
2963 |
|
2964 |
iallocatorModeAlloc :: String |
2965 |
iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc |
2966 |
|
2967 |
iallocatorModeChgGroup :: String |
2968 |
iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup |
2969 |
|
2970 |
iallocatorModeMultiAlloc :: String |
2971 |
iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc |
2972 |
|
2973 |
iallocatorModeNodeEvac :: String |
2974 |
iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac |
2975 |
|
2976 |
iallocatorModeReloc :: String |
2977 |
iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc |
2978 |
|
2979 |
validIallocatorModes :: FrozenSet String |
2980 |
validIallocatorModes = |
2981 |
ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..] |
2982 |
|
2983 |
iallocatorSearchPath :: [String] |
2984 |
iallocatorSearchPath = AutoConf.iallocatorSearchPath |
2985 |
|
2986 |
defaultIallocatorShortcut :: String |
2987 |
defaultIallocatorShortcut = "." |
2988 |
|
2989 |
-- * Node evacuation |
2990 |
|
2991 |
nodeEvacPri :: String |
2992 |
nodeEvacPri = Types.evacModeToRaw ChangePrimary |
2993 |
|
2994 |
nodeEvacSec :: String |
2995 |
nodeEvacSec = Types.evacModeToRaw ChangeSecondary |
2996 |
|
2997 |
nodeEvacAll :: String |
2998 |
nodeEvacAll = Types.evacModeToRaw ChangeAll |
2999 |
|
3000 |
nodeEvacModes :: FrozenSet String |
3001 |
nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..] |
3002 |
|
3003 |
-- * Job queue |
3004 |
|
3005 |
jobQueueVersion :: Int |
3006 |
jobQueueVersion = 1 |
3007 |
|
3008 |
jobQueueSizeHardLimit :: Int |
3009 |
jobQueueSizeHardLimit = 5000 |
3010 |
|
3011 |
jobQueueFilesPerms :: Int |
3012 |
jobQueueFilesPerms = 0o640 |
3013 |
|
3014 |
-- * Unchanged job return |
3015 |
|
3016 |
jobNotchanged :: String |
3017 |
jobNotchanged = "nochange" |
3018 |
|
3019 |
-- * Job status |
3020 |
|
3021 |
jobStatusQueued :: String |
3022 |
jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED |
3023 |
|
3024 |
jobStatusWaiting :: String |
3025 |
jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING |
3026 |
|
3027 |
jobStatusCanceling :: String |
3028 |
jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING |
3029 |
|
3030 |
jobStatusRunning :: String |
3031 |
jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING |
3032 |
|
3033 |
jobStatusCanceled :: String |
3034 |
jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED |
3035 |
|
3036 |
jobStatusSuccess :: String |
3037 |
jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS |
3038 |
|
3039 |
jobStatusError :: String |
3040 |
jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR |
3041 |
|
3042 |
jobsPending :: FrozenSet String |
3043 |
jobsPending = |
3044 |
ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling] |
3045 |
|
3046 |
jobsFinalized :: FrozenSet String |
3047 |
jobsFinalized = |
3048 |
ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..] |
3049 |
|
3050 |
jobStatusAll :: FrozenSet String |
3051 |
jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..] |
3052 |
|
3053 |
-- * OpCode status |
3054 |
|
3055 |
-- ** Not yet finalized opcodes |
3056 |
|
3057 |
opStatusCanceling :: String |
3058 |
opStatusCanceling = "canceling" |
3059 |
|
3060 |
opStatusQueued :: String |
3061 |
opStatusQueued = "queued" |
3062 |
|
3063 |
opStatusRunning :: String |
3064 |
opStatusRunning = "running" |
3065 |
|
3066 |
opStatusWaiting :: String |
3067 |
opStatusWaiting = "waiting" |
3068 |
|
3069 |
-- ** Finalized opcodes |
3070 |
|
3071 |
opStatusCanceled :: String |
3072 |
opStatusCanceled = "canceled" |
3073 |
|
3074 |
opStatusError :: String |
3075 |
opStatusError = "error" |
3076 |
|
3077 |
opStatusSuccess :: String |
3078 |
opStatusSuccess = "success" |
3079 |
|
3080 |
opsFinalized :: FrozenSet String |
3081 |
opsFinalized = |
3082 |
ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess] |
3083 |
|
3084 |
-- * OpCode priority |
3085 |
|
3086 |
opPrioLowest :: Int |
3087 |
opPrioLowest = 19 |
3088 |
|
3089 |
opPrioHighest :: Int |
3090 |
opPrioHighest = -20 |
3091 |
|
3092 |
opPrioLow :: Int |
3093 |
opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow |
3094 |
|
3095 |
opPrioNormal :: Int |
3096 |
opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal |
3097 |
|
3098 |
opPrioHigh :: Int |
3099 |
opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh |
3100 |
|
3101 |
opPrioSubmitValid :: FrozenSet Int |
3102 |
opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh] |
3103 |
|
3104 |
opPrioDefault :: Int |
3105 |
opPrioDefault = opPrioNormal |
3106 |
|
3107 |
-- * Lock recalculate mode |
3108 |
|
3109 |
locksAppend :: String |
3110 |
locksAppend = "append" |
3111 |
|
3112 |
locksReplace :: String |
3113 |
locksReplace = "replace" |
3114 |
|
3115 |
-- * Lock timeout |
3116 |
-- |
3117 |
-- The lock timeout (sum) before we transition into blocking acquire |
3118 |
-- (this can still be reset by priority change). Computed as max time |
3119 |
-- (10 hours) before we should actually go into blocking acquire, |
3120 |
-- given that we start from the default priority level. |
3121 |
|
3122 |
lockAttemptsMaxwait :: Double |
3123 |
lockAttemptsMaxwait = 15.0 |
3124 |
|
3125 |
lockAttemptsMinwait :: Double |
3126 |
lockAttemptsMinwait = 1.0 |
3127 |
|
3128 |
lockAttemptsTimeout :: Int |
3129 |
lockAttemptsTimeout = (10 * 3600) `div` (opPrioDefault - opPrioHighest) |
3130 |
|
3131 |
-- * Execution log types |
3132 |
|
3133 |
elogMessage :: String |
3134 |
elogMessage = Types.eLogTypeToRaw ELogMessage |
3135 |
|
3136 |
elogRemoteImport :: String |
3137 |
elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport |
3138 |
|
3139 |
elogJqueueTest :: String |
3140 |
elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest |
3141 |
|
3142 |
-- * /etc/hosts modification |
3143 |
|
3144 |
etcHostsAdd :: String |
3145 |
etcHostsAdd = "add" |
3146 |
|
3147 |
etcHostsRemove :: String |
3148 |
etcHostsRemove = "remove" |
3149 |
|
3150 |
-- * Job queue test |
3151 |
|
3152 |
jqtMsgprefix :: String |
3153 |
jqtMsgprefix = "TESTMSG=" |
3154 |
|
3155 |
jqtExec :: String |
3156 |
jqtExec = "exec" |
3157 |
|
3158 |
jqtExpandnames :: String |
3159 |
jqtExpandnames = "expandnames" |
3160 |
|
3161 |
jqtLogmsg :: String |
3162 |
jqtLogmsg = "logmsg" |
3163 |
|
3164 |
jqtStartmsg :: String |
3165 |
jqtStartmsg = "startmsg" |
3166 |
|
3167 |
jqtAll :: FrozenSet String |
3168 |
jqtAll = ConstantUtils.mkSet [jqtExec, jqtExpandnames, jqtLogmsg, jqtStartmsg] |
3169 |
|
3170 |
-- * Query resources |
3171 |
|
3172 |
qrCluster :: String |
3173 |
qrCluster = "cluster" |
3174 |
|
3175 |
qrExport :: String |
3176 |
qrExport = "export" |
3177 |
|
3178 |
qrExtstorage :: String |
3179 |
qrExtstorage = "extstorage" |
3180 |
|
3181 |
qrGroup :: String |
3182 |
qrGroup = "group" |
3183 |
|
3184 |
qrInstance :: String |
3185 |
qrInstance = "instance" |
3186 |
|
3187 |
qrJob :: String |
3188 |
qrJob = "job" |
3189 |
|
3190 |
qrLock :: String |
3191 |
qrLock = "lock" |
3192 |
|
3193 |
qrNetwork :: String |
3194 |
qrNetwork = "network" |
3195 |
|
3196 |
qrNode :: String |
3197 |
qrNode = "node" |
3198 |
|
3199 |
qrOs :: String |
3200 |
qrOs = "os" |
3201 |
|
3202 |
-- | List of resources which can be queried using 'Ganeti.OpCodes.OpQuery' |
3203 |
qrViaOp :: FrozenSet String |
3204 |
qrViaOp = |
3205 |
ConstantUtils.mkSet [qrCluster, |
3206 |
qrInstance, |
3207 |
qrNode, |
3208 |
qrGroup, |
3209 |
qrOs, |
3210 |
qrExport, |
3211 |
qrNetwork, |
3212 |
qrExtstorage] |
3213 |
|
3214 |
-- | List of resources which can be queried using Local UniX Interface |
3215 |
qrViaLuxi :: FrozenSet String |
3216 |
qrViaLuxi = ConstantUtils.mkSet [qrLock, qrJob] |
3217 |
|
3218 |
-- | List of resources which can be queried using RAPI |
3219 |
qrViaRapi :: FrozenSet String |
3220 |
qrViaRapi = qrViaLuxi |
3221 |
|
3222 |
-- * Query field types |
3223 |
|
3224 |
qftBool :: String |
3225 |
qftBool = "bool" |
3226 |
|
3227 |
qftNumber :: String |
3228 |
qftNumber = "number" |
3229 |
|
3230 |
qftOther :: String |
3231 |
qftOther = "other" |
3232 |
|
3233 |
qftText :: String |
3234 |
qftText = "text" |
3235 |
|
3236 |
qftTimestamp :: String |
3237 |
qftTimestamp = "timestamp" |
3238 |
|
3239 |
qftUnit :: String |
3240 |
qftUnit = "unit" |
3241 |
|
3242 |
qftUnknown :: String |
3243 |
qftUnknown = "unknown" |
3244 |
|
3245 |
qftAll :: FrozenSet String |
3246 |
qftAll = |
3247 |
ConstantUtils.mkSet [qftBool, |
3248 |
qftNumber, |
3249 |
qftOther, |
3250 |
qftText, |
3251 |
qftTimestamp, |
3252 |
qftUnit, |
3253 |
qftUnknown] |
3254 |
|
3255 |
-- * Query result field status |
3256 |
-- |
3257 |
-- Don't change or reuse values as they're used by clients. |
3258 |
-- |
3259 |
-- FIXME: link with 'Ganeti.Query.Language.ResultStatus' |
3260 |
|
3261 |
-- | No data (e.g. RPC error), can be used instead of 'rsOffline' |
3262 |
rsNodata :: Int |
3263 |
rsNodata = 2 |
3264 |
|
3265 |
rsNormal :: Int |
3266 |
rsNormal = 0 |
3267 |
|
3268 |
-- | Resource marked offline |
3269 |
rsOffline :: Int |
3270 |
rsOffline = 4 |
3271 |
|
3272 |
-- | Value unavailable/unsupported for item; if this field is |
3273 |
-- supported but we cannot get the data for the moment, 'rsNodata' or |
3274 |
-- 'rsOffline' should be used |
3275 |
rsUnavail :: Int |
3276 |
rsUnavail = 3 |
3277 |
|
3278 |
rsUnknown :: Int |
3279 |
rsUnknown = 1 |
3280 |
|
3281 |
rsAll :: FrozenSet Int |
3282 |
rsAll = |
3283 |
ConstantUtils.mkSet [rsNodata, |
3284 |
rsNormal, |
3285 |
rsOffline, |
3286 |
rsUnavail, |
3287 |
rsUnknown] |
3288 |
|
3289 |
-- | Special field cases and their verbose/terse formatting |
3290 |
rssDescription :: Map Int (String, String) |
3291 |
rssDescription = |
3292 |
Map.fromList [(rsUnknown, ("(unknown)", "??")), |
3293 |
(rsNodata, ("(nodata)", "?")), |
3294 |
(rsOffline, ("(offline)", "*")), |
3295 |
(rsUnavail, ("(unavail)", "-"))] |
3296 |
|
3297 |
-- * Max dynamic devices |
3298 |
|
3299 |
maxDisks :: Int |
3300 |
maxDisks = Types.maxDisks |
3301 |
|
3302 |
maxNics :: Int |
3303 |
maxNics = Types.maxNics |
3304 |
|
3305 |
-- | SSCONF file prefix |
3306 |
ssconfFileprefix :: String |
3307 |
ssconfFileprefix = "ssconf_" |
3308 |
|
3309 |
-- * SSCONF keys |
3310 |
|
3311 |
ssClusterName :: String |
3312 |
ssClusterName = "cluster_name" |
3313 |
|
3314 |
ssClusterTags :: String |
3315 |
ssClusterTags = "cluster_tags" |
3316 |
|
3317 |
ssFileStorageDir :: String |
3318 |
ssFileStorageDir = "file_storage_dir" |
3319 |
|
3320 |
ssSharedFileStorageDir :: String |
3321 |
ssSharedFileStorageDir = "shared_file_storage_dir" |
3322 |
|
3323 |
ssMasterCandidates :: String |
3324 |
ssMasterCandidates = "master_candidates" |
3325 |
|
3326 |
ssMasterCandidatesIps :: String |
3327 |
ssMasterCandidatesIps = "master_candidates_ips" |
3328 |
|
3329 |
ssMasterIp :: String |
3330 |
ssMasterIp = "master_ip" |
3331 |
|
3332 |
ssMasterNetdev :: String |
3333 |
ssMasterNetdev = "master_netdev" |
3334 |
|
3335 |
ssMasterNetmask :: String |
3336 |
ssMasterNetmask = "master_netmask" |
3337 |
|
3338 |
ssMasterNode :: String |
3339 |
ssMasterNode = "master_node" |
3340 |
|
3341 |
ssNodeList :: String |
3342 |
ssNodeList = "node_list" |
3343 |
|
3344 |
ssNodePrimaryIps :: String |
3345 |
ssNodePrimaryIps = "node_primary_ips" |
3346 |
|
3347 |
ssNodeSecondaryIps :: String |
3348 |
ssNodeSecondaryIps = "node_secondary_ips" |
3349 |
|
3350 |
ssOfflineNodes :: String |
3351 |
ssOfflineNodes = "offline_nodes" |
3352 |
|
3353 |
ssOnlineNodes :: String |
3354 |
ssOnlineNodes = "online_nodes" |
3355 |
|
3356 |
ssPrimaryIpFamily :: String |
3357 |
ssPrimaryIpFamily = "primary_ip_family" |
3358 |
|
3359 |
ssInstanceList :: String |
3360 |
ssInstanceList = "instance_list" |
3361 |
|
3362 |
ssReleaseVersion :: String |
3363 |
ssReleaseVersion = "release_version" |
3364 |
|
3365 |
ssHypervisorList :: String |
3366 |
ssHypervisorList = "hypervisor_list" |
3367 |
|
3368 |
ssMaintainNodeHealth :: String |
3369 |
ssMaintainNodeHealth = "maintain_node_health" |
3370 |
|
3371 |
ssUidPool :: String |
3372 |
ssUidPool = "uid_pool" |
3373 |
|
3374 |
ssNodegroups :: String |
3375 |
ssNodegroups = "nodegroups" |
3376 |
|
3377 |
ssNetworks :: String |
3378 |
ssNetworks = "networks" |
3379 |
|
3380 |
-- | This is not a complete SSCONF key, but the prefix for the |
3381 |
-- hypervisor keys |
3382 |
ssHvparamsPref :: String |
3383 |
ssHvparamsPref = "hvparams_" |
3384 |
|
3385 |
-- * Hvparams keys |
3386 |
|
3387 |
ssHvparamsXenChroot :: String |
3388 |
ssHvparamsXenChroot = ssHvparamsPref ++ htChroot |
3389 |
|
3390 |
ssHvparamsXenFake :: String |
3391 |
ssHvparamsXenFake = ssHvparamsPref ++ htFake |
3392 |
|
3393 |
ssHvparamsXenHvm :: String |
3394 |
ssHvparamsXenHvm = ssHvparamsPref ++ htXenHvm |
3395 |
|
3396 |
ssHvparamsXenKvm :: String |
3397 |
ssHvparamsXenKvm = ssHvparamsPref ++ htKvm |
3398 |
|
3399 |
ssHvparamsXenLxc :: String |
3400 |
ssHvparamsXenLxc = ssHvparamsPref ++ htLxc |
3401 |
|
3402 |
ssHvparamsXenPvm :: String |
3403 |
ssHvparamsXenPvm = ssHvparamsPref ++ htXenPvm |
3404 |
|
3405 |
validSsHvparamsKeys :: FrozenSet String |
3406 |
validSsHvparamsKeys = |
3407 |
ConstantUtils.mkSet [ssHvparamsXenChroot, |
3408 |
ssHvparamsXenLxc, |
3409 |
ssHvparamsXenFake, |
3410 |
ssHvparamsXenHvm, |
3411 |
ssHvparamsXenKvm, |
3412 |
ssHvparamsXenPvm] |
3413 |
|
3414 |
ssFilePerms :: Int |
3415 |
ssFilePerms = 0o444 |
3416 |
|
3417 |
-- | Cluster wide default parameters |
3418 |
defaultEnabledHypervisor :: String |
3419 |
defaultEnabledHypervisor = htXenPvm |
3420 |
|
3421 |
hvcGlobals :: FrozenSet String |
3422 |
hvcGlobals = |
3423 |
ConstantUtils.mkSet [hvMigrationBandwidth, |
3424 |
hvMigrationMode, |
3425 |
hvMigrationPort, |
3426 |
hvXenCmd] |
3427 |
|
3428 |
ndcGlobals :: FrozenSet String |
3429 |
ndcGlobals = ConstantUtils.mkSet [ndExclusiveStorage] |
3430 |
|
3431 |
-- | All of the following values are quite arbitrary - there are no |
3432 |
-- "good" defaults, these must be customised per-site |
3433 |
ispecsMinmaxDefaults :: Map String (Map String Int) |
3434 |
ispecsMinmaxDefaults = |
3435 |
Map.fromList |
3436 |
[(ispecsMin, |
3437 |
Map.fromList |
3438 |
[(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMinISpec), |
3439 |
(ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMinISpec), |
3440 |
(ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMinISpec), |
3441 |
(ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMinISpec), |
3442 |
(ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMinISpec), |
3443 |
(ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMinISpec)]), |
3444 |
(ispecsMax, |
3445 |
Map.fromList |
3446 |
[(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMaxISpec), |
3447 |
(ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMaxISpec), |
3448 |
(ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMaxISpec), |
3449 |
(ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMaxISpec), |
3450 |
(ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMaxISpec), |
3451 |
(ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMaxISpec)])] |
3452 |
|
3453 |
masterPoolSizeDefault :: Int |
3454 |
masterPoolSizeDefault = 10 |
3455 |
|
3456 |
-- * Exclusive storage |
3457 |
|
3458 |
-- | Error margin used to compare physical disks |
3459 |
partMargin :: Double |
3460 |
partMargin = 0.01 |
3461 |
|
3462 |
-- | Space reserved when creating instance disks |
3463 |
partReserved :: Double |
3464 |
partReserved = 0.02 |
3465 |
|
3466 |
-- * Confd |
3467 |
|
3468 |
confdProtocolVersion :: Int |
3469 |
confdProtocolVersion = ConstantUtils.confdProtocolVersion |
3470 |
|
3471 |
-- Confd request type |
3472 |
|
3473 |
confdReqPing :: Int |
3474 |
confdReqPing = Types.confdRequestTypeToRaw ReqPing |
3475 |
|
3476 |
confdReqNodeRoleByname :: Int |
3477 |
confdReqNodeRoleByname = Types.confdRequestTypeToRaw ReqNodeRoleByName |
3478 |
|
3479 |
confdReqNodePipByInstanceIp :: Int |
3480 |
confdReqNodePipByInstanceIp = Types.confdRequestTypeToRaw ReqNodePipByInstPip |
3481 |
|
3482 |
confdReqClusterMaster :: Int |
3483 |
confdReqClusterMaster = Types.confdRequestTypeToRaw ReqClusterMaster |
3484 |
|
3485 |
confdReqNodePipList :: Int |
3486 |
confdReqNodePipList = Types.confdRequestTypeToRaw ReqNodePipList |
3487 |
|
3488 |
confdReqMcPipList :: Int |
3489 |
confdReqMcPipList = Types.confdRequestTypeToRaw ReqMcPipList |
3490 |
|
3491 |
confdReqInstancesIpsList :: Int |
3492 |
confdReqInstancesIpsList = Types.confdRequestTypeToRaw ReqInstIpsList |
3493 |
|
3494 |
confdReqNodeDrbd :: Int |
3495 |
confdReqNodeDrbd = Types.confdRequestTypeToRaw ReqNodeDrbd |
3496 |
|
3497 |
confdReqNodeInstances :: Int |
3498 |
confdReqNodeInstances = Types.confdRequestTypeToRaw ReqNodeInstances |
3499 |
|
3500 |
confdReqs :: FrozenSet Int |
3501 |
confdReqs = |
3502 |
ConstantUtils.mkSet . |
3503 |
map Types.confdRequestTypeToRaw $ |
3504 |
[minBound..] \\ [ReqNodeInstances] |
3505 |
|
3506 |
-- * Confd request type |
3507 |
|
3508 |
confdReqfieldName :: Int |
3509 |
confdReqfieldName = Types.confdReqFieldToRaw ReqFieldName |
3510 |
|
3511 |
confdReqfieldIp :: Int |
3512 |
confdReqfieldIp = Types.confdReqFieldToRaw ReqFieldIp |
3513 |
|
3514 |
confdReqfieldMnodePip :: Int |
3515 |
confdReqfieldMnodePip = Types.confdReqFieldToRaw ReqFieldMNodePip |
3516 |
|
3517 |
-- * Confd repl status |
3518 |
|
3519 |
confdReplStatusOk :: Int |
3520 |
confdReplStatusOk = Types.confdReplyStatusToRaw ReplyStatusOk |
3521 |
|
3522 |
confdReplStatusError :: Int |
3523 |
confdReplStatusError = Types.confdReplyStatusToRaw ReplyStatusError |
3524 |
|
3525 |
confdReplStatusNotimplemented :: Int |
3526 |
confdReplStatusNotimplemented = Types.confdReplyStatusToRaw ReplyStatusNotImpl |
3527 |
|
3528 |
confdReplStatuses :: FrozenSet Int |
3529 |
confdReplStatuses = |
3530 |
ConstantUtils.mkSet $ map Types.confdReplyStatusToRaw [minBound..] |
3531 |
|
3532 |
-- * Confd node role |
3533 |
|
3534 |
confdNodeRoleMaster :: Int |
3535 |
confdNodeRoleMaster = Types.confdNodeRoleToRaw NodeRoleMaster |
3536 |
|
3537 |
confdNodeRoleCandidate :: Int |
3538 |
confdNodeRoleCandidate = Types.confdNodeRoleToRaw NodeRoleCandidate |
3539 |
|
3540 |
confdNodeRoleOffline :: Int |
3541 |
confdNodeRoleOffline = Types.confdNodeRoleToRaw NodeRoleOffline |
3542 |
|
3543 |
confdNodeRoleDrained :: Int |
3544 |
confdNodeRoleDrained = Types.confdNodeRoleToRaw NodeRoleDrained |
3545 |
|
3546 |
confdNodeRoleRegular :: Int |
3547 |
confdNodeRoleRegular = Types.confdNodeRoleToRaw NodeRoleRegular |
3548 |
|
3549 |
-- * A few common errors for confd |
3550 |
|
3551 |
confdErrorUnknownEntry :: Int |
3552 |
confdErrorUnknownEntry = Types.confdErrorTypeToRaw ConfdErrorUnknownEntry |
3553 |
|
3554 |
confdErrorInternal :: Int |
3555 |
confdErrorInternal = Types.confdErrorTypeToRaw ConfdErrorInternal |
3556 |
|
3557 |
confdErrorArgument :: Int |
3558 |
confdErrorArgument = Types.confdErrorTypeToRaw ConfdErrorArgument |
3559 |
|
3560 |
-- * Confd request query fields |
3561 |
|
3562 |
confdReqqLink :: String |
3563 |
confdReqqLink = ConstantUtils.confdReqqLink |
3564 |
|
3565 |
confdReqqIp :: String |
3566 |
confdReqqIp = ConstantUtils.confdReqqIp |
3567 |
|
3568 |
confdReqqIplist :: String |
3569 |
confdReqqIplist = ConstantUtils.confdReqqIplist |
3570 |
|
3571 |
confdReqqFields :: String |
3572 |
confdReqqFields = ConstantUtils.confdReqqFields |
3573 |
|
3574 |
-- | Each request is "salted" by the current timestamp. |
3575 |
-- |
3576 |
-- This constant decides how many seconds of skew to accept. |
3577 |
-- |
3578 |
-- TODO: make this a default and allow the value to be more |
3579 |
-- configurable |
3580 |
confdMaxClockSkew :: Int |
3581 |
confdMaxClockSkew = 2 * nodeMaxClockSkew |
3582 |
|
3583 |
-- | When we haven't reloaded the config for more than this amount of |
3584 |
-- seconds, we force a test to see if inotify is betraying us. Using a |
3585 |
-- prime number to ensure we get less chance of 'same wakeup' with |
3586 |
-- other processes. |
3587 |
confdConfigReloadTimeout :: Int |
3588 |
confdConfigReloadTimeout = 17 |
3589 |
|
3590 |
-- | If we receive more than one update in this amount of |
3591 |
-- microseconds, we move to polling every RATELIMIT seconds, rather |
3592 |
-- than relying on inotify, to be able to serve more requests. |
3593 |
confdConfigReloadRatelimit :: Int |
3594 |
confdConfigReloadRatelimit = 250000 |
3595 |
|
3596 |
-- | Magic number prepended to all confd queries. |
3597 |
-- |
3598 |
-- This allows us to distinguish different types of confd protocols |
3599 |
-- and handle them. For example by changing this we can move the whole |
3600 |
-- payload to be compressed, or move away from json. |
3601 |
confdMagicFourcc :: String |
3602 |
confdMagicFourcc = "plj0" |
3603 |
|
3604 |
-- | By default a confd request is sent to the minimum between this |
3605 |
-- number and all MCs. 6 was chosen because even in the case of a |
3606 |
-- disastrous 50% response rate, we should have enough answers to be |
3607 |
-- able to compare more than one. |
3608 |
confdDefaultReqCoverage :: Int |
3609 |
confdDefaultReqCoverage = 6 |
3610 |
|
3611 |
-- | Timeout in seconds to expire pending query request in the confd |
3612 |
-- client library. We don't actually expect any answer more than 10 |
3613 |
-- seconds after we sent a request. |
3614 |
confdClientExpireTimeout :: Int |
3615 |
confdClientExpireTimeout = 10 |
3616 |
|
3617 |
-- | Maximum UDP datagram size. |
3618 |
-- |
3619 |
-- On IPv4: 64K - 20 (ip header size) - 8 (udp header size) = 65507 |
3620 |
-- On IPv6: 64K - 40 (ip6 header size) - 8 (udp header size) = 65487 |
3621 |
-- (assuming we can't use jumbo frames) |
3622 |
-- We just set this to 60K, which should be enough |
3623 |
maxUdpDataSize :: Int |
3624 |
maxUdpDataSize = 61440 |
3625 |
|
3626 |
-- * User-id pool minimum/maximum acceptable user-ids |
3627 |
|
3628 |
uidpoolUidMin :: Int |
3629 |
uidpoolUidMin = 0 |
3630 |
|
3631 |
-- | Assuming 32 bit user-ids |
3632 |
uidpoolUidMax :: Integer |
3633 |
uidpoolUidMax = 2 ^ 32 - 1 |
3634 |
|
3635 |
-- | Name or path of the pgrep command |
3636 |
pgrep :: String |
3637 |
pgrep = "pgrep" |
3638 |
|
3639 |
-- | Name of the node group that gets created at cluster init or |
3640 |
-- upgrade |
3641 |
initialNodeGroupName :: String |
3642 |
initialNodeGroupName = "default" |
3643 |
|
3644 |
-- * Possible values for NodeGroup.alloc_policy |
3645 |
|
3646 |
allocPolicyLastResort :: String |
3647 |
allocPolicyLastResort = Types.allocPolicyToRaw AllocLastResort |
3648 |
|
3649 |
allocPolicyPreferred :: String |
3650 |
allocPolicyPreferred = Types.allocPolicyToRaw AllocPreferred |
3651 |
|
3652 |
allocPolicyUnallocable :: String |
3653 |
allocPolicyUnallocable = Types.allocPolicyToRaw AllocUnallocable |
3654 |
|
3655 |
validAllocPolicies :: [String] |
3656 |
validAllocPolicies = map Types.allocPolicyToRaw [minBound..] |
3657 |
|
3658 |
-- | Temporary external/shared storage parameters |
3659 |
blockdevDriverManual :: String |
3660 |
blockdevDriverManual = Types.blockDriverToRaw BlockDrvManual |
3661 |
|
3662 |
-- | 'qemu-img' path, required for 'ovfconverter' |
3663 |
qemuimgPath :: String |
3664 |
qemuimgPath = AutoConf.qemuimgPath |
3665 |
|
3666 |
-- | Whether htools was enabled at compilation time |
3667 |
-- |
3668 |
-- FIXME: this should be moved next to the other enable constants, |
3669 |
-- such as, 'enableConfd', and renamed to 'enableHtools'. |
3670 |
htools :: Bool |
3671 |
htools = AutoConf.htools |
3672 |
|
3673 |
-- | The hail iallocator |
3674 |
iallocHail :: String |
3675 |
iallocHail = "hail" |
3676 |
|
3677 |
-- * Fake opcodes for functions that have hooks attached to them via |
3678 |
-- backend.RunLocalHooks |
3679 |
|
3680 |
fakeOpMasterTurndown :: String |
3681 |
fakeOpMasterTurndown = "OP_CLUSTER_IP_TURNDOWN" |
3682 |
|
3683 |
fakeOpMasterTurnup :: String |
3684 |
fakeOpMasterTurnup = "OP_CLUSTER_IP_TURNUP" |
3685 |
|
3686 |
-- * SSH key types |
3687 |
|
3688 |
sshkDsa :: String |
3689 |
sshkDsa = "dsa" |
3690 |
|
3691 |
sshkRsa :: String |
3692 |
sshkRsa = "rsa" |
3693 |
|
3694 |
sshkAll :: FrozenSet String |
3695 |
sshkAll = ConstantUtils.mkSet [sshkRsa, sshkDsa] |
3696 |
|
3697 |
-- * SSH authorized key types |
3698 |
|
3699 |
sshakDss :: String |
3700 |
sshakDss = "ssh-dss" |
3701 |
|
3702 |
sshakRsa :: String |
3703 |
sshakRsa = "ssh-rsa" |
3704 |
|
3705 |
sshakAll :: FrozenSet String |
3706 |
sshakAll = ConstantUtils.mkSet [sshakDss, sshakRsa] |
3707 |
|
3708 |
-- * SSH setup |
3709 |
|
3710 |
sshsClusterName :: String |
3711 |
sshsClusterName = "cluster_name" |
3712 |
|
3713 |
sshsSshHostKey :: String |
3714 |
sshsSshHostKey = "ssh_host_key" |
3715 |
|
3716 |
sshsSshRootKey :: String |
3717 |
sshsSshRootKey = "ssh_root_key" |
3718 |
|
3719 |
sshsNodeDaemonCertificate :: String |
3720 |
sshsNodeDaemonCertificate = "node_daemon_certificate" |
3721 |
|
3722 |
-- * Key files for SSH daemon |
3723 |
|
3724 |
sshHostDsaPriv :: String |
3725 |
sshHostDsaPriv = sshConfigDir ++ "/ssh_host_dsa_key" |
3726 |
|
3727 |
sshHostDsaPub :: String |
3728 |
sshHostDsaPub = sshHostDsaPriv ++ ".pub" |
3729 |
|
3730 |
sshHostRsaPriv :: String |
3731 |
sshHostRsaPriv = sshConfigDir ++ "/ssh_host_rsa_key" |
3732 |
|
3733 |
sshHostRsaPub :: String |
3734 |
sshHostRsaPub = sshHostRsaPriv ++ ".pub" |
3735 |
|
3736 |
-- * Node daemon setup |
3737 |
|
3738 |
ndsClusterName :: String |
3739 |
ndsClusterName = "cluster_name" |
3740 |
|
3741 |
ndsNodeDaemonCertificate :: String |
3742 |
ndsNodeDaemonCertificate = "node_daemon_certificate" |
3743 |
|
3744 |
ndsSsconf :: String |
3745 |
ndsSsconf = "ssconf" |
3746 |
|
3747 |
ndsStartNodeDaemon :: String |
3748 |
ndsStartNodeDaemon = "start_node_daemon" |
3749 |
|
3750 |
-- * The source reasons for the execution of an OpCode |
3751 |
|
3752 |
opcodeReasonSrcClient :: String |
3753 |
opcodeReasonSrcClient = "gnt:client" |
3754 |
|
3755 |
opcodeReasonSrcNoded :: String |
3756 |
opcodeReasonSrcNoded = "gnt:daemon:noded" |
3757 |
|
3758 |
opcodeReasonSrcOpcode :: String |
3759 |
opcodeReasonSrcOpcode = "gnt:opcode" |
3760 |
|
3761 |
opcodeReasonSrcRlib2 :: String |
3762 |
opcodeReasonSrcRlib2 = "gnt:library:rlib2" |
3763 |
|
3764 |
opcodeReasonSrcUser :: String |
3765 |
opcodeReasonSrcUser = "gnt:user" |
3766 |
|
3767 |
opcodeReasonSources :: FrozenSet String |
3768 |
opcodeReasonSources = |
3769 |
ConstantUtils.mkSet [opcodeReasonSrcClient, |
3770 |
opcodeReasonSrcNoded, |
3771 |
opcodeReasonSrcOpcode, |
3772 |
opcodeReasonSrcRlib2, |
3773 |
opcodeReasonSrcUser] |
3774 |
|
3775 |
-- | Path generating random UUID |
3776 |
randomUuidFile :: String |
3777 |
randomUuidFile = ConstantUtils.randomUuidFile |
3778 |
|
3779 |
-- * Auto-repair tag prefixes |
3780 |
|
3781 |
autoRepairTagPrefix :: String |
3782 |
autoRepairTagPrefix = "ganeti:watcher:autorepair:" |
3783 |
|
3784 |
autoRepairTagEnabled :: String |
3785 |
autoRepairTagEnabled = autoRepairTagPrefix |
3786 |
|
3787 |
autoRepairTagPending :: String |
3788 |
autoRepairTagPending = autoRepairTagPrefix ++ "pending:" |
3789 |
|
3790 |
autoRepairTagResult :: String |
3791 |
autoRepairTagResult = autoRepairTagPrefix ++ "result:" |
3792 |
|
3793 |
autoRepairTagSuspended :: String |
3794 |
autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:" |
3795 |
|
3796 |
-- * Auto-repair levels |
3797 |
|
3798 |
autoRepairFailover :: String |
3799 |
autoRepairFailover = "failover" |
3800 |
|
3801 |
autoRepairFixStorage :: String |
3802 |
autoRepairFixStorage = "fix-storage" |
3803 |
|
3804 |
autoRepairMigrate :: String |
3805 |
autoRepairMigrate = "migrate" |
3806 |
|
3807 |
autoRepairReinstall :: String |
3808 |
autoRepairReinstall = "reinstall" |
3809 |
|
3810 |
autoRepairAllTypes :: FrozenSet String |
3811 |
autoRepairAllTypes = |
3812 |
ConstantUtils.mkSet [autoRepairFailover, |
3813 |
autoRepairFixStorage, |
3814 |
autoRepairMigrate, |
3815 |
autoRepairReinstall] |
3816 |
|
3817 |
-- * Auto-repair results |
3818 |
|
3819 |
autoRepairEnoperm :: String |
3820 |
autoRepairEnoperm = "enoperm" |
3821 |
|
3822 |
autoRepairFailure :: String |
3823 |
autoRepairFailure = "failure" |
3824 |
|
3825 |
autoRepairSuccess :: String |
3826 |
autoRepairSuccess = "success" |
3827 |
|
3828 |
autoRepairAllResults :: FrozenSet String |
3829 |
autoRepairAllResults = |
3830 |
ConstantUtils.mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess] |
3831 |
|
3832 |
-- | The version identifier for builtin data collectors |
3833 |
builtinDataCollectorVersion :: String |
3834 |
builtinDataCollectorVersion = "B" |
3835 |
|
3836 |
-- | The reason trail opcode parameter name |
3837 |
opcodeReason :: String |
3838 |
opcodeReason = "reason" |
3839 |
|
3840 |
diskstatsFile :: String |
3841 |
diskstatsFile = "/proc/diskstats" |
3842 |
|
3843 |
-- * CPU load collector |
3844 |
|
3845 |
statFile :: String |
3846 |
statFile = "/proc/stat" |
3847 |
|
3848 |
cpuavgloadBufferSize :: Int |
3849 |
cpuavgloadBufferSize = 150 |
3850 |
|
3851 |
cpuavgloadWindowSize :: Int |
3852 |
cpuavgloadWindowSize = 600 |
3853 |
|
3854 |
-- | Mond's variable for periodical data collection |
3855 |
mondTimeInterval :: Int |
3856 |
mondTimeInterval = 5 |
3857 |
|
3858 |
-- * Disk access modes |
3859 |
|
3860 |
diskUserspace :: String |
3861 |
diskUserspace = Types.diskAccessModeToRaw DiskUserspace |
3862 |
|
3863 |
diskKernelspace :: String |
3864 |
diskKernelspace = Types.diskAccessModeToRaw DiskKernelspace |
3865 |
|
3866 |
diskValidAccessModes :: FrozenSet String |
3867 |
diskValidAccessModes = |
3868 |
ConstantUtils.mkSet $ map Types.diskAccessModeToRaw [minBound..] |
3869 |
|
3870 |
-- | Timeout for queue draining in upgrades |
3871 |
upgradeQueueDrainTimeout :: Int |
3872 |
upgradeQueueDrainTimeout = 36 * 60 * 60 -- 1.5 days |
3873 |
|
3874 |
-- | Intervall at which the queue is polled during upgrades |
3875 |
upgradeQueuePollInterval :: Int |
3876 |
upgradeQueuePollInterval = 10 |