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