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 -- * File backend driver
536 fdBlktap = Types.fileDriverToRaw FileBlktap
539 fdLoop = Types.fileDriverToRaw FileLoop
541 fileDriver :: FrozenSet String
543 ConstantUtils.mkSet $
544 map Types.fileDriverToRaw [minBound..]
546 -- | The set of drbd-like disk types
547 ldsDrbd :: FrozenSet String
548 ldsDrbd = ConstantUtils.mkSet [Types.diskTemplateToRaw DTDrbd8]
550 -- * Disk access mode
553 diskRdonly = Types.diskModeToRaw DiskRdOnly
556 diskRdwr = Types.diskModeToRaw DiskRdWr
558 diskAccessSet :: FrozenSet String
559 diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..]
561 -- * Disk replacement mode
563 replaceDiskAuto :: String
564 replaceDiskAuto = Types.replaceDisksModeToRaw ReplaceAuto
566 replaceDiskChg :: String
567 replaceDiskChg = Types.replaceDisksModeToRaw ReplaceNewSecondary
569 replaceDiskPri :: String
570 replaceDiskPri = Types.replaceDisksModeToRaw ReplaceOnPrimary
572 replaceDiskSec :: String
573 replaceDiskSec = Types.replaceDisksModeToRaw ReplaceOnSecondary
575 replaceModes :: FrozenSet String
577 ConstantUtils.mkSet $ map Types.replaceDisksModeToRaw [minBound..]
579 -- * Instance export mode
581 exportModeLocal :: String
582 exportModeLocal = Types.exportModeToRaw ExportModeLocal
584 exportModeRemote :: String
585 exportModeRemote = Types.exportModeToRaw ExportModeRemote
587 exportModes :: FrozenSet String
588 exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
590 -- * Instance creation modes
592 instanceCreate :: String
593 instanceCreate = Types.instCreateModeToRaw InstCreate
595 instanceImport :: String
596 instanceImport = Types.instCreateModeToRaw InstImport
598 instanceRemoteImport :: String
599 instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
601 instanceCreateModes :: FrozenSet String
602 instanceCreateModes =
603 ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
605 -- * Dynamic device modification
608 ddmAdd = Types.ddmFullToRaw DdmFullAdd
611 ddmModify = Types.ddmFullToRaw DdmFullModify
614 ddmRemove = Types.ddmFullToRaw DdmFullRemove
616 ddmsValues :: FrozenSet String
617 ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
619 ddmsValuesWithModify :: FrozenSet String
620 ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
622 -- * Common exit codes
628 exitFailure = ConstantUtils.exitFailure
630 exitNotcluster :: Int
636 exitNodesetupError :: Int
637 exitNodesetupError = 12
639 -- | Need user confirmation
640 exitConfirmation :: Int
641 exitConfirmation = 13
643 -- | Exit code for query operations with unknown fields
644 exitUnknownField :: Int
645 exitUnknownField = 14
650 tagCluster = Types.tagKindToRaw TagKindCluster
652 tagInstance :: String
653 tagInstance = Types.tagKindToRaw TagKindInstance
656 tagNetwork = Types.tagKindToRaw TagKindNetwork
659 tagNode = Types.tagKindToRaw TagKindNode
661 tagNodegroup :: String
662 tagNodegroup = Types.tagKindToRaw TagKindGroup
664 validTagTypes :: FrozenSet String
665 validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
673 -- | Node clock skew in seconds
674 nodeMaxClockSkew :: Int
675 nodeMaxClockSkew = 150
677 -- | Disk index separator
678 diskSeparator :: String
679 diskSeparator = AutoConf.diskSeparator
683 -- Various time constants for the timeout table
686 rpcTmoUrgent = Types.rpcTimeoutToRaw Urgent
689 rpcTmoFast = Types.rpcTimeoutToRaw Fast
692 rpcTmoNormal = Types.rpcTimeoutToRaw Normal
695 rpcTmoSlow = Types.rpcTimeoutToRaw Slow
697 -- | 'rpcTmo_4hrs' contains an underscore to circumvent a limitation
698 -- in the 'Ganeti.THH.deCamelCase' function and generate the correct
701 rpcTmo_4hrs = Types.rpcTimeoutToRaw FourHours
703 -- | 'rpcTmo_1day' contains an underscore to circumvent a limitation
704 -- in the 'Ganeti.THH.deCamelCase' function and generate the correct
707 rpcTmo_1day = Types.rpcTimeoutToRaw OneDay
709 -- | Timeout for connecting to nodes (seconds)
710 rpcConnectTimeout :: Int
711 rpcConnectTimeout = 5
716 -- FIXME: these should be associated with 'Ganeti.HTools.Types.ISpec'
718 ispecMemSize :: String
719 ispecMemSize = ConstantUtils.ispecMemSize
721 ispecCpuCount :: String
722 ispecCpuCount = ConstantUtils.ispecCpuCount
724 ispecDiskCount :: String
725 ispecDiskCount = ConstantUtils.ispecDiskCount
727 ispecDiskSize :: String
728 ispecDiskSize = ConstantUtils.ispecDiskSize
730 ispecNicCount :: String
731 ispecNicCount = ConstantUtils.ispecNicCount
733 ispecSpindleUse :: String
734 ispecSpindleUse = ConstantUtils.ispecSpindleUse
736 ispecsParameterTypes :: Map String VType
737 ispecsParameterTypes =
739 [(ConstantUtils.ispecDiskSize, VTypeInt),
740 (ConstantUtils.ispecCpuCount, VTypeInt),
741 (ConstantUtils.ispecSpindleUse, VTypeInt),
742 (ConstantUtils.ispecMemSize, VTypeInt),
743 (ConstantUtils.ispecNicCount, VTypeInt),
744 (ConstantUtils.ispecDiskCount, VTypeInt)]
746 ispecsParameters :: FrozenSet String
748 ConstantUtils.mkSet [ConstantUtils.ispecCpuCount,
749 ConstantUtils.ispecDiskCount,
750 ConstantUtils.ispecDiskSize,
751 ConstantUtils.ispecMemSize,
752 ConstantUtils.ispecNicCount,
753 ConstantUtils.ispecSpindleUse]
755 ispecsMinmax :: String
756 ispecsMinmax = ConstantUtils.ispecsMinmax
765 ispecsStd = ConstantUtils.ispecsStd
768 ipolicyDts = ConstantUtils.ipolicyDts
770 ipolicyVcpuRatio :: String
771 ipolicyVcpuRatio = ConstantUtils.ipolicyVcpuRatio
773 ipolicySpindleRatio :: String
774 ipolicySpindleRatio = ConstantUtils.ipolicySpindleRatio
776 ispecsMinmaxKeys :: FrozenSet String
777 ispecsMinmaxKeys = ConstantUtils.mkSet [ispecsMax, ispecsMin]
779 ipolicyParameters :: FrozenSet String
781 ConstantUtils.mkSet [ConstantUtils.ipolicyVcpuRatio,
782 ConstantUtils.ipolicySpindleRatio]
784 ipolicyAllKeys :: FrozenSet String
786 ConstantUtils.union ipolicyParameters $
787 ConstantUtils.mkSet [ConstantUtils.ipolicyDts,
788 ConstantUtils.ispecsMinmax,
791 -- | Node parameter names
793 ndExclusiveStorage :: String
794 ndExclusiveStorage = "exclusive_storage"
796 ndOobProgram :: String
797 ndOobProgram = "oob_program"
799 ndSpindleCount :: String
800 ndSpindleCount = "spindle_count"
806 ndOvsLink = "ovs_link"
809 ndOvsName = "ovs_name"
811 ndsParameterTypes :: Map String VType
814 [(ndExclusiveStorage, VTypeBool),
815 (ndOobProgram, VTypeString),
817 (ndOvsLink, VTypeMaybeString),
818 (ndOvsName, VTypeMaybeString),
819 (ndSpindleCount, VTypeInt)]
821 ndsParameters :: FrozenSet String
822 ndsParameters = ConstantUtils.mkSet (Map.keys ndsParameterTypes)
824 ndsParameterTitles :: Map String String
827 [(ndExclusiveStorage, "ExclusiveStorage"),
828 (ndOobProgram, "OutOfBandProgram"),
829 (ndOvs, "OpenvSwitch"),
830 (ndOvsLink, "OpenvSwitchLink"),
831 (ndOvsName, "OpenvSwitchName"),
832 (ndSpindleCount, "SpindleCount")]
834 ipCommandPath :: String
835 ipCommandPath = AutoConf.ipPath
839 instanceRebootSoft :: String
840 instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
842 instanceRebootHard :: String
843 instanceRebootHard = Types.rebootTypeToRaw RebootHard
845 instanceRebootFull :: String
846 instanceRebootFull = Types.rebootTypeToRaw RebootFull
848 rebootTypes :: FrozenSet String
849 rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
854 vtypeBool = Types.vTypeToRaw VTypeBool
857 vtypeInt = Types.vTypeToRaw VTypeInt
859 vtypeMaybeString :: String
860 vtypeMaybeString = Types.vTypeToRaw VTypeMaybeString
864 vtypeSize = Types.vTypeToRaw VTypeSize
866 vtypeString :: String
867 vtypeString = Types.vTypeToRaw VTypeString
869 enforceableTypes :: FrozenSet String
870 enforceableTypes = ConstantUtils.mkSet $ map Types.vTypeToRaw [minBound..]
872 -- * OOB supported commands
875 oobPowerOn = Types.oobCommandToRaw OobPowerOn
877 oobPowerOff :: String
878 oobPowerOff = Types.oobCommandToRaw OobPowerOff
880 oobPowerCycle :: String
881 oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
883 oobPowerStatus :: String
884 oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
887 oobHealth = Types.oobCommandToRaw OobHealth
889 oobCommands :: FrozenSet String
890 oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
892 oobPowerStatusPowered :: String
893 oobPowerStatusPowered = "powered"
900 oobPowerDelay :: Double
903 oobStatusCritical :: String
904 oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
906 oobStatusOk :: String
907 oobStatusOk = Types.oobStatusToRaw OobStatusOk
909 oobStatusUnknown :: String
910 oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
912 oobStatusWarning :: String
913 oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
915 oobStatuses :: FrozenSet String
916 oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
918 -- * NIC_* constants are used inside the ganeti config
929 nicModeBridged :: String
930 nicModeBridged = Types.nICModeToRaw NMBridged
932 nicModeRouted :: String
933 nicModeRouted = Types.nICModeToRaw NMRouted
936 nicModeOvs = Types.nICModeToRaw NMOvs
939 nicIpPool = Types.nICModeToRaw NMPool
941 nicValidModes :: FrozenSet String
942 nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
944 -- * Hypervisor constants
947 htXenPvm = Types.hypervisorToRaw XenPvm
950 htFake = Types.hypervisorToRaw Fake
953 htXenHvm = Types.hypervisorToRaw XenHvm
956 htKvm = Types.hypervisorToRaw Kvm
959 htChroot = Types.hypervisorToRaw Chroot
962 htLxc = Types.hypervisorToRaw Lxc
964 hyperTypes :: FrozenSet String
965 hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
967 htsReqPort :: FrozenSet String
968 htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
972 htMigrationLive :: String
973 htMigrationLive = Types.migrationModeToRaw MigrationLive
975 htMigrationNonlive :: String
976 htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
978 htMigrationModes :: FrozenSet String
980 ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
982 -- * Cluster verify steps
984 verifyNplusoneMem :: String
985 verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
987 verifyOptionalChecks :: FrozenSet String
988 verifyOptionalChecks =
989 ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
991 -- * Cluster Verify error classes
994 cvTcluster = "cluster"
1002 cvTinstance :: String
1003 cvTinstance = "instance"
1005 -- * Cluster Verify error codes and documentation
1007 cvEclustercert :: (String, String, String)
1010 Types.cVErrorCodeToRaw CvECLUSTERCERT,
1011 "Cluster certificate files verification failure")
1013 cvEclustercfg :: (String, String, String)
1016 Types.cVErrorCodeToRaw CvECLUSTERCFG,
1017 "Cluster configuration verification failure")
1019 cvEclusterdanglinginst :: (String, String, String)
1020 cvEclusterdanglinginst =
1022 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
1023 "Some instances have a non-existing primary node")
1025 cvEclusterdanglingnodes :: (String, String, String)
1026 cvEclusterdanglingnodes =
1028 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
1029 "Some nodes belong to non-existing groups")
1031 cvEclusterfilecheck :: (String, String, String)
1032 cvEclusterfilecheck =
1034 Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
1035 "Cluster configuration verification failure")
1037 cvEgroupdifferentpvsize :: (String, String, String)
1038 cvEgroupdifferentpvsize =
1040 Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
1041 "PVs in the group have different sizes")
1043 cvEinstancebadnode :: (String, String, String)
1044 cvEinstancebadnode =
1046 Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
1047 "Instance marked as running lives on an offline node")
1049 cvEinstancedown :: (String, String, String)
1052 Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
1053 "Instance not running on its primary node")
1055 cvEinstancefaultydisk :: (String, String, String)
1056 cvEinstancefaultydisk =
1058 Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
1059 "Impossible to retrieve status for a disk")
1061 cvEinstancelayout :: (String, String, String)
1064 Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
1065 "Instance has multiple secondary nodes")
1067 cvEinstancemissingcfgparameter :: (String, String, String)
1068 cvEinstancemissingcfgparameter =
1070 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
1071 "A configuration parameter for an instance is missing")
1073 cvEinstancemissingdisk :: (String, String, String)
1074 cvEinstancemissingdisk =
1076 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
1077 "Missing volume on an instance")
1079 cvEinstancepolicy :: (String, String, String)
1082 Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
1083 "Instance does not meet policy")
1085 cvEinstancesplitgroups :: (String, String, String)
1086 cvEinstancesplitgroups =
1088 Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
1089 "Instance with primary and secondary nodes in different groups")
1091 cvEinstanceunsuitablenode :: (String, String, String)
1092 cvEinstanceunsuitablenode =
1094 Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
1095 "Instance running on nodes that are not suitable for it")
1097 cvEinstancewrongnode :: (String, String, String)
1098 cvEinstancewrongnode =
1100 Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
1101 "Instance running on the wrong node")
1103 cvEnodedrbd :: (String, String, String)
1106 Types.cVErrorCodeToRaw CvENODEDRBD,
1107 "Error parsing the DRBD status file")
1109 cvEnodedrbdhelper :: (String, String, String)
1112 Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
1113 "Error caused by the DRBD helper")
1115 cvEnodedrbdversion :: (String, String, String)
1116 cvEnodedrbdversion =
1118 Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
1119 "DRBD version mismatch within a node group")
1121 cvEnodefilecheck :: (String, String, String)
1124 Types.cVErrorCodeToRaw CvENODEFILECHECK,
1125 "Error retrieving the checksum of the node files")
1127 cvEnodefilestoragepaths :: (String, String, String)
1128 cvEnodefilestoragepaths =
1130 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
1131 "Detected bad file storage paths")
1133 cvEnodefilestoragepathunusable :: (String, String, String)
1134 cvEnodefilestoragepathunusable =
1136 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
1137 "File storage path unusable")
1139 cvEnodehooks :: (String, String, String)
1142 Types.cVErrorCodeToRaw CvENODEHOOKS,
1143 "Communication failure in hooks execution")
1145 cvEnodehv :: (String, String, String)
1148 Types.cVErrorCodeToRaw CvENODEHV,
1149 "Hypervisor parameters verification failure")
1151 cvEnodelvm :: (String, String, String)
1154 Types.cVErrorCodeToRaw CvENODELVM,
1155 "LVM-related node error")
1157 cvEnoden1 :: (String, String, String)
1160 Types.cVErrorCodeToRaw CvENODEN1,
1161 "Not enough memory to accommodate instance failovers")
1163 cvEnodenet :: (String, String, String)
1166 Types.cVErrorCodeToRaw CvENODENET,
1167 "Network-related node error")
1169 cvEnodeoobpath :: (String, String, String)
1172 Types.cVErrorCodeToRaw CvENODEOOBPATH,
1173 "Invalid Out Of Band path")
1175 cvEnodeorphaninstance :: (String, String, String)
1176 cvEnodeorphaninstance =
1178 Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
1179 "Unknown intance running on a node")
1181 cvEnodeorphanlv :: (String, String, String)
1184 Types.cVErrorCodeToRaw CvENODEORPHANLV,
1185 "Unknown LVM logical volume")
1187 cvEnodeos :: (String, String, String)
1190 Types.cVErrorCodeToRaw CvENODEOS,
1191 "OS-related node error")
1193 cvEnoderpc :: (String, String, String)
1196 Types.cVErrorCodeToRaw CvENODERPC,
1197 "Error during connection to the primary node of an instance")
1199 cvEnodesetup :: (String, String, String)
1202 Types.cVErrorCodeToRaw CvENODESETUP,
1205 cvEnodesharedfilestoragepathunusable :: (String, String, String)
1206 cvEnodesharedfilestoragepathunusable =
1208 Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
1209 "Shared file storage path unusable")
1211 cvEnodessh :: (String, String, String)
1214 Types.cVErrorCodeToRaw CvENODESSH,
1215 "SSH-related node error")
1217 cvEnodetime :: (String, String, String)
1220 Types.cVErrorCodeToRaw CvENODETIME,
1221 "Node returned invalid time")
1223 cvEnodeuserscripts :: (String, String, String)
1224 cvEnodeuserscripts =
1226 Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
1227 "User scripts not present or not executable")
1229 cvEnodeversion :: (String, String, String)
1232 Types.cVErrorCodeToRaw CvENODEVERSION,
1233 "Protocol version mismatch or Ganeti version mismatch")
1235 cvAllEcodes :: FrozenSet (String, String, String)
1240 cvEclusterdanglinginst,
1241 cvEclusterdanglingnodes,
1242 cvEclusterfilecheck,
1243 cvEgroupdifferentpvsize,
1246 cvEinstancefaultydisk,
1248 cvEinstancemissingcfgparameter,
1249 cvEinstancemissingdisk,
1251 cvEinstancesplitgroups,
1252 cvEinstanceunsuitablenode,
1253 cvEinstancewrongnode,
1258 cvEnodefilestoragepaths,
1259 cvEnodefilestoragepathunusable,
1266 cvEnodeorphaninstance,
1271 cvEnodesharedfilestoragepathunusable,
1277 cvAllEcodesStrings :: FrozenSet String
1278 cvAllEcodesStrings =
1279 ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
1281 -- * Instance status
1283 inststAdmindown :: String
1284 inststAdmindown = Types.instanceStatusToRaw StatusDown
1286 inststAdminoffline :: String
1287 inststAdminoffline = Types.instanceStatusToRaw StatusOffline
1289 inststErrordown :: String
1290 inststErrordown = Types.instanceStatusToRaw ErrorDown
1292 inststErrorup :: String
1293 inststErrorup = Types.instanceStatusToRaw ErrorUp
1295 inststNodedown :: String
1296 inststNodedown = Types.instanceStatusToRaw NodeDown
1298 inststNodeoffline :: String
1299 inststNodeoffline = Types.instanceStatusToRaw NodeOffline
1301 inststRunning :: String
1302 inststRunning = Types.instanceStatusToRaw Running
1304 inststWrongnode :: String
1305 inststWrongnode = Types.instanceStatusToRaw WrongNode
1307 inststAll :: FrozenSet String
1308 inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
1312 adminstDown :: String
1313 adminstDown = Types.adminStateToRaw AdminDown
1315 adminstOffline :: String
1316 adminstOffline = Types.adminStateToRaw AdminOffline
1319 adminstUp = Types.adminStateToRaw AdminUp
1321 adminstAll :: FrozenSet String
1322 adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
1327 nrDrained = Types.nodeRoleToRaw NRDrained
1330 nrMaster = Types.nodeRoleToRaw NRMaster
1332 nrMcandidate :: String
1333 nrMcandidate = Types.nodeRoleToRaw NRCandidate
1336 nrOffline = Types.nodeRoleToRaw NROffline
1339 nrRegular = Types.nodeRoleToRaw NRRegular
1341 nrAll :: FrozenSet String
1342 nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
1344 -- * Allocator framework constants
1346 iallocatorVersion :: Int
1347 iallocatorVersion = 2
1349 iallocatorDirIn :: String
1350 iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
1352 iallocatorDirOut :: String
1353 iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
1355 validIallocatorDirections :: FrozenSet String
1356 validIallocatorDirections =
1357 ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
1359 iallocatorModeAlloc :: String
1360 iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
1362 iallocatorModeChgGroup :: String
1363 iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
1365 iallocatorModeMultiAlloc :: String
1366 iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
1368 iallocatorModeNodeEvac :: String
1369 iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
1371 iallocatorModeReloc :: String
1372 iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
1374 validIallocatorModes :: FrozenSet String
1375 validIallocatorModes =
1376 ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
1378 iallocatorSearchPath :: [String]
1379 iallocatorSearchPath = AutoConf.iallocatorSearchPath
1381 defaultIallocatorShortcut :: String
1382 defaultIallocatorShortcut = "."
1384 -- * Node evacuation
1386 nodeEvacPri :: String
1387 nodeEvacPri = Types.evacModeToRaw ChangePrimary
1389 nodeEvacSec :: String
1390 nodeEvacSec = Types.evacModeToRaw ChangeSecondary
1392 nodeEvacAll :: String
1393 nodeEvacAll = Types.evacModeToRaw ChangeAll
1395 nodeEvacModes :: FrozenSet String
1396 nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..]
1400 jobStatusQueued :: String
1401 jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
1403 jobStatusWaiting :: String
1404 jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
1406 jobStatusCanceling :: String
1407 jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
1409 jobStatusRunning :: String
1410 jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
1412 jobStatusCanceled :: String
1413 jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
1415 jobStatusSuccess :: String
1416 jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
1418 jobStatusError :: String
1419 jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
1421 jobsPending :: FrozenSet String
1423 ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
1425 jobsFinalized :: FrozenSet String
1427 ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
1429 jobStatusAll :: FrozenSet String
1430 jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
1434 -- ** Not yet finalized opcodes
1436 opStatusCanceling :: String
1437 opStatusCanceling = "canceling"
1439 opStatusQueued :: String
1440 opStatusQueued = "queued"
1442 opStatusRunning :: String
1443 opStatusRunning = "running"
1445 opStatusWaiting :: String
1446 opStatusWaiting = "waiting"
1448 -- ** Finalized opcodes
1450 opStatusCanceled :: String
1451 opStatusCanceled = "canceled"
1453 opStatusError :: String
1454 opStatusError = "error"
1456 opStatusSuccess :: String
1457 opStatusSuccess = "success"
1459 opsFinalized :: FrozenSet String
1461 ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
1463 -- * OpCode priority
1468 opPrioHighest :: Int
1472 opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
1475 opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
1478 opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
1480 opPrioSubmitValid :: FrozenSet Int
1481 opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
1483 opPrioDefault :: Int
1484 opPrioDefault = opPrioNormal
1486 -- * Execution log types
1488 elogMessage :: String
1489 elogMessage = Types.eLogTypeToRaw ELogMessage
1491 elogRemoteImport :: String
1492 elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
1494 elogJqueueTest :: String
1495 elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
1499 confdProtocolVersion :: Int
1500 confdProtocolVersion = ConstantUtils.confdProtocolVersion
1502 -- Confd request type
1505 confdReqPing = Types.confdRequestTypeToRaw ReqPing
1507 confdReqNodeRoleByname :: Int
1508 confdReqNodeRoleByname = Types.confdRequestTypeToRaw ReqNodeRoleByName
1510 confdReqNodePipByInstanceIp :: Int
1511 confdReqNodePipByInstanceIp = Types.confdRequestTypeToRaw ReqNodePipByInstPip
1513 confdReqClusterMaster :: Int
1514 confdReqClusterMaster = Types.confdRequestTypeToRaw ReqClusterMaster
1516 confdReqNodePipList :: Int
1517 confdReqNodePipList = Types.confdRequestTypeToRaw ReqNodePipList
1519 confdReqMcPipList :: Int
1520 confdReqMcPipList = Types.confdRequestTypeToRaw ReqMcPipList
1522 confdReqInstancesIpsList :: Int
1523 confdReqInstancesIpsList = Types.confdRequestTypeToRaw ReqInstIpsList
1525 confdReqNodeDrbd :: Int
1526 confdReqNodeDrbd = Types.confdRequestTypeToRaw ReqNodeDrbd
1528 confdReqNodeInstances :: Int
1529 confdReqNodeInstances = Types.confdRequestTypeToRaw ReqNodeInstances
1531 confdReqs :: FrozenSet Int
1533 ConstantUtils.mkSet .
1534 map Types.confdRequestTypeToRaw $
1535 [minBound..] \\ [ReqNodeInstances]
1537 -- * Confd request type
1539 confdReqfieldName :: Int
1540 confdReqfieldName = Types.confdReqFieldToRaw ReqFieldName
1542 confdReqfieldIp :: Int
1543 confdReqfieldIp = Types.confdReqFieldToRaw ReqFieldIp
1545 confdReqfieldMnodePip :: Int
1546 confdReqfieldMnodePip = Types.confdReqFieldToRaw ReqFieldMNodePip
1548 -- * Confd repl status
1550 confdReplStatusOk :: Int
1551 confdReplStatusOk = Types.confdReplyStatusToRaw ReplyStatusOk
1553 confdReplStatusError :: Int
1554 confdReplStatusError = Types.confdReplyStatusToRaw ReplyStatusError
1556 confdReplStatusNotimplemented :: Int
1557 confdReplStatusNotimplemented = Types.confdReplyStatusToRaw ReplyStatusNotImpl
1559 confdReplStatuses :: FrozenSet Int
1561 ConstantUtils.mkSet $ map Types.confdReplyStatusToRaw [minBound..]
1563 -- * Confd node role
1565 confdNodeRoleMaster :: Int
1566 confdNodeRoleMaster = Types.confdNodeRoleToRaw NodeRoleMaster
1568 confdNodeRoleCandidate :: Int
1569 confdNodeRoleCandidate = Types.confdNodeRoleToRaw NodeRoleCandidate
1571 confdNodeRoleOffline :: Int
1572 confdNodeRoleOffline = Types.confdNodeRoleToRaw NodeRoleOffline
1574 confdNodeRoleDrained :: Int
1575 confdNodeRoleDrained = Types.confdNodeRoleToRaw NodeRoleDrained
1577 confdNodeRoleRegular :: Int
1578 confdNodeRoleRegular = Types.confdNodeRoleToRaw NodeRoleRegular
1580 -- * A few common errors for confd
1582 confdErrorUnknownEntry :: Int
1583 confdErrorUnknownEntry = Types.confdErrorTypeToRaw ConfdErrorUnknownEntry
1585 confdErrorInternal :: Int
1586 confdErrorInternal = Types.confdErrorTypeToRaw ConfdErrorInternal
1588 confdErrorArgument :: Int
1589 confdErrorArgument = Types.confdErrorTypeToRaw ConfdErrorArgument
1591 -- * Confd request query fields
1593 confdReqqLink :: String
1594 confdReqqLink = ConstantUtils.confdReqqLink
1596 confdReqqIp :: String
1597 confdReqqIp = ConstantUtils.confdReqqIp
1599 confdReqqIplist :: String
1600 confdReqqIplist = ConstantUtils.confdReqqIplist
1602 confdReqqFields :: String
1603 confdReqqFields = ConstantUtils.confdReqqFields
1605 -- | Each request is "salted" by the current timestamp.
1607 -- This constant decides how many seconds of skew to accept.
1609 -- TODO: make this a default and allow the value to be more
1611 confdMaxClockSkew :: Int
1612 confdMaxClockSkew = 2 * nodeMaxClockSkew
1614 -- | When we haven't reloaded the config for more than this amount of
1615 -- seconds, we force a test to see if inotify is betraying us. Using a
1616 -- prime number to ensure we get less chance of 'same wakeup' with
1618 confdConfigReloadTimeout :: Int
1619 confdConfigReloadTimeout = 17
1621 -- | If we receive more than one update in this amount of
1622 -- microseconds, we move to polling every RATELIMIT seconds, rather
1623 -- than relying on inotify, to be able to serve more requests.
1624 confdConfigReloadRatelimit :: Int
1625 confdConfigReloadRatelimit = 250000
1627 -- | Magic number prepended to all confd queries.
1629 -- This allows us to distinguish different types of confd protocols
1630 -- and handle them. For example by changing this we can move the whole
1631 -- payload to be compressed, or move away from json.
1632 confdMagicFourcc :: String
1633 confdMagicFourcc = "plj0"
1635 -- | By default a confd request is sent to the minimum between this
1636 -- number and all MCs. 6 was chosen because even in the case of a
1637 -- disastrous 50% response rate, we should have enough answers to be
1638 -- able to compare more than one.
1639 confdDefaultReqCoverage :: Int
1640 confdDefaultReqCoverage = 6
1642 -- | Timeout in seconds to expire pending query request in the confd
1643 -- client library. We don't actually expect any answer more than 10
1644 -- seconds after we sent a request.
1645 confdClientExpireTimeout :: Int
1646 confdClientExpireTimeout = 10
1648 -- * Possible values for NodeGroup.alloc_policy
1650 allocPolicyLastResort :: String
1651 allocPolicyLastResort = Types.allocPolicyToRaw AllocLastResort
1653 allocPolicyPreferred :: String
1654 allocPolicyPreferred = Types.allocPolicyToRaw AllocPreferred
1656 allocPolicyUnallocable :: String
1657 allocPolicyUnallocable = Types.allocPolicyToRaw AllocUnallocable
1659 validAllocPolicies :: [String]
1660 validAllocPolicies = map Types.allocPolicyToRaw [minBound..]
1662 -- | Temporary external/shared storage parameters
1663 blockdevDriverManual :: String
1664 blockdevDriverManual = Types.blockDriverToRaw BlockDrvManual
1666 -- | 'qemu-img' path, required for 'ovfconverter'
1667 qemuimgPath :: String
1668 qemuimgPath = AutoConf.qemuimgPath
1670 -- | Whether htools was enabled at compilation time
1672 -- FIXME: this should be moved next to the other enable constants,
1673 -- such as, 'enableConfd', and renamed to 'enableHtools'.
1675 htools = AutoConf.htools
1677 -- | Path generating random UUID
1678 randomUuidFile :: String
1679 randomUuidFile = ConstantUtils.randomUuidFile
1681 -- * Auto-repair tag prefixes
1683 autoRepairTagPrefix :: String
1684 autoRepairTagPrefix = "ganeti:watcher:autorepair:"
1686 autoRepairTagEnabled :: String
1687 autoRepairTagEnabled = autoRepairTagPrefix
1689 autoRepairTagPending :: String
1690 autoRepairTagPending = autoRepairTagPrefix ++ "pending:"
1692 autoRepairTagResult :: String
1693 autoRepairTagResult = autoRepairTagPrefix ++ "result:"
1695 autoRepairTagSuspended :: String
1696 autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:"
1698 -- * Auto-repair levels
1700 autoRepairFailover :: String
1701 autoRepairFailover = "failover"
1703 autoRepairFixStorage :: String
1704 autoRepairFixStorage = "fix-storage"
1706 autoRepairMigrate :: String
1707 autoRepairMigrate = "migrate"
1709 autoRepairReinstall :: String
1710 autoRepairReinstall = "reinstall"
1712 autoRepairAllTypes :: FrozenSet String
1713 autoRepairAllTypes =
1714 ConstantUtils.mkSet [autoRepairFailover,
1715 autoRepairFixStorage,
1717 autoRepairReinstall]
1719 -- * Auto-repair results
1721 autoRepairEnoperm :: String
1722 autoRepairEnoperm = "enoperm"
1724 autoRepairFailure :: String
1725 autoRepairFailure = "failure"
1727 autoRepairSuccess :: String
1728 autoRepairSuccess = "success"
1730 autoRepairAllResults :: FrozenSet String
1731 autoRepairAllResults =
1732 ConstantUtils.mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess]
1734 -- | The version identifier for builtin data collectors
1735 builtinDataCollectorVersion :: String
1736 builtinDataCollectorVersion = "B"
1738 -- | The reason trail opcode parameter name
1739 opcodeReason :: String
1740 opcodeReason = "reason"
1742 diskstatsFile :: String
1743 diskstatsFile = "/proc/diskstats"
1745 -- * CPU load collector
1748 statFile = "/proc/stat"
1750 cpuavgloadBufferSize :: Int
1751 cpuavgloadBufferSize = 150
1753 cpuavgloadWindowSize :: Int
1754 cpuavgloadWindowSize = 600
1756 -- | Mond's variable for periodical data collection
1757 mondTimeInterval :: Int
1758 mondTimeInterval = 5
1760 -- * Disk access modes
1762 diskUserspace :: String
1763 diskUserspace = Types.diskAccessModeToRaw DiskUserspace
1765 diskKernelspace :: String
1766 diskKernelspace = Types.diskAccessModeToRaw DiskKernelspace
1768 diskValidAccessModes :: FrozenSet String
1769 diskValidAccessModes =
1770 ConstantUtils.mkSet $ map Types.diskAccessModeToRaw [minBound..]
1772 -- | Timeout for queue draining in upgrades
1773 upgradeQueueDrainTimeout :: Int
1774 upgradeQueueDrainTimeout = 36 * 60 * 60 -- 1.5 days
1776 -- | Intervall at which the queue is polled during upgrades
1777 upgradeQueuePollInterval :: Int
1778 upgradeQueuePollInterval = 10