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 -- FIXME: these should be associated with 'Ganeti.HTools.Types.ISpec'
783 ispecMemSize :: String
784 ispecMemSize = ConstantUtils.ispecMemSize
786 ispecCpuCount :: String
787 ispecCpuCount = ConstantUtils.ispecCpuCount
789 ispecDiskCount :: String
790 ispecDiskCount = ConstantUtils.ispecDiskCount
792 ispecDiskSize :: String
793 ispecDiskSize = ConstantUtils.ispecDiskSize
795 ispecNicCount :: String
796 ispecNicCount = ConstantUtils.ispecNicCount
798 ispecSpindleUse :: String
799 ispecSpindleUse = ConstantUtils.ispecSpindleUse
801 ispecsParameterTypes :: Map String VType
802 ispecsParameterTypes =
804 [(ConstantUtils.ispecDiskSize, VTypeInt),
805 (ConstantUtils.ispecCpuCount, VTypeInt),
806 (ConstantUtils.ispecSpindleUse, VTypeInt),
807 (ConstantUtils.ispecMemSize, VTypeInt),
808 (ConstantUtils.ispecNicCount, VTypeInt),
809 (ConstantUtils.ispecDiskCount, VTypeInt)]
811 ispecsParameters :: FrozenSet String
813 ConstantUtils.mkSet [ConstantUtils.ispecCpuCount,
814 ConstantUtils.ispecDiskCount,
815 ConstantUtils.ispecDiskSize,
816 ConstantUtils.ispecMemSize,
817 ConstantUtils.ispecNicCount,
818 ConstantUtils.ispecSpindleUse]
820 ispecsMinmax :: String
821 ispecsMinmax = ConstantUtils.ispecsMinmax
830 ispecsStd = ConstantUtils.ispecsStd
833 ipolicyDts = ConstantUtils.ipolicyDts
835 ipolicyVcpuRatio :: String
836 ipolicyVcpuRatio = ConstantUtils.ipolicyVcpuRatio
838 ipolicySpindleRatio :: String
839 ipolicySpindleRatio = ConstantUtils.ipolicySpindleRatio
841 ispecsMinmaxKeys :: FrozenSet String
842 ispecsMinmaxKeys = ConstantUtils.mkSet [ispecsMax, ispecsMin]
844 ipolicyParameters :: FrozenSet String
846 ConstantUtils.mkSet [ConstantUtils.ipolicyVcpuRatio,
847 ConstantUtils.ipolicySpindleRatio]
849 ipolicyAllKeys :: FrozenSet String
851 ConstantUtils.union ipolicyParameters $
852 ConstantUtils.mkSet [ConstantUtils.ipolicyDts,
853 ConstantUtils.ispecsMinmax,
856 -- | Node parameter names
858 ndExclusiveStorage :: String
859 ndExclusiveStorage = "exclusive_storage"
861 ndOobProgram :: String
862 ndOobProgram = "oob_program"
864 ndSpindleCount :: String
865 ndSpindleCount = "spindle_count"
871 ndOvsLink = "ovs_link"
874 ndOvsName = "ovs_name"
876 ndsParameterTypes :: Map String VType
879 [(ndExclusiveStorage, VTypeBool),
880 (ndOobProgram, VTypeString),
882 (ndOvsLink, VTypeMaybeString),
883 (ndOvsName, VTypeMaybeString),
884 (ndSpindleCount, VTypeInt)]
886 ndsParameters :: FrozenSet String
887 ndsParameters = ConstantUtils.mkSet (Map.keys ndsParameterTypes)
889 ndsParameterTitles :: Map String String
892 [(ndExclusiveStorage, "ExclusiveStorage"),
893 (ndOobProgram, "OutOfBandProgram"),
894 (ndOvs, "OpenvSwitch"),
895 (ndOvsLink, "OpenvSwitchLink"),
896 (ndOvsName, "OpenvSwitchName"),
897 (ndSpindleCount, "SpindleCount")]
899 ipCommandPath :: String
900 ipCommandPath = AutoConf.ipPath
904 instanceRebootSoft :: String
905 instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
907 instanceRebootHard :: String
908 instanceRebootHard = Types.rebootTypeToRaw RebootHard
910 instanceRebootFull :: String
911 instanceRebootFull = Types.rebootTypeToRaw RebootFull
913 rebootTypes :: FrozenSet String
914 rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
919 vtypeBool = Types.vTypeToRaw VTypeBool
922 vtypeInt = Types.vTypeToRaw VTypeInt
924 vtypeMaybeString :: String
925 vtypeMaybeString = Types.vTypeToRaw VTypeMaybeString
929 vtypeSize = Types.vTypeToRaw VTypeSize
931 vtypeString :: String
932 vtypeString = Types.vTypeToRaw VTypeString
934 enforceableTypes :: FrozenSet String
935 enforceableTypes = ConstantUtils.mkSet $ map Types.vTypeToRaw [minBound..]
937 -- * OOB supported commands
940 oobPowerOn = Types.oobCommandToRaw OobPowerOn
942 oobPowerOff :: String
943 oobPowerOff = Types.oobCommandToRaw OobPowerOff
945 oobPowerCycle :: String
946 oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
948 oobPowerStatus :: String
949 oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
952 oobHealth = Types.oobCommandToRaw OobHealth
954 oobCommands :: FrozenSet String
955 oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
957 oobPowerStatusPowered :: String
958 oobPowerStatusPowered = "powered"
965 oobPowerDelay :: Double
968 oobStatusCritical :: String
969 oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
971 oobStatusOk :: String
972 oobStatusOk = Types.oobStatusToRaw OobStatusOk
974 oobStatusUnknown :: String
975 oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
977 oobStatusWarning :: String
978 oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
980 oobStatuses :: FrozenSet String
981 oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
983 -- * NIC_* constants are used inside the ganeti config
994 nicModeBridged :: String
995 nicModeBridged = Types.nICModeToRaw NMBridged
997 nicModeRouted :: String
998 nicModeRouted = Types.nICModeToRaw NMRouted
1000 nicModeOvs :: String
1001 nicModeOvs = Types.nICModeToRaw NMOvs
1004 nicIpPool = Types.nICModeToRaw NMPool
1006 nicValidModes :: FrozenSet String
1007 nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
1009 -- * Hypervisor constants
1012 htXenPvm = Types.hypervisorToRaw XenPvm
1015 htFake = Types.hypervisorToRaw Fake
1018 htXenHvm = Types.hypervisorToRaw XenHvm
1021 htKvm = Types.hypervisorToRaw Kvm
1024 htChroot = Types.hypervisorToRaw Chroot
1027 htLxc = Types.hypervisorToRaw Lxc
1029 hyperTypes :: FrozenSet String
1030 hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
1032 htsReqPort :: FrozenSet String
1033 htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
1037 htMigrationLive :: String
1038 htMigrationLive = Types.migrationModeToRaw MigrationLive
1040 htMigrationNonlive :: String
1041 htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
1043 htMigrationModes :: FrozenSet String
1045 ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
1047 -- * Cluster verify steps
1049 verifyNplusoneMem :: String
1050 verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
1052 verifyOptionalChecks :: FrozenSet String
1053 verifyOptionalChecks =
1054 ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
1056 -- * Cluster Verify error classes
1058 cvTcluster :: String
1059 cvTcluster = "cluster"
1067 cvTinstance :: String
1068 cvTinstance = "instance"
1070 -- * Cluster Verify error codes and documentation
1072 cvEclustercert :: (String, String, String)
1075 Types.cVErrorCodeToRaw CvECLUSTERCERT,
1076 "Cluster certificate files verification failure")
1078 cvEclustercfg :: (String, String, String)
1081 Types.cVErrorCodeToRaw CvECLUSTERCFG,
1082 "Cluster configuration verification failure")
1084 cvEclusterdanglinginst :: (String, String, String)
1085 cvEclusterdanglinginst =
1087 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
1088 "Some instances have a non-existing primary node")
1090 cvEclusterdanglingnodes :: (String, String, String)
1091 cvEclusterdanglingnodes =
1093 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
1094 "Some nodes belong to non-existing groups")
1096 cvEclusterfilecheck :: (String, String, String)
1097 cvEclusterfilecheck =
1099 Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
1100 "Cluster configuration verification failure")
1102 cvEgroupdifferentpvsize :: (String, String, String)
1103 cvEgroupdifferentpvsize =
1105 Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
1106 "PVs in the group have different sizes")
1108 cvEinstancebadnode :: (String, String, String)
1109 cvEinstancebadnode =
1111 Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
1112 "Instance marked as running lives on an offline node")
1114 cvEinstancedown :: (String, String, String)
1117 Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
1118 "Instance not running on its primary node")
1120 cvEinstancefaultydisk :: (String, String, String)
1121 cvEinstancefaultydisk =
1123 Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
1124 "Impossible to retrieve status for a disk")
1126 cvEinstancelayout :: (String, String, String)
1129 Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
1130 "Instance has multiple secondary nodes")
1132 cvEinstancemissingcfgparameter :: (String, String, String)
1133 cvEinstancemissingcfgparameter =
1135 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
1136 "A configuration parameter for an instance is missing")
1138 cvEinstancemissingdisk :: (String, String, String)
1139 cvEinstancemissingdisk =
1141 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
1142 "Missing volume on an instance")
1144 cvEinstancepolicy :: (String, String, String)
1147 Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
1148 "Instance does not meet policy")
1150 cvEinstancesplitgroups :: (String, String, String)
1151 cvEinstancesplitgroups =
1153 Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
1154 "Instance with primary and secondary nodes in different groups")
1156 cvEinstanceunsuitablenode :: (String, String, String)
1157 cvEinstanceunsuitablenode =
1159 Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
1160 "Instance running on nodes that are not suitable for it")
1162 cvEinstancewrongnode :: (String, String, String)
1163 cvEinstancewrongnode =
1165 Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
1166 "Instance running on the wrong node")
1168 cvEnodedrbd :: (String, String, String)
1171 Types.cVErrorCodeToRaw CvENODEDRBD,
1172 "Error parsing the DRBD status file")
1174 cvEnodedrbdhelper :: (String, String, String)
1177 Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
1178 "Error caused by the DRBD helper")
1180 cvEnodedrbdversion :: (String, String, String)
1181 cvEnodedrbdversion =
1183 Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
1184 "DRBD version mismatch within a node group")
1186 cvEnodefilecheck :: (String, String, String)
1189 Types.cVErrorCodeToRaw CvENODEFILECHECK,
1190 "Error retrieving the checksum of the node files")
1192 cvEnodefilestoragepaths :: (String, String, String)
1193 cvEnodefilestoragepaths =
1195 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
1196 "Detected bad file storage paths")
1198 cvEnodefilestoragepathunusable :: (String, String, String)
1199 cvEnodefilestoragepathunusable =
1201 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
1202 "File storage path unusable")
1204 cvEnodehooks :: (String, String, String)
1207 Types.cVErrorCodeToRaw CvENODEHOOKS,
1208 "Communication failure in hooks execution")
1210 cvEnodehv :: (String, String, String)
1213 Types.cVErrorCodeToRaw CvENODEHV,
1214 "Hypervisor parameters verification failure")
1216 cvEnodelvm :: (String, String, String)
1219 Types.cVErrorCodeToRaw CvENODELVM,
1220 "LVM-related node error")
1222 cvEnoden1 :: (String, String, String)
1225 Types.cVErrorCodeToRaw CvENODEN1,
1226 "Not enough memory to accommodate instance failovers")
1228 cvEnodenet :: (String, String, String)
1231 Types.cVErrorCodeToRaw CvENODENET,
1232 "Network-related node error")
1234 cvEnodeoobpath :: (String, String, String)
1237 Types.cVErrorCodeToRaw CvENODEOOBPATH,
1238 "Invalid Out Of Band path")
1240 cvEnodeorphaninstance :: (String, String, String)
1241 cvEnodeorphaninstance =
1243 Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
1244 "Unknown intance running on a node")
1246 cvEnodeorphanlv :: (String, String, String)
1249 Types.cVErrorCodeToRaw CvENODEORPHANLV,
1250 "Unknown LVM logical volume")
1252 cvEnodeos :: (String, String, String)
1255 Types.cVErrorCodeToRaw CvENODEOS,
1256 "OS-related node error")
1258 cvEnoderpc :: (String, String, String)
1261 Types.cVErrorCodeToRaw CvENODERPC,
1262 "Error during connection to the primary node of an instance")
1264 cvEnodesetup :: (String, String, String)
1267 Types.cVErrorCodeToRaw CvENODESETUP,
1270 cvEnodesharedfilestoragepathunusable :: (String, String, String)
1271 cvEnodesharedfilestoragepathunusable =
1273 Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
1274 "Shared file storage path unusable")
1276 cvEnodessh :: (String, String, String)
1279 Types.cVErrorCodeToRaw CvENODESSH,
1280 "SSH-related node error")
1282 cvEnodetime :: (String, String, String)
1285 Types.cVErrorCodeToRaw CvENODETIME,
1286 "Node returned invalid time")
1288 cvEnodeuserscripts :: (String, String, String)
1289 cvEnodeuserscripts =
1291 Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
1292 "User scripts not present or not executable")
1294 cvEnodeversion :: (String, String, String)
1297 Types.cVErrorCodeToRaw CvENODEVERSION,
1298 "Protocol version mismatch or Ganeti version mismatch")
1300 cvAllEcodes :: FrozenSet (String, String, String)
1305 cvEclusterdanglinginst,
1306 cvEclusterdanglingnodes,
1307 cvEclusterfilecheck,
1308 cvEgroupdifferentpvsize,
1311 cvEinstancefaultydisk,
1313 cvEinstancemissingcfgparameter,
1314 cvEinstancemissingdisk,
1316 cvEinstancesplitgroups,
1317 cvEinstanceunsuitablenode,
1318 cvEinstancewrongnode,
1323 cvEnodefilestoragepaths,
1324 cvEnodefilestoragepathunusable,
1331 cvEnodeorphaninstance,
1336 cvEnodesharedfilestoragepathunusable,
1342 cvAllEcodesStrings :: FrozenSet String
1343 cvAllEcodesStrings =
1344 ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
1346 -- * Instance status
1348 inststAdmindown :: String
1349 inststAdmindown = Types.instanceStatusToRaw StatusDown
1351 inststAdminoffline :: String
1352 inststAdminoffline = Types.instanceStatusToRaw StatusOffline
1354 inststErrordown :: String
1355 inststErrordown = Types.instanceStatusToRaw ErrorDown
1357 inststErrorup :: String
1358 inststErrorup = Types.instanceStatusToRaw ErrorUp
1360 inststNodedown :: String
1361 inststNodedown = Types.instanceStatusToRaw NodeDown
1363 inststNodeoffline :: String
1364 inststNodeoffline = Types.instanceStatusToRaw NodeOffline
1366 inststRunning :: String
1367 inststRunning = Types.instanceStatusToRaw Running
1369 inststWrongnode :: String
1370 inststWrongnode = Types.instanceStatusToRaw WrongNode
1372 inststAll :: FrozenSet String
1373 inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
1377 adminstDown :: String
1378 adminstDown = Types.adminStateToRaw AdminDown
1380 adminstOffline :: String
1381 adminstOffline = Types.adminStateToRaw AdminOffline
1384 adminstUp = Types.adminStateToRaw AdminUp
1386 adminstAll :: FrozenSet String
1387 adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
1392 nrDrained = Types.nodeRoleToRaw NRDrained
1395 nrMaster = Types.nodeRoleToRaw NRMaster
1397 nrMcandidate :: String
1398 nrMcandidate = Types.nodeRoleToRaw NRCandidate
1401 nrOffline = Types.nodeRoleToRaw NROffline
1404 nrRegular = Types.nodeRoleToRaw NRRegular
1406 nrAll :: FrozenSet String
1407 nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
1409 -- * Allocator framework constants
1411 iallocatorVersion :: Int
1412 iallocatorVersion = 2
1414 iallocatorDirIn :: String
1415 iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
1417 iallocatorDirOut :: String
1418 iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
1420 validIallocatorDirections :: FrozenSet String
1421 validIallocatorDirections =
1422 ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
1424 iallocatorModeAlloc :: String
1425 iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
1427 iallocatorModeChgGroup :: String
1428 iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
1430 iallocatorModeMultiAlloc :: String
1431 iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
1433 iallocatorModeNodeEvac :: String
1434 iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
1436 iallocatorModeReloc :: String
1437 iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
1439 validIallocatorModes :: FrozenSet String
1440 validIallocatorModes =
1441 ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
1443 iallocatorSearchPath :: [String]
1444 iallocatorSearchPath = AutoConf.iallocatorSearchPath
1446 defaultIallocatorShortcut :: String
1447 defaultIallocatorShortcut = "."
1449 -- * Node evacuation
1451 nodeEvacPri :: String
1452 nodeEvacPri = Types.evacModeToRaw ChangePrimary
1454 nodeEvacSec :: String
1455 nodeEvacSec = Types.evacModeToRaw ChangeSecondary
1457 nodeEvacAll :: String
1458 nodeEvacAll = Types.evacModeToRaw ChangeAll
1460 nodeEvacModes :: FrozenSet String
1461 nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..]
1465 jobStatusQueued :: String
1466 jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
1468 jobStatusWaiting :: String
1469 jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
1471 jobStatusCanceling :: String
1472 jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
1474 jobStatusRunning :: String
1475 jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
1477 jobStatusCanceled :: String
1478 jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
1480 jobStatusSuccess :: String
1481 jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
1483 jobStatusError :: String
1484 jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
1486 jobsPending :: FrozenSet String
1488 ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
1490 jobsFinalized :: FrozenSet String
1492 ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
1494 jobStatusAll :: FrozenSet String
1495 jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
1499 -- ** Not yet finalized opcodes
1501 opStatusCanceling :: String
1502 opStatusCanceling = "canceling"
1504 opStatusQueued :: String
1505 opStatusQueued = "queued"
1507 opStatusRunning :: String
1508 opStatusRunning = "running"
1510 opStatusWaiting :: String
1511 opStatusWaiting = "waiting"
1513 -- ** Finalized opcodes
1515 opStatusCanceled :: String
1516 opStatusCanceled = "canceled"
1518 opStatusError :: String
1519 opStatusError = "error"
1521 opStatusSuccess :: String
1522 opStatusSuccess = "success"
1524 opsFinalized :: FrozenSet String
1526 ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
1528 -- * OpCode priority
1533 opPrioHighest :: Int
1537 opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
1540 opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
1543 opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
1545 opPrioSubmitValid :: FrozenSet Int
1546 opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
1548 opPrioDefault :: Int
1549 opPrioDefault = opPrioNormal
1551 -- * Execution log types
1553 elogMessage :: String
1554 elogMessage = Types.eLogTypeToRaw ELogMessage
1556 elogRemoteImport :: String
1557 elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
1559 elogJqueueTest :: String
1560 elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
1564 confdProtocolVersion :: Int
1565 confdProtocolVersion = ConstantUtils.confdProtocolVersion
1567 -- Confd request type
1570 confdReqPing = Types.confdRequestTypeToRaw ReqPing
1572 confdReqNodeRoleByname :: Int
1573 confdReqNodeRoleByname = Types.confdRequestTypeToRaw ReqNodeRoleByName
1575 confdReqNodePipByInstanceIp :: Int
1576 confdReqNodePipByInstanceIp = Types.confdRequestTypeToRaw ReqNodePipByInstPip
1578 confdReqClusterMaster :: Int
1579 confdReqClusterMaster = Types.confdRequestTypeToRaw ReqClusterMaster
1581 confdReqNodePipList :: Int
1582 confdReqNodePipList = Types.confdRequestTypeToRaw ReqNodePipList
1584 confdReqMcPipList :: Int
1585 confdReqMcPipList = Types.confdRequestTypeToRaw ReqMcPipList
1587 confdReqInstancesIpsList :: Int
1588 confdReqInstancesIpsList = Types.confdRequestTypeToRaw ReqInstIpsList
1590 confdReqNodeDrbd :: Int
1591 confdReqNodeDrbd = Types.confdRequestTypeToRaw ReqNodeDrbd
1593 confdReqNodeInstances :: Int
1594 confdReqNodeInstances = Types.confdRequestTypeToRaw ReqNodeInstances
1596 confdReqs :: FrozenSet Int
1598 ConstantUtils.mkSet .
1599 map Types.confdRequestTypeToRaw $
1600 [minBound..] \\ [ReqNodeInstances]
1602 -- * Confd request type
1604 confdReqfieldName :: Int
1605 confdReqfieldName = Types.confdReqFieldToRaw ReqFieldName
1607 confdReqfieldIp :: Int
1608 confdReqfieldIp = Types.confdReqFieldToRaw ReqFieldIp
1610 confdReqfieldMnodePip :: Int
1611 confdReqfieldMnodePip = Types.confdReqFieldToRaw ReqFieldMNodePip
1613 -- * Confd repl status
1615 confdReplStatusOk :: Int
1616 confdReplStatusOk = Types.confdReplyStatusToRaw ReplyStatusOk
1618 confdReplStatusError :: Int
1619 confdReplStatusError = Types.confdReplyStatusToRaw ReplyStatusError
1621 confdReplStatusNotimplemented :: Int
1622 confdReplStatusNotimplemented = Types.confdReplyStatusToRaw ReplyStatusNotImpl
1624 confdReplStatuses :: FrozenSet Int
1626 ConstantUtils.mkSet $ map Types.confdReplyStatusToRaw [minBound..]
1628 -- * Confd node role
1630 confdNodeRoleMaster :: Int
1631 confdNodeRoleMaster = Types.confdNodeRoleToRaw NodeRoleMaster
1633 confdNodeRoleCandidate :: Int
1634 confdNodeRoleCandidate = Types.confdNodeRoleToRaw NodeRoleCandidate
1636 confdNodeRoleOffline :: Int
1637 confdNodeRoleOffline = Types.confdNodeRoleToRaw NodeRoleOffline
1639 confdNodeRoleDrained :: Int
1640 confdNodeRoleDrained = Types.confdNodeRoleToRaw NodeRoleDrained
1642 confdNodeRoleRegular :: Int
1643 confdNodeRoleRegular = Types.confdNodeRoleToRaw NodeRoleRegular
1645 -- * A few common errors for confd
1647 confdErrorUnknownEntry :: Int
1648 confdErrorUnknownEntry = Types.confdErrorTypeToRaw ConfdErrorUnknownEntry
1650 confdErrorInternal :: Int
1651 confdErrorInternal = Types.confdErrorTypeToRaw ConfdErrorInternal
1653 confdErrorArgument :: Int
1654 confdErrorArgument = Types.confdErrorTypeToRaw ConfdErrorArgument
1656 -- * Confd request query fields
1658 confdReqqLink :: String
1659 confdReqqLink = ConstantUtils.confdReqqLink
1661 confdReqqIp :: String
1662 confdReqqIp = ConstantUtils.confdReqqIp
1664 confdReqqIplist :: String
1665 confdReqqIplist = ConstantUtils.confdReqqIplist
1667 confdReqqFields :: String
1668 confdReqqFields = ConstantUtils.confdReqqFields
1670 -- | Each request is "salted" by the current timestamp.
1672 -- This constant decides how many seconds of skew to accept.
1674 -- TODO: make this a default and allow the value to be more
1676 confdMaxClockSkew :: Int
1677 confdMaxClockSkew = 2 * nodeMaxClockSkew
1679 -- | When we haven't reloaded the config for more than this amount of
1680 -- seconds, we force a test to see if inotify is betraying us. Using a
1681 -- prime number to ensure we get less chance of 'same wakeup' with
1683 confdConfigReloadTimeout :: Int
1684 confdConfigReloadTimeout = 17
1686 -- | If we receive more than one update in this amount of
1687 -- microseconds, we move to polling every RATELIMIT seconds, rather
1688 -- than relying on inotify, to be able to serve more requests.
1689 confdConfigReloadRatelimit :: Int
1690 confdConfigReloadRatelimit = 250000
1692 -- | Magic number prepended to all confd queries.
1694 -- This allows us to distinguish different types of confd protocols
1695 -- and handle them. For example by changing this we can move the whole
1696 -- payload to be compressed, or move away from json.
1697 confdMagicFourcc :: String
1698 confdMagicFourcc = "plj0"
1700 -- | By default a confd request is sent to the minimum between this
1701 -- number and all MCs. 6 was chosen because even in the case of a
1702 -- disastrous 50% response rate, we should have enough answers to be
1703 -- able to compare more than one.
1704 confdDefaultReqCoverage :: Int
1705 confdDefaultReqCoverage = 6
1707 -- | Timeout in seconds to expire pending query request in the confd
1708 -- client library. We don't actually expect any answer more than 10
1709 -- seconds after we sent a request.
1710 confdClientExpireTimeout :: Int
1711 confdClientExpireTimeout = 10
1713 -- * Possible values for NodeGroup.alloc_policy
1715 allocPolicyLastResort :: String
1716 allocPolicyLastResort = Types.allocPolicyToRaw AllocLastResort
1718 allocPolicyPreferred :: String
1719 allocPolicyPreferred = Types.allocPolicyToRaw AllocPreferred
1721 allocPolicyUnallocable :: String
1722 allocPolicyUnallocable = Types.allocPolicyToRaw AllocUnallocable
1724 validAllocPolicies :: [String]
1725 validAllocPolicies = map Types.allocPolicyToRaw [minBound..]
1727 -- | Temporary external/shared storage parameters
1728 blockdevDriverManual :: String
1729 blockdevDriverManual = Types.blockDriverToRaw BlockDrvManual
1731 -- | 'qemu-img' path, required for 'ovfconverter'
1732 qemuimgPath :: String
1733 qemuimgPath = AutoConf.qemuimgPath
1735 -- | Whether htools was enabled at compilation time
1737 -- FIXME: this should be moved next to the other enable constants,
1738 -- such as, 'enableConfd', and renamed to 'enableHtools'.
1740 htools = AutoConf.htools
1742 -- * Key files for SSH daemon
1744 sshHostDsaPriv :: String
1745 sshHostDsaPriv = sshConfigDir ++ "/ssh_host_dsa_key"
1747 sshHostDsaPub :: String
1748 sshHostDsaPub = sshHostDsaPriv ++ ".pub"
1750 sshHostRsaPriv :: String
1751 sshHostRsaPriv = sshConfigDir ++ "/ssh_host_rsa_key"
1753 sshHostRsaPub :: String
1754 sshHostRsaPub = sshHostRsaPriv ++ ".pub"
1756 -- | Path generating random UUID
1757 randomUuidFile :: String
1758 randomUuidFile = ConstantUtils.randomUuidFile
1760 -- * Auto-repair tag prefixes
1762 autoRepairTagPrefix :: String
1763 autoRepairTagPrefix = "ganeti:watcher:autorepair:"
1765 autoRepairTagEnabled :: String
1766 autoRepairTagEnabled = autoRepairTagPrefix
1768 autoRepairTagPending :: String
1769 autoRepairTagPending = autoRepairTagPrefix ++ "pending:"
1771 autoRepairTagResult :: String
1772 autoRepairTagResult = autoRepairTagPrefix ++ "result:"
1774 autoRepairTagSuspended :: String
1775 autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:"
1777 -- * Auto-repair levels
1779 autoRepairFailover :: String
1780 autoRepairFailover = "failover"
1782 autoRepairFixStorage :: String
1783 autoRepairFixStorage = "fix-storage"
1785 autoRepairMigrate :: String
1786 autoRepairMigrate = "migrate"
1788 autoRepairReinstall :: String
1789 autoRepairReinstall = "reinstall"
1791 autoRepairAllTypes :: FrozenSet String
1792 autoRepairAllTypes =
1793 ConstantUtils.mkSet [autoRepairFailover,
1794 autoRepairFixStorage,
1796 autoRepairReinstall]
1798 -- * Auto-repair results
1800 autoRepairEnoperm :: String
1801 autoRepairEnoperm = "enoperm"
1803 autoRepairFailure :: String
1804 autoRepairFailure = "failure"
1806 autoRepairSuccess :: String
1807 autoRepairSuccess = "success"
1809 autoRepairAllResults :: FrozenSet String
1810 autoRepairAllResults =
1811 ConstantUtils.mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess]
1813 -- | The version identifier for builtin data collectors
1814 builtinDataCollectorVersion :: String
1815 builtinDataCollectorVersion = "B"
1817 -- | The reason trail opcode parameter name
1818 opcodeReason :: String
1819 opcodeReason = "reason"
1821 diskstatsFile :: String
1822 diskstatsFile = "/proc/diskstats"
1824 -- * CPU load collector
1827 statFile = "/proc/stat"
1829 cpuavgloadBufferSize :: Int
1830 cpuavgloadBufferSize = 150
1832 cpuavgloadWindowSize :: Int
1833 cpuavgloadWindowSize = 600
1835 -- | Mond's variable for periodical data collection
1836 mondTimeInterval :: Int
1837 mondTimeInterval = 5
1839 -- * Disk access modes
1841 diskUserspace :: String
1842 diskUserspace = Types.diskAccessModeToRaw DiskUserspace
1844 diskKernelspace :: String
1845 diskKernelspace = Types.diskAccessModeToRaw DiskKernelspace
1847 diskValidAccessModes :: FrozenSet String
1848 diskValidAccessModes =
1849 ConstantUtils.mkSet $ map Types.diskAccessModeToRaw [minBound..]
1851 -- | Timeout for queue draining in upgrades
1852 upgradeQueueDrainTimeout :: Int
1853 upgradeQueueDrainTimeout = 36 * 60 * 60 -- 1.5 days
1855 -- | Intervall at which the queue is polled during upgrades
1856 upgradeQueuePollInterval :: Int
1857 upgradeQueuePollInterval = 10