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)
44 import Ganeti.ConstantUtils (FrozenSet, Protocol(..), buildVersion)
45 import qualified Ganeti.ConstantUtils as ConstantUtils
46 import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..),
48 import Ganeti.Logging (SyslogUsage(..))
49 import qualified Ganeti.Logging as Logging (syslogUsageToRaw)
50 import qualified Ganeti.Runtime as Runtime
52 import qualified Ganeti.Types as Types
53 import Ganeti.Confd.Types (ConfdRequestType(..), ConfdReqField(..),
54 ConfdReplyStatus(..), ConfdNodeRole(..),
56 import qualified Ganeti.Confd.Types as Types
58 -- * 'autoconf' constants for Python only ('autotools/build-bash-completion')
60 htoolsProgs :: [String]
61 htoolsProgs = AutoConf.htoolsProgs
63 -- * 'autoconf' constants for Python only ('lib/constants.py')
65 drbdBarriers :: String
66 drbdBarriers = AutoConf.drbdBarriers
68 drbdNoMetaFlush :: Bool
69 drbdNoMetaFlush = AutoConf.drbdNoMetaFlush
72 lvmStripecount = AutoConf.lvmStripecount
74 -- * 'autoconf' constants for Python only ('lib/pathutils.py')
76 -- ** Build-time constants
79 exportDir = AutoConf.exportDir
81 osSearchPath :: [String]
82 osSearchPath = AutoConf.osSearchPath
84 esSearchPath :: [String]
85 esSearchPath = AutoConf.esSearchPath
87 sshConfigDir :: String
88 sshConfigDir = AutoConf.sshConfigDir
90 xenConfigDir :: String
91 xenConfigDir = AutoConf.xenConfigDir
94 sysconfdir = AutoConf.sysconfdir
97 toolsdir = AutoConf.toolsdir
99 localstatedir :: String
100 localstatedir = AutoConf.localstatedir
102 -- ** Paths which don't change for a virtual cluster
105 pkglibdir = AutoConf.pkglibdir
108 sharedir = AutoConf.sharedir
110 -- * 'autoconf' constants for Python only ('lib/build/sphinx_ext.py')
112 manPages :: Map String Int
113 manPages = Map.fromList AutoConf.manPages
115 -- * 'autoconf' constants for QA cluster only ('qa/qa_cluster.py')
117 versionedsharedir :: String
118 versionedsharedir = AutoConf.versionedsharedir
120 -- * 'autoconf' constants for Python only ('tests/py/docs_unittest.py')
122 gntScripts :: [String]
123 gntScripts = AutoConf.gntScripts
125 -- * Various versions
127 releaseVersion :: String
128 releaseVersion = AutoConf.packageVersion
131 versionMajor = AutoConf.versionMajor
134 versionMinor = AutoConf.versionMinor
136 versionRevision :: Int
137 versionRevision = AutoConf.versionRevision
140 dirVersion = AutoConf.dirVersion
151 osApiVersions :: FrozenSet Int
152 osApiVersions = ConstantUtils.mkSet [osApiV10, osApiV15, osApiV20]
155 configMajor = AutoConf.versionMajor
158 configMinor = AutoConf.versionMinor
160 -- | The configuration is supposed to remain stable across
161 -- revisions. Therefore, the revision number is cleared to '0'.
162 configRevision :: Int
166 configVersion = buildVersion configMajor configMinor configRevision
168 -- | Similarly to the configuration (see 'configRevision'), the
169 -- protocols are supposed to remain stable across revisions.
170 protocolVersion :: Int
171 protocolVersion = buildVersion configMajor configMinor configRevision
175 daemonsGroup :: String
176 daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
179 adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
181 masterdUser :: String
182 masterdUser = Runtime.daemonUser GanetiMasterd
184 masterdGroup :: String
185 masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
188 rapiUser = Runtime.daemonUser GanetiRapi
191 rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
194 confdUser = Runtime.daemonUser GanetiConfd
197 confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
200 luxidUser = Runtime.daemonUser GanetiLuxid
203 luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
206 nodedUser = Runtime.daemonUser GanetiNoded
209 nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
212 mondUser = Runtime.daemonUser GanetiMond
215 mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
217 sshLoginUser :: String
218 sshLoginUser = AutoConf.sshLoginUser
220 sshConsoleUser :: String
221 sshConsoleUser = AutoConf.sshConsoleUser
232 minWipeChunkPercent :: Int
233 minWipeChunkPercent = 10
241 secureDirMode = 0o700
243 secureFileMode :: Int
244 secureFileMode = 0o600
246 adoptableBlockdevRoot :: String
247 adoptableBlockdevRoot = "/dev/disk/"
249 -- * 'autoconf' enable/disable
252 enableConfd = AutoConf.enableConfd
255 enableMond = AutoConf.enableMond
257 enableRestrictedCommands :: Bool
258 enableRestrictedCommands = AutoConf.enableRestrictedCommands
260 enableSplitQuery :: Bool
261 enableSplitQuery = AutoConf.enableSplitQuery
274 confd = Runtime.daemonName GanetiConfd
277 masterd = Runtime.daemonName GanetiMasterd
280 mond = Runtime.daemonName GanetiMond
283 noded = Runtime.daemonName GanetiNoded
286 luxid = Runtime.daemonName GanetiLuxid
289 rapi = Runtime.daemonName GanetiRapi
291 daemons :: FrozenSet String
293 ConstantUtils.mkSet [confd,
300 defaultConfdPort :: Int
301 defaultConfdPort = 1814
303 defaultMondPort :: Int
304 defaultMondPort = 1815
306 defaultNodedPort :: Int
307 defaultNodedPort = 1811
309 defaultRapiPort :: Int
310 defaultRapiPort = 5080
312 daemonsPorts :: Map String (Protocol, Int)
314 Map.fromList [(confd, (Udp, defaultConfdPort)),
315 (mond, (Tcp, defaultMondPort)),
316 (noded, (Tcp, defaultNodedPort)),
317 (rapi, (Tcp, defaultRapiPort)),
321 firstDrbdPort = 11000
326 daemonsLogbase :: Map String String
329 [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
331 extraLogreasonAccess :: String
332 extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
334 extraLogreasonError :: String
335 extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
338 devConsole = ConstantUtils.devConsole
342 syslogUsage :: String
343 syslogUsage = AutoConf.syslogUsage
346 syslogNo = Logging.syslogUsageToRaw SyslogNo
349 syslogYes = Logging.syslogUsageToRaw SyslogYes
352 syslogOnly = Logging.syslogUsageToRaw SyslogOnly
354 syslogSocket :: String
355 syslogSocket = "/dev/log"
359 xenBootloader :: String
360 xenBootloader = AutoConf.xenBootloader
369 xenInitrd = AutoConf.xenInitrd
372 xenKernel = AutoConf.xenKernel
374 -- FIXME: perhaps rename to 'validXenCommands' for consistency with
376 knownXenCommands :: FrozenSet String
377 knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
382 kvmPath = AutoConf.kvmPath
385 kvmKernel = AutoConf.kvmKernel
387 socatEscapeCode :: String
388 socatEscapeCode = "0x1d"
391 socatPath = AutoConf.socatPath
393 socatUseCompress :: Bool
394 socatUseCompress = AutoConf.socatUseCompress
396 socatUseEscape :: Bool
397 socatUseEscape = AutoConf.socatUseEscape
402 stBlock = Types.storageTypeToRaw StorageBlock
405 stDiskless = Types.storageTypeToRaw StorageDiskless
408 stExt = Types.storageTypeToRaw StorageExt
411 stFile = Types.storageTypeToRaw StorageFile
414 stLvmPv = Types.storageTypeToRaw StorageLvmPv
417 stLvmVg = Types.storageTypeToRaw StorageLvmVg
420 stRados = Types.storageTypeToRaw StorageRados
422 storageTypes :: FrozenSet String
423 storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
426 -- ** First two are valid in LU context only, not passed to backend
434 -- ** and the rest are valid in backend
436 sfAllocatable :: String
437 sfAllocatable = Types.storageFieldToRaw SFAllocatable
440 sfFree = Types.storageFieldToRaw SFFree
443 sfName = Types.storageFieldToRaw SFName
446 sfSize = Types.storageFieldToRaw SFSize
449 sfUsed = Types.storageFieldToRaw SFUsed
451 -- * Disk template types
454 dtDiskless = Types.diskTemplateToRaw DTDiskless
457 dtFile = Types.diskTemplateToRaw DTFile
459 dtSharedFile :: String
460 dtSharedFile = Types.diskTemplateToRaw DTSharedFile
463 dtPlain = Types.diskTemplateToRaw DTPlain
466 dtBlock = Types.diskTemplateToRaw DTBlock
469 dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
472 dtRbd = Types.diskTemplateToRaw DTRbd
475 dtExt = Types.diskTemplateToRaw DTExt
477 -- | This is used to order determine the default disk template when
478 -- the list of enabled disk templates is inferred from the current
479 -- state of the cluster. This only happens on an upgrade from a
480 -- version of Ganeti that did not support the 'enabled_disk_templates'
482 diskTemplatePreference :: [String]
483 diskTemplatePreference =
484 map Types.diskTemplateToRaw
485 [DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile]
487 diskTemplates :: FrozenSet String
488 diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
490 -- | Disk templates that are enabled by default
491 defaultEnabledDiskTemplates :: [String]
492 defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
494 -- * File backend driver
497 fdBlktap = Types.fileDriverToRaw FileBlktap
500 fdLoop = Types.fileDriverToRaw FileLoop
502 -- * Disk access mode
505 diskRdonly = Types.diskModeToRaw DiskRdOnly
508 diskRdwr = Types.diskModeToRaw DiskRdWr
510 diskAccessSet :: FrozenSet String
511 diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..]
513 -- * Instance export mode
515 exportModeLocal :: String
516 exportModeLocal = Types.exportModeToRaw ExportModeLocal
518 exportModeRemote :: String
519 exportModeRemote = Types.exportModeToRaw ExportModeRemote
521 exportModes :: FrozenSet String
522 exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
524 -- * Instance creation modes
526 instanceCreate :: String
527 instanceCreate = Types.instCreateModeToRaw InstCreate
529 instanceImport :: String
530 instanceImport = Types.instCreateModeToRaw InstImport
532 instanceRemoteImport :: String
533 instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
535 instanceCreateModes :: FrozenSet String
536 instanceCreateModes =
537 ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
539 -- * Dynamic device modification
542 ddmAdd = Types.ddmFullToRaw DdmFullAdd
545 ddmModify = Types.ddmFullToRaw DdmFullModify
548 ddmRemove = Types.ddmFullToRaw DdmFullRemove
550 ddmsValues :: FrozenSet String
551 ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
553 ddmsValuesWithModify :: FrozenSet String
554 ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
556 -- * Common exit codes
562 exitFailure = ConstantUtils.exitFailure
564 exitNotcluster :: Int
570 exitNodesetupError :: Int
571 exitNodesetupError = 12
573 -- | Need user confirmation
574 exitConfirmation :: Int
575 exitConfirmation = 13
577 -- | Exit code for query operations with unknown fields
578 exitUnknownField :: Int
579 exitUnknownField = 14
584 tagCluster = Types.tagKindToRaw TagKindCluster
586 tagInstance :: String
587 tagInstance = Types.tagKindToRaw TagKindInstance
590 tagNetwork = Types.tagKindToRaw TagKindNetwork
593 tagNode = Types.tagKindToRaw TagKindNode
595 tagNodegroup :: String
596 tagNodegroup = Types.tagKindToRaw TagKindGroup
598 validTagTypes :: FrozenSet String
599 validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
607 -- | Node clock skew in seconds
608 nodeMaxClockSkew :: Int
609 nodeMaxClockSkew = 150
611 -- | Disk index separator
612 diskSeparator :: String
613 diskSeparator = AutoConf.diskSeparator
615 ipCommandPath :: String
616 ipCommandPath = AutoConf.ipPath
620 instanceRebootSoft :: String
621 instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
623 instanceRebootHard :: String
624 instanceRebootHard = Types.rebootTypeToRaw RebootHard
626 instanceRebootFull :: String
627 instanceRebootFull = Types.rebootTypeToRaw RebootFull
629 rebootTypes :: FrozenSet String
630 rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
635 vtypeBool = Types.vTypeToRaw VTypeBool
638 vtypeInt = Types.vTypeToRaw VTypeInt
640 vtypeMaybeString :: String
641 vtypeMaybeString = Types.vTypeToRaw VTypeMaybeString
645 vtypeSize = Types.vTypeToRaw VTypeSize
647 vtypeString :: String
648 vtypeString = Types.vTypeToRaw VTypeString
650 enforceableTypes :: FrozenSet String
651 enforceableTypes = ConstantUtils.mkSet $ map Types.vTypeToRaw [minBound..]
653 -- * OOB supported commands
656 oobPowerOn = Types.oobCommandToRaw OobPowerOn
658 oobPowerOff :: String
659 oobPowerOff = Types.oobCommandToRaw OobPowerOff
661 oobPowerCycle :: String
662 oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
664 oobPowerStatus :: String
665 oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
668 oobHealth = Types.oobCommandToRaw OobHealth
670 oobCommands :: FrozenSet String
671 oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
673 oobPowerStatusPowered :: String
674 oobPowerStatusPowered = "powered"
681 oobPowerDelay :: Double
684 oobStatusCritical :: String
685 oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
687 oobStatusOk :: String
688 oobStatusOk = Types.oobStatusToRaw OobStatusOk
690 oobStatusUnknown :: String
691 oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
693 oobStatusWarning :: String
694 oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
696 oobStatuses :: FrozenSet String
697 oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
699 -- * NIC_* constants are used inside the ganeti config
710 nicModeBridged :: String
711 nicModeBridged = Types.nICModeToRaw NMBridged
713 nicModeRouted :: String
714 nicModeRouted = Types.nICModeToRaw NMRouted
717 nicModeOvs = Types.nICModeToRaw NMOvs
720 nicIpPool = Types.nICModeToRaw NMPool
722 nicValidModes :: FrozenSet String
723 nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
725 -- * Hypervisor constants
728 htXenPvm = Types.hypervisorToRaw XenPvm
731 htFake = Types.hypervisorToRaw Fake
734 htXenHvm = Types.hypervisorToRaw XenHvm
737 htKvm = Types.hypervisorToRaw Kvm
740 htChroot = Types.hypervisorToRaw Chroot
743 htLxc = Types.hypervisorToRaw Lxc
745 hyperTypes :: FrozenSet String
746 hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
748 htsReqPort :: FrozenSet String
749 htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
753 htMigrationLive :: String
754 htMigrationLive = Types.migrationModeToRaw MigrationLive
756 htMigrationNonlive :: String
757 htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
759 htMigrationModes :: FrozenSet String
761 ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
763 -- * Cluster verify steps
765 verifyNplusoneMem :: String
766 verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
768 verifyOptionalChecks :: FrozenSet String
769 verifyOptionalChecks =
770 ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
772 -- * Cluster Verify error classes
775 cvTcluster = "cluster"
783 cvTinstance :: String
784 cvTinstance = "instance"
786 -- * Cluster Verify error codes and documentation
788 cvEclustercert :: (String, String, String)
791 Types.cVErrorCodeToRaw CvECLUSTERCERT,
792 "Cluster certificate files verification failure")
794 cvEclustercfg :: (String, String, String)
797 Types.cVErrorCodeToRaw CvECLUSTERCFG,
798 "Cluster configuration verification failure")
800 cvEclusterdanglinginst :: (String, String, String)
801 cvEclusterdanglinginst =
803 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
804 "Some instances have a non-existing primary node")
806 cvEclusterdanglingnodes :: (String, String, String)
807 cvEclusterdanglingnodes =
809 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
810 "Some nodes belong to non-existing groups")
812 cvEclusterfilecheck :: (String, String, String)
813 cvEclusterfilecheck =
815 Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
816 "Cluster configuration verification failure")
818 cvEgroupdifferentpvsize :: (String, String, String)
819 cvEgroupdifferentpvsize =
821 Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
822 "PVs in the group have different sizes")
824 cvEinstancebadnode :: (String, String, String)
827 Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
828 "Instance marked as running lives on an offline node")
830 cvEinstancedown :: (String, String, String)
833 Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
834 "Instance not running on its primary node")
836 cvEinstancefaultydisk :: (String, String, String)
837 cvEinstancefaultydisk =
839 Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
840 "Impossible to retrieve status for a disk")
842 cvEinstancelayout :: (String, String, String)
845 Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
846 "Instance has multiple secondary nodes")
848 cvEinstancemissingcfgparameter :: (String, String, String)
849 cvEinstancemissingcfgparameter =
851 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
852 "A configuration parameter for an instance is missing")
854 cvEinstancemissingdisk :: (String, String, String)
855 cvEinstancemissingdisk =
857 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
858 "Missing volume on an instance")
860 cvEinstancepolicy :: (String, String, String)
863 Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
864 "Instance does not meet policy")
866 cvEinstancesplitgroups :: (String, String, String)
867 cvEinstancesplitgroups =
869 Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
870 "Instance with primary and secondary nodes in different groups")
872 cvEinstanceunsuitablenode :: (String, String, String)
873 cvEinstanceunsuitablenode =
875 Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
876 "Instance running on nodes that are not suitable for it")
878 cvEinstancewrongnode :: (String, String, String)
879 cvEinstancewrongnode =
881 Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
882 "Instance running on the wrong node")
884 cvEnodedrbd :: (String, String, String)
887 Types.cVErrorCodeToRaw CvENODEDRBD,
888 "Error parsing the DRBD status file")
890 cvEnodedrbdhelper :: (String, String, String)
893 Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
894 "Error caused by the DRBD helper")
896 cvEnodedrbdversion :: (String, String, String)
899 Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
900 "DRBD version mismatch within a node group")
902 cvEnodefilecheck :: (String, String, String)
905 Types.cVErrorCodeToRaw CvENODEFILECHECK,
906 "Error retrieving the checksum of the node files")
908 cvEnodefilestoragepaths :: (String, String, String)
909 cvEnodefilestoragepaths =
911 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
912 "Detected bad file storage paths")
914 cvEnodefilestoragepathunusable :: (String, String, String)
915 cvEnodefilestoragepathunusable =
917 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
918 "File storage path unusable")
920 cvEnodehooks :: (String, String, String)
923 Types.cVErrorCodeToRaw CvENODEHOOKS,
924 "Communication failure in hooks execution")
926 cvEnodehv :: (String, String, String)
929 Types.cVErrorCodeToRaw CvENODEHV,
930 "Hypervisor parameters verification failure")
932 cvEnodelvm :: (String, String, String)
935 Types.cVErrorCodeToRaw CvENODELVM,
936 "LVM-related node error")
938 cvEnoden1 :: (String, String, String)
941 Types.cVErrorCodeToRaw CvENODEN1,
942 "Not enough memory to accommodate instance failovers")
944 cvEnodenet :: (String, String, String)
947 Types.cVErrorCodeToRaw CvENODENET,
948 "Network-related node error")
950 cvEnodeoobpath :: (String, String, String)
953 Types.cVErrorCodeToRaw CvENODEOOBPATH,
954 "Invalid Out Of Band path")
956 cvEnodeorphaninstance :: (String, String, String)
957 cvEnodeorphaninstance =
959 Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
960 "Unknown intance running on a node")
962 cvEnodeorphanlv :: (String, String, String)
965 Types.cVErrorCodeToRaw CvENODEORPHANLV,
966 "Unknown LVM logical volume")
968 cvEnodeos :: (String, String, String)
971 Types.cVErrorCodeToRaw CvENODEOS,
972 "OS-related node error")
974 cvEnoderpc :: (String, String, String)
977 Types.cVErrorCodeToRaw CvENODERPC,
978 "Error during connection to the primary node of an instance")
980 cvEnodesetup :: (String, String, String)
983 Types.cVErrorCodeToRaw CvENODESETUP,
986 cvEnodesharedfilestoragepathunusable :: (String, String, String)
987 cvEnodesharedfilestoragepathunusable =
989 Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
990 "Shared file storage path unusable")
992 cvEnodessh :: (String, String, String)
995 Types.cVErrorCodeToRaw CvENODESSH,
996 "SSH-related node error")
998 cvEnodetime :: (String, String, String)
1001 Types.cVErrorCodeToRaw CvENODETIME,
1002 "Node returned invalid time")
1004 cvEnodeuserscripts :: (String, String, String)
1005 cvEnodeuserscripts =
1007 Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
1008 "User scripts not present or not executable")
1010 cvEnodeversion :: (String, String, String)
1013 Types.cVErrorCodeToRaw CvENODEVERSION,
1014 "Protocol version mismatch or Ganeti version mismatch")
1016 cvAllEcodes :: FrozenSet (String, String, String)
1021 cvEclusterdanglinginst,
1022 cvEclusterdanglingnodes,
1023 cvEclusterfilecheck,
1024 cvEgroupdifferentpvsize,
1027 cvEinstancefaultydisk,
1029 cvEinstancemissingcfgparameter,
1030 cvEinstancemissingdisk,
1032 cvEinstancesplitgroups,
1033 cvEinstanceunsuitablenode,
1034 cvEinstancewrongnode,
1039 cvEnodefilestoragepaths,
1040 cvEnodefilestoragepathunusable,
1047 cvEnodeorphaninstance,
1052 cvEnodesharedfilestoragepathunusable,
1058 cvAllEcodesStrings :: FrozenSet String
1059 cvAllEcodesStrings =
1060 ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
1062 -- * Instance status
1064 inststAdmindown :: String
1065 inststAdmindown = Types.instanceStatusToRaw StatusDown
1067 inststAdminoffline :: String
1068 inststAdminoffline = Types.instanceStatusToRaw StatusOffline
1070 inststErrordown :: String
1071 inststErrordown = Types.instanceStatusToRaw ErrorDown
1073 inststErrorup :: String
1074 inststErrorup = Types.instanceStatusToRaw ErrorUp
1076 inststNodedown :: String
1077 inststNodedown = Types.instanceStatusToRaw NodeDown
1079 inststNodeoffline :: String
1080 inststNodeoffline = Types.instanceStatusToRaw NodeOffline
1082 inststRunning :: String
1083 inststRunning = Types.instanceStatusToRaw Running
1085 inststWrongnode :: String
1086 inststWrongnode = Types.instanceStatusToRaw WrongNode
1088 inststAll :: FrozenSet String
1089 inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
1093 adminstDown :: String
1094 adminstDown = Types.adminStateToRaw AdminDown
1096 adminstOffline :: String
1097 adminstOffline = Types.adminStateToRaw AdminOffline
1100 adminstUp = Types.adminStateToRaw AdminUp
1102 adminstAll :: FrozenSet String
1103 adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
1108 nrDrained = Types.nodeRoleToRaw NRDrained
1111 nrMaster = Types.nodeRoleToRaw NRMaster
1113 nrMcandidate :: String
1114 nrMcandidate = Types.nodeRoleToRaw NRCandidate
1117 nrOffline = Types.nodeRoleToRaw NROffline
1120 nrRegular = Types.nodeRoleToRaw NRRegular
1122 nrAll :: FrozenSet String
1123 nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
1125 -- * Allocator framework constants
1127 iallocatorVersion :: Int
1128 iallocatorVersion = 2
1130 iallocatorDirIn :: String
1131 iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
1133 iallocatorDirOut :: String
1134 iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
1136 validIallocatorDirections :: FrozenSet String
1137 validIallocatorDirections =
1138 ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
1140 iallocatorModeAlloc :: String
1141 iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
1143 iallocatorModeChgGroup :: String
1144 iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
1146 iallocatorModeMultiAlloc :: String
1147 iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
1149 iallocatorModeNodeEvac :: String
1150 iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
1152 iallocatorModeReloc :: String
1153 iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
1155 validIallocatorModes :: FrozenSet String
1156 validIallocatorModes =
1157 ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
1159 iallocatorSearchPath :: [String]
1160 iallocatorSearchPath = AutoConf.iallocatorSearchPath
1162 defaultIallocatorShortcut :: String
1163 defaultIallocatorShortcut = "."
1165 -- * Node evacuation
1167 nodeEvacPri :: String
1168 nodeEvacPri = Types.evacModeToRaw ChangePrimary
1170 nodeEvacSec :: String
1171 nodeEvacSec = Types.evacModeToRaw ChangeSecondary
1173 nodeEvacAll :: String
1174 nodeEvacAll = Types.evacModeToRaw ChangeAll
1176 nodeEvacModes :: FrozenSet String
1177 nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..]
1181 jobStatusQueued :: String
1182 jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
1184 jobStatusWaiting :: String
1185 jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
1187 jobStatusCanceling :: String
1188 jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
1190 jobStatusRunning :: String
1191 jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
1193 jobStatusCanceled :: String
1194 jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
1196 jobStatusSuccess :: String
1197 jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
1199 jobStatusError :: String
1200 jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
1202 jobsPending :: FrozenSet String
1204 ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
1206 jobsFinalized :: FrozenSet String
1208 ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
1210 jobStatusAll :: FrozenSet String
1211 jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
1215 -- ** Not yet finalized opcodes
1217 opStatusCanceling :: String
1218 opStatusCanceling = "canceling"
1220 opStatusQueued :: String
1221 opStatusQueued = "queued"
1223 opStatusRunning :: String
1224 opStatusRunning = "running"
1226 opStatusWaiting :: String
1227 opStatusWaiting = "waiting"
1229 -- ** Finalized opcodes
1231 opStatusCanceled :: String
1232 opStatusCanceled = "canceled"
1234 opStatusError :: String
1235 opStatusError = "error"
1237 opStatusSuccess :: String
1238 opStatusSuccess = "success"
1240 opsFinalized :: FrozenSet String
1242 ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
1244 -- * OpCode priority
1249 opPrioHighest :: Int
1253 opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
1256 opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
1259 opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
1261 opPrioSubmitValid :: FrozenSet Int
1262 opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
1264 opPrioDefault :: Int
1265 opPrioDefault = opPrioNormal
1267 -- * Execution log types
1269 elogMessage :: String
1270 elogMessage = Types.eLogTypeToRaw ELogMessage
1272 elogRemoteImport :: String
1273 elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
1275 elogJqueueTest :: String
1276 elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
1280 confdProtocolVersion :: Int
1281 confdProtocolVersion = ConstantUtils.confdProtocolVersion
1283 -- Confd request type
1286 confdReqPing = Types.confdRequestTypeToRaw ReqPing
1288 confdReqNodeRoleByname :: Int
1289 confdReqNodeRoleByname = Types.confdRequestTypeToRaw ReqNodeRoleByName
1291 confdReqNodePipByInstanceIp :: Int
1292 confdReqNodePipByInstanceIp = Types.confdRequestTypeToRaw ReqNodePipByInstPip
1294 confdReqClusterMaster :: Int
1295 confdReqClusterMaster = Types.confdRequestTypeToRaw ReqClusterMaster
1297 confdReqNodePipList :: Int
1298 confdReqNodePipList = Types.confdRequestTypeToRaw ReqNodePipList
1300 confdReqMcPipList :: Int
1301 confdReqMcPipList = Types.confdRequestTypeToRaw ReqMcPipList
1303 confdReqInstancesIpsList :: Int
1304 confdReqInstancesIpsList = Types.confdRequestTypeToRaw ReqInstIpsList
1306 confdReqNodeDrbd :: Int
1307 confdReqNodeDrbd = Types.confdRequestTypeToRaw ReqNodeDrbd
1309 confdReqNodeInstances :: Int
1310 confdReqNodeInstances = Types.confdRequestTypeToRaw ReqNodeInstances
1312 confdReqs :: FrozenSet Int
1314 ConstantUtils.mkSet .
1315 map Types.confdRequestTypeToRaw $
1316 [minBound..] \\ [ReqNodeInstances]
1318 -- * Confd request type
1320 confdReqfieldName :: Int
1321 confdReqfieldName = Types.confdReqFieldToRaw ReqFieldName
1323 confdReqfieldIp :: Int
1324 confdReqfieldIp = Types.confdReqFieldToRaw ReqFieldIp
1326 confdReqfieldMnodePip :: Int
1327 confdReqfieldMnodePip = Types.confdReqFieldToRaw ReqFieldMNodePip
1329 -- * Confd repl status
1331 confdReplStatusOk :: Int
1332 confdReplStatusOk = Types.confdReplyStatusToRaw ReplyStatusOk
1334 confdReplStatusError :: Int
1335 confdReplStatusError = Types.confdReplyStatusToRaw ReplyStatusError
1337 confdReplStatusNotimplemented :: Int
1338 confdReplStatusNotimplemented = Types.confdReplyStatusToRaw ReplyStatusNotImpl
1340 confdReplStatuses :: FrozenSet Int
1342 ConstantUtils.mkSet $ map Types.confdReplyStatusToRaw [minBound..]
1344 -- * Confd node role
1346 confdNodeRoleMaster :: Int
1347 confdNodeRoleMaster = Types.confdNodeRoleToRaw NodeRoleMaster
1349 confdNodeRoleCandidate :: Int
1350 confdNodeRoleCandidate = Types.confdNodeRoleToRaw NodeRoleCandidate
1352 confdNodeRoleOffline :: Int
1353 confdNodeRoleOffline = Types.confdNodeRoleToRaw NodeRoleOffline
1355 confdNodeRoleDrained :: Int
1356 confdNodeRoleDrained = Types.confdNodeRoleToRaw NodeRoleDrained
1358 confdNodeRoleRegular :: Int
1359 confdNodeRoleRegular = Types.confdNodeRoleToRaw NodeRoleRegular
1361 -- * A few common errors for confd
1363 confdErrorUnknownEntry :: Int
1364 confdErrorUnknownEntry = Types.confdErrorTypeToRaw ConfdErrorUnknownEntry
1366 confdErrorInternal :: Int
1367 confdErrorInternal = Types.confdErrorTypeToRaw ConfdErrorInternal
1369 confdErrorArgument :: Int
1370 confdErrorArgument = Types.confdErrorTypeToRaw ConfdErrorArgument
1372 -- * Confd request query fields
1374 confdReqqLink :: String
1375 confdReqqLink = ConstantUtils.confdReqqLink
1377 confdReqqIp :: String
1378 confdReqqIp = ConstantUtils.confdReqqIp
1380 confdReqqIplist :: String
1381 confdReqqIplist = ConstantUtils.confdReqqIplist
1383 confdReqqFields :: String
1384 confdReqqFields = ConstantUtils.confdReqqFields
1386 -- | Each request is "salted" by the current timestamp.
1388 -- This constant decides how many seconds of skew to accept.
1390 -- TODO: make this a default and allow the value to be more
1392 confdMaxClockSkew :: Int
1393 confdMaxClockSkew = 2 * nodeMaxClockSkew
1395 -- | When we haven't reloaded the config for more than this amount of
1396 -- seconds, we force a test to see if inotify is betraying us. Using a
1397 -- prime number to ensure we get less chance of 'same wakeup' with
1399 confdConfigReloadTimeout :: Int
1400 confdConfigReloadTimeout = 17
1402 -- | If we receive more than one update in this amount of
1403 -- microseconds, we move to polling every RATELIMIT seconds, rather
1404 -- than relying on inotify, to be able to serve more requests.
1405 confdConfigReloadRatelimit :: Int
1406 confdConfigReloadRatelimit = 250000
1408 -- | Magic number prepended to all confd queries.
1410 -- This allows us to distinguish different types of confd protocols
1411 -- and handle them. For example by changing this we can move the whole
1412 -- payload to be compressed, or move away from json.
1413 confdMagicFourcc :: String
1414 confdMagicFourcc = "plj0"
1416 -- | By default a confd request is sent to the minimum between this
1417 -- number and all MCs. 6 was chosen because even in the case of a
1418 -- disastrous 50% response rate, we should have enough answers to be
1419 -- able to compare more than one.
1420 confdDefaultReqCoverage :: Int
1421 confdDefaultReqCoverage = 6
1423 -- | Timeout in seconds to expire pending query request in the confd
1424 -- client library. We don't actually expect any answer more than 10
1425 -- seconds after we sent a request.
1426 confdClientExpireTimeout :: Int
1427 confdClientExpireTimeout = 10
1429 -- * Possible values for NodeGroup.alloc_policy
1431 allocPolicyLastResort :: String
1432 allocPolicyLastResort = Types.allocPolicyToRaw AllocLastResort
1434 allocPolicyPreferred :: String
1435 allocPolicyPreferred = Types.allocPolicyToRaw AllocPreferred
1437 allocPolicyUnallocable :: String
1438 allocPolicyUnallocable = Types.allocPolicyToRaw AllocUnallocable
1440 validAllocPolicies :: [String]
1441 validAllocPolicies = map Types.allocPolicyToRaw [minBound..]
1443 -- | Temporary external/shared storage parameters
1444 blockdevDriverManual :: String
1445 blockdevDriverManual = Types.blockDriverToRaw BlockDrvManual
1447 -- | 'qemu-img' path, required for 'ovfconverter'
1448 qemuimgPath :: String
1449 qemuimgPath = AutoConf.qemuimgPath
1451 -- | Whether htools was enabled at compilation time
1453 -- FIXME: this should be moved next to the other enable constants,
1454 -- such as, 'enableConfd', and renamed to 'enableHtools'.
1456 htools = AutoConf.htools
1458 -- | Path generating random UUID
1459 randomUuidFile :: String
1460 randomUuidFile = ConstantUtils.randomUuidFile
1462 -- * Auto-repair tag prefixes
1464 autoRepairTagPrefix :: String
1465 autoRepairTagPrefix = "ganeti:watcher:autorepair:"
1467 autoRepairTagEnabled :: String
1468 autoRepairTagEnabled = autoRepairTagPrefix
1470 autoRepairTagPending :: String
1471 autoRepairTagPending = autoRepairTagPrefix ++ "pending:"
1473 autoRepairTagResult :: String
1474 autoRepairTagResult = autoRepairTagPrefix ++ "result:"
1476 autoRepairTagSuspended :: String
1477 autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:"
1479 -- * Auto-repair levels
1481 autoRepairFailover :: String
1482 autoRepairFailover = "failover"
1484 autoRepairFixStorage :: String
1485 autoRepairFixStorage = "fix-storage"
1487 autoRepairMigrate :: String
1488 autoRepairMigrate = "migrate"
1490 autoRepairReinstall :: String
1491 autoRepairReinstall = "reinstall"
1493 autoRepairAllTypes :: FrozenSet String
1494 autoRepairAllTypes =
1495 ConstantUtils.mkSet [autoRepairFailover,
1496 autoRepairFixStorage,
1498 autoRepairReinstall]
1500 -- * Auto-repair results
1502 autoRepairEnoperm :: String
1503 autoRepairEnoperm = "enoperm"
1505 autoRepairFailure :: String
1506 autoRepairFailure = "failure"
1508 autoRepairSuccess :: String
1509 autoRepairSuccess = "success"
1511 autoRepairAllResults :: FrozenSet String
1512 autoRepairAllResults =
1513 ConstantUtils.mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess]
1515 -- | The version identifier for builtin data collectors
1516 builtinDataCollectorVersion :: String
1517 builtinDataCollectorVersion = "B"
1519 -- | The reason trail opcode parameter name
1520 opcodeReason :: String
1521 opcodeReason = "reason"
1523 diskstatsFile :: String
1524 diskstatsFile = "/proc/diskstats"
1526 -- * CPU load collector
1529 statFile = "/proc/stat"
1531 cpuavgloadBufferSize :: Int
1532 cpuavgloadBufferSize = 150
1534 cpuavgloadWindowSize :: Int
1535 cpuavgloadWindowSize = 600
1537 -- | Mond's variable for periodical data collection
1538 mondTimeInterval :: Int
1539 mondTimeInterval = 5
1541 -- * Disk access modes
1543 diskUserspace :: String
1544 diskUserspace = Types.diskAccessModeToRaw DiskUserspace
1546 diskKernelspace :: String
1547 diskKernelspace = Types.diskAccessModeToRaw DiskKernelspace
1549 diskValidAccessModes :: FrozenSet String
1550 diskValidAccessModes =
1551 ConstantUtils.mkSet $ map Types.diskAccessModeToRaw [minBound..]
1553 -- | Timeout for queue draining in upgrades
1554 upgradeQueueDrainTimeout :: Int
1555 upgradeQueueDrainTimeout = 36 * 60 * 60 -- 1.5 days
1557 -- | Intervall at which the queue is polled during upgrades
1558 upgradeQueuePollInterval :: Int
1559 upgradeQueuePollInterval = 10