1 {-# OPTIONS -fno-warn-type-defaults #-}
2 {-| Constants contains the Haskell constants
4 The constants in this module are used in Haskell and are also
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
19 Copyright (C) 2013 Google Inc.
21 This program is free software; you can redistribute it and/or modify
22 it under the terms of the GNU General Public License as published by
23 the Free Software Foundation; either version 2 of the License, or
24 (at your option) any later version.
26 This program is distributed in the hope that it will be useful, but
27 WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 General Public License for more details.
31 You should have received a copy of the GNU General Public License
32 along with this program; if not, write to the Free Software
33 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
37 module Ganeti.Constants where
39 import Control.Arrow ((***))
40 import Data.List ((\\))
42 import qualified Data.Map as Map (empty, fromList, keys, insert)
44 import qualified AutoConf
45 import Ganeti.ConstantUtils (PythonChar(..), PythonNone(..), FrozenSet,
46 Protocol(..), buildVersion)
47 import qualified Ganeti.ConstantUtils as ConstantUtils
48 import Ganeti.HTools.Types (AutoRepairResult(..), AutoRepairType(..))
49 import qualified Ganeti.HTools.Types as Types
50 import Ganeti.Logging (SyslogUsage(..))
51 import qualified Ganeti.Logging as Logging (syslogUsageToRaw)
52 import qualified Ganeti.Runtime as Runtime
53 import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..),
55 import Ganeti.THH (PyValueEx(..))
57 import qualified Ganeti.Types as Types
58 import Ganeti.Confd.Types (ConfdRequestType(..), ConfdReqField(..),
59 ConfdReplyStatus(..), ConfdNodeRole(..),
61 import qualified Ganeti.Confd.Types as Types
63 {-# ANN module "HLint: ignore Use camelCase" #-}
65 -- * 'autoconf' constants for Python only ('autotools/build-bash-completion')
67 htoolsProgs :: [String]
68 htoolsProgs = AutoConf.htoolsProgs
70 -- * 'autoconf' constants for Python only ('lib/constants.py')
72 drbdBarriers :: String
73 drbdBarriers = AutoConf.drbdBarriers
75 drbdNoMetaFlush :: Bool
76 drbdNoMetaFlush = AutoConf.drbdNoMetaFlush
79 lvmStripecount = AutoConf.lvmStripecount
82 hasGnuLn = AutoConf.hasGnuLn
84 -- * 'autoconf' constants for Python only ('lib/pathutils.py')
86 -- ** Build-time constants
89 exportDir = AutoConf.exportDir
91 osSearchPath :: [String]
92 osSearchPath = AutoConf.osSearchPath
94 esSearchPath :: [String]
95 esSearchPath = AutoConf.esSearchPath
97 sshConfigDir :: String
98 sshConfigDir = AutoConf.sshConfigDir
100 xenConfigDir :: String
101 xenConfigDir = AutoConf.xenConfigDir
104 sysconfdir = AutoConf.sysconfdir
107 toolsdir = AutoConf.toolsdir
109 localstatedir :: String
110 localstatedir = AutoConf.localstatedir
112 -- ** Paths which don't change for a virtual cluster
115 pkglibdir = AutoConf.pkglibdir
118 sharedir = AutoConf.sharedir
120 -- * 'autoconf' constants for Python only ('lib/build/sphinx_ext.py')
122 manPages :: Map String Int
123 manPages = Map.fromList AutoConf.manPages
125 -- * 'autoconf' constants for QA cluster only ('qa/qa_cluster.py')
127 versionedsharedir :: String
128 versionedsharedir = AutoConf.versionedsharedir
130 -- * 'autoconf' constants for Python only ('tests/py/docs_unittest.py')
132 gntScripts :: [String]
133 gntScripts = AutoConf.gntScripts
135 -- * Various versions
137 releaseVersion :: String
138 releaseVersion = AutoConf.packageVersion
141 versionMajor = AutoConf.versionMajor
144 versionMinor = AutoConf.versionMinor
146 versionRevision :: Int
147 versionRevision = AutoConf.versionRevision
150 dirVersion = AutoConf.dirVersion
161 osApiVersions :: FrozenSet Int
162 osApiVersions = ConstantUtils.mkSet [osApiV10, osApiV15, osApiV20]
171 configMajor = AutoConf.versionMajor
174 configMinor = AutoConf.versionMinor
176 -- | The configuration is supposed to remain stable across
177 -- revisions. Therefore, the revision number is cleared to '0'.
178 configRevision :: Int
182 configVersion = buildVersion configMajor configMinor configRevision
184 -- | Similarly to the configuration (see 'configRevision'), the
185 -- protocols are supposed to remain stable across revisions.
186 protocolVersion :: Int
187 protocolVersion = buildVersion configMajor configMinor configRevision
191 daemonsGroup :: String
192 daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
195 adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
197 masterdUser :: String
198 masterdUser = Runtime.daemonUser GanetiMasterd
200 masterdGroup :: String
201 masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
204 rapiUser = Runtime.daemonUser GanetiRapi
207 rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
210 confdUser = Runtime.daemonUser GanetiConfd
213 confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
216 luxidUser = Runtime.daemonUser GanetiLuxid
219 luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
222 nodedUser = Runtime.daemonUser GanetiNoded
225 nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
228 mondUser = Runtime.daemonUser GanetiMond
231 mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
233 sshLoginUser :: String
234 sshLoginUser = AutoConf.sshLoginUser
236 sshConsoleUser :: String
237 sshConsoleUser = AutoConf.sshConsoleUser
239 -- * Cpu pinning separators and constants
241 cpuPinningSep :: String
244 cpuPinningAll :: String
245 cpuPinningAll = "all"
247 -- | Internal representation of "all"
248 cpuPinningAllVal :: Int
249 cpuPinningAllVal = -1
251 -- | One "all" entry in a CPU list means CPU pinning is off
252 cpuPinningOff :: [Int]
253 cpuPinningOff = [cpuPinningAllVal]
255 -- | A Xen-specific implementation detail is that there is no way to
256 -- actually say "use any cpu for pinning" in a Xen configuration file,
257 -- as opposed to the command line, where you can say
259 -- xm vcpu-pin <domain> <vcpu> all
262 -- The workaround used in Xen is "0-63" (see source code function
263 -- "xm_vcpu_pin" in @<xen-source>/tools/python/xen/xm/main.py@).
265 -- To support future changes, the following constant is treated as a
266 -- blackbox string that simply means "use any cpu for pinning under
268 cpuPinningAllXen :: String
269 cpuPinningAllXen = "0-63"
271 -- | A KVM-specific implementation detail - the following value is
272 -- used to set CPU affinity to all processors (--0 through --31), per
275 -- FIXME: This only works for machines with up to 32 CPU cores
276 cpuPinningAllKvm :: Int
277 cpuPinningAllKvm = 0xFFFFFFFF
288 minWipeChunkPercent :: Int
289 minWipeChunkPercent = 10
297 secureDirMode = 0o700
299 secureFileMode :: Int
300 secureFileMode = 0o600
302 adoptableBlockdevRoot :: String
303 adoptableBlockdevRoot = "/dev/disk/"
305 -- * 'autoconf' enable/disable
308 enableConfd = AutoConf.enableConfd
311 enableMond = AutoConf.enableMond
313 enableRestrictedCommands :: Bool
314 enableRestrictedCommands = AutoConf.enableRestrictedCommands
316 enableSplitQuery :: Bool
317 enableSplitQuery = AutoConf.enableSplitQuery
330 confd = Runtime.daemonName GanetiConfd
333 masterd = Runtime.daemonName GanetiMasterd
336 mond = Runtime.daemonName GanetiMond
339 noded = Runtime.daemonName GanetiNoded
342 luxid = Runtime.daemonName GanetiLuxid
345 rapi = Runtime.daemonName GanetiRapi
347 daemons :: FrozenSet String
349 ConstantUtils.mkSet [confd,
356 defaultConfdPort :: Int
357 defaultConfdPort = 1814
359 defaultMondPort :: Int
360 defaultMondPort = 1815
362 defaultNodedPort :: Int
363 defaultNodedPort = 1811
365 defaultRapiPort :: Int
366 defaultRapiPort = 5080
368 daemonsPorts :: Map String (Protocol, Int)
370 Map.fromList [(confd, (Udp, defaultConfdPort)),
371 (mond, (Tcp, defaultMondPort)),
372 (noded, (Tcp, defaultNodedPort)),
373 (rapi, (Tcp, defaultRapiPort)),
377 firstDrbdPort = 11000
382 daemonsLogbase :: Map String String
385 [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
387 daemonsExtraLogbase :: Map String (Map String String)
388 daemonsExtraLogbase =
390 map (Runtime.daemonName *** id)
391 [ (GanetiMond, Map.fromList
392 [ ("access", Runtime.daemonsExtraLogbase GanetiMond AccessLog)
393 , ("error", Runtime.daemonsExtraLogbase GanetiMond ErrorLog)
397 extraLogreasonAccess :: String
398 extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
400 extraLogreasonError :: String
401 extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
404 devConsole = ConstantUtils.devConsole
407 procMounts = "/proc/mounts"
409 -- * Luxi (Local UniX Interface) related constants
411 luxiEom :: PythonChar
412 luxiEom = PythonChar '\x03'
414 -- | Environment variable for the luxi override socket
415 luxiOverride :: String
416 luxiOverride = "FORCE_LUXI_SOCKET"
418 luxiOverrideMaster :: String
419 luxiOverrideMaster = "master"
421 luxiOverrideQuery :: String
422 luxiOverrideQuery = "query"
425 luxiVersion = configVersion
429 syslogUsage :: String
430 syslogUsage = AutoConf.syslogUsage
433 syslogNo = Logging.syslogUsageToRaw SyslogNo
436 syslogYes = Logging.syslogUsageToRaw SyslogYes
439 syslogOnly = Logging.syslogUsageToRaw SyslogOnly
441 syslogSocket :: String
442 syslogSocket = "/dev/log"
444 exportConfFile :: String
445 exportConfFile = "config.ini"
449 xenBootloader :: String
450 xenBootloader = AutoConf.xenBootloader
459 xenInitrd = AutoConf.xenInitrd
462 xenKernel = AutoConf.xenKernel
464 -- FIXME: perhaps rename to 'validXenCommands' for consistency with
466 knownXenCommands :: FrozenSet String
467 knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
472 kvmPath = AutoConf.kvmPath
475 kvmKernel = AutoConf.kvmKernel
477 socatEscapeCode :: String
478 socatEscapeCode = "0x1d"
481 socatPath = AutoConf.socatPath
483 socatUseCompress :: Bool
484 socatUseCompress = AutoConf.socatUseCompress
486 socatUseEscape :: Bool
487 socatUseEscape = AutoConf.socatUseEscape
491 -- | Display a message for console access
492 consMessage :: String
495 -- | Console as SPICE server
499 -- | Console as SSH command
503 -- | Console as VNC server
507 consAll :: FrozenSet String
508 consAll = ConstantUtils.mkSet [consMessage, consSpice, consSsh, consVnc]
510 -- | RSA key bit length
512 -- For RSA keys more bits are better, but they also make operations
513 -- more expensive. NIST SP 800-131 recommends a minimum of 2048 bits
514 -- from the year 2010 on.
518 -- | Ciphers allowed for SSL connections.
520 -- For the format, see ciphers(1). A better way to disable ciphers
521 -- would be to use the exclamation mark (!), but socat versions below
522 -- 1.5 can't parse exclamation marks in options properly. When
523 -- modifying the ciphers, ensure not to accidentially add something
524 -- after it's been removed. Use the "openssl" utility to check the
525 -- allowed ciphers, e.g. "openssl ciphers -v HIGH:-DES".
526 opensslCiphers :: String
527 opensslCiphers = "HIGH:-DES:-3DES:-EXPORT:-ADH"
531 -- | commonName (CN) used in certificates
533 x509CertCn = "ganeti.example.com"
535 -- | Default validity of certificates in days
536 x509CertDefaultValidity :: Int
537 x509CertDefaultValidity = 365 * 5
539 x509CertSignatureHeader :: String
540 x509CertSignatureHeader = "X-Ganeti-Signature"
542 -- | Digest used to sign certificates ("openssl x509" uses SHA1 by default)
543 x509CertSignDigest :: String
544 x509CertSignDigest = "SHA1"
546 -- * Import/export daemon mode
554 -- * Import/export transport compression
563 iecAll = [iecGzip, iecNone]
565 ieCustomSize :: String
568 -- * Import/export I/O
570 -- | Direct file I/O, equivalent to a shell's I/O redirection using
575 -- | Raw block device I/O using "dd"
576 ieioRawDisk :: String
579 -- | OS definition import/export script
581 ieioScript = "script"
585 valueDefault :: String
586 valueDefault = "default"
591 valueGenerate :: String
592 valueGenerate = "generate"
603 valueHsNothing :: Map String PythonNone
604 valueHsNothing = Map.fromList [("Nothing", PythonNone)]
608 hooksNameCfgupdate :: String
609 hooksNameCfgupdate = "config-update"
611 hooksNameWatcher :: String
612 hooksNameWatcher = "watcher"
615 hooksPath = "/sbin:/bin:/usr/sbin:/usr/bin"
617 hooksPhasePost :: String
618 hooksPhasePost = "post"
620 hooksPhasePre :: String
621 hooksPhasePre = "pre"
626 -- * Hooks subject type (what object type does the LU deal with)
628 htypeCluster :: String
629 htypeCluster = "CLUSTER"
634 htypeInstance :: String
635 htypeInstance = "INSTANCE"
637 htypeNetwork :: String
638 htypeNetwork = "NETWORK"
657 stBlock = Types.storageTypeToRaw StorageBlock
660 stDiskless = Types.storageTypeToRaw StorageDiskless
663 stExt = Types.storageTypeToRaw StorageExt
666 stFile = Types.storageTypeToRaw StorageFile
669 stLvmPv = Types.storageTypeToRaw StorageLvmPv
672 stLvmVg = Types.storageTypeToRaw StorageLvmVg
675 stRados = Types.storageTypeToRaw StorageRados
677 storageTypes :: FrozenSet String
678 storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
680 -- | The set of storage types for which storage reporting is available
682 -- FIXME: Remove this, once storage reporting is available for all
684 stsReport :: FrozenSet String
685 stsReport = ConstantUtils.mkSet [stFile, stLvmPv, stLvmVg]
688 -- ** First two are valid in LU context only, not passed to backend
696 -- ** and the rest are valid in backend
698 sfAllocatable :: String
699 sfAllocatable = Types.storageFieldToRaw SFAllocatable
702 sfFree = Types.storageFieldToRaw SFFree
705 sfName = Types.storageFieldToRaw SFName
708 sfSize = Types.storageFieldToRaw SFSize
711 sfUsed = Types.storageFieldToRaw SFUsed
713 validStorageFields :: FrozenSet String
715 ConstantUtils.mkSet $ map Types.storageFieldToRaw [minBound..] ++
718 modifiableStorageFields :: Map String (FrozenSet String)
719 modifiableStorageFields =
720 Map.fromList [(Types.storageTypeToRaw StorageLvmPv,
721 ConstantUtils.mkSet [sfAllocatable])]
723 -- * Storage operations
725 soFixConsistency :: String
726 soFixConsistency = "fix-consistency"
728 validStorageOperations :: Map String (FrozenSet String)
729 validStorageOperations =
730 Map.fromList [(Types.storageTypeToRaw StorageLvmVg,
731 ConstantUtils.mkSet [soFixConsistency])]
739 vfInstance = "instance"
756 -- * Local disk status
759 ldsFaulty = Types.localDiskStatusToRaw DiskStatusFaulty
762 ldsOkay = Types.localDiskStatusToRaw DiskStatusOk
765 ldsUnknown = Types.localDiskStatusToRaw DiskStatusUnknown
767 ldsNames :: Map Int String
769 Map.fromList [ (Types.localDiskStatusToRaw ds,
770 localDiskStatusName ds) | ds <- [minBound..] ]
772 -- * Disk template types
775 dtDiskless = Types.diskTemplateToRaw DTDiskless
778 dtFile = Types.diskTemplateToRaw DTFile
780 dtSharedFile :: String
781 dtSharedFile = Types.diskTemplateToRaw DTSharedFile
784 dtPlain = Types.diskTemplateToRaw DTPlain
787 dtBlock = Types.diskTemplateToRaw DTBlock
790 dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
793 dtRbd = Types.diskTemplateToRaw DTRbd
796 dtExt = Types.diskTemplateToRaw DTExt
798 -- | This is used to order determine the default disk template when
799 -- the list of enabled disk templates is inferred from the current
800 -- state of the cluster. This only happens on an upgrade from a
801 -- version of Ganeti that did not support the 'enabled_disk_templates'
803 diskTemplatePreference :: [String]
804 diskTemplatePreference =
805 map Types.diskTemplateToRaw
806 [DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile]
808 diskTemplates :: FrozenSet String
809 diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
811 -- | Disk templates that are enabled by default
812 defaultEnabledDiskTemplates :: [String]
813 defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
815 -- | Mapping of disk templates to storage types
816 mapDiskTemplateStorageType :: Map String String
817 mapDiskTemplateStorageType =
819 map (Types.diskTemplateToRaw *** Types.storageTypeToRaw)
820 [(DTBlock, StorageBlock),
821 (DTDrbd8, StorageLvmVg),
823 (DTSharedFile, StorageFile),
824 (DTFile, StorageFile),
825 (DTDiskless, StorageDiskless),
826 (DTPlain, StorageLvmVg),
827 (DTRbd, StorageRados)]
829 -- | The set of network-mirrored disk templates
830 dtsIntMirror :: FrozenSet String
831 dtsIntMirror = ConstantUtils.mkSet [dtDrbd8]
833 -- | 'DTDiskless' is 'trivially' externally mirrored
834 dtsExtMirror :: FrozenSet String
836 ConstantUtils.mkSet $
837 map Types.diskTemplateToRaw [DTDiskless, DTBlock, DTExt, DTSharedFile, DTRbd]
839 -- | The set of non-lvm-based disk templates
840 dtsNotLvm :: FrozenSet String
842 ConstantUtils.mkSet $
843 map Types.diskTemplateToRaw
844 [DTSharedFile, DTDiskless, DTBlock, DTExt, DTFile, DTRbd]
846 -- | The set of disk templates which can be grown
847 dtsGrowable :: FrozenSet String
849 ConstantUtils.mkSet $
850 map Types.diskTemplateToRaw
851 [DTSharedFile, DTDrbd8, DTPlain, DTExt, DTFile, DTRbd]
853 -- | The set of disk templates that allow adoption
854 dtsMayAdopt :: FrozenSet String
856 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTBlock, DTPlain]
858 -- | The set of disk templates that *must* use adoption
859 dtsMustAdopt :: FrozenSet String
860 dtsMustAdopt = ConstantUtils.mkSet [Types.diskTemplateToRaw DTBlock]
862 -- | The set of disk templates that allow migrations
863 dtsMirrored :: FrozenSet String
864 dtsMirrored = dtsIntMirror `ConstantUtils.union` dtsExtMirror
866 -- | The set of file based disk templates
867 dtsFilebased :: FrozenSet String
869 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTSharedFile, DTFile]
871 -- | The set of disk templates that can be moved by copying
873 -- Note: a requirement is that they're not accessed externally or
874 -- shared between nodes; in particular, sharedfile is not suitable.
875 dtsCopyable :: FrozenSet String
877 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain, DTFile]
879 -- | The set of disk templates that are supported by exclusive_storage
880 dtsExclStorage :: FrozenSet String
881 dtsExclStorage = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain]
883 -- | Templates for which we don't perform checks on free space
884 dtsNoFreeSpaceCheck :: FrozenSet String
885 dtsNoFreeSpaceCheck =
886 ConstantUtils.mkSet $
887 map Types.diskTemplateToRaw [DTExt, DTSharedFile, DTFile, DTRbd]
889 dtsBlock :: FrozenSet String
891 ConstantUtils.mkSet $
892 map Types.diskTemplateToRaw [DTPlain, DTDrbd8, DTBlock, DTRbd, DTExt]
894 -- | The set of lvm-based disk templates
895 dtsLvm :: FrozenSet String
896 dtsLvm = diskTemplates `ConstantUtils.difference` dtsNotLvm
900 drbdHmacAlg :: String
903 drbdDefaultNetProtocol :: String
904 drbdDefaultNetProtocol = "C"
906 drbdMigrationNetProtocol :: String
907 drbdMigrationNetProtocol = "C"
909 drbdStatusFile :: String
910 drbdStatusFile = "/proc/drbd"
912 -- | Size of DRBD meta block device
916 -- * Drbd barrier types
918 drbdBDiskBarriers :: String
919 drbdBDiskBarriers = "b"
921 drbdBDiskDrain :: String
924 drbdBDiskFlush :: String
930 -- | Valid barrier combinations: "n" or any non-null subset of "bfd"
931 drbdValidBarrierOpt :: FrozenSet (FrozenSet String)
932 drbdValidBarrierOpt =
934 [ ConstantUtils.mkSet [drbdBNone]
935 , ConstantUtils.mkSet [drbdBDiskBarriers]
936 , ConstantUtils.mkSet [drbdBDiskDrain]
937 , ConstantUtils.mkSet [drbdBDiskFlush]
938 , ConstantUtils.mkSet [drbdBDiskDrain, drbdBDiskFlush]
939 , ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskDrain]
940 , ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskFlush]
941 , ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskFlush, drbdBDiskDrain]
944 -- | Rbd tool command
948 -- * File backend driver
951 fdBlktap = Types.fileDriverToRaw FileBlktap
954 fdLoop = Types.fileDriverToRaw FileLoop
956 fileDriver :: FrozenSet String
958 ConstantUtils.mkSet $
959 map Types.fileDriverToRaw [minBound..]
961 -- | The set of drbd-like disk types
962 dtsDrbd :: FrozenSet String
963 dtsDrbd = ConstantUtils.mkSet [Types.diskTemplateToRaw DTDrbd8]
965 -- * Disk access mode
968 diskRdonly = Types.diskModeToRaw DiskRdOnly
971 diskRdwr = Types.diskModeToRaw DiskRdWr
973 diskAccessSet :: FrozenSet String
974 diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..]
976 -- * Disk replacement mode
978 replaceDiskAuto :: String
979 replaceDiskAuto = Types.replaceDisksModeToRaw ReplaceAuto
981 replaceDiskChg :: String
982 replaceDiskChg = Types.replaceDisksModeToRaw ReplaceNewSecondary
984 replaceDiskPri :: String
985 replaceDiskPri = Types.replaceDisksModeToRaw ReplaceOnPrimary
987 replaceDiskSec :: String
988 replaceDiskSec = Types.replaceDisksModeToRaw ReplaceOnSecondary
990 replaceModes :: FrozenSet String
992 ConstantUtils.mkSet $ map Types.replaceDisksModeToRaw [minBound..]
994 -- * Instance export mode
996 exportModeLocal :: String
997 exportModeLocal = Types.exportModeToRaw ExportModeLocal
999 exportModeRemote :: String
1000 exportModeRemote = Types.exportModeToRaw ExportModeRemote
1002 exportModes :: FrozenSet String
1003 exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
1005 -- * Instance creation modes
1007 instanceCreate :: String
1008 instanceCreate = Types.instCreateModeToRaw InstCreate
1010 instanceImport :: String
1011 instanceImport = Types.instCreateModeToRaw InstImport
1013 instanceRemoteImport :: String
1014 instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
1016 instanceCreateModes :: FrozenSet String
1017 instanceCreateModes =
1018 ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
1020 -- * Remote import/export handshake message and version
1022 rieHandshake :: String
1023 rieHandshake = "Hi, I'm Ganeti"
1028 -- | Remote import/export certificate validity (seconds)
1029 rieCertValidity :: Int
1030 rieCertValidity = 24 * 60 * 60
1032 -- | Export only: how long to wait per connection attempt (seconds)
1033 rieConnectAttemptTimeout :: Int
1034 rieConnectAttemptTimeout = 20
1036 -- | Export only: number of attempts to connect
1037 rieConnectRetries :: Int
1038 rieConnectRetries = 10
1040 -- | Overall timeout for establishing connection
1041 rieConnectTimeout :: Int
1042 rieConnectTimeout = 180
1044 -- | Give child process up to 5 seconds to exit after sending a signal
1045 childLingerTimeout :: Double
1046 childLingerTimeout = 5.0
1048 -- * Import/export config options
1050 inisectBep :: String
1051 inisectBep = "backend"
1053 inisectExp :: String
1054 inisectExp = "export"
1056 inisectHyp :: String
1057 inisectHyp = "hypervisor"
1059 inisectIns :: String
1060 inisectIns = "instance"
1062 inisectOsp :: String
1065 -- * Dynamic device modification
1068 ddmAdd = Types.ddmFullToRaw DdmFullAdd
1071 ddmModify = Types.ddmFullToRaw DdmFullModify
1074 ddmRemove = Types.ddmFullToRaw DdmFullRemove
1076 ddmsValues :: FrozenSet String
1077 ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
1079 ddmsValuesWithModify :: FrozenSet String
1080 ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
1082 -- * Common exit codes
1088 exitFailure = ConstantUtils.exitFailure
1090 exitNotcluster :: Int
1093 exitNotmaster :: Int
1096 exitNodesetupError :: Int
1097 exitNodesetupError = 12
1099 -- | Need user confirmation
1100 exitConfirmation :: Int
1101 exitConfirmation = 13
1103 -- | Exit code for query operations with unknown fields
1104 exitUnknownField :: Int
1105 exitUnknownField = 14
1109 tagCluster :: String
1110 tagCluster = Types.tagKindToRaw TagKindCluster
1112 tagInstance :: String
1113 tagInstance = Types.tagKindToRaw TagKindInstance
1115 tagNetwork :: String
1116 tagNetwork = Types.tagKindToRaw TagKindNetwork
1119 tagNode = Types.tagKindToRaw TagKindNode
1121 tagNodegroup :: String
1122 tagNodegroup = Types.tagKindToRaw TagKindGroup
1124 validTagTypes :: FrozenSet String
1125 validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
1130 maxTagsPerObj :: Int
1131 maxTagsPerObj = 4096
1135 defaultBridge :: String
1136 defaultBridge = "xen-br0"
1138 defaultOvs :: String
1139 defaultOvs = "switch1"
1141 -- | 60 MiB/s, expressed in KiB/s
1142 classicDrbdSyncSpeed :: Int
1143 classicDrbdSyncSpeed = 60 * 1024
1145 ip4AddressAny :: String
1146 ip4AddressAny = "0.0.0.0"
1148 ip4AddressLocalhost :: String
1149 ip4AddressLocalhost = "127.0.0.1"
1151 ip6AddressAny :: String
1152 ip6AddressAny = "::"
1154 ip6AddressLocalhost :: String
1155 ip6AddressLocalhost = "::1"
1163 validIpVersions :: FrozenSet Int
1164 validIpVersions = ConstantUtils.mkSet [ip4Version, ip6Version]
1166 tcpPingTimeout :: Int
1172 defaultDrbdHelper :: String
1173 defaultDrbdHelper = "/bin/true"
1178 defaultMacPrefix :: String
1179 defaultMacPrefix = "aa:00:00"
1181 -- | Default maximum instance wait time (seconds)
1182 defaultShutdownTimeout :: Int
1183 defaultShutdownTimeout = 120
1185 -- | Node clock skew (seconds)
1186 nodeMaxClockSkew :: Int
1187 nodeMaxClockSkew = 150
1189 -- | Time for an intra-cluster disk transfer to wait for a connection
1190 diskTransferConnectTimeout :: Int
1191 diskTransferConnectTimeout = 60
1193 -- | Disk index separator
1194 diskSeparator :: String
1195 diskSeparator = AutoConf.diskSeparator
1197 ipCommandPath :: String
1198 ipCommandPath = AutoConf.ipPath
1200 -- | Key for job IDs in opcode result
1204 -- * Runparts results
1215 runpartsStatus :: [Int]
1216 runpartsStatus = [runpartsErr, runpartsRun, runpartsSkip]
1220 rpcEncodingNone :: Int
1223 rpcEncodingZlibBase64 :: Int
1224 rpcEncodingZlibBase64 = 1
1228 -- Various time constants for the timeout table
1231 rpcTmoUrgent = Types.rpcTimeoutToRaw Urgent
1234 rpcTmoFast = Types.rpcTimeoutToRaw Fast
1237 rpcTmoNormal = Types.rpcTimeoutToRaw Normal
1240 rpcTmoSlow = Types.rpcTimeoutToRaw Slow
1242 -- | 'rpcTmo_4hrs' contains an underscore to circumvent a limitation
1243 -- in the 'Ganeti.THH.deCamelCase' function and generate the correct
1246 rpcTmo_4hrs = Types.rpcTimeoutToRaw FourHours
1248 -- | 'rpcTmo_1day' contains an underscore to circumvent a limitation
1249 -- in the 'Ganeti.THH.deCamelCase' function and generate the correct
1252 rpcTmo_1day = Types.rpcTimeoutToRaw OneDay
1254 -- | Timeout for connecting to nodes (seconds)
1255 rpcConnectTimeout :: Int
1256 rpcConnectTimeout = 5
1260 osScriptCreate :: String
1261 osScriptCreate = "create"
1263 osScriptExport :: String
1264 osScriptExport = "export"
1266 osScriptImport :: String
1267 osScriptImport = "import"
1269 osScriptRename :: String
1270 osScriptRename = "rename"
1272 osScriptVerify :: String
1273 osScriptVerify = "verify"
1275 osScripts :: [String]
1276 osScripts = [osScriptCreate, osScriptExport, osScriptImport, osScriptRename,
1280 osApiFile = "ganeti_api_version"
1282 osVariantsFile :: String
1283 osVariantsFile = "variants.list"
1285 osParametersFile :: String
1286 osParametersFile = "parameters.list"
1288 osValidateParameters :: String
1289 osValidateParameters = "parameters"
1291 osValidateCalls :: FrozenSet String
1292 osValidateCalls = ConstantUtils.mkSet [osValidateParameters]
1294 -- | External Storage (ES) related constants
1296 esActionAttach :: String
1297 esActionAttach = "attach"
1299 esActionCreate :: String
1300 esActionCreate = "create"
1302 esActionDetach :: String
1303 esActionDetach = "detach"
1305 esActionGrow :: String
1306 esActionGrow = "grow"
1308 esActionRemove :: String
1309 esActionRemove = "remove"
1311 esActionSetinfo :: String
1312 esActionSetinfo = "setinfo"
1314 esActionVerify :: String
1315 esActionVerify = "verify"
1317 esScriptCreate :: String
1318 esScriptCreate = esActionCreate
1320 esScriptRemove :: String
1321 esScriptRemove = esActionRemove
1323 esScriptGrow :: String
1324 esScriptGrow = esActionGrow
1326 esScriptAttach :: String
1327 esScriptAttach = esActionAttach
1329 esScriptDetach :: String
1330 esScriptDetach = esActionDetach
1332 esScriptSetinfo :: String
1333 esScriptSetinfo = esActionSetinfo
1335 esScriptVerify :: String
1336 esScriptVerify = esActionVerify
1338 esScripts :: FrozenSet String
1340 ConstantUtils.mkSet [esScriptAttach,
1348 esParametersFile :: String
1349 esParametersFile = "parameters.list"
1353 instanceRebootSoft :: String
1354 instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
1356 instanceRebootHard :: String
1357 instanceRebootHard = Types.rebootTypeToRaw RebootHard
1359 instanceRebootFull :: String
1360 instanceRebootFull = Types.rebootTypeToRaw RebootFull
1362 rebootTypes :: FrozenSet String
1363 rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
1365 -- * Instance reboot behaviors
1367 instanceRebootAllowed :: String
1368 instanceRebootAllowed = "reboot"
1370 instanceRebootExit :: String
1371 instanceRebootExit = "exit"
1373 rebootBehaviors :: [String]
1374 rebootBehaviors = [instanceRebootAllowed, instanceRebootExit]
1379 vtypeBool = VTypeBool
1384 vtypeMaybeString :: VType
1385 vtypeMaybeString = VTypeMaybeString
1389 vtypeSize = VTypeSize
1391 vtypeString :: VType
1392 vtypeString = VTypeString
1394 enforceableTypes :: FrozenSet VType
1395 enforceableTypes = ConstantUtils.mkSet [minBound..]
1397 -- | Constant representing that the user does not specify any IP version
1398 ifaceNoIpVersionSpecified :: Int
1399 ifaceNoIpVersionSpecified = 0
1401 validSerialSpeeds :: [Int]
1422 -- * HV parameter names (global namespace)
1427 hvBlockdevPrefix :: String
1428 hvBlockdevPrefix = "blockdev_prefix"
1430 hvBootloaderArgs :: String
1431 hvBootloaderArgs = "bootloader_args"
1433 hvBootloaderPath :: String
1434 hvBootloaderPath = "bootloader_path"
1436 hvBootOrder :: String
1437 hvBootOrder = "boot_order"
1439 hvCdromImagePath :: String
1440 hvCdromImagePath = "cdrom_image_path"
1443 hvCpuCap = "cpu_cap"
1445 hvCpuCores :: String
1446 hvCpuCores = "cpu_cores"
1449 hvCpuMask = "cpu_mask"
1451 hvCpuSockets :: String
1452 hvCpuSockets = "cpu_sockets"
1454 hvCpuThreads :: String
1455 hvCpuThreads = "cpu_threads"
1458 hvCpuType = "cpu_type"
1460 hvCpuWeight :: String
1461 hvCpuWeight = "cpu_weight"
1463 hvDeviceModel :: String
1464 hvDeviceModel = "device_model"
1466 hvDiskCache :: String
1467 hvDiskCache = "disk_cache"
1469 hvDiskType :: String
1470 hvDiskType = "disk_type"
1472 hvInitrdPath :: String
1473 hvInitrdPath = "initrd_path"
1475 hvInitScript :: String
1476 hvInitScript = "init_script"
1478 hvKernelArgs :: String
1479 hvKernelArgs = "kernel_args"
1481 hvKernelPath :: String
1482 hvKernelPath = "kernel_path"
1487 hvKvmCdrom2ImagePath :: String
1488 hvKvmCdrom2ImagePath = "cdrom2_image_path"
1490 hvKvmCdromDiskType :: String
1491 hvKvmCdromDiskType = "cdrom_disk_type"
1493 hvKvmExtra :: String
1494 hvKvmExtra = "kvm_extra"
1497 hvKvmFlag = "kvm_flag"
1499 hvKvmFloppyImagePath :: String
1500 hvKvmFloppyImagePath = "floppy_image_path"
1502 hvKvmMachineVersion :: String
1503 hvKvmMachineVersion = "machine_version"
1506 hvKvmPath = "kvm_path"
1508 hvKvmSpiceAudioCompr :: String
1509 hvKvmSpiceAudioCompr = "spice_playback_compression"
1511 hvKvmSpiceBind :: String
1512 hvKvmSpiceBind = "spice_bind"
1514 hvKvmSpiceIpVersion :: String
1515 hvKvmSpiceIpVersion = "spice_ip_version"
1517 hvKvmSpiceJpegImgCompr :: String
1518 hvKvmSpiceJpegImgCompr = "spice_jpeg_wan_compression"
1520 hvKvmSpiceLosslessImgCompr :: String
1521 hvKvmSpiceLosslessImgCompr = "spice_image_compression"
1523 hvKvmSpicePasswordFile :: String
1524 hvKvmSpicePasswordFile = "spice_password_file"
1526 hvKvmSpiceStreamingVideoDetection :: String
1527 hvKvmSpiceStreamingVideoDetection = "spice_streaming_video"
1529 hvKvmSpiceTlsCiphers :: String
1530 hvKvmSpiceTlsCiphers = "spice_tls_ciphers"
1532 hvKvmSpiceUseTls :: String
1533 hvKvmSpiceUseTls = "spice_use_tls"
1535 hvKvmSpiceUseVdagent :: String
1536 hvKvmSpiceUseVdagent = "spice_use_vdagent"
1538 hvKvmSpiceZlibGlzImgCompr :: String
1539 hvKvmSpiceZlibGlzImgCompr = "spice_zlib_glz_wan_compression"
1541 hvKvmUseChroot :: String
1542 hvKvmUseChroot = "use_chroot"
1545 hvMemPath = "mem_path"
1547 hvMigrationBandwidth :: String
1548 hvMigrationBandwidth = "migration_bandwidth"
1550 hvMigrationDowntime :: String
1551 hvMigrationDowntime = "migration_downtime"
1553 hvMigrationMode :: String
1554 hvMigrationMode = "migration_mode"
1556 hvMigrationPort :: String
1557 hvMigrationPort = "migration_port"
1560 hvNicType = "nic_type"
1565 hvPassthrough :: String
1566 hvPassthrough = "pci_pass"
1568 hvRebootBehavior :: String
1569 hvRebootBehavior = "reboot_behavior"
1571 hvRootPath :: String
1572 hvRootPath = "root_path"
1574 hvSecurityDomain :: String
1575 hvSecurityDomain = "security_domain"
1577 hvSecurityModel :: String
1578 hvSecurityModel = "security_model"
1580 hvSerialConsole :: String
1581 hvSerialConsole = "serial_console"
1583 hvSerialSpeed :: String
1584 hvSerialSpeed = "serial_speed"
1587 hvSoundhw = "soundhw"
1589 hvUsbDevices :: String
1590 hvUsbDevices = "usb_devices"
1592 hvUsbMouse :: String
1593 hvUsbMouse = "usb_mouse"
1595 hvUseBootloader :: String
1596 hvUseBootloader = "use_bootloader"
1598 hvUseLocaltime :: String
1599 hvUseLocaltime = "use_localtime"
1604 hvVhostNet :: String
1605 hvVhostNet = "vhost_net"
1607 hvVifScript :: String
1608 hvVifScript = "vif_script"
1611 hvVifType = "vif_type"
1613 hvViridian :: String
1614 hvViridian = "viridian"
1616 hvVncBindAddress :: String
1617 hvVncBindAddress = "vnc_bind_address"
1619 hvVncPasswordFile :: String
1620 hvVncPasswordFile = "vnc_password_file"
1623 hvVncTls = "vnc_tls"
1626 hvVncX509 = "vnc_x509_path"
1628 hvVncX509Verify :: String
1629 hvVncX509Verify = "vnc_x509_verify"
1632 hvVnetHdr = "vnet_hdr"
1635 hvXenCmd = "xen_cmd"
1637 hvXenCpuid :: String
1638 hvXenCpuid = "cpuid"
1640 hvsParameterTitles :: Map String String
1641 hvsParameterTitles =
1644 (hvBootOrder, "Boot_order"),
1645 (hvCdromImagePath, "CDROM_image_path"),
1646 (hvCpuType, "cpu_type"),
1647 (hvDiskType, "Disk_type"),
1648 (hvInitrdPath, "Initrd_path"),
1649 (hvKernelPath, "Kernel_path"),
1650 (hvNicType, "NIC_type"),
1652 (hvPassthrough, "pci_pass"),
1653 (hvVncBindAddress, "VNC_bind_address")]
1655 hvsParameters :: FrozenSet String
1656 hvsParameters = ConstantUtils.mkSet $ Map.keys hvsParameterTypes
1658 hvsParameterTypes :: Map String VType
1659 hvsParameterTypes = Map.fromList
1660 [ (hvAcpi, VTypeBool)
1661 , (hvBlockdevPrefix, VTypeString)
1662 , (hvBootloaderArgs, VTypeString)
1663 , (hvBootloaderPath, VTypeString)
1664 , (hvBootOrder, VTypeString)
1665 , (hvCdromImagePath, VTypeString)
1666 , (hvCpuCap, VTypeInt)
1667 , (hvCpuCores, VTypeInt)
1668 , (hvCpuMask, VTypeString)
1669 , (hvCpuSockets, VTypeInt)
1670 , (hvCpuThreads, VTypeInt)
1671 , (hvCpuType, VTypeString)
1672 , (hvCpuWeight, VTypeInt)
1673 , (hvDeviceModel, VTypeString)
1674 , (hvDiskCache, VTypeString)
1675 , (hvDiskType, VTypeString)
1676 , (hvInitrdPath, VTypeString)
1677 , (hvInitScript, VTypeString)
1678 , (hvKernelArgs, VTypeString)
1679 , (hvKernelPath, VTypeString)
1680 , (hvKeymap, VTypeString)
1681 , (hvKvmCdrom2ImagePath, VTypeString)
1682 , (hvKvmCdromDiskType, VTypeString)
1683 , (hvKvmExtra, VTypeString)
1684 , (hvKvmFlag, VTypeString)
1685 , (hvKvmFloppyImagePath, VTypeString)
1686 , (hvKvmMachineVersion, VTypeString)
1687 , (hvKvmPath, VTypeString)
1688 , (hvKvmSpiceAudioCompr, VTypeBool)
1689 , (hvKvmSpiceBind, VTypeString)
1690 , (hvKvmSpiceIpVersion, VTypeInt)
1691 , (hvKvmSpiceJpegImgCompr, VTypeString)
1692 , (hvKvmSpiceLosslessImgCompr, VTypeString)
1693 , (hvKvmSpicePasswordFile, VTypeString)
1694 , (hvKvmSpiceStreamingVideoDetection, VTypeString)
1695 , (hvKvmSpiceTlsCiphers, VTypeString)
1696 , (hvKvmSpiceUseTls, VTypeBool)
1697 , (hvKvmSpiceUseVdagent, VTypeBool)
1698 , (hvKvmSpiceZlibGlzImgCompr, VTypeString)
1699 , (hvKvmUseChroot, VTypeBool)
1700 , (hvMemPath, VTypeString)
1701 , (hvMigrationBandwidth, VTypeInt)
1702 , (hvMigrationDowntime, VTypeInt)
1703 , (hvMigrationMode, VTypeString)
1704 , (hvMigrationPort, VTypeInt)
1705 , (hvNicType, VTypeString)
1706 , (hvPae, VTypeBool)
1707 , (hvPassthrough, VTypeString)
1708 , (hvRebootBehavior, VTypeString)
1709 , (hvRootPath, VTypeMaybeString)
1710 , (hvSecurityDomain, VTypeString)
1711 , (hvSecurityModel, VTypeString)
1712 , (hvSerialConsole, VTypeBool)
1713 , (hvSerialSpeed, VTypeInt)
1714 , (hvSoundhw, VTypeString)
1715 , (hvUsbDevices, VTypeString)
1716 , (hvUsbMouse, VTypeString)
1717 , (hvUseBootloader, VTypeBool)
1718 , (hvUseLocaltime, VTypeBool)
1719 , (hvVga, VTypeString)
1720 , (hvVhostNet, VTypeBool)
1721 , (hvVifScript, VTypeString)
1722 , (hvVifType, VTypeString)
1723 , (hvViridian, VTypeBool)
1724 , (hvVncBindAddress, VTypeString)
1725 , (hvVncPasswordFile, VTypeString)
1726 , (hvVncTls, VTypeBool)
1727 , (hvVncX509, VTypeString)
1728 , (hvVncX509Verify, VTypeBool)
1729 , (hvVnetHdr, VTypeBool)
1730 , (hvXenCmd, VTypeString)
1731 , (hvXenCpuid, VTypeString)
1734 -- * Migration statuses
1736 hvMigrationActive :: String
1737 hvMigrationActive = "active"
1739 hvMigrationCancelled :: String
1740 hvMigrationCancelled = "cancelled"
1742 hvMigrationCompleted :: String
1743 hvMigrationCompleted = "completed"
1745 hvMigrationFailed :: String
1746 hvMigrationFailed = "failed"
1748 hvMigrationValidStatuses :: FrozenSet String
1749 hvMigrationValidStatuses =
1750 ConstantUtils.mkSet [hvMigrationActive,
1751 hvMigrationCancelled,
1752 hvMigrationCompleted,
1755 hvMigrationFailedStatuses :: FrozenSet String
1756 hvMigrationFailedStatuses =
1757 ConstantUtils.mkSet [hvMigrationFailed, hvMigrationCancelled]
1759 -- | KVM-specific statuses
1761 -- FIXME: this constant seems unnecessary
1762 hvKvmMigrationValidStatuses :: FrozenSet String
1763 hvKvmMigrationValidStatuses = hvMigrationValidStatuses
1766 hvNodeinfoKeyVersion :: String
1767 hvNodeinfoKeyVersion = "hv_version"
1769 -- * Hypervisor state
1771 hvstCpuNode :: String
1772 hvstCpuNode = "cpu_node"
1774 hvstCpuTotal :: String
1775 hvstCpuTotal = "cpu_total"
1777 hvstMemoryHv :: String
1778 hvstMemoryHv = "mem_hv"
1780 hvstMemoryNode :: String
1781 hvstMemoryNode = "mem_node"
1783 hvstMemoryTotal :: String
1784 hvstMemoryTotal = "mem_total"
1786 hvstsParameters :: FrozenSet String
1788 ConstantUtils.mkSet [hvstCpuNode,
1794 hvstDefaults :: Map String Int
1800 (hvstMemoryTotal, 0),
1801 (hvstMemoryNode, 0)]
1803 hvstsParameterTypes :: Map String VType
1804 hvstsParameterTypes =
1805 Map.fromList [(hvstMemoryTotal, VTypeInt),
1806 (hvstMemoryNode, VTypeInt),
1807 (hvstMemoryHv, VTypeInt),
1808 (hvstCpuTotal, VTypeInt),
1809 (hvstCpuNode, VTypeInt)]
1813 dsDiskOverhead :: String
1814 dsDiskOverhead = "disk_overhead"
1816 dsDiskReserved :: String
1817 dsDiskReserved = "disk_reserved"
1819 dsDiskTotal :: String
1820 dsDiskTotal = "disk_total"
1822 dsDefaults :: Map String Int
1826 (dsDiskReserved, 0),
1827 (dsDiskOverhead, 0)]
1829 dssParameterTypes :: Map String VType
1831 Map.fromList [(dsDiskTotal, VTypeInt),
1832 (dsDiskReserved, VTypeInt),
1833 (dsDiskOverhead, VTypeInt)]
1835 dssParameters :: FrozenSet String
1837 ConstantUtils.mkSet [dsDiskTotal, dsDiskReserved, dsDiskOverhead]
1839 dsValidTypes :: FrozenSet String
1840 dsValidTypes = ConstantUtils.mkSet [Types.diskTemplateToRaw DTPlain]
1842 -- Backend parameter names
1844 beAlwaysFailover :: String
1845 beAlwaysFailover = "always_failover"
1847 beAutoBalance :: String
1848 beAutoBalance = "auto_balance"
1853 -- | Deprecated and replaced by max and min mem
1860 beSpindleUse :: String
1861 beSpindleUse = "spindle_use"
1866 besParameterTypes :: Map String VType
1868 Map.fromList [(beAlwaysFailover, VTypeBool),
1869 (beAutoBalance, VTypeBool),
1870 (beMaxmem, VTypeSize),
1871 (beMinmem, VTypeSize),
1872 (beSpindleUse, VTypeInt),
1873 (beVcpus, VTypeInt)]
1875 besParameterTitles :: Map String String
1876 besParameterTitles =
1877 Map.fromList [(beAutoBalance, "Auto_balance"),
1878 (beMinmem, "ConfigMinMem"),
1879 (beVcpus, "ConfigVCPUs"),
1880 (beMaxmem, "ConfigMaxMem")]
1882 besParameterCompat :: Map String VType
1883 besParameterCompat = Map.insert beMemory VTypeSize besParameterTypes
1885 besParameters :: FrozenSet String
1887 ConstantUtils.mkSet [beAlwaysFailover,
1896 -- FIXME: these should be associated with 'Ganeti.HTools.Types.ISpec'
1898 ispecMemSize :: String
1899 ispecMemSize = ConstantUtils.ispecMemSize
1901 ispecCpuCount :: String
1902 ispecCpuCount = ConstantUtils.ispecCpuCount
1904 ispecDiskCount :: String
1905 ispecDiskCount = ConstantUtils.ispecDiskCount
1907 ispecDiskSize :: String
1908 ispecDiskSize = ConstantUtils.ispecDiskSize
1910 ispecNicCount :: String
1911 ispecNicCount = ConstantUtils.ispecNicCount
1913 ispecSpindleUse :: String
1914 ispecSpindleUse = ConstantUtils.ispecSpindleUse
1916 ispecsParameterTypes :: Map String VType
1917 ispecsParameterTypes =
1919 [(ConstantUtils.ispecDiskSize, VTypeInt),
1920 (ConstantUtils.ispecCpuCount, VTypeInt),
1921 (ConstantUtils.ispecSpindleUse, VTypeInt),
1922 (ConstantUtils.ispecMemSize, VTypeInt),
1923 (ConstantUtils.ispecNicCount, VTypeInt),
1924 (ConstantUtils.ispecDiskCount, VTypeInt)]
1926 ispecsParameters :: FrozenSet String
1928 ConstantUtils.mkSet [ConstantUtils.ispecCpuCount,
1929 ConstantUtils.ispecDiskCount,
1930 ConstantUtils.ispecDiskSize,
1931 ConstantUtils.ispecMemSize,
1932 ConstantUtils.ispecNicCount,
1933 ConstantUtils.ispecSpindleUse]
1935 ispecsMinmax :: String
1936 ispecsMinmax = ConstantUtils.ispecsMinmax
1945 ispecsStd = ConstantUtils.ispecsStd
1947 ipolicyDts :: String
1948 ipolicyDts = ConstantUtils.ipolicyDts
1950 ipolicyVcpuRatio :: String
1951 ipolicyVcpuRatio = ConstantUtils.ipolicyVcpuRatio
1953 ipolicySpindleRatio :: String
1954 ipolicySpindleRatio = ConstantUtils.ipolicySpindleRatio
1956 ispecsMinmaxKeys :: FrozenSet String
1957 ispecsMinmaxKeys = ConstantUtils.mkSet [ispecsMax, ispecsMin]
1959 ipolicyParameters :: FrozenSet String
1961 ConstantUtils.mkSet [ConstantUtils.ipolicyVcpuRatio,
1962 ConstantUtils.ipolicySpindleRatio]
1964 ipolicyAllKeys :: FrozenSet String
1966 ConstantUtils.union ipolicyParameters $
1967 ConstantUtils.mkSet [ConstantUtils.ipolicyDts,
1968 ConstantUtils.ispecsMinmax,
1971 -- | Node parameter names
1973 ndExclusiveStorage :: String
1974 ndExclusiveStorage = "exclusive_storage"
1976 ndOobProgram :: String
1977 ndOobProgram = "oob_program"
1979 ndSpindleCount :: String
1980 ndSpindleCount = "spindle_count"
1986 ndOvsLink = "ovs_link"
1989 ndOvsName = "ovs_name"
1991 ndsParameterTypes :: Map String VType
1994 [(ndExclusiveStorage, VTypeBool),
1995 (ndOobProgram, VTypeString),
1997 (ndOvsLink, VTypeMaybeString),
1998 (ndOvsName, VTypeMaybeString),
1999 (ndSpindleCount, VTypeInt)]
2001 ndsParameters :: FrozenSet String
2002 ndsParameters = ConstantUtils.mkSet (Map.keys ndsParameterTypes)
2004 ndsParameterTitles :: Map String String
2005 ndsParameterTitles =
2007 [(ndExclusiveStorage, "ExclusiveStorage"),
2008 (ndOobProgram, "OutOfBandProgram"),
2009 (ndOvs, "OpenvSwitch"),
2010 (ndOvsLink, "OpenvSwitchLink"),
2011 (ndOvsName, "OpenvSwitchName"),
2012 (ndSpindleCount, "SpindleCount")]
2014 -- * Logical Disks parameters
2017 ldpAccess = "access"
2019 ldpBarriers :: String
2020 ldpBarriers = "disabled-barriers"
2022 ldpDefaultMetavg :: String
2023 ldpDefaultMetavg = "default-metavg"
2025 ldpDelayTarget :: String
2026 ldpDelayTarget = "c-delay-target"
2028 ldpDiskCustom :: String
2029 ldpDiskCustom = "disk-custom"
2031 ldpDynamicResync :: String
2032 ldpDynamicResync = "dynamic-resync"
2034 ldpFillTarget :: String
2035 ldpFillTarget = "c-fill-target"
2037 ldpMaxRate :: String
2038 ldpMaxRate = "c-max-rate"
2040 ldpMinRate :: String
2041 ldpMinRate = "c-min-rate"
2043 ldpNetCustom :: String
2044 ldpNetCustom = "net-custom"
2046 ldpNoMetaFlush :: String
2047 ldpNoMetaFlush = "disable-meta-flush"
2049 ldpPlanAhead :: String
2050 ldpPlanAhead = "c-plan-ahead"
2055 ldpProtocol :: String
2056 ldpProtocol = "protocol"
2058 ldpResyncRate :: String
2059 ldpResyncRate = "resync-rate"
2061 ldpStripes :: String
2062 ldpStripes = "stripes"
2064 diskLdTypes :: Map String VType
2067 [(ldpAccess, VTypeString),
2068 (ldpResyncRate, VTypeInt),
2069 (ldpStripes, VTypeInt),
2070 (ldpBarriers, VTypeString),
2071 (ldpNoMetaFlush, VTypeBool),
2072 (ldpDefaultMetavg, VTypeString),
2073 (ldpDiskCustom, VTypeString),
2074 (ldpNetCustom, VTypeString),
2075 (ldpProtocol, VTypeString),
2076 (ldpDynamicResync, VTypeBool),
2077 (ldpPlanAhead, VTypeInt),
2078 (ldpFillTarget, VTypeInt),
2079 (ldpDelayTarget, VTypeInt),
2080 (ldpMaxRate, VTypeInt),
2081 (ldpMinRate, VTypeInt),
2082 (ldpPool, VTypeString)]
2084 diskLdParameters :: FrozenSet String
2085 diskLdParameters = ConstantUtils.mkSet (Map.keys diskLdTypes)
2087 -- * Disk template parameters
2089 -- Disk template parameters can be set/changed by the user via
2090 -- gnt-cluster and gnt-group)
2092 drbdResyncRate :: String
2093 drbdResyncRate = "resync-rate"
2095 drbdDataStripes :: String
2096 drbdDataStripes = "data-stripes"
2098 drbdMetaStripes :: String
2099 drbdMetaStripes = "meta-stripes"
2101 drbdDiskBarriers :: String
2102 drbdDiskBarriers = "disk-barriers"
2104 drbdMetaBarriers :: String
2105 drbdMetaBarriers = "meta-barriers"
2107 drbdDefaultMetavg :: String
2108 drbdDefaultMetavg = "metavg"
2110 drbdDiskCustom :: String
2111 drbdDiskCustom = "disk-custom"
2113 drbdNetCustom :: String
2114 drbdNetCustom = "net-custom"
2116 drbdProtocol :: String
2117 drbdProtocol = "protocol"
2119 drbdDynamicResync :: String
2120 drbdDynamicResync = "dynamic-resync"
2122 drbdPlanAhead :: String
2123 drbdPlanAhead = "c-plan-ahead"
2125 drbdFillTarget :: String
2126 drbdFillTarget = "c-fill-target"
2128 drbdDelayTarget :: String
2129 drbdDelayTarget = "c-delay-target"
2131 drbdMaxRate :: String
2132 drbdMaxRate = "c-max-rate"
2134 drbdMinRate :: String
2135 drbdMinRate = "c-min-rate"
2138 lvStripes = "stripes"
2141 rbdAccess = "access"
2146 diskDtTypes :: Map String VType
2148 Map.fromList [(drbdResyncRate, VTypeInt),
2149 (drbdDataStripes, VTypeInt),
2150 (drbdMetaStripes, VTypeInt),
2151 (drbdDiskBarriers, VTypeString),
2152 (drbdMetaBarriers, VTypeBool),
2153 (drbdDefaultMetavg, VTypeString),
2154 (drbdDiskCustom, VTypeString),
2155 (drbdNetCustom, VTypeString),
2156 (drbdProtocol, VTypeString),
2157 (drbdDynamicResync, VTypeBool),
2158 (drbdPlanAhead, VTypeInt),
2159 (drbdFillTarget, VTypeInt),
2160 (drbdDelayTarget, VTypeInt),
2161 (drbdMaxRate, VTypeInt),
2162 (drbdMinRate, VTypeInt),
2163 (lvStripes, VTypeInt),
2164 (rbdAccess, VTypeString),
2165 (rbdPool, VTypeString)]
2167 diskDtParameters :: FrozenSet String
2168 diskDtParameters = ConstantUtils.mkSet (Map.keys diskDtTypes)
2170 -- * Dynamic disk parameters
2172 ddpLocalIp :: String
2173 ddpLocalIp = "local-ip"
2175 ddpRemoteIp :: String
2176 ddpRemoteIp = "remote-ip"
2181 ddpLocalMinor :: String
2182 ddpLocalMinor = "local-minor"
2184 ddpRemoteMinor :: String
2185 ddpRemoteMinor = "remote-minor"
2187 -- * OOB supported commands
2189 oobPowerOn :: String
2190 oobPowerOn = Types.oobCommandToRaw OobPowerOn
2192 oobPowerOff :: String
2193 oobPowerOff = Types.oobCommandToRaw OobPowerOff
2195 oobPowerCycle :: String
2196 oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
2198 oobPowerStatus :: String
2199 oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
2202 oobHealth = Types.oobCommandToRaw OobHealth
2204 oobCommands :: FrozenSet String
2205 oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
2207 oobPowerStatusPowered :: String
2208 oobPowerStatusPowered = "powered"
2215 oobPowerDelay :: Double
2218 oobStatusCritical :: String
2219 oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
2221 oobStatusOk :: String
2222 oobStatusOk = Types.oobStatusToRaw OobStatusOk
2224 oobStatusUnknown :: String
2225 oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
2227 oobStatusWarning :: String
2228 oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
2230 oobStatuses :: FrozenSet String
2231 oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
2233 -- | Instance Parameters Profile
2235 ppDefault = "default"
2237 -- * nic* constants are used inside the ganeti config
2248 nicsParameterTypes :: Map String VType
2249 nicsParameterTypes =
2250 Map.fromList [(nicMode, vtypeString),
2251 (nicLink, vtypeString),
2252 (nicVlan, vtypeMaybeString)]
2254 nicsParameters :: FrozenSet String
2255 nicsParameters = ConstantUtils.mkSet (Map.keys nicsParameterTypes)
2257 nicModeBridged :: String
2258 nicModeBridged = Types.nICModeToRaw NMBridged
2260 nicModeRouted :: String
2261 nicModeRouted = Types.nICModeToRaw NMRouted
2263 nicModeOvs :: String
2264 nicModeOvs = Types.nICModeToRaw NMOvs
2267 nicIpPool = Types.nICModeToRaw NMPool
2269 nicValidModes :: FrozenSet String
2270 nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
2272 releaseAction :: String
2273 releaseAction = "release"
2275 reserveAction :: String
2276 reserveAction = "reserve"
2278 -- * idisk* constants are used in opcodes, to create/change disks
2280 idiskAdopt :: String
2281 idiskAdopt = "adopt"
2283 idiskMetavg :: String
2284 idiskMetavg = "metavg"
2295 idiskSpindles :: String
2296 idiskSpindles = "spindles"
2301 idiskProvider :: String
2302 idiskProvider = "provider"
2304 idiskParamsTypes :: Map String VType
2306 Map.fromList [(idiskSize, VTypeSize),
2307 (idiskSpindles, VTypeInt),
2308 (idiskMode, VTypeString),
2309 (idiskAdopt, VTypeString),
2310 (idiskVg, VTypeString),
2311 (idiskMetavg, VTypeString),
2312 (idiskProvider, VTypeString),
2313 (idiskName, VTypeMaybeString)]
2315 idiskParams :: FrozenSet String
2316 idiskParams = ConstantUtils.mkSet (Map.keys idiskParamsTypes)
2318 -- * inic* constants are used in opcodes, to create/change nics
2320 inicBridge :: String
2321 inicBridge = "bridge"
2338 inicNetwork :: String
2339 inicNetwork = "network"
2344 inicParamsTypes :: Map String VType
2346 Map.fromList [(inicBridge, VTypeMaybeString),
2347 (inicIp, VTypeMaybeString),
2348 (inicLink, VTypeString),
2349 (inicMac, VTypeString),
2350 (inicMode, VTypeString),
2351 (inicName, VTypeMaybeString),
2352 (inicNetwork, VTypeMaybeString),
2353 (inicVlan, VTypeMaybeString)]
2355 inicParams :: FrozenSet String
2356 inicParams = ConstantUtils.mkSet (Map.keys inicParamsTypes)
2358 -- * Hypervisor constants
2361 htXenPvm = Types.hypervisorToRaw XenPvm
2364 htFake = Types.hypervisorToRaw Fake
2367 htXenHvm = Types.hypervisorToRaw XenHvm
2370 htKvm = Types.hypervisorToRaw Kvm
2373 htChroot = Types.hypervisorToRaw Chroot
2376 htLxc = Types.hypervisorToRaw Lxc
2378 hyperTypes :: FrozenSet String
2379 hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
2381 htsReqPort :: FrozenSet String
2382 htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
2387 vncDefaultBindAddress :: String
2388 vncDefaultBindAddress = ip4AddressAny
2392 htNicE1000 :: String
2393 htNicE1000 = "e1000"
2395 htNicI82551 :: String
2396 htNicI82551 = "i82551"
2398 htNicI8259er :: String
2399 htNicI8259er = "i82559er"
2401 htNicI85557b :: String
2402 htNicI85557b = "i82557b"
2404 htNicNe2kIsa :: String
2405 htNicNe2kIsa = "ne2k_isa"
2407 htNicNe2kPci :: String
2408 htNicNe2kPci = "ne2k_pci"
2410 htNicParavirtual :: String
2411 htNicParavirtual = "paravirtual"
2413 htNicPcnet :: String
2414 htNicPcnet = "pcnet"
2416 htNicRtl8139 :: String
2417 htNicRtl8139 = "rtl8139"
2419 htHvmValidNicTypes :: FrozenSet String
2420 htHvmValidNicTypes =
2421 ConstantUtils.mkSet [htNicE1000,
2427 htKvmValidNicTypes :: FrozenSet String
2428 htKvmValidNicTypes =
2429 ConstantUtils.mkSet [htNicE1000,
2441 -- | Default vif type in xen-hvm
2442 htHvmVifIoemu :: String
2443 htHvmVifIoemu = "ioemu"
2445 htHvmVifVif :: String
2448 htHvmValidVifTypes :: FrozenSet String
2449 htHvmValidVifTypes = ConstantUtils.mkSet [htHvmVifIoemu, htHvmVifVif]
2456 htDiskIoemu :: String
2457 htDiskIoemu = "ioemu"
2462 htDiskParavirtual :: String
2463 htDiskParavirtual = "paravirtual"
2465 htDiskPflash :: String
2466 htDiskPflash = "pflash"
2468 htDiskScsi :: String
2474 htHvmValidDiskTypes :: FrozenSet String
2475 htHvmValidDiskTypes = ConstantUtils.mkSet [htDiskIoemu, htDiskParavirtual]
2477 htKvmValidDiskTypes :: FrozenSet String
2478 htKvmValidDiskTypes =
2479 ConstantUtils.mkSet [htDiskIde,
2486 htCacheDefault :: String
2487 htCacheDefault = "default"
2489 htCacheNone :: String
2490 htCacheNone = "none"
2492 htCacheWback :: String
2493 htCacheWback = "writeback"
2495 htCacheWthrough :: String
2496 htCacheWthrough = "writethrough"
2498 htValidCacheTypes :: FrozenSet String
2500 ConstantUtils.mkSet [htCacheDefault,
2507 htMouseMouse :: String
2508 htMouseMouse = "mouse"
2510 htMouseTablet :: String
2511 htMouseTablet = "tablet"
2513 htKvmValidMouseTypes :: FrozenSet String
2514 htKvmValidMouseTypes = ConstantUtils.mkSet [htMouseMouse, htMouseTablet]
2524 htBoFloppy :: String
2525 htBoFloppy = "floppy"
2527 htBoNetwork :: String
2528 htBoNetwork = "network"
2530 htKvmValidBoTypes :: FrozenSet String
2532 ConstantUtils.mkSet [htBoCdrom, htBoDisk, htBoFloppy, htBoNetwork]
2534 -- * SPICE lossless image compression options
2536 htKvmSpiceLosslessImgComprAutoGlz :: String
2537 htKvmSpiceLosslessImgComprAutoGlz = "auto_glz"
2539 htKvmSpiceLosslessImgComprAutoLz :: String
2540 htKvmSpiceLosslessImgComprAutoLz = "auto_lz"
2542 htKvmSpiceLosslessImgComprGlz :: String
2543 htKvmSpiceLosslessImgComprGlz = "glz"
2545 htKvmSpiceLosslessImgComprLz :: String
2546 htKvmSpiceLosslessImgComprLz = "lz"
2548 htKvmSpiceLosslessImgComprOff :: String
2549 htKvmSpiceLosslessImgComprOff = "off"
2551 htKvmSpiceLosslessImgComprQuic :: String
2552 htKvmSpiceLosslessImgComprQuic = "quic"
2554 htKvmSpiceValidLosslessImgComprOptions :: FrozenSet String
2555 htKvmSpiceValidLosslessImgComprOptions =
2556 ConstantUtils.mkSet [htKvmSpiceLosslessImgComprAutoGlz,
2557 htKvmSpiceLosslessImgComprAutoLz,
2558 htKvmSpiceLosslessImgComprGlz,
2559 htKvmSpiceLosslessImgComprLz,
2560 htKvmSpiceLosslessImgComprOff,
2561 htKvmSpiceLosslessImgComprQuic]
2563 htKvmSpiceLossyImgComprAlways :: String
2564 htKvmSpiceLossyImgComprAlways = "always"
2566 htKvmSpiceLossyImgComprAuto :: String
2567 htKvmSpiceLossyImgComprAuto = "auto"
2569 htKvmSpiceLossyImgComprNever :: String
2570 htKvmSpiceLossyImgComprNever = "never"
2572 htKvmSpiceValidLossyImgComprOptions :: FrozenSet String
2573 htKvmSpiceValidLossyImgComprOptions =
2574 ConstantUtils.mkSet [htKvmSpiceLossyImgComprAlways,
2575 htKvmSpiceLossyImgComprAuto,
2576 htKvmSpiceLossyImgComprNever]
2578 -- * SPICE video stream detection
2580 htKvmSpiceVideoStreamDetectionAll :: String
2581 htKvmSpiceVideoStreamDetectionAll = "all"
2583 htKvmSpiceVideoStreamDetectionFilter :: String
2584 htKvmSpiceVideoStreamDetectionFilter = "filter"
2586 htKvmSpiceVideoStreamDetectionOff :: String
2587 htKvmSpiceVideoStreamDetectionOff = "off"
2589 htKvmSpiceValidVideoStreamDetectionOptions :: FrozenSet String
2590 htKvmSpiceValidVideoStreamDetectionOptions =
2591 ConstantUtils.mkSet [htKvmSpiceVideoStreamDetectionAll,
2592 htKvmSpiceVideoStreamDetectionFilter,
2593 htKvmSpiceVideoStreamDetectionOff]
2595 -- * Security models
2606 htKvmValidSmTypes :: FrozenSet String
2607 htKvmValidSmTypes = ConstantUtils.mkSet [htSmNone, htSmPool, htSmUser]
2609 -- * Kvm flag values
2611 htKvmDisabled :: String
2612 htKvmDisabled = "disabled"
2614 htKvmEnabled :: String
2615 htKvmEnabled = "enabled"
2617 htKvmFlagValues :: FrozenSet String
2618 htKvmFlagValues = ConstantUtils.mkSet [htKvmDisabled, htKvmEnabled]
2622 htMigrationLive :: String
2623 htMigrationLive = Types.migrationModeToRaw MigrationLive
2625 htMigrationNonlive :: String
2626 htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
2628 htMigrationModes :: FrozenSet String
2630 ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
2632 -- * Cluster verify steps
2634 verifyNplusoneMem :: String
2635 verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
2637 verifyOptionalChecks :: FrozenSet String
2638 verifyOptionalChecks =
2639 ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
2641 -- * Cluster Verify error classes
2643 cvTcluster :: String
2644 cvTcluster = "cluster"
2652 cvTinstance :: String
2653 cvTinstance = "instance"
2655 -- * Cluster Verify error codes and documentation
2657 cvEclustercert :: (String, String, String)
2660 Types.cVErrorCodeToRaw CvECLUSTERCERT,
2661 "Cluster certificate files verification failure")
2663 cvEclustercfg :: (String, String, String)
2666 Types.cVErrorCodeToRaw CvECLUSTERCFG,
2667 "Cluster configuration verification failure")
2669 cvEclusterdanglinginst :: (String, String, String)
2670 cvEclusterdanglinginst =
2672 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
2673 "Some instances have a non-existing primary node")
2675 cvEclusterdanglingnodes :: (String, String, String)
2676 cvEclusterdanglingnodes =
2678 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
2679 "Some nodes belong to non-existing groups")
2681 cvEclusterfilecheck :: (String, String, String)
2682 cvEclusterfilecheck =
2684 Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
2685 "Cluster configuration verification failure")
2687 cvEgroupdifferentpvsize :: (String, String, String)
2688 cvEgroupdifferentpvsize =
2690 Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
2691 "PVs in the group have different sizes")
2693 cvEinstancebadnode :: (String, String, String)
2694 cvEinstancebadnode =
2696 Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
2697 "Instance marked as running lives on an offline node")
2699 cvEinstancedown :: (String, String, String)
2702 Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
2703 "Instance not running on its primary node")
2705 cvEinstancefaultydisk :: (String, String, String)
2706 cvEinstancefaultydisk =
2708 Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
2709 "Impossible to retrieve status for a disk")
2711 cvEinstancelayout :: (String, String, String)
2714 Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
2715 "Instance has multiple secondary nodes")
2717 cvEinstancemissingcfgparameter :: (String, String, String)
2718 cvEinstancemissingcfgparameter =
2720 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
2721 "A configuration parameter for an instance is missing")
2723 cvEinstancemissingdisk :: (String, String, String)
2724 cvEinstancemissingdisk =
2726 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
2727 "Missing volume on an instance")
2729 cvEinstancepolicy :: (String, String, String)
2732 Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
2733 "Instance does not meet policy")
2735 cvEinstancesplitgroups :: (String, String, String)
2736 cvEinstancesplitgroups =
2738 Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
2739 "Instance with primary and secondary nodes in different groups")
2741 cvEinstanceunsuitablenode :: (String, String, String)
2742 cvEinstanceunsuitablenode =
2744 Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
2745 "Instance running on nodes that are not suitable for it")
2747 cvEinstancewrongnode :: (String, String, String)
2748 cvEinstancewrongnode =
2750 Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
2751 "Instance running on the wrong node")
2753 cvEnodedrbd :: (String, String, String)
2756 Types.cVErrorCodeToRaw CvENODEDRBD,
2757 "Error parsing the DRBD status file")
2759 cvEnodedrbdhelper :: (String, String, String)
2762 Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
2763 "Error caused by the DRBD helper")
2765 cvEnodedrbdversion :: (String, String, String)
2766 cvEnodedrbdversion =
2768 Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
2769 "DRBD version mismatch within a node group")
2771 cvEnodefilecheck :: (String, String, String)
2774 Types.cVErrorCodeToRaw CvENODEFILECHECK,
2775 "Error retrieving the checksum of the node files")
2777 cvEnodefilestoragepaths :: (String, String, String)
2778 cvEnodefilestoragepaths =
2780 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
2781 "Detected bad file storage paths")
2783 cvEnodefilestoragepathunusable :: (String, String, String)
2784 cvEnodefilestoragepathunusable =
2786 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
2787 "File storage path unusable")
2789 cvEnodehooks :: (String, String, String)
2792 Types.cVErrorCodeToRaw CvENODEHOOKS,
2793 "Communication failure in hooks execution")
2795 cvEnodehv :: (String, String, String)
2798 Types.cVErrorCodeToRaw CvENODEHV,
2799 "Hypervisor parameters verification failure")
2801 cvEnodelvm :: (String, String, String)
2804 Types.cVErrorCodeToRaw CvENODELVM,
2805 "LVM-related node error")
2807 cvEnoden1 :: (String, String, String)
2810 Types.cVErrorCodeToRaw CvENODEN1,
2811 "Not enough memory to accommodate instance failovers")
2813 cvEnodenet :: (String, String, String)
2816 Types.cVErrorCodeToRaw CvENODENET,
2817 "Network-related node error")
2819 cvEnodeoobpath :: (String, String, String)
2822 Types.cVErrorCodeToRaw CvENODEOOBPATH,
2823 "Invalid Out Of Band path")
2825 cvEnodeorphaninstance :: (String, String, String)
2826 cvEnodeorphaninstance =
2828 Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
2829 "Unknown intance running on a node")
2831 cvEnodeorphanlv :: (String, String, String)
2834 Types.cVErrorCodeToRaw CvENODEORPHANLV,
2835 "Unknown LVM logical volume")
2837 cvEnodeos :: (String, String, String)
2840 Types.cVErrorCodeToRaw CvENODEOS,
2841 "OS-related node error")
2843 cvEnoderpc :: (String, String, String)
2846 Types.cVErrorCodeToRaw CvENODERPC,
2847 "Error during connection to the primary node of an instance")
2849 cvEnodesetup :: (String, String, String)
2852 Types.cVErrorCodeToRaw CvENODESETUP,
2855 cvEnodesharedfilestoragepathunusable :: (String, String, String)
2856 cvEnodesharedfilestoragepathunusable =
2858 Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
2859 "Shared file storage path unusable")
2861 cvEnodessh :: (String, String, String)
2864 Types.cVErrorCodeToRaw CvENODESSH,
2865 "SSH-related node error")
2867 cvEnodetime :: (String, String, String)
2870 Types.cVErrorCodeToRaw CvENODETIME,
2871 "Node returned invalid time")
2873 cvEnodeuserscripts :: (String, String, String)
2874 cvEnodeuserscripts =
2876 Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
2877 "User scripts not present or not executable")
2879 cvEnodeversion :: (String, String, String)
2882 Types.cVErrorCodeToRaw CvENODEVERSION,
2883 "Protocol version mismatch or Ganeti version mismatch")
2885 cvAllEcodes :: FrozenSet (String, String, String)
2890 cvEclusterdanglinginst,
2891 cvEclusterdanglingnodes,
2892 cvEclusterfilecheck,
2893 cvEgroupdifferentpvsize,
2896 cvEinstancefaultydisk,
2898 cvEinstancemissingcfgparameter,
2899 cvEinstancemissingdisk,
2901 cvEinstancesplitgroups,
2902 cvEinstanceunsuitablenode,
2903 cvEinstancewrongnode,
2908 cvEnodefilestoragepaths,
2909 cvEnodefilestoragepathunusable,
2916 cvEnodeorphaninstance,
2921 cvEnodesharedfilestoragepathunusable,
2927 cvAllEcodesStrings :: FrozenSet String
2928 cvAllEcodesStrings =
2929 ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
2931 -- * Node verify constants
2934 nvBridges = "bridges"
2936 nvDrbdhelper :: String
2937 nvDrbdhelper = "drbd-helper"
2939 nvDrbdversion :: String
2940 nvDrbdversion = "drbd-version"
2942 nvDrbdlist :: String
2943 nvDrbdlist = "drbd-list"
2945 nvExclusivepvs :: String
2946 nvExclusivepvs = "exclusive-pvs"
2948 nvFilelist :: String
2949 nvFilelist = "filelist"
2951 nvAcceptedStoragePaths :: String
2952 nvAcceptedStoragePaths = "allowed-file-storage-paths"
2954 nvFileStoragePath :: String
2955 nvFileStoragePath = "file-storage-path"
2957 nvSharedFileStoragePath :: String
2958 nvSharedFileStoragePath = "shared-file-storage-path"
2963 nvHvparams :: String
2964 nvHvparams = "hvparms"
2966 nvHypervisor :: String
2967 nvHypervisor = "hypervisor"
2969 nvInstancelist :: String
2970 nvInstancelist = "instancelist"
2975 nvMasterip :: String
2976 nvMasterip = "master-ip"
2978 nvNodelist :: String
2979 nvNodelist = "nodelist"
2981 nvNodenettest :: String
2982 nvNodenettest = "node-net-test"
2984 nvNodesetup :: String
2985 nvNodesetup = "nodesetup"
2987 nvOobPaths :: String
2988 nvOobPaths = "oob-paths"
2999 nvUserscripts :: String
3000 nvUserscripts = "user-scripts"
3003 nvVersion = "version"
3009 nvVmnodes = "vmnodes"
3011 -- * Instance status
3013 inststAdmindown :: String
3014 inststAdmindown = Types.instanceStatusToRaw StatusDown
3016 inststAdminoffline :: String
3017 inststAdminoffline = Types.instanceStatusToRaw StatusOffline
3019 inststErrordown :: String
3020 inststErrordown = Types.instanceStatusToRaw ErrorDown
3022 inststErrorup :: String
3023 inststErrorup = Types.instanceStatusToRaw ErrorUp
3025 inststNodedown :: String
3026 inststNodedown = Types.instanceStatusToRaw NodeDown
3028 inststNodeoffline :: String
3029 inststNodeoffline = Types.instanceStatusToRaw NodeOffline
3031 inststRunning :: String
3032 inststRunning = Types.instanceStatusToRaw Running
3034 inststWrongnode :: String
3035 inststWrongnode = Types.instanceStatusToRaw WrongNode
3037 inststAll :: FrozenSet String
3038 inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
3042 adminstDown :: String
3043 adminstDown = Types.adminStateToRaw AdminDown
3045 adminstOffline :: String
3046 adminstOffline = Types.adminStateToRaw AdminOffline
3049 adminstUp = Types.adminStateToRaw AdminUp
3051 adminstAll :: FrozenSet String
3052 adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
3057 nrDrained = Types.nodeRoleToRaw NRDrained
3060 nrMaster = Types.nodeRoleToRaw NRMaster
3062 nrMcandidate :: String
3063 nrMcandidate = Types.nodeRoleToRaw NRCandidate
3066 nrOffline = Types.nodeRoleToRaw NROffline
3069 nrRegular = Types.nodeRoleToRaw NRRegular
3071 nrAll :: FrozenSet String
3072 nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
3074 -- * SSL certificate check constants (in days)
3076 sslCertExpirationError :: Int
3077 sslCertExpirationError = 7
3079 sslCertExpirationWarn :: Int
3080 sslCertExpirationWarn = 30
3082 -- * Allocator framework constants
3084 iallocatorVersion :: Int
3085 iallocatorVersion = 2
3087 iallocatorDirIn :: String
3088 iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
3090 iallocatorDirOut :: String
3091 iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
3093 validIallocatorDirections :: FrozenSet String
3094 validIallocatorDirections =
3095 ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
3097 iallocatorModeAlloc :: String
3098 iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
3100 iallocatorModeChgGroup :: String
3101 iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
3103 iallocatorModeMultiAlloc :: String
3104 iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
3106 iallocatorModeNodeEvac :: String
3107 iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
3109 iallocatorModeReloc :: String
3110 iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
3112 validIallocatorModes :: FrozenSet String
3113 validIallocatorModes =
3114 ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
3116 iallocatorSearchPath :: [String]
3117 iallocatorSearchPath = AutoConf.iallocatorSearchPath
3119 defaultIallocatorShortcut :: String
3120 defaultIallocatorShortcut = "."
3122 -- * Node evacuation
3124 nodeEvacPri :: String
3125 nodeEvacPri = Types.evacModeToRaw ChangePrimary
3127 nodeEvacSec :: String
3128 nodeEvacSec = Types.evacModeToRaw ChangeSecondary
3130 nodeEvacAll :: String
3131 nodeEvacAll = Types.evacModeToRaw ChangeAll
3133 nodeEvacModes :: FrozenSet String
3134 nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..]
3138 jobQueueVersion :: Int
3141 jobQueueSizeHardLimit :: Int
3142 jobQueueSizeHardLimit = 5000
3144 jobQueueFilesPerms :: Int
3145 jobQueueFilesPerms = 0o640
3147 -- * Unchanged job return
3149 jobNotchanged :: String
3150 jobNotchanged = "nochange"
3154 jobStatusQueued :: String
3155 jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
3157 jobStatusWaiting :: String
3158 jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
3160 jobStatusCanceling :: String
3161 jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
3163 jobStatusRunning :: String
3164 jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
3166 jobStatusCanceled :: String
3167 jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
3169 jobStatusSuccess :: String
3170 jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
3172 jobStatusError :: String
3173 jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
3175 jobsPending :: FrozenSet String
3177 ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
3179 jobsFinalized :: FrozenSet String
3181 ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
3183 jobStatusAll :: FrozenSet String
3184 jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
3188 -- ** Not yet finalized opcodes
3190 opStatusCanceling :: String
3191 opStatusCanceling = "canceling"
3193 opStatusQueued :: String
3194 opStatusQueued = "queued"
3196 opStatusRunning :: String
3197 opStatusRunning = "running"
3199 opStatusWaiting :: String
3200 opStatusWaiting = "waiting"
3202 -- ** Finalized opcodes
3204 opStatusCanceled :: String
3205 opStatusCanceled = "canceled"
3207 opStatusError :: String
3208 opStatusError = "error"
3210 opStatusSuccess :: String
3211 opStatusSuccess = "success"
3213 opsFinalized :: FrozenSet String
3215 ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
3217 -- * OpCode priority
3222 opPrioHighest :: Int
3226 opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
3229 opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
3232 opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
3234 opPrioSubmitValid :: FrozenSet Int
3235 opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
3237 opPrioDefault :: Int
3238 opPrioDefault = opPrioNormal
3240 -- * Lock recalculate mode
3242 locksAppend :: String
3243 locksAppend = "append"
3245 locksReplace :: String
3246 locksReplace = "replace"
3250 -- The lock timeout (sum) before we transition into blocking acquire
3251 -- (this can still be reset by priority change). Computed as max time
3252 -- (10 hours) before we should actually go into blocking acquire,
3253 -- given that we start from the default priority level.
3255 lockAttemptsMaxwait :: Double
3256 lockAttemptsMaxwait = 15.0
3258 lockAttemptsMinwait :: Double
3259 lockAttemptsMinwait = 1.0
3261 lockAttemptsTimeout :: Int
3262 lockAttemptsTimeout = (10 * 3600) `div` (opPrioDefault - opPrioHighest)
3264 -- * Execution log types
3266 elogMessage :: String
3267 elogMessage = Types.eLogTypeToRaw ELogMessage
3269 elogRemoteImport :: String
3270 elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
3272 elogJqueueTest :: String
3273 elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
3275 -- * /etc/hosts modification
3277 etcHostsAdd :: String
3280 etcHostsRemove :: String
3281 etcHostsRemove = "remove"
3285 jqtMsgprefix :: String
3286 jqtMsgprefix = "TESTMSG="
3291 jqtExpandnames :: String
3292 jqtExpandnames = "expandnames"
3295 jqtLogmsg = "logmsg"
3297 jqtStartmsg :: String
3298 jqtStartmsg = "startmsg"
3300 jqtAll :: FrozenSet String
3301 jqtAll = ConstantUtils.mkSet [jqtExec, jqtExpandnames, jqtLogmsg, jqtStartmsg]
3303 -- * Query resources
3306 qrCluster = "cluster"
3311 qrExtstorage :: String
3312 qrExtstorage = "extstorage"
3317 qrInstance :: String
3318 qrInstance = "instance"
3327 qrNetwork = "network"
3335 -- | List of resources which can be queried using 'Ganeti.OpCodes.OpQuery'
3336 qrViaOp :: FrozenSet String
3338 ConstantUtils.mkSet [qrCluster,
3347 -- | List of resources which can be queried using Local UniX Interface
3348 qrViaLuxi :: FrozenSet String
3349 qrViaLuxi = ConstantUtils.mkSet [qrLock, qrJob]
3351 -- | List of resources which can be queried using RAPI
3352 qrViaRapi :: FrozenSet String
3353 qrViaRapi = qrViaLuxi
3355 -- * Query field types
3361 qftNumber = "number"
3369 qftTimestamp :: String
3370 qftTimestamp = "timestamp"
3375 qftUnknown :: String
3376 qftUnknown = "unknown"
3378 qftAll :: FrozenSet String
3380 ConstantUtils.mkSet [qftBool,
3388 -- * Query result field status
3390 -- Don't change or reuse values as they're used by clients.
3392 -- FIXME: link with 'Ganeti.Query.Language.ResultStatus'
3394 -- | No data (e.g. RPC error), can be used instead of 'rsOffline'
3401 -- | Resource marked offline
3405 -- | Value unavailable/unsupported for item; if this field is
3406 -- supported but we cannot get the data for the moment, 'rsNodata' or
3407 -- 'rsOffline' should be used
3414 rsAll :: FrozenSet Int
3416 ConstantUtils.mkSet [rsNodata,
3422 -- | Special field cases and their verbose/terse formatting
3423 rssDescription :: Map Int (String, String)
3425 Map.fromList [(rsUnknown, ("(unknown)", "??")),
3426 (rsNodata, ("(nodata)", "?")),
3427 (rsOffline, ("(offline)", "*")),
3428 (rsUnavail, ("(unavail)", "-"))]
3430 -- * Max dynamic devices
3433 maxDisks = Types.maxDisks
3436 maxNics = Types.maxNics
3438 -- | SSCONF file prefix
3439 ssconfFileprefix :: String
3440 ssconfFileprefix = "ssconf_"
3444 ssClusterName :: String
3445 ssClusterName = "cluster_name"
3447 ssClusterTags :: String
3448 ssClusterTags = "cluster_tags"
3450 ssFileStorageDir :: String
3451 ssFileStorageDir = "file_storage_dir"
3453 ssSharedFileStorageDir :: String
3454 ssSharedFileStorageDir = "shared_file_storage_dir"
3456 ssMasterCandidates :: String
3457 ssMasterCandidates = "master_candidates"
3459 ssMasterCandidatesIps :: String
3460 ssMasterCandidatesIps = "master_candidates_ips"
3462 ssMasterIp :: String
3463 ssMasterIp = "master_ip"
3465 ssMasterNetdev :: String
3466 ssMasterNetdev = "master_netdev"
3468 ssMasterNetmask :: String
3469 ssMasterNetmask = "master_netmask"
3471 ssMasterNode :: String
3472 ssMasterNode = "master_node"
3474 ssNodeList :: String
3475 ssNodeList = "node_list"
3477 ssNodePrimaryIps :: String
3478 ssNodePrimaryIps = "node_primary_ips"
3480 ssNodeSecondaryIps :: String
3481 ssNodeSecondaryIps = "node_secondary_ips"
3483 ssOfflineNodes :: String
3484 ssOfflineNodes = "offline_nodes"
3486 ssOnlineNodes :: String
3487 ssOnlineNodes = "online_nodes"
3489 ssPrimaryIpFamily :: String
3490 ssPrimaryIpFamily = "primary_ip_family"
3492 ssInstanceList :: String
3493 ssInstanceList = "instance_list"
3495 ssReleaseVersion :: String
3496 ssReleaseVersion = "release_version"
3498 ssHypervisorList :: String
3499 ssHypervisorList = "hypervisor_list"
3501 ssMaintainNodeHealth :: String
3502 ssMaintainNodeHealth = "maintain_node_health"
3505 ssUidPool = "uid_pool"
3507 ssNodegroups :: String
3508 ssNodegroups = "nodegroups"
3510 ssNetworks :: String
3511 ssNetworks = "networks"
3513 -- | This is not a complete SSCONF key, but the prefix for the
3515 ssHvparamsPref :: String
3516 ssHvparamsPref = "hvparams_"
3520 ssHvparamsXenChroot :: String
3521 ssHvparamsXenChroot = ssHvparamsPref ++ htChroot
3523 ssHvparamsXenFake :: String
3524 ssHvparamsXenFake = ssHvparamsPref ++ htFake
3526 ssHvparamsXenHvm :: String
3527 ssHvparamsXenHvm = ssHvparamsPref ++ htXenHvm
3529 ssHvparamsXenKvm :: String
3530 ssHvparamsXenKvm = ssHvparamsPref ++ htKvm
3532 ssHvparamsXenLxc :: String
3533 ssHvparamsXenLxc = ssHvparamsPref ++ htLxc
3535 ssHvparamsXenPvm :: String
3536 ssHvparamsXenPvm = ssHvparamsPref ++ htXenPvm
3538 validSsHvparamsKeys :: FrozenSet String
3539 validSsHvparamsKeys =
3540 ConstantUtils.mkSet [ssHvparamsXenChroot,
3550 -- | Cluster wide default parameters
3551 defaultEnabledHypervisor :: String
3552 defaultEnabledHypervisor = htXenPvm
3554 hvcDefaults :: Map Hypervisor (Map String PyValueEx)
3557 [ (XenPvm, Map.fromList
3558 [ (hvUseBootloader, PyValueEx False)
3559 , (hvBootloaderPath, PyValueEx xenBootloader)
3560 , (hvBootloaderArgs, PyValueEx "")
3561 , (hvKernelPath, PyValueEx xenKernel)
3562 , (hvInitrdPath, PyValueEx "")
3563 , (hvRootPath, PyValueEx "/dev/xvda1")
3564 , (hvKernelArgs, PyValueEx "ro")
3565 , (hvMigrationPort, PyValueEx (8002 :: Int))
3566 , (hvMigrationMode, PyValueEx htMigrationLive)
3567 , (hvBlockdevPrefix, PyValueEx "sd")
3568 , (hvRebootBehavior, PyValueEx instanceRebootAllowed)
3569 , (hvCpuMask, PyValueEx cpuPinningAll)
3570 , (hvCpuCap, PyValueEx (0 :: Int))
3571 , (hvCpuWeight, PyValueEx (256 :: Int))
3572 , (hvVifScript, PyValueEx "")
3573 , (hvXenCmd, PyValueEx xenCmdXm)
3574 , (hvXenCpuid, PyValueEx "")
3575 , (hvSoundhw, PyValueEx "")
3577 , (XenHvm, Map.fromList
3578 [ (hvBootOrder, PyValueEx "cd")
3579 , (hvCdromImagePath, PyValueEx "")
3580 , (hvNicType, PyValueEx htNicRtl8139)
3581 , (hvDiskType, PyValueEx htDiskParavirtual)
3582 , (hvVncBindAddress, PyValueEx ip4AddressAny)
3583 , (hvAcpi, PyValueEx True)
3584 , (hvPae, PyValueEx True)
3585 , (hvKernelPath, PyValueEx "/usr/lib/xen/boot/hvmloader")
3586 , (hvDeviceModel, PyValueEx "/usr/lib/xen/bin/qemu-dm")
3587 , (hvMigrationPort, PyValueEx (8002 :: Int))
3588 , (hvMigrationMode, PyValueEx htMigrationNonlive)
3589 , (hvUseLocaltime, PyValueEx False)
3590 , (hvBlockdevPrefix, PyValueEx "hd")
3591 , (hvPassthrough, PyValueEx "")
3592 , (hvRebootBehavior, PyValueEx instanceRebootAllowed)
3593 , (hvCpuMask, PyValueEx cpuPinningAll)
3594 , (hvCpuCap, PyValueEx (0 :: Int))
3595 , (hvCpuWeight, PyValueEx (256 :: Int))
3596 , (hvVifType, PyValueEx htHvmVifIoemu)
3597 , (hvVifScript, PyValueEx "")
3598 , (hvViridian, PyValueEx False)
3599 , (hvXenCmd, PyValueEx xenCmdXm)
3600 , (hvXenCpuid, PyValueEx "")
3601 , (hvSoundhw, PyValueEx "")
3603 , (Kvm, Map.fromList
3604 [ (hvKvmPath, PyValueEx kvmPath)
3605 , (hvKernelPath, PyValueEx kvmKernel)
3606 , (hvInitrdPath, PyValueEx "")
3607 , (hvKernelArgs, PyValueEx "ro")
3608 , (hvRootPath, PyValueEx "/dev/vda1")
3609 , (hvAcpi, PyValueEx True)
3610 , (hvSerialConsole, PyValueEx True)
3611 , (hvSerialSpeed, PyValueEx (38400 :: Int))
3612 , (hvVncBindAddress, PyValueEx "")
3613 , (hvVncTls, PyValueEx False)
3614 , (hvVncX509, PyValueEx "")
3615 , (hvVncX509Verify, PyValueEx False)
3616 , (hvVncPasswordFile, PyValueEx "")
3617 , (hvKvmSpiceBind, PyValueEx "")
3618 , (hvKvmSpiceIpVersion, PyValueEx ifaceNoIpVersionSpecified)
3619 , (hvKvmSpicePasswordFile, PyValueEx "")
3620 , (hvKvmSpiceLosslessImgCompr, PyValueEx "")
3621 , (hvKvmSpiceJpegImgCompr, PyValueEx "")
3622 , (hvKvmSpiceZlibGlzImgCompr, PyValueEx "")
3623 , (hvKvmSpiceStreamingVideoDetection, PyValueEx "")
3624 , (hvKvmSpiceAudioCompr, PyValueEx True)
3625 , (hvKvmSpiceUseTls, PyValueEx False)
3626 , (hvKvmSpiceTlsCiphers, PyValueEx opensslCiphers)
3627 , (hvKvmSpiceUseVdagent, PyValueEx True)
3628 , (hvKvmFloppyImagePath, PyValueEx "")
3629 , (hvCdromImagePath, PyValueEx "")
3630 , (hvKvmCdrom2ImagePath, PyValueEx "")
3631 , (hvBootOrder, PyValueEx htBoDisk)
3632 , (hvNicType, PyValueEx htNicParavirtual)
3633 , (hvDiskType, PyValueEx htDiskParavirtual)
3634 , (hvKvmCdromDiskType, PyValueEx "")
3635 , (hvUsbMouse, PyValueEx "")
3636 , (hvKeymap, PyValueEx "")
3637 , (hvMigrationPort, PyValueEx (8102 :: Int))
3638 , (hvMigrationBandwidth, PyValueEx (32 :: Int))
3639 , (hvMigrationDowntime, PyValueEx (30 :: Int))
3640 , (hvMigrationMode, PyValueEx htMigrationLive)
3641 , (hvUseLocaltime, PyValueEx False)
3642 , (hvDiskCache, PyValueEx htCacheDefault)
3643 , (hvSecurityModel, PyValueEx htSmNone)
3644 , (hvSecurityDomain, PyValueEx "")
3645 , (hvKvmFlag, PyValueEx "")
3646 , (hvVhostNet, PyValueEx False)
3647 , (hvKvmUseChroot, PyValueEx False)
3648 , (hvMemPath, PyValueEx "")
3649 , (hvRebootBehavior, PyValueEx instanceRebootAllowed)
3650 , (hvCpuMask, PyValueEx cpuPinningAll)
3651 , (hvCpuType, PyValueEx "")
3652 , (hvCpuCores, PyValueEx (0 :: Int))
3653 , (hvCpuThreads, PyValueEx (0 :: Int))
3654 , (hvCpuSockets, PyValueEx (0 :: Int))
3655 , (hvSoundhw, PyValueEx "")
3656 , (hvUsbDevices, PyValueEx "")
3657 , (hvVga, PyValueEx "")
3658 , (hvKvmExtra, PyValueEx "")
3659 , (hvKvmMachineVersion, PyValueEx "")
3660 , (hvVnetHdr, PyValueEx True)])
3661 , (Fake, Map.fromList [(hvMigrationMode, PyValueEx htMigrationLive)])
3662 , (Chroot, Map.fromList [(hvInitScript, PyValueEx "/ganeti-chroot")])
3663 , (Lxc, Map.fromList [(hvCpuMask, PyValueEx "")])
3666 hvcGlobals :: FrozenSet String
3668 ConstantUtils.mkSet [hvMigrationBandwidth,
3673 becDefaults :: Map String PyValueEx
3676 [ (beMinmem, PyValueEx (128 :: Int))
3677 , (beMaxmem, PyValueEx (128 :: Int))
3678 , (beVcpus, PyValueEx (1 :: Int))
3679 , (beAutoBalance, PyValueEx True)
3680 , (beAlwaysFailover, PyValueEx False)
3681 , (beSpindleUse, PyValueEx (1 :: Int))
3684 ndcDefaults :: Map String PyValueEx
3687 [ (ndOobProgram, PyValueEx "")
3688 , (ndSpindleCount, PyValueEx (1 :: Int))
3689 , (ndExclusiveStorage, PyValueEx False)
3690 , (ndOvs, PyValueEx False)
3691 , (ndOvsName, PyValueEx defaultOvs)
3692 , (ndOvsLink, PyValueEx "")
3695 ndcGlobals :: FrozenSet String
3696 ndcGlobals = ConstantUtils.mkSet [ndExclusiveStorage]
3698 -- | Default delay target measured in sectors
3699 defaultDelayTarget :: Int
3700 defaultDelayTarget = 1
3702 defaultDiskCustom :: String
3703 defaultDiskCustom = ""
3705 defaultDiskResync :: Bool
3706 defaultDiskResync = False
3708 -- | Default fill target measured in sectors
3709 defaultFillTarget :: Int
3710 defaultFillTarget = 0
3712 -- | Default mininum rate measured in KiB/s
3713 defaultMinRate :: Int
3714 defaultMinRate = 4 * 1024
3716 defaultNetCustom :: String
3717 defaultNetCustom = ""
3719 -- | Default plan ahead measured in sectors
3721 -- The default values for the DRBD dynamic resync speed algorithm are
3722 -- taken from the drbsetup 8.3.11 man page, except for c-plan-ahead
3723 -- (that we don't need to set to 0, because we have a separate option
3724 -- to enable it) and for c-max-rate, that we cap to the default value
3725 -- for the static resync rate.
3726 defaultPlanAhead :: Int
3727 defaultPlanAhead = 20
3729 defaultRbdPool :: String
3730 defaultRbdPool = "rbd"
3732 diskLdDefaults :: Map DiskTemplate (Map String PyValueEx)
3735 [ (DTBlock, Map.empty)
3736 , (DTDrbd8, Map.fromList
3737 [ (ldpBarriers, PyValueEx drbdBarriers)
3738 , (ldpDefaultMetavg, PyValueEx defaultVg)
3739 , (ldpDelayTarget, PyValueEx defaultDelayTarget)
3740 , (ldpDiskCustom, PyValueEx defaultDiskCustom)
3741 , (ldpDynamicResync, PyValueEx defaultDiskResync)
3742 , (ldpFillTarget, PyValueEx defaultFillTarget)
3743 , (ldpMaxRate, PyValueEx classicDrbdSyncSpeed)
3744 , (ldpMinRate, PyValueEx defaultMinRate)
3745 , (ldpNetCustom, PyValueEx defaultNetCustom)
3746 , (ldpNoMetaFlush, PyValueEx drbdNoMetaFlush)
3747 , (ldpPlanAhead, PyValueEx defaultPlanAhead)
3748 , (ldpProtocol, PyValueEx drbdDefaultNetProtocol)
3749 , (ldpResyncRate, PyValueEx classicDrbdSyncSpeed)
3751 , (DTExt, Map.empty)
3752 , (DTFile, Map.empty)
3753 , (DTPlain, Map.fromList [(ldpStripes, PyValueEx lvmStripecount)])
3754 , (DTRbd, Map.fromList
3755 [ (ldpPool, PyValueEx defaultRbdPool)
3756 , (ldpAccess, PyValueEx diskKernelspace)
3758 , (DTSharedFile, Map.empty)
3761 diskDtDefaults :: Map DiskTemplate (Map String PyValueEx)
3764 [ (DTBlock, Map.empty)
3765 , (DTDiskless, Map.empty)
3766 , (DTDrbd8, Map.fromList
3767 [ (drbdDataStripes, PyValueEx lvmStripecount)
3768 , (drbdDefaultMetavg, PyValueEx defaultVg)
3769 , (drbdDelayTarget, PyValueEx defaultDelayTarget)
3770 , (drbdDiskBarriers, PyValueEx drbdBarriers)
3771 , (drbdDiskCustom, PyValueEx defaultDiskCustom)
3772 , (drbdDynamicResync, PyValueEx defaultDiskResync)
3773 , (drbdFillTarget, PyValueEx defaultFillTarget)
3774 , (drbdMaxRate, PyValueEx classicDrbdSyncSpeed)
3775 , (drbdMetaBarriers, PyValueEx drbdNoMetaFlush)
3776 , (drbdMetaStripes, PyValueEx lvmStripecount)
3777 , (drbdMinRate, PyValueEx defaultMinRate)
3778 , (drbdNetCustom, PyValueEx defaultNetCustom)
3779 , (drbdPlanAhead, PyValueEx defaultPlanAhead)
3780 , (drbdProtocol, PyValueEx drbdDefaultNetProtocol)
3781 , (drbdResyncRate, PyValueEx classicDrbdSyncSpeed)
3783 , (DTExt, Map.empty)
3784 , (DTFile, Map.empty)
3785 , (DTPlain, Map.fromList [(lvStripes, PyValueEx lvmStripecount)])
3786 , (DTRbd, Map.fromList
3787 [ (rbdPool, PyValueEx defaultRbdPool)
3788 , (rbdAccess, PyValueEx diskKernelspace)
3790 , (DTSharedFile, Map.empty)
3793 niccDefaults :: Map String PyValueEx
3796 [ (nicMode, PyValueEx nicModeBridged)
3797 , (nicLink, PyValueEx defaultBridge)
3798 , (nicVlan, PyValueEx valueHsNothing)
3801 -- | All of the following values are quite arbitrary - there are no
3802 -- "good" defaults, these must be customised per-site
3803 ispecsMinmaxDefaults :: Map String (Map String Int)
3804 ispecsMinmaxDefaults =
3808 [(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMinISpec),
3809 (ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMinISpec),
3810 (ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMinISpec),
3811 (ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMinISpec),
3812 (ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMinISpec),
3813 (ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMinISpec)]),
3816 [(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMaxISpec),
3817 (ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMaxISpec),
3818 (ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMaxISpec),
3819 (ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMaxISpec),
3820 (ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMaxISpec),
3821 (ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMaxISpec)])]
3823 ipolicyDefaults :: Map String PyValueEx
3826 [ (ispecsMinmax, PyValueEx [ispecsMinmaxDefaults])
3827 , (ispecsStd, PyValueEx (Map.fromList
3828 [ (ispecMemSize, 128)
3829 , (ispecCpuCount, 1)
3830 , (ispecDiskCount, 1)
3831 , (ispecDiskSize, 1024)
3832 , (ispecNicCount, 1)
3833 , (ispecSpindleUse, 1)
3834 ] :: Map String Int))
3835 , (ipolicyDts, PyValueEx (ConstantUtils.toList diskTemplates))
3836 , (ipolicyVcpuRatio, PyValueEx (4.0 :: Double))
3837 , (ipolicySpindleRatio, PyValueEx (32.0 :: Double))
3840 masterPoolSizeDefault :: Int
3841 masterPoolSizeDefault = 10
3843 -- * Exclusive storage
3845 -- | Error margin used to compare physical disks
3846 partMargin :: Double
3849 -- | Space reserved when creating instance disks
3850 partReserved :: Double
3855 confdProtocolVersion :: Int
3856 confdProtocolVersion = ConstantUtils.confdProtocolVersion
3858 -- Confd request type
3861 confdReqPing = Types.confdRequestTypeToRaw ReqPing
3863 confdReqNodeRoleByname :: Int
3864 confdReqNodeRoleByname = Types.confdRequestTypeToRaw ReqNodeRoleByName
3866 confdReqNodePipByInstanceIp :: Int
3867 confdReqNodePipByInstanceIp = Types.confdRequestTypeToRaw ReqNodePipByInstPip
3869 confdReqClusterMaster :: Int
3870 confdReqClusterMaster = Types.confdRequestTypeToRaw ReqClusterMaster
3872 confdReqNodePipList :: Int
3873 confdReqNodePipList = Types.confdRequestTypeToRaw ReqNodePipList
3875 confdReqMcPipList :: Int
3876 confdReqMcPipList = Types.confdRequestTypeToRaw ReqMcPipList
3878 confdReqInstancesIpsList :: Int
3879 confdReqInstancesIpsList = Types.confdRequestTypeToRaw ReqInstIpsList
3881 confdReqNodeDrbd :: Int
3882 confdReqNodeDrbd = Types.confdRequestTypeToRaw ReqNodeDrbd
3884 confdReqNodeInstances :: Int
3885 confdReqNodeInstances = Types.confdRequestTypeToRaw ReqNodeInstances
3887 confdReqs :: FrozenSet Int
3889 ConstantUtils.mkSet .
3890 map Types.confdRequestTypeToRaw $
3891 [minBound..] \\ [ReqNodeInstances]
3893 -- * Confd request type
3895 confdReqfieldName :: Int
3896 confdReqfieldName = Types.confdReqFieldToRaw ReqFieldName
3898 confdReqfieldIp :: Int
3899 confdReqfieldIp = Types.confdReqFieldToRaw ReqFieldIp
3901 confdReqfieldMnodePip :: Int
3902 confdReqfieldMnodePip = Types.confdReqFieldToRaw ReqFieldMNodePip
3904 -- * Confd repl status
3906 confdReplStatusOk :: Int
3907 confdReplStatusOk = Types.confdReplyStatusToRaw ReplyStatusOk
3909 confdReplStatusError :: Int
3910 confdReplStatusError = Types.confdReplyStatusToRaw ReplyStatusError
3912 confdReplStatusNotimplemented :: Int
3913 confdReplStatusNotimplemented = Types.confdReplyStatusToRaw ReplyStatusNotImpl
3915 confdReplStatuses :: FrozenSet Int
3917 ConstantUtils.mkSet $ map Types.confdReplyStatusToRaw [minBound..]
3919 -- * Confd node role
3921 confdNodeRoleMaster :: Int
3922 confdNodeRoleMaster = Types.confdNodeRoleToRaw NodeRoleMaster
3924 confdNodeRoleCandidate :: Int
3925 confdNodeRoleCandidate = Types.confdNodeRoleToRaw NodeRoleCandidate
3927 confdNodeRoleOffline :: Int
3928 confdNodeRoleOffline = Types.confdNodeRoleToRaw NodeRoleOffline
3930 confdNodeRoleDrained :: Int
3931 confdNodeRoleDrained = Types.confdNodeRoleToRaw NodeRoleDrained
3933 confdNodeRoleRegular :: Int
3934 confdNodeRoleRegular = Types.confdNodeRoleToRaw NodeRoleRegular
3936 -- * A few common errors for confd
3938 confdErrorUnknownEntry :: Int
3939 confdErrorUnknownEntry = Types.confdErrorTypeToRaw ConfdErrorUnknownEntry
3941 confdErrorInternal :: Int
3942 confdErrorInternal = Types.confdErrorTypeToRaw ConfdErrorInternal
3944 confdErrorArgument :: Int
3945 confdErrorArgument = Types.confdErrorTypeToRaw ConfdErrorArgument
3947 -- * Confd request query fields
3949 confdReqqLink :: String
3950 confdReqqLink = ConstantUtils.confdReqqLink
3952 confdReqqIp :: String
3953 confdReqqIp = ConstantUtils.confdReqqIp
3955 confdReqqIplist :: String
3956 confdReqqIplist = ConstantUtils.confdReqqIplist
3958 confdReqqFields :: String
3959 confdReqqFields = ConstantUtils.confdReqqFields
3961 -- | Each request is "salted" by the current timestamp.
3963 -- This constant decides how many seconds of skew to accept.
3965 -- TODO: make this a default and allow the value to be more
3967 confdMaxClockSkew :: Int
3968 confdMaxClockSkew = 2 * nodeMaxClockSkew
3970 -- | When we haven't reloaded the config for more than this amount of
3971 -- seconds, we force a test to see if inotify is betraying us. Using a
3972 -- prime number to ensure we get less chance of 'same wakeup' with
3974 confdConfigReloadTimeout :: Int
3975 confdConfigReloadTimeout = 17
3977 -- | If we receive more than one update in this amount of
3978 -- microseconds, we move to polling every RATELIMIT seconds, rather
3979 -- than relying on inotify, to be able to serve more requests.
3980 confdConfigReloadRatelimit :: Int
3981 confdConfigReloadRatelimit = 250000
3983 -- | Magic number prepended to all confd queries.
3985 -- This allows us to distinguish different types of confd protocols
3986 -- and handle them. For example by changing this we can move the whole
3987 -- payload to be compressed, or move away from json.
3988 confdMagicFourcc :: String
3989 confdMagicFourcc = "plj0"
3991 -- | By default a confd request is sent to the minimum between this
3992 -- number and all MCs. 6 was chosen because even in the case of a
3993 -- disastrous 50% response rate, we should have enough answers to be
3994 -- able to compare more than one.
3995 confdDefaultReqCoverage :: Int
3996 confdDefaultReqCoverage = 6
3998 -- | Timeout in seconds to expire pending query request in the confd
3999 -- client library. We don't actually expect any answer more than 10
4000 -- seconds after we sent a request.
4001 confdClientExpireTimeout :: Int
4002 confdClientExpireTimeout = 10
4004 -- | Maximum UDP datagram size.
4006 -- On IPv4: 64K - 20 (ip header size) - 8 (udp header size) = 65507
4007 -- On IPv6: 64K - 40 (ip6 header size) - 8 (udp header size) = 65487
4008 -- (assuming we can't use jumbo frames)
4009 -- We just set this to 60K, which should be enough
4010 maxUdpDataSize :: Int
4011 maxUdpDataSize = 61440
4013 -- * User-id pool minimum/maximum acceptable user-ids
4015 uidpoolUidMin :: Int
4018 -- | Assuming 32 bit user-ids
4019 uidpoolUidMax :: Integer
4020 uidpoolUidMax = 2 ^ 32 - 1
4022 -- | Name or path of the pgrep command
4026 -- | Name of the node group that gets created at cluster init or
4028 initialNodeGroupName :: String
4029 initialNodeGroupName = "default"
4031 -- * Possible values for NodeGroup.alloc_policy
4033 allocPolicyLastResort :: String
4034 allocPolicyLastResort = Types.allocPolicyToRaw AllocLastResort
4036 allocPolicyPreferred :: String
4037 allocPolicyPreferred = Types.allocPolicyToRaw AllocPreferred
4039 allocPolicyUnallocable :: String
4040 allocPolicyUnallocable = Types.allocPolicyToRaw AllocUnallocable
4042 validAllocPolicies :: [String]
4043 validAllocPolicies = map Types.allocPolicyToRaw [minBound..]
4045 -- | Temporary external/shared storage parameters
4046 blockdevDriverManual :: String
4047 blockdevDriverManual = Types.blockDriverToRaw BlockDrvManual
4049 -- | 'qemu-img' path, required for 'ovfconverter'
4050 qemuimgPath :: String
4051 qemuimgPath = AutoConf.qemuimgPath
4053 -- | Whether htools was enabled at compilation time
4055 -- FIXME: this should be moved next to the other enable constants,
4056 -- such as, 'enableConfd', and renamed to 'enableHtools'.
4058 htools = AutoConf.htools
4060 -- | The hail iallocator
4061 iallocHail :: String
4064 -- * Fake opcodes for functions that have hooks attached to them via
4065 -- backend.RunLocalHooks
4067 fakeOpMasterTurndown :: String
4068 fakeOpMasterTurndown = "OP_CLUSTER_IP_TURNDOWN"
4070 fakeOpMasterTurnup :: String
4071 fakeOpMasterTurnup = "OP_CLUSTER_IP_TURNUP"
4081 sshkAll :: FrozenSet String
4082 sshkAll = ConstantUtils.mkSet [sshkRsa, sshkDsa]
4084 -- * SSH authorized key types
4087 sshakDss = "ssh-dss"
4090 sshakRsa = "ssh-rsa"
4092 sshakAll :: FrozenSet String
4093 sshakAll = ConstantUtils.mkSet [sshakDss, sshakRsa]
4097 sshsClusterName :: String
4098 sshsClusterName = "cluster_name"
4100 sshsSshHostKey :: String
4101 sshsSshHostKey = "ssh_host_key"
4103 sshsSshRootKey :: String
4104 sshsSshRootKey = "ssh_root_key"
4106 sshsNodeDaemonCertificate :: String
4107 sshsNodeDaemonCertificate = "node_daemon_certificate"
4109 -- * Key files for SSH daemon
4111 sshHostDsaPriv :: String
4112 sshHostDsaPriv = sshConfigDir ++ "/ssh_host_dsa_key"
4114 sshHostDsaPub :: String
4115 sshHostDsaPub = sshHostDsaPriv ++ ".pub"
4117 sshHostRsaPriv :: String
4118 sshHostRsaPriv = sshConfigDir ++ "/ssh_host_rsa_key"
4120 sshHostRsaPub :: String
4121 sshHostRsaPub = sshHostRsaPriv ++ ".pub"
4123 sshDaemonKeyfiles :: Map String (String, String)
4125 Map.fromList [ (sshkRsa, (sshHostRsaPriv, sshHostRsaPub))
4126 , (sshkDsa, (sshHostDsaPriv, sshHostDsaPub))
4129 -- * Node daemon setup
4131 ndsClusterName :: String
4132 ndsClusterName = "cluster_name"
4134 ndsNodeDaemonCertificate :: String
4135 ndsNodeDaemonCertificate = "node_daemon_certificate"
4138 ndsSsconf = "ssconf"
4140 ndsStartNodeDaemon :: String
4141 ndsStartNodeDaemon = "start_node_daemon"
4143 -- * The source reasons for the execution of an OpCode
4145 opcodeReasonSrcClient :: String
4146 opcodeReasonSrcClient = "gnt:client"
4148 opcodeReasonSrcNoded :: String
4149 opcodeReasonSrcNoded = "gnt:daemon:noded"
4151 opcodeReasonSrcOpcode :: String
4152 opcodeReasonSrcOpcode = "gnt:opcode"
4154 opcodeReasonSrcRlib2 :: String
4155 opcodeReasonSrcRlib2 = "gnt:library:rlib2"
4157 opcodeReasonSrcUser :: String
4158 opcodeReasonSrcUser = "gnt:user"
4160 opcodeReasonSources :: FrozenSet String
4161 opcodeReasonSources =
4162 ConstantUtils.mkSet [opcodeReasonSrcClient,
4163 opcodeReasonSrcNoded,
4164 opcodeReasonSrcOpcode,
4165 opcodeReasonSrcRlib2,
4166 opcodeReasonSrcUser]
4168 -- | Path generating random UUID
4169 randomUuidFile :: String
4170 randomUuidFile = ConstantUtils.randomUuidFile
4172 -- * Auto-repair tag prefixes
4174 autoRepairTagPrefix :: String
4175 autoRepairTagPrefix = "ganeti:watcher:autorepair:"
4177 autoRepairTagEnabled :: String
4178 autoRepairTagEnabled = autoRepairTagPrefix
4180 autoRepairTagPending :: String
4181 autoRepairTagPending = autoRepairTagPrefix ++ "pending:"
4183 autoRepairTagResult :: String
4184 autoRepairTagResult = autoRepairTagPrefix ++ "result:"
4186 autoRepairTagSuspended :: String
4187 autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:"
4189 -- * Auto-repair levels
4191 autoRepairFailover :: String
4192 autoRepairFailover = Types.autoRepairTypeToRaw ArFailover
4194 autoRepairFixStorage :: String
4195 autoRepairFixStorage = Types.autoRepairTypeToRaw ArFixStorage
4197 autoRepairMigrate :: String
4198 autoRepairMigrate = Types.autoRepairTypeToRaw ArMigrate
4200 autoRepairReinstall :: String
4201 autoRepairReinstall = Types.autoRepairTypeToRaw ArReinstall
4203 autoRepairAllTypes :: FrozenSet String
4204 autoRepairAllTypes =
4205 ConstantUtils.mkSet [autoRepairFailover,
4206 autoRepairFixStorage,
4208 autoRepairReinstall]
4210 -- * Auto-repair results
4212 autoRepairEnoperm :: String
4213 autoRepairEnoperm = Types.autoRepairResultToRaw ArEnoperm
4215 autoRepairFailure :: String
4216 autoRepairFailure = Types.autoRepairResultToRaw ArFailure
4218 autoRepairSuccess :: String
4219 autoRepairSuccess = Types.autoRepairResultToRaw ArSuccess
4221 autoRepairAllResults :: FrozenSet String
4222 autoRepairAllResults =
4223 ConstantUtils.mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess]
4225 -- | The version identifier for builtin data collectors
4226 builtinDataCollectorVersion :: String
4227 builtinDataCollectorVersion = "B"
4229 -- | The reason trail opcode parameter name
4230 opcodeReason :: String
4231 opcodeReason = "reason"
4233 diskstatsFile :: String
4234 diskstatsFile = "/proc/diskstats"
4236 -- * CPU load collector
4239 statFile = "/proc/stat"
4241 cpuavgloadBufferSize :: Int
4242 cpuavgloadBufferSize = 150
4244 cpuavgloadWindowSize :: Int
4245 cpuavgloadWindowSize = 600
4247 -- * Monitoring daemon
4249 -- | Mond's variable for periodical data collection
4250 mondTimeInterval :: Int
4251 mondTimeInterval = 5
4253 -- | Mond's latest API version
4254 mondLatestApiVersion :: Int
4255 mondLatestApiVersion = 1
4257 -- * Disk access modes
4259 diskUserspace :: String
4260 diskUserspace = Types.diskAccessModeToRaw DiskUserspace
4262 diskKernelspace :: String
4263 diskKernelspace = Types.diskAccessModeToRaw DiskKernelspace
4265 diskValidAccessModes :: FrozenSet String
4266 diskValidAccessModes =
4267 ConstantUtils.mkSet $ map Types.diskAccessModeToRaw [minBound..]
4269 -- | Timeout for queue draining in upgrades
4270 upgradeQueueDrainTimeout :: Int
4271 upgradeQueueDrainTimeout = 36 * 60 * 60 -- 1.5 days
4273 -- | Intervall at which the queue is polled during upgrades
4274 upgradeQueuePollInterval :: Int
4275 upgradeQueuePollInterval = 10
4277 -- * Hotplug Actions
4279 hotplugActionAdd :: String
4280 hotplugActionAdd = Types.hotplugActionToRaw HAAdd
4282 hotplugActionRemove :: String
4283 hotplugActionRemove = Types.hotplugActionToRaw HARemove
4285 hotplugActionModify :: String
4286 hotplugActionModify = Types.hotplugActionToRaw HAMod
4288 hotplugAllActions :: FrozenSet String
4290 ConstantUtils.mkSet $ map Types.hotplugActionToRaw [minBound..]
4292 -- * Hotplug Device Targets
4294 hotplugTargetNic :: String
4295 hotplugTargetNic = Types.hotplugTargetToRaw HTNic
4297 hotplugTargetDisk :: String
4298 hotplugTargetDisk = Types.hotplugTargetToRaw HTDisk
4300 hotplugAllTargets :: FrozenSet String
4302 ConstantUtils.mkSet $ map Types.hotplugTargetToRaw [minBound..]
4304 -- | Timeout for disk removal (seconds)
4305 diskRemoveRetryTimeout :: Int
4306 diskRemoveRetryTimeout = 30
4308 -- | Interval between disk removal retries (seconds)
4309 diskRemoveRetryInterval :: Int
4310 diskRemoveRetryInterval = 3
4315 uuidRegex = "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"
4319 luxiKeyMethod :: String
4320 luxiKeyMethod = "method"
4322 luxiKeyArgs :: String
4323 luxiKeyArgs = "args"
4325 luxiKeySuccess :: String
4326 luxiKeySuccess = "success"
4328 luxiKeyResult :: String
4329 luxiKeyResult = "result"
4331 luxiKeyVersion :: String
4332 luxiKeyVersion = "version"
4334 luxiReqSubmitJob :: String
4335 luxiReqSubmitJob = "SubmitJob"
4337 luxiReqSubmitJobToDrainedQueue :: String
4338 luxiReqSubmitJobToDrainedQueue = "SubmitJobToDrainedQueue"
4340 luxiReqSubmitManyJobs :: String
4341 luxiReqSubmitManyJobs = "SubmitManyJobs"
4343 luxiReqWaitForJobChange :: String
4344 luxiReqWaitForJobChange = "WaitForJobChange"
4346 luxiReqCancelJob :: String
4347 luxiReqCancelJob = "CancelJob"
4349 luxiReqArchiveJob :: String
4350 luxiReqArchiveJob = "ArchiveJob"
4352 luxiReqChangeJobPriority :: String
4353 luxiReqChangeJobPriority = "ChangeJobPriority"
4355 luxiReqAutoArchiveJobs :: String
4356 luxiReqAutoArchiveJobs = "AutoArchiveJobs"
4358 luxiReqQuery :: String
4359 luxiReqQuery = "Query"
4361 luxiReqQueryFields :: String
4362 luxiReqQueryFields = "QueryFields"
4364 luxiReqQueryJobs :: String
4365 luxiReqQueryJobs = "QueryJobs"
4367 luxiReqQueryInstances :: String
4368 luxiReqQueryInstances = "QueryInstances"
4370 luxiReqQueryNodes :: String
4371 luxiReqQueryNodes = "QueryNodes"
4373 luxiReqQueryGroups :: String
4374 luxiReqQueryGroups = "QueryGroups"
4376 luxiReqQueryNetworks :: String
4377 luxiReqQueryNetworks = "QueryNetworks"
4379 luxiReqQueryExports :: String
4380 luxiReqQueryExports = "QueryExports"
4382 luxiReqQueryConfigValues :: String
4383 luxiReqQueryConfigValues = "QueryConfigValues"
4385 luxiReqQueryClusterInfo :: String
4386 luxiReqQueryClusterInfo = "QueryClusterInfo"
4388 luxiReqQueryTags :: String
4389 luxiReqQueryTags = "QueryTags"
4391 luxiReqSetDrainFlag :: String
4392 luxiReqSetDrainFlag = "SetDrainFlag"
4394 luxiReqSetWatcherPause :: String
4395 luxiReqSetWatcherPause = "SetWatcherPause"
4397 luxiReqAll :: FrozenSet String
4401 , luxiReqAutoArchiveJobs
4403 , luxiReqChangeJobPriority
4405 , luxiReqQueryClusterInfo
4406 , luxiReqQueryConfigValues
4407 , luxiReqQueryExports
4408 , luxiReqQueryFields
4409 , luxiReqQueryGroups
4410 , luxiReqQueryInstances
4413 , luxiReqQueryNetworks
4415 , luxiReqSetDrainFlag
4416 , luxiReqSetWatcherPause
4418 , luxiReqSubmitJobToDrainedQueue
4419 , luxiReqSubmitManyJobs
4420 , luxiReqWaitForJobChange
4429 -- | 'WaitForJobChange' timeout
4430 luxiWfjcTimeout :: Int
4431 luxiWfjcTimeout = (luxiDefRwto - 1) `div` 2
4433 -- * Query language constants
4435 -- ** Logic operators with one or more operands, each of which is a
4436 -- filter on its own
4438 qlangOpAnd :: String
4444 -- ** Unary operators with exactly one operand
4446 qlangOpNot :: String
4449 qlangOpTrue :: String
4452 -- ** Binary operators with exactly two operands, the field name and
4453 -- an operator-specific value
4455 qlangOpContains :: String
4456 qlangOpContains = "=[]"
4458 qlangOpEqual :: String
4473 qlangOpNotEqual :: String
4474 qlangOpNotEqual = "!="
4476 qlangOpRegexp :: String
4477 qlangOpRegexp = "=~"
4479 -- | Characters used for detecting user-written filters (see
4482 qlangFilterDetectionChars :: FrozenSet String
4483 qlangFilterDetectionChars =
4484 ConstantUtils.mkSet ["!", " ", "\"", "\'",
4485 ")", "(", "\x0b", "\n",
4486 "\r", "\x0c", "/", "<",
4487 "\t", ">", "=", "\\", "~"]
4489 -- | Characters used to detect globbing filters
4490 qlangGlobDetectionChars :: FrozenSet String
4491 qlangGlobDetectionChars = ConstantUtils.mkSet ["*", "?"]
4493 -- * Error related constants
4495 -- 'OpPrereqError' failure types
4497 -- | Environment error (e.g. node disk error)
4498 errorsEcodeEnviron :: String
4499 errorsEcodeEnviron = "environment_error"
4501 -- | Entity already exists
4502 errorsEcodeExists :: String
4503 errorsEcodeExists = "already_exists"
4505 -- | Internal cluster error
4506 errorsEcodeFault :: String
4507 errorsEcodeFault = "internal_error"
4509 -- | Wrong arguments (at syntax level)
4510 errorsEcodeInval :: String
4511 errorsEcodeInval = "wrong_input"
4513 -- | Entity not found
4514 errorsEcodeNoent :: String
4515 errorsEcodeNoent = "unknown_entity"
4517 -- | Not enough resources (iallocator failure, disk space, memory, etc)
4518 errorsEcodeNores :: String
4519 errorsEcodeNores = "insufficient_resources"
4521 -- | Resource not unique (e.g. MAC or IP duplication)
4522 errorsEcodeNotunique :: String
4523 errorsEcodeNotunique = "resource_not_unique"
4525 -- | Resolver errors
4526 errorsEcodeResolver :: String
4527 errorsEcodeResolver = "resolver_error"
4529 -- | Wrong entity state
4530 errorsEcodeState :: String
4531 errorsEcodeState = "wrong_state"
4533 -- | Temporarily out of resources; operation can be tried again
4534 errorsEcodeTempNores :: String
4535 errorsEcodeTempNores = "temp_insufficient_resources"
4537 errorsEcodeAll :: FrozenSet String
4539 ConstantUtils.mkSet [ errorsEcodeNores
4542 , errorsEcodeNotunique
4543 , errorsEcodeTempNores
4546 , errorsEcodeResolver
4548 , errorsEcodeEnviron
4551 -- * Jstore related constants
4553 jstoreJobsPerArchiveDirectory :: Int
4554 jstoreJobsPerArchiveDirectory = 10000