1 {-| HsConstants contains the Haskell constants
3 This is a transitional module complementary to 'Ganeti.Constants'. It
4 is intended to contain the Haskell constants that are meant to be
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.HsConstants where
39 import Data.List ((\\))
41 import qualified Data.Map as Map (fromList, keys, insert)
44 import Ganeti.ConstantUtils (PythonChar(..), FrozenSet, Protocol(..),
46 import qualified Ganeti.ConstantUtils as ConstantUtils
47 import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..),
49 import Ganeti.HTools.Types (AutoRepairResult(..), AutoRepairType(..))
50 import qualified Ganeti.HTools.Types as Types
51 import Ganeti.Logging (SyslogUsage(..))
52 import qualified Ganeti.Logging as Logging (syslogUsageToRaw)
53 import qualified Ganeti.Runtime as Runtime
55 import qualified Ganeti.Types as Types
56 import Ganeti.Confd.Types (ConfdRequestType(..), ConfdReqField(..),
57 ConfdReplyStatus(..), ConfdNodeRole(..),
59 import qualified Ganeti.Confd.Types as Types
61 {-# ANN module "HLint: ignore Use camelCase" #-}
63 -- * 'autoconf' constants for Python only ('autotools/build-bash-completion')
65 htoolsProgs :: [String]
66 htoolsProgs = AutoConf.htoolsProgs
68 -- * 'autoconf' constants for Python only ('lib/constants.py')
70 drbdBarriers :: String
71 drbdBarriers = AutoConf.drbdBarriers
73 drbdNoMetaFlush :: Bool
74 drbdNoMetaFlush = AutoConf.drbdNoMetaFlush
77 lvmStripecount = AutoConf.lvmStripecount
79 -- * 'autoconf' constants for Python only ('lib/pathutils.py')
81 -- ** Build-time constants
84 exportDir = AutoConf.exportDir
86 osSearchPath :: [String]
87 osSearchPath = AutoConf.osSearchPath
89 esSearchPath :: [String]
90 esSearchPath = AutoConf.esSearchPath
92 sshConfigDir :: String
93 sshConfigDir = AutoConf.sshConfigDir
95 xenConfigDir :: String
96 xenConfigDir = AutoConf.xenConfigDir
99 sysconfdir = AutoConf.sysconfdir
102 toolsdir = AutoConf.toolsdir
104 localstatedir :: String
105 localstatedir = AutoConf.localstatedir
107 -- ** Paths which don't change for a virtual cluster
110 pkglibdir = AutoConf.pkglibdir
113 sharedir = AutoConf.sharedir
115 -- * 'autoconf' constants for Python only ('lib/build/sphinx_ext.py')
117 manPages :: Map String Int
118 manPages = Map.fromList AutoConf.manPages
120 -- * 'autoconf' constants for QA cluster only ('qa/qa_cluster.py')
122 versionedsharedir :: String
123 versionedsharedir = AutoConf.versionedsharedir
125 -- * 'autoconf' constants for Python only ('tests/py/docs_unittest.py')
127 gntScripts :: [String]
128 gntScripts = AutoConf.gntScripts
130 -- * Various versions
132 releaseVersion :: String
133 releaseVersion = AutoConf.packageVersion
136 versionMajor = AutoConf.versionMajor
139 versionMinor = AutoConf.versionMinor
141 versionRevision :: Int
142 versionRevision = AutoConf.versionRevision
145 dirVersion = AutoConf.dirVersion
156 osApiVersions :: FrozenSet Int
157 osApiVersions = ConstantUtils.mkSet [osApiV10, osApiV15, osApiV20]
160 configMajor = AutoConf.versionMajor
163 configMinor = AutoConf.versionMinor
165 -- | The configuration is supposed to remain stable across
166 -- revisions. Therefore, the revision number is cleared to '0'.
167 configRevision :: Int
171 configVersion = buildVersion configMajor configMinor configRevision
173 -- | Similarly to the configuration (see 'configRevision'), the
174 -- protocols are supposed to remain stable across revisions.
175 protocolVersion :: Int
176 protocolVersion = buildVersion configMajor configMinor configRevision
180 daemonsGroup :: String
181 daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
184 adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
186 masterdUser :: String
187 masterdUser = Runtime.daemonUser GanetiMasterd
189 masterdGroup :: String
190 masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
193 rapiUser = Runtime.daemonUser GanetiRapi
196 rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
199 confdUser = Runtime.daemonUser GanetiConfd
202 confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
205 luxidUser = Runtime.daemonUser GanetiLuxid
208 luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
211 nodedUser = Runtime.daemonUser GanetiNoded
214 nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
217 mondUser = Runtime.daemonUser GanetiMond
220 mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
222 sshLoginUser :: String
223 sshLoginUser = AutoConf.sshLoginUser
225 sshConsoleUser :: String
226 sshConsoleUser = AutoConf.sshConsoleUser
237 minWipeChunkPercent :: Int
238 minWipeChunkPercent = 10
246 secureDirMode = 0o700
248 secureFileMode :: Int
249 secureFileMode = 0o600
251 adoptableBlockdevRoot :: String
252 adoptableBlockdevRoot = "/dev/disk/"
254 -- * 'autoconf' enable/disable
257 enableConfd = AutoConf.enableConfd
260 enableMond = AutoConf.enableMond
262 enableRestrictedCommands :: Bool
263 enableRestrictedCommands = AutoConf.enableRestrictedCommands
265 enableSplitQuery :: Bool
266 enableSplitQuery = AutoConf.enableSplitQuery
279 confd = Runtime.daemonName GanetiConfd
282 masterd = Runtime.daemonName GanetiMasterd
285 mond = Runtime.daemonName GanetiMond
288 noded = Runtime.daemonName GanetiNoded
291 luxid = Runtime.daemonName GanetiLuxid
294 rapi = Runtime.daemonName GanetiRapi
296 daemons :: FrozenSet String
298 ConstantUtils.mkSet [confd,
305 defaultConfdPort :: Int
306 defaultConfdPort = 1814
308 defaultMondPort :: Int
309 defaultMondPort = 1815
311 defaultNodedPort :: Int
312 defaultNodedPort = 1811
314 defaultRapiPort :: Int
315 defaultRapiPort = 5080
317 daemonsPorts :: Map String (Protocol, Int)
319 Map.fromList [(confd, (Udp, defaultConfdPort)),
320 (mond, (Tcp, defaultMondPort)),
321 (noded, (Tcp, defaultNodedPort)),
322 (rapi, (Tcp, defaultRapiPort)),
326 firstDrbdPort = 11000
331 daemonsLogbase :: Map String String
334 [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
336 extraLogreasonAccess :: String
337 extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
339 extraLogreasonError :: String
340 extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
343 devConsole = ConstantUtils.devConsole
345 -- * Luxi (Local UniX Interface) related constants
347 luxiEom :: PythonChar
348 luxiEom = PythonChar '\x03'
350 -- | Environment variable for the luxi override socket
351 luxiOverride :: String
352 luxiOverride = "FORCE_LUXI_SOCKET"
354 luxiOverrideMaster :: String
355 luxiOverrideMaster = "master"
357 luxiOverrideQuery :: String
358 luxiOverrideQuery = "query"
361 luxiVersion = configVersion
365 syslogUsage :: String
366 syslogUsage = AutoConf.syslogUsage
369 syslogNo = Logging.syslogUsageToRaw SyslogNo
372 syslogYes = Logging.syslogUsageToRaw SyslogYes
375 syslogOnly = Logging.syslogUsageToRaw SyslogOnly
377 syslogSocket :: String
378 syslogSocket = "/dev/log"
382 xenBootloader :: String
383 xenBootloader = AutoConf.xenBootloader
392 xenInitrd = AutoConf.xenInitrd
395 xenKernel = AutoConf.xenKernel
397 -- FIXME: perhaps rename to 'validXenCommands' for consistency with
399 knownXenCommands :: FrozenSet String
400 knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
405 kvmPath = AutoConf.kvmPath
408 kvmKernel = AutoConf.kvmKernel
410 socatEscapeCode :: String
411 socatEscapeCode = "0x1d"
414 socatPath = AutoConf.socatPath
416 socatUseCompress :: Bool
417 socatUseCompress = AutoConf.socatUseCompress
419 socatUseEscape :: Bool
420 socatUseEscape = AutoConf.socatUseEscape
425 stBlock = Types.storageTypeToRaw StorageBlock
428 stDiskless = Types.storageTypeToRaw StorageDiskless
431 stExt = Types.storageTypeToRaw StorageExt
434 stFile = Types.storageTypeToRaw StorageFile
437 stLvmPv = Types.storageTypeToRaw StorageLvmPv
440 stLvmVg = Types.storageTypeToRaw StorageLvmVg
443 stRados = Types.storageTypeToRaw StorageRados
445 storageTypes :: FrozenSet String
446 storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
449 -- ** First two are valid in LU context only, not passed to backend
457 -- ** and the rest are valid in backend
459 sfAllocatable :: String
460 sfAllocatable = Types.storageFieldToRaw SFAllocatable
463 sfFree = Types.storageFieldToRaw SFFree
466 sfName = Types.storageFieldToRaw SFName
469 sfSize = Types.storageFieldToRaw SFSize
472 sfUsed = Types.storageFieldToRaw SFUsed
474 -- * Local disk status
477 ldsFaulty = Types.localDiskStatusToRaw DiskStatusFaulty
480 ldsOkay = Types.localDiskStatusToRaw DiskStatusOk
483 ldsUnknown = Types.localDiskStatusToRaw DiskStatusUnknown
485 ldsNames :: Map Int String
487 Map.fromList [ (Types.localDiskStatusToRaw ds,
488 localDiskStatusName ds) | ds <- [minBound..] ]
490 -- * Disk template types
493 dtDiskless = Types.diskTemplateToRaw DTDiskless
496 dtFile = Types.diskTemplateToRaw DTFile
498 dtSharedFile :: String
499 dtSharedFile = Types.diskTemplateToRaw DTSharedFile
502 dtPlain = Types.diskTemplateToRaw DTPlain
505 dtBlock = Types.diskTemplateToRaw DTBlock
508 dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
511 dtRbd = Types.diskTemplateToRaw DTRbd
514 dtExt = Types.diskTemplateToRaw DTExt
516 -- | This is used to order determine the default disk template when
517 -- the list of enabled disk templates is inferred from the current
518 -- state of the cluster. This only happens on an upgrade from a
519 -- version of Ganeti that did not support the 'enabled_disk_templates'
521 diskTemplatePreference :: [String]
522 diskTemplatePreference =
523 map Types.diskTemplateToRaw
524 [DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile]
526 diskTemplates :: FrozenSet String
527 diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
529 -- | Disk templates that are enabled by default
530 defaultEnabledDiskTemplates :: [String]
531 defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
533 -- | The set of network-mirrored disk templates
534 dtsIntMirror :: FrozenSet String
535 dtsIntMirror = ConstantUtils.mkSet [dtDrbd8]
537 -- | 'DTDiskless' is 'trivially' externally mirrored
538 dtsExtMirror :: FrozenSet String
540 ConstantUtils.mkSet $
541 map Types.diskTemplateToRaw [DTDiskless, DTBlock, DTExt, DTSharedFile, DTRbd]
543 -- | The set of non-lvm-based disk templates
544 dtsNotLvm :: FrozenSet String
546 ConstantUtils.mkSet $
547 map Types.diskTemplateToRaw
548 [DTSharedFile, DTDiskless, DTBlock, DTExt, DTFile, DTRbd]
550 -- | The set of disk templates which can be grown
551 dtsGrowable :: FrozenSet String
553 ConstantUtils.mkSet $
554 map Types.diskTemplateToRaw
555 [DTSharedFile, DTDrbd8, DTPlain, DTExt, DTFile, DTRbd]
557 -- | The set of disk templates that allow adoption
558 dtsMayAdopt :: FrozenSet String
560 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTBlock, DTPlain]
562 -- | The set of disk templates that *must* use adoption
563 dtsMustAdopt :: FrozenSet String
564 dtsMustAdopt = ConstantUtils.mkSet [Types.diskTemplateToRaw DTBlock]
566 -- | The set of disk templates that allow migrations
567 dtsMirrored :: FrozenSet String
568 dtsMirrored = dtsIntMirror `ConstantUtils.union` dtsExtMirror
570 -- | The set of file based disk templates
571 dtsFilebased :: FrozenSet String
573 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTSharedFile, DTFile]
575 -- | The set of disk templates that can be moved by copying
577 -- Note: a requirement is that they're not accessed externally or
578 -- shared between nodes; in particular, sharedfile is not suitable.
579 dtsCopyable :: FrozenSet String
581 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain, DTFile]
583 -- | The set of disk templates that are supported by exclusive_storage
584 dtsExclStorage :: FrozenSet String
585 dtsExclStorage = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain]
587 -- | Templates for which we don't perform checks on free space
588 dtsNoFreeSpaceCheck :: FrozenSet String
589 dtsNoFreeSpaceCheck =
590 ConstantUtils.mkSet $
591 map Types.diskTemplateToRaw [DTExt, DTSharedFile, DTFile, DTRbd]
593 dtsBlock :: FrozenSet String
595 ConstantUtils.mkSet $
596 map Types.diskTemplateToRaw [DTPlain, DTDrbd8, DTBlock, DTRbd, DTExt]
598 -- * File backend driver
601 fdBlktap = Types.fileDriverToRaw FileBlktap
604 fdLoop = Types.fileDriverToRaw FileLoop
606 fileDriver :: FrozenSet String
608 ConstantUtils.mkSet $
609 map Types.fileDriverToRaw [minBound..]
611 -- | The set of drbd-like disk types
612 ldsDrbd :: FrozenSet String
613 ldsDrbd = ConstantUtils.mkSet [Types.diskTemplateToRaw DTDrbd8]
615 -- * Disk access mode
618 diskRdonly = Types.diskModeToRaw DiskRdOnly
621 diskRdwr = Types.diskModeToRaw DiskRdWr
623 diskAccessSet :: FrozenSet String
624 diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..]
626 -- * Disk replacement mode
628 replaceDiskAuto :: String
629 replaceDiskAuto = Types.replaceDisksModeToRaw ReplaceAuto
631 replaceDiskChg :: String
632 replaceDiskChg = Types.replaceDisksModeToRaw ReplaceNewSecondary
634 replaceDiskPri :: String
635 replaceDiskPri = Types.replaceDisksModeToRaw ReplaceOnPrimary
637 replaceDiskSec :: String
638 replaceDiskSec = Types.replaceDisksModeToRaw ReplaceOnSecondary
640 replaceModes :: FrozenSet String
642 ConstantUtils.mkSet $ map Types.replaceDisksModeToRaw [minBound..]
644 -- * Instance export mode
646 exportModeLocal :: String
647 exportModeLocal = Types.exportModeToRaw ExportModeLocal
649 exportModeRemote :: String
650 exportModeRemote = Types.exportModeToRaw ExportModeRemote
652 exportModes :: FrozenSet String
653 exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
655 -- * Instance creation modes
657 instanceCreate :: String
658 instanceCreate = Types.instCreateModeToRaw InstCreate
660 instanceImport :: String
661 instanceImport = Types.instCreateModeToRaw InstImport
663 instanceRemoteImport :: String
664 instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
666 instanceCreateModes :: FrozenSet String
667 instanceCreateModes =
668 ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
670 -- * Dynamic device modification
673 ddmAdd = Types.ddmFullToRaw DdmFullAdd
676 ddmModify = Types.ddmFullToRaw DdmFullModify
679 ddmRemove = Types.ddmFullToRaw DdmFullRemove
681 ddmsValues :: FrozenSet String
682 ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
684 ddmsValuesWithModify :: FrozenSet String
685 ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
687 -- * Common exit codes
693 exitFailure = ConstantUtils.exitFailure
695 exitNotcluster :: Int
701 exitNodesetupError :: Int
702 exitNodesetupError = 12
704 -- | Need user confirmation
705 exitConfirmation :: Int
706 exitConfirmation = 13
708 -- | Exit code for query operations with unknown fields
709 exitUnknownField :: Int
710 exitUnknownField = 14
715 tagCluster = Types.tagKindToRaw TagKindCluster
717 tagInstance :: String
718 tagInstance = Types.tagKindToRaw TagKindInstance
721 tagNetwork = Types.tagKindToRaw TagKindNetwork
724 tagNode = Types.tagKindToRaw TagKindNode
726 tagNodegroup :: String
727 tagNodegroup = Types.tagKindToRaw TagKindGroup
729 validTagTypes :: FrozenSet String
730 validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
738 -- | Node clock skew in seconds
739 nodeMaxClockSkew :: Int
740 nodeMaxClockSkew = 150
742 -- | Disk index separator
743 diskSeparator :: String
744 diskSeparator = AutoConf.diskSeparator
748 -- Various time constants for the timeout table
751 rpcTmoUrgent = Types.rpcTimeoutToRaw Urgent
754 rpcTmoFast = Types.rpcTimeoutToRaw Fast
757 rpcTmoNormal = Types.rpcTimeoutToRaw Normal
760 rpcTmoSlow = Types.rpcTimeoutToRaw Slow
762 -- | 'rpcTmo_4hrs' contains an underscore to circumvent a limitation
763 -- in the 'Ganeti.THH.deCamelCase' function and generate the correct
766 rpcTmo_4hrs = Types.rpcTimeoutToRaw FourHours
768 -- | 'rpcTmo_1day' contains an underscore to circumvent a limitation
769 -- in the 'Ganeti.THH.deCamelCase' function and generate the correct
772 rpcTmo_1day = Types.rpcTimeoutToRaw OneDay
774 -- | Timeout for connecting to nodes (seconds)
775 rpcConnectTimeout :: Int
776 rpcConnectTimeout = 5
781 vtypeBool = VTypeBool
786 vtypeMaybeString :: VType
787 vtypeMaybeString = VTypeMaybeString
791 vtypeSize = VTypeSize
794 vtypeString = VTypeString
796 enforceableTypes :: FrozenSet VType
797 enforceableTypes = ConstantUtils.mkSet [minBound..]
801 -- FIXME: these should be associated with 'Ganeti.HTools.Types.ISpec'
803 ispecMemSize :: String
804 ispecMemSize = ConstantUtils.ispecMemSize
806 ispecCpuCount :: String
807 ispecCpuCount = ConstantUtils.ispecCpuCount
809 ispecDiskCount :: String
810 ispecDiskCount = ConstantUtils.ispecDiskCount
812 ispecDiskSize :: String
813 ispecDiskSize = ConstantUtils.ispecDiskSize
815 ispecNicCount :: String
816 ispecNicCount = ConstantUtils.ispecNicCount
818 ispecSpindleUse :: String
819 ispecSpindleUse = ConstantUtils.ispecSpindleUse
821 ispecsParameterTypes :: Map String VType
822 ispecsParameterTypes =
824 [(ConstantUtils.ispecDiskSize, VTypeInt),
825 (ConstantUtils.ispecCpuCount, VTypeInt),
826 (ConstantUtils.ispecSpindleUse, VTypeInt),
827 (ConstantUtils.ispecMemSize, VTypeInt),
828 (ConstantUtils.ispecNicCount, VTypeInt),
829 (ConstantUtils.ispecDiskCount, VTypeInt)]
831 ispecsParameters :: FrozenSet String
833 ConstantUtils.mkSet [ConstantUtils.ispecCpuCount,
834 ConstantUtils.ispecDiskCount,
835 ConstantUtils.ispecDiskSize,
836 ConstantUtils.ispecMemSize,
837 ConstantUtils.ispecNicCount,
838 ConstantUtils.ispecSpindleUse]
840 ispecsMinmax :: String
841 ispecsMinmax = ConstantUtils.ispecsMinmax
850 ispecsStd = ConstantUtils.ispecsStd
853 ipolicyDts = ConstantUtils.ipolicyDts
855 ipolicyVcpuRatio :: String
856 ipolicyVcpuRatio = ConstantUtils.ipolicyVcpuRatio
858 ipolicySpindleRatio :: String
859 ipolicySpindleRatio = ConstantUtils.ipolicySpindleRatio
861 ispecsMinmaxKeys :: FrozenSet String
862 ispecsMinmaxKeys = ConstantUtils.mkSet [ispecsMax, ispecsMin]
864 ipolicyParameters :: FrozenSet String
866 ConstantUtils.mkSet [ConstantUtils.ipolicyVcpuRatio,
867 ConstantUtils.ipolicySpindleRatio]
869 ipolicyAllKeys :: FrozenSet String
871 ConstantUtils.union ipolicyParameters $
872 ConstantUtils.mkSet [ConstantUtils.ipolicyDts,
873 ConstantUtils.ispecsMinmax,
876 -- | Node parameter names
878 ndExclusiveStorage :: String
879 ndExclusiveStorage = "exclusive_storage"
881 ndOobProgram :: String
882 ndOobProgram = "oob_program"
884 ndSpindleCount :: String
885 ndSpindleCount = "spindle_count"
891 ndOvsLink = "ovs_link"
894 ndOvsName = "ovs_name"
896 ndsParameterTypes :: Map String VType
899 [(ndExclusiveStorage, VTypeBool),
900 (ndOobProgram, VTypeString),
902 (ndOvsLink, VTypeMaybeString),
903 (ndOvsName, VTypeMaybeString),
904 (ndSpindleCount, VTypeInt)]
906 ndsParameters :: FrozenSet String
907 ndsParameters = ConstantUtils.mkSet (Map.keys ndsParameterTypes)
909 ndsParameterTitles :: Map String String
912 [(ndExclusiveStorage, "ExclusiveStorage"),
913 (ndOobProgram, "OutOfBandProgram"),
914 (ndOvs, "OpenvSwitch"),
915 (ndOvsLink, "OpenvSwitchLink"),
916 (ndOvsName, "OpenvSwitchName"),
917 (ndSpindleCount, "SpindleCount")]
919 ipCommandPath :: String
920 ipCommandPath = AutoConf.ipPath
924 instanceRebootSoft :: String
925 instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
927 instanceRebootHard :: String
928 instanceRebootHard = Types.rebootTypeToRaw RebootHard
930 instanceRebootFull :: String
931 instanceRebootFull = Types.rebootTypeToRaw RebootFull
933 rebootTypes :: FrozenSet String
934 rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
943 -- * OOB supported commands
946 oobPowerOn = Types.oobCommandToRaw OobPowerOn
948 oobPowerOff :: String
949 oobPowerOff = Types.oobCommandToRaw OobPowerOff
951 oobPowerCycle :: String
952 oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
954 oobPowerStatus :: String
955 oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
958 oobHealth = Types.oobCommandToRaw OobHealth
960 oobCommands :: FrozenSet String
961 oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
963 oobPowerStatusPowered :: String
964 oobPowerStatusPowered = "powered"
971 oobPowerDelay :: Double
974 oobStatusCritical :: String
975 oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
977 oobStatusOk :: String
978 oobStatusOk = Types.oobStatusToRaw OobStatusOk
980 oobStatusUnknown :: String
981 oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
983 oobStatusWarning :: String
984 oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
986 oobStatuses :: FrozenSet String
987 oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
989 -- * NIC_* constants are used inside the ganeti config
1000 nicModeBridged :: String
1001 nicModeBridged = Types.nICModeToRaw NMBridged
1003 nicModeRouted :: String
1004 nicModeRouted = Types.nICModeToRaw NMRouted
1006 nicModeOvs :: String
1007 nicModeOvs = Types.nICModeToRaw NMOvs
1010 nicIpPool = Types.nICModeToRaw NMPool
1012 nicValidModes :: FrozenSet String
1013 nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
1015 -- * Hypervisor constants
1018 htXenPvm = Types.hypervisorToRaw XenPvm
1021 htFake = Types.hypervisorToRaw Fake
1024 htXenHvm = Types.hypervisorToRaw XenHvm
1027 htKvm = Types.hypervisorToRaw Kvm
1030 htChroot = Types.hypervisorToRaw Chroot
1033 htLxc = Types.hypervisorToRaw Lxc
1035 hyperTypes :: FrozenSet String
1036 hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
1038 htsReqPort :: FrozenSet String
1039 htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
1043 htMigrationLive :: String
1044 htMigrationLive = Types.migrationModeToRaw MigrationLive
1046 htMigrationNonlive :: String
1047 htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
1049 htMigrationModes :: FrozenSet String
1051 ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
1053 -- * Cluster verify steps
1055 verifyNplusoneMem :: String
1056 verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
1058 verifyOptionalChecks :: FrozenSet String
1059 verifyOptionalChecks =
1060 ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
1062 -- * Cluster Verify error classes
1064 cvTcluster :: String
1065 cvTcluster = "cluster"
1073 cvTinstance :: String
1074 cvTinstance = "instance"
1076 -- * Cluster Verify error codes and documentation
1078 cvEclustercert :: (String, String, String)
1081 Types.cVErrorCodeToRaw CvECLUSTERCERT,
1082 "Cluster certificate files verification failure")
1084 cvEclustercfg :: (String, String, String)
1087 Types.cVErrorCodeToRaw CvECLUSTERCFG,
1088 "Cluster configuration verification failure")
1090 cvEclusterdanglinginst :: (String, String, String)
1091 cvEclusterdanglinginst =
1093 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
1094 "Some instances have a non-existing primary node")
1096 cvEclusterdanglingnodes :: (String, String, String)
1097 cvEclusterdanglingnodes =
1099 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
1100 "Some nodes belong to non-existing groups")
1102 cvEclusterfilecheck :: (String, String, String)
1103 cvEclusterfilecheck =
1105 Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
1106 "Cluster configuration verification failure")
1108 cvEgroupdifferentpvsize :: (String, String, String)
1109 cvEgroupdifferentpvsize =
1111 Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
1112 "PVs in the group have different sizes")
1114 cvEinstancebadnode :: (String, String, String)
1115 cvEinstancebadnode =
1117 Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
1118 "Instance marked as running lives on an offline node")
1120 cvEinstancedown :: (String, String, String)
1123 Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
1124 "Instance not running on its primary node")
1126 cvEinstancefaultydisk :: (String, String, String)
1127 cvEinstancefaultydisk =
1129 Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
1130 "Impossible to retrieve status for a disk")
1132 cvEinstancelayout :: (String, String, String)
1135 Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
1136 "Instance has multiple secondary nodes")
1138 cvEinstancemissingcfgparameter :: (String, String, String)
1139 cvEinstancemissingcfgparameter =
1141 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
1142 "A configuration parameter for an instance is missing")
1144 cvEinstancemissingdisk :: (String, String, String)
1145 cvEinstancemissingdisk =
1147 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
1148 "Missing volume on an instance")
1150 cvEinstancepolicy :: (String, String, String)
1153 Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
1154 "Instance does not meet policy")
1156 cvEinstancesplitgroups :: (String, String, String)
1157 cvEinstancesplitgroups =
1159 Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
1160 "Instance with primary and secondary nodes in different groups")
1162 cvEinstanceunsuitablenode :: (String, String, String)
1163 cvEinstanceunsuitablenode =
1165 Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
1166 "Instance running on nodes that are not suitable for it")
1168 cvEinstancewrongnode :: (String, String, String)
1169 cvEinstancewrongnode =
1171 Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
1172 "Instance running on the wrong node")
1174 cvEnodedrbd :: (String, String, String)
1177 Types.cVErrorCodeToRaw CvENODEDRBD,
1178 "Error parsing the DRBD status file")
1180 cvEnodedrbdhelper :: (String, String, String)
1183 Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
1184 "Error caused by the DRBD helper")
1186 cvEnodedrbdversion :: (String, String, String)
1187 cvEnodedrbdversion =
1189 Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
1190 "DRBD version mismatch within a node group")
1192 cvEnodefilecheck :: (String, String, String)
1195 Types.cVErrorCodeToRaw CvENODEFILECHECK,
1196 "Error retrieving the checksum of the node files")
1198 cvEnodefilestoragepaths :: (String, String, String)
1199 cvEnodefilestoragepaths =
1201 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
1202 "Detected bad file storage paths")
1204 cvEnodefilestoragepathunusable :: (String, String, String)
1205 cvEnodefilestoragepathunusable =
1207 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
1208 "File storage path unusable")
1210 cvEnodehooks :: (String, String, String)
1213 Types.cVErrorCodeToRaw CvENODEHOOKS,
1214 "Communication failure in hooks execution")
1216 cvEnodehv :: (String, String, String)
1219 Types.cVErrorCodeToRaw CvENODEHV,
1220 "Hypervisor parameters verification failure")
1222 cvEnodelvm :: (String, String, String)
1225 Types.cVErrorCodeToRaw CvENODELVM,
1226 "LVM-related node error")
1228 cvEnoden1 :: (String, String, String)
1231 Types.cVErrorCodeToRaw CvENODEN1,
1232 "Not enough memory to accommodate instance failovers")
1234 cvEnodenet :: (String, String, String)
1237 Types.cVErrorCodeToRaw CvENODENET,
1238 "Network-related node error")
1240 cvEnodeoobpath :: (String, String, String)
1243 Types.cVErrorCodeToRaw CvENODEOOBPATH,
1244 "Invalid Out Of Band path")
1246 cvEnodeorphaninstance :: (String, String, String)
1247 cvEnodeorphaninstance =
1249 Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
1250 "Unknown intance running on a node")
1252 cvEnodeorphanlv :: (String, String, String)
1255 Types.cVErrorCodeToRaw CvENODEORPHANLV,
1256 "Unknown LVM logical volume")
1258 cvEnodeos :: (String, String, String)
1261 Types.cVErrorCodeToRaw CvENODEOS,
1262 "OS-related node error")
1264 cvEnoderpc :: (String, String, String)
1267 Types.cVErrorCodeToRaw CvENODERPC,
1268 "Error during connection to the primary node of an instance")
1270 cvEnodesetup :: (String, String, String)
1273 Types.cVErrorCodeToRaw CvENODESETUP,
1276 cvEnodesharedfilestoragepathunusable :: (String, String, String)
1277 cvEnodesharedfilestoragepathunusable =
1279 Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
1280 "Shared file storage path unusable")
1282 cvEnodessh :: (String, String, String)
1285 Types.cVErrorCodeToRaw CvENODESSH,
1286 "SSH-related node error")
1288 cvEnodetime :: (String, String, String)
1291 Types.cVErrorCodeToRaw CvENODETIME,
1292 "Node returned invalid time")
1294 cvEnodeuserscripts :: (String, String, String)
1295 cvEnodeuserscripts =
1297 Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
1298 "User scripts not present or not executable")
1300 cvEnodeversion :: (String, String, String)
1303 Types.cVErrorCodeToRaw CvENODEVERSION,
1304 "Protocol version mismatch or Ganeti version mismatch")
1306 cvAllEcodes :: FrozenSet (String, String, String)
1311 cvEclusterdanglinginst,
1312 cvEclusterdanglingnodes,
1313 cvEclusterfilecheck,
1314 cvEgroupdifferentpvsize,
1317 cvEinstancefaultydisk,
1319 cvEinstancemissingcfgparameter,
1320 cvEinstancemissingdisk,
1322 cvEinstancesplitgroups,
1323 cvEinstanceunsuitablenode,
1324 cvEinstancewrongnode,
1329 cvEnodefilestoragepaths,
1330 cvEnodefilestoragepathunusable,
1337 cvEnodeorphaninstance,
1342 cvEnodesharedfilestoragepathunusable,
1348 cvAllEcodesStrings :: FrozenSet String
1349 cvAllEcodesStrings =
1350 ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
1352 -- * Instance status
1354 inststAdmindown :: String
1355 inststAdmindown = Types.instanceStatusToRaw StatusDown
1357 inststAdminoffline :: String
1358 inststAdminoffline = Types.instanceStatusToRaw StatusOffline
1360 inststErrordown :: String
1361 inststErrordown = Types.instanceStatusToRaw ErrorDown
1363 inststErrorup :: String
1364 inststErrorup = Types.instanceStatusToRaw ErrorUp
1366 inststNodedown :: String
1367 inststNodedown = Types.instanceStatusToRaw NodeDown
1369 inststNodeoffline :: String
1370 inststNodeoffline = Types.instanceStatusToRaw NodeOffline
1372 inststRunning :: String
1373 inststRunning = Types.instanceStatusToRaw Running
1375 inststWrongnode :: String
1376 inststWrongnode = Types.instanceStatusToRaw WrongNode
1378 inststAll :: FrozenSet String
1379 inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
1383 adminstDown :: String
1384 adminstDown = Types.adminStateToRaw AdminDown
1386 adminstOffline :: String
1387 adminstOffline = Types.adminStateToRaw AdminOffline
1390 adminstUp = Types.adminStateToRaw AdminUp
1392 adminstAll :: FrozenSet String
1393 adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
1398 nrDrained = Types.nodeRoleToRaw NRDrained
1401 nrMaster = Types.nodeRoleToRaw NRMaster
1403 nrMcandidate :: String
1404 nrMcandidate = Types.nodeRoleToRaw NRCandidate
1407 nrOffline = Types.nodeRoleToRaw NROffline
1410 nrRegular = Types.nodeRoleToRaw NRRegular
1412 nrAll :: FrozenSet String
1413 nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
1415 -- * Allocator framework constants
1417 iallocatorVersion :: Int
1418 iallocatorVersion = 2
1420 iallocatorDirIn :: String
1421 iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
1423 iallocatorDirOut :: String
1424 iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
1426 validIallocatorDirections :: FrozenSet String
1427 validIallocatorDirections =
1428 ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
1430 iallocatorModeAlloc :: String
1431 iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
1433 iallocatorModeChgGroup :: String
1434 iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
1436 iallocatorModeMultiAlloc :: String
1437 iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
1439 iallocatorModeNodeEvac :: String
1440 iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
1442 iallocatorModeReloc :: String
1443 iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
1445 validIallocatorModes :: FrozenSet String
1446 validIallocatorModes =
1447 ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
1449 iallocatorSearchPath :: [String]
1450 iallocatorSearchPath = AutoConf.iallocatorSearchPath
1452 defaultIallocatorShortcut :: String
1453 defaultIallocatorShortcut = "."
1455 -- * Node evacuation
1457 nodeEvacPri :: String
1458 nodeEvacPri = Types.evacModeToRaw ChangePrimary
1460 nodeEvacSec :: String
1461 nodeEvacSec = Types.evacModeToRaw ChangeSecondary
1463 nodeEvacAll :: String
1464 nodeEvacAll = Types.evacModeToRaw ChangeAll
1466 nodeEvacModes :: FrozenSet String
1467 nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..]
1471 jobStatusQueued :: String
1472 jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
1474 jobStatusWaiting :: String
1475 jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
1477 jobStatusCanceling :: String
1478 jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
1480 jobStatusRunning :: String
1481 jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
1483 jobStatusCanceled :: String
1484 jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
1486 jobStatusSuccess :: String
1487 jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
1489 jobStatusError :: String
1490 jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
1492 jobsPending :: FrozenSet String
1494 ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
1496 jobsFinalized :: FrozenSet String
1498 ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
1500 jobStatusAll :: FrozenSet String
1501 jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
1505 -- ** Not yet finalized opcodes
1507 opStatusCanceling :: String
1508 opStatusCanceling = "canceling"
1510 opStatusQueued :: String
1511 opStatusQueued = "queued"
1513 opStatusRunning :: String
1514 opStatusRunning = "running"
1516 opStatusWaiting :: String
1517 opStatusWaiting = "waiting"
1519 -- ** Finalized opcodes
1521 opStatusCanceled :: String
1522 opStatusCanceled = "canceled"
1524 opStatusError :: String
1525 opStatusError = "error"
1527 opStatusSuccess :: String
1528 opStatusSuccess = "success"
1530 opsFinalized :: FrozenSet String
1532 ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
1534 -- * OpCode priority
1539 opPrioHighest :: Int
1543 opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
1546 opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
1549 opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
1551 opPrioSubmitValid :: FrozenSet Int
1552 opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
1554 opPrioDefault :: Int
1555 opPrioDefault = opPrioNormal
1557 -- * Execution log types
1559 elogMessage :: String
1560 elogMessage = Types.eLogTypeToRaw ELogMessage
1562 elogRemoteImport :: String
1563 elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
1565 elogJqueueTest :: String
1566 elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
1570 confdProtocolVersion :: Int
1571 confdProtocolVersion = ConstantUtils.confdProtocolVersion
1573 -- Confd request type
1576 confdReqPing = Types.confdRequestTypeToRaw ReqPing
1578 confdReqNodeRoleByname :: Int
1579 confdReqNodeRoleByname = Types.confdRequestTypeToRaw ReqNodeRoleByName
1581 confdReqNodePipByInstanceIp :: Int
1582 confdReqNodePipByInstanceIp = Types.confdRequestTypeToRaw ReqNodePipByInstPip
1584 confdReqClusterMaster :: Int
1585 confdReqClusterMaster = Types.confdRequestTypeToRaw ReqClusterMaster
1587 confdReqNodePipList :: Int
1588 confdReqNodePipList = Types.confdRequestTypeToRaw ReqNodePipList
1590 confdReqMcPipList :: Int
1591 confdReqMcPipList = Types.confdRequestTypeToRaw ReqMcPipList
1593 confdReqInstancesIpsList :: Int
1594 confdReqInstancesIpsList = Types.confdRequestTypeToRaw ReqInstIpsList
1596 confdReqNodeDrbd :: Int
1597 confdReqNodeDrbd = Types.confdRequestTypeToRaw ReqNodeDrbd
1599 confdReqNodeInstances :: Int
1600 confdReqNodeInstances = Types.confdRequestTypeToRaw ReqNodeInstances
1602 confdReqs :: FrozenSet Int
1604 ConstantUtils.mkSet .
1605 map Types.confdRequestTypeToRaw $
1606 [minBound..] \\ [ReqNodeInstances]
1608 -- * Confd request type
1610 confdReqfieldName :: Int
1611 confdReqfieldName = Types.confdReqFieldToRaw ReqFieldName
1613 confdReqfieldIp :: Int
1614 confdReqfieldIp = Types.confdReqFieldToRaw ReqFieldIp
1616 confdReqfieldMnodePip :: Int
1617 confdReqfieldMnodePip = Types.confdReqFieldToRaw ReqFieldMNodePip
1619 -- * Confd repl status
1621 confdReplStatusOk :: Int
1622 confdReplStatusOk = Types.confdReplyStatusToRaw ReplyStatusOk
1624 confdReplStatusError :: Int
1625 confdReplStatusError = Types.confdReplyStatusToRaw ReplyStatusError
1627 confdReplStatusNotimplemented :: Int
1628 confdReplStatusNotimplemented = Types.confdReplyStatusToRaw ReplyStatusNotImpl
1630 confdReplStatuses :: FrozenSet Int
1632 ConstantUtils.mkSet $ map Types.confdReplyStatusToRaw [minBound..]
1634 -- * Confd node role
1636 confdNodeRoleMaster :: Int
1637 confdNodeRoleMaster = Types.confdNodeRoleToRaw NodeRoleMaster
1639 confdNodeRoleCandidate :: Int
1640 confdNodeRoleCandidate = Types.confdNodeRoleToRaw NodeRoleCandidate
1642 confdNodeRoleOffline :: Int
1643 confdNodeRoleOffline = Types.confdNodeRoleToRaw NodeRoleOffline
1645 confdNodeRoleDrained :: Int
1646 confdNodeRoleDrained = Types.confdNodeRoleToRaw NodeRoleDrained
1648 confdNodeRoleRegular :: Int
1649 confdNodeRoleRegular = Types.confdNodeRoleToRaw NodeRoleRegular
1651 -- * A few common errors for confd
1653 confdErrorUnknownEntry :: Int
1654 confdErrorUnknownEntry = Types.confdErrorTypeToRaw ConfdErrorUnknownEntry
1656 confdErrorInternal :: Int
1657 confdErrorInternal = Types.confdErrorTypeToRaw ConfdErrorInternal
1659 confdErrorArgument :: Int
1660 confdErrorArgument = Types.confdErrorTypeToRaw ConfdErrorArgument
1662 -- * Confd request query fields
1664 confdReqqLink :: String
1665 confdReqqLink = ConstantUtils.confdReqqLink
1667 confdReqqIp :: String
1668 confdReqqIp = ConstantUtils.confdReqqIp
1670 confdReqqIplist :: String
1671 confdReqqIplist = ConstantUtils.confdReqqIplist
1673 confdReqqFields :: String
1674 confdReqqFields = ConstantUtils.confdReqqFields
1676 -- | Each request is "salted" by the current timestamp.
1678 -- This constant decides how many seconds of skew to accept.
1680 -- TODO: make this a default and allow the value to be more
1682 confdMaxClockSkew :: Int
1683 confdMaxClockSkew = 2 * nodeMaxClockSkew
1685 -- | When we haven't reloaded the config for more than this amount of
1686 -- seconds, we force a test to see if inotify is betraying us. Using a
1687 -- prime number to ensure we get less chance of 'same wakeup' with
1689 confdConfigReloadTimeout :: Int
1690 confdConfigReloadTimeout = 17
1692 -- | If we receive more than one update in this amount of
1693 -- microseconds, we move to polling every RATELIMIT seconds, rather
1694 -- than relying on inotify, to be able to serve more requests.
1695 confdConfigReloadRatelimit :: Int
1696 confdConfigReloadRatelimit = 250000
1698 -- | Magic number prepended to all confd queries.
1700 -- This allows us to distinguish different types of confd protocols
1701 -- and handle them. For example by changing this we can move the whole
1702 -- payload to be compressed, or move away from json.
1703 confdMagicFourcc :: String
1704 confdMagicFourcc = "plj0"
1706 -- | By default a confd request is sent to the minimum between this
1707 -- number and all MCs. 6 was chosen because even in the case of a
1708 -- disastrous 50% response rate, we should have enough answers to be
1709 -- able to compare more than one.
1710 confdDefaultReqCoverage :: Int
1711 confdDefaultReqCoverage = 6
1713 -- | Timeout in seconds to expire pending query request in the confd
1714 -- client library. We don't actually expect any answer more than 10
1715 -- seconds after we sent a request.
1716 confdClientExpireTimeout :: Int
1717 confdClientExpireTimeout = 10
1719 -- * Possible values for NodeGroup.alloc_policy
1721 allocPolicyLastResort :: String
1722 allocPolicyLastResort = Types.allocPolicyToRaw AllocLastResort
1724 allocPolicyPreferred :: String
1725 allocPolicyPreferred = Types.allocPolicyToRaw AllocPreferred
1727 allocPolicyUnallocable :: String
1728 allocPolicyUnallocable = Types.allocPolicyToRaw AllocUnallocable
1730 validAllocPolicies :: [String]
1731 validAllocPolicies = map Types.allocPolicyToRaw [minBound..]
1733 -- | Temporary external/shared storage parameters
1734 blockdevDriverManual :: String
1735 blockdevDriverManual = Types.blockDriverToRaw BlockDrvManual
1737 -- | 'qemu-img' path, required for 'ovfconverter'
1738 qemuimgPath :: String
1739 qemuimgPath = AutoConf.qemuimgPath
1741 -- | Whether htools was enabled at compilation time
1743 -- FIXME: this should be moved next to the other enable constants,
1744 -- such as, 'enableConfd', and renamed to 'enableHtools'.
1746 htools = AutoConf.htools
1748 -- * Key files for SSH daemon
1750 sshHostDsaPriv :: String
1751 sshHostDsaPriv = sshConfigDir ++ "/ssh_host_dsa_key"
1753 sshHostDsaPub :: String
1754 sshHostDsaPub = sshHostDsaPriv ++ ".pub"
1756 sshHostRsaPriv :: String
1757 sshHostRsaPriv = sshConfigDir ++ "/ssh_host_rsa_key"
1759 sshHostRsaPub :: String
1760 sshHostRsaPub = sshHostRsaPriv ++ ".pub"
1762 -- | Path generating random UUID
1763 randomUuidFile :: String
1764 randomUuidFile = ConstantUtils.randomUuidFile
1766 -- * Auto-repair tag prefixes
1768 autoRepairTagPrefix :: String
1769 autoRepairTagPrefix = "ganeti:watcher:autorepair:"
1771 autoRepairTagEnabled :: String
1772 autoRepairTagEnabled = autoRepairTagPrefix
1774 autoRepairTagPending :: String
1775 autoRepairTagPending = autoRepairTagPrefix ++ "pending:"
1777 autoRepairTagResult :: String
1778 autoRepairTagResult = autoRepairTagPrefix ++ "result:"
1780 autoRepairTagSuspended :: String
1781 autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:"
1783 -- * Auto-repair levels
1785 autoRepairFailover :: String
1786 autoRepairFailover = "failover"
1788 autoRepairFixStorage :: String
1789 autoRepairFixStorage = "fix-storage"
1791 autoRepairMigrate :: String
1792 autoRepairMigrate = "migrate"
1794 autoRepairReinstall :: String
1795 autoRepairReinstall = "reinstall"
1797 autoRepairAllTypes :: FrozenSet String
1798 autoRepairAllTypes =
1799 ConstantUtils.mkSet [autoRepairFailover,
1800 autoRepairFixStorage,
1802 autoRepairReinstall]
1804 -- * Auto-repair results
1806 autoRepairEnoperm :: String
1807 autoRepairEnoperm = "enoperm"
1809 autoRepairFailure :: String
1810 autoRepairFailure = "failure"
1812 autoRepairSuccess :: String
1813 autoRepairSuccess = "success"
1815 autoRepairAllResults :: FrozenSet String
1816 autoRepairAllResults =
1817 ConstantUtils.mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess]
1819 -- | The version identifier for builtin data collectors
1820 builtinDataCollectorVersion :: String
1821 builtinDataCollectorVersion = "B"
1823 -- | The reason trail opcode parameter name
1824 opcodeReason :: String
1825 opcodeReason = "reason"
1827 diskstatsFile :: String
1828 diskstatsFile = "/proc/diskstats"
1830 -- * CPU load collector
1833 statFile = "/proc/stat"
1835 cpuavgloadBufferSize :: Int
1836 cpuavgloadBufferSize = 150
1838 cpuavgloadWindowSize :: Int
1839 cpuavgloadWindowSize = 600
1841 -- | Mond's variable for periodical data collection
1842 mondTimeInterval :: Int
1843 mondTimeInterval = 5
1845 -- * Disk access modes
1847 diskUserspace :: String
1848 diskUserspace = Types.diskAccessModeToRaw DiskUserspace
1850 diskKernelspace :: String
1851 diskKernelspace = Types.diskAccessModeToRaw DiskKernelspace
1853 diskValidAccessModes :: FrozenSet String
1854 diskValidAccessModes =
1855 ConstantUtils.mkSet $ map Types.diskAccessModeToRaw [minBound..]
1857 -- | Timeout for queue draining in upgrades
1858 upgradeQueueDrainTimeout :: Int
1859 upgradeQueueDrainTimeout = 36 * 60 * 60 -- 1.5 days
1861 -- | Intervall at which the queue is polled during upgrades
1862 upgradeQueuePollInterval :: Int
1863 upgradeQueuePollInterval = 10