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
40 import qualified Data.Map as Map (fromList)
43 import Ganeti.ConstantUtils (FrozenSet, Protocol(..), buildVersion)
44 import qualified Ganeti.ConstantUtils as ConstantUtils
45 import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..),
47 import Ganeti.Logging (SyslogUsage(..))
48 import qualified Ganeti.Logging as Logging (syslogUsageToRaw)
49 import qualified Ganeti.Runtime as Runtime
51 import qualified Ganeti.Types as Types
53 -- * 'autoconf' constants for Python only ('autotools/build-bash-completion')
55 htoolsProgs :: [String]
56 htoolsProgs = AutoConf.htoolsProgs
58 -- * 'autoconf' constants for Python only ('lib/constants.py')
60 drbdBarriers :: String
61 drbdBarriers = AutoConf.drbdBarriers
63 drbdNoMetaFlush :: Bool
64 drbdNoMetaFlush = AutoConf.drbdNoMetaFlush
67 lvmStripecount = AutoConf.lvmStripecount
69 -- * 'autoconf' constants for Python only ('lib/pathutils.py')
71 -- ** Build-time constants
74 exportDir = AutoConf.exportDir
76 osSearchPath :: [String]
77 osSearchPath = AutoConf.osSearchPath
79 esSearchPath :: [String]
80 esSearchPath = AutoConf.esSearchPath
82 sshConfigDir :: String
83 sshConfigDir = AutoConf.sshConfigDir
85 xenConfigDir :: String
86 xenConfigDir = AutoConf.xenConfigDir
89 sysconfdir = AutoConf.sysconfdir
92 toolsdir = AutoConf.toolsdir
94 localstatedir :: String
95 localstatedir = AutoConf.localstatedir
97 -- ** Paths which don't change for a virtual cluster
100 pkglibdir = AutoConf.pkglibdir
102 -- * 'autoconf' constants for Python only ('lib/build/sphinx_ext.py')
104 manPages :: Map String Int
105 manPages = Map.fromList AutoConf.manPages
107 -- * 'autoconf' constants for QA cluster only ('qa/qa_cluster.py')
109 versionedsharedir :: String
110 versionedsharedir = AutoConf.versionedsharedir
112 -- * 'autoconf' constants for Python only ('tests/py/docs_unittest.py')
114 gntScripts :: [String]
115 gntScripts = AutoConf.gntScripts
117 -- * Various versions
119 releaseVersion :: String
120 releaseVersion = AutoConf.packageVersion
123 configMajor = AutoConf.versionMajor
126 configMinor = AutoConf.versionMinor
128 -- | The configuration is supposed to remain stable across
129 -- revisions. Therefore, the revision number is cleared to '0'.
130 configRevision :: Int
134 configVersion = buildVersion configMajor configMinor configRevision
136 -- | Similarly to the configuration (see 'configRevision'), the
137 -- protocols are supposed to remain stable across revisions.
138 protocolVersion :: Int
139 protocolVersion = buildVersion configMajor configMinor configRevision
142 daemonsGroup :: String
143 daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
146 adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
148 masterdUser :: String
149 masterdUser = Runtime.daemonUser GanetiMasterd
151 masterdGroup :: String
152 masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
155 rapiUser = Runtime.daemonUser GanetiRapi
158 rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
161 confdUser = Runtime.daemonUser GanetiConfd
164 confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
167 luxidUser = Runtime.daemonUser GanetiLuxid
170 luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
173 nodedUser = Runtime.daemonUser GanetiNoded
176 nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
179 mondUser = Runtime.daemonUser GanetiMond
182 mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
184 sshLoginUser :: String
185 sshLoginUser = AutoConf.sshLoginUser
187 sshConsoleUser :: String
188 sshConsoleUser = AutoConf.sshConsoleUser
190 -- * 'autoconf' enable/disable
193 enableConfd = AutoConf.enableConfd
196 enableMond = AutoConf.enableMond
198 enableRestrictedCommands :: Bool
199 enableRestrictedCommands = AutoConf.enableRestrictedCommands
201 enableSplitQuery :: Bool
202 enableSplitQuery = AutoConf.enableSplitQuery
215 confd = Runtime.daemonName GanetiConfd
218 masterd = Runtime.daemonName GanetiMasterd
221 mond = Runtime.daemonName GanetiMond
224 noded = Runtime.daemonName GanetiNoded
227 luxid = Runtime.daemonName GanetiLuxid
230 rapi = Runtime.daemonName GanetiRapi
232 daemons :: FrozenSet String
234 ConstantUtils.mkSet [confd,
241 defaultConfdPort :: Int
242 defaultConfdPort = 1814
244 defaultMondPort :: Int
245 defaultMondPort = 1815
247 defaultNodedPort :: Int
248 defaultNodedPort = 1811
250 defaultRapiPort :: Int
251 defaultRapiPort = 5080
253 daemonsPorts :: Map String (Protocol, Int)
255 Map.fromList [(confd, (Udp, defaultConfdPort)),
256 (mond, (Tcp, defaultMondPort)),
257 (noded, (Tcp, defaultNodedPort)),
258 (rapi, (Tcp, defaultRapiPort)),
261 daemonsLogbase :: Map String String
264 [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
266 extraLogreasonAccess :: String
267 extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
269 extraLogreasonError :: String
270 extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
273 devConsole = ConstantUtils.devConsole
277 syslogUsage :: String
278 syslogUsage = AutoConf.syslogUsage
281 syslogNo = Logging.syslogUsageToRaw SyslogNo
284 syslogYes = Logging.syslogUsageToRaw SyslogYes
287 syslogOnly = Logging.syslogUsageToRaw SyslogOnly
289 syslogSocket :: String
290 syslogSocket = "/dev/log"
294 xenBootloader :: String
295 xenBootloader = AutoConf.xenBootloader
304 xenInitrd = AutoConf.xenInitrd
307 xenKernel = AutoConf.xenKernel
309 -- FIXME: perhaps rename to 'validXenCommands' for consistency with
311 knownXenCommands :: FrozenSet String
312 knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
317 kvmPath = AutoConf.kvmPath
320 kvmKernel = AutoConf.kvmKernel
322 socatEscapeCode :: String
323 socatEscapeCode = "0x1d"
326 socatPath = AutoConf.socatPath
328 socatUseCompress :: Bool
329 socatUseCompress = AutoConf.socatUseCompress
331 socatUseEscape :: Bool
332 socatUseEscape = AutoConf.socatUseEscape
337 stBlock = Types.storageTypeToRaw StorageBlock
340 stDiskless = Types.storageTypeToRaw StorageDiskless
343 stExt = Types.storageTypeToRaw StorageExt
346 stFile = Types.storageTypeToRaw StorageFile
349 stLvmPv = Types.storageTypeToRaw StorageLvmPv
352 stLvmVg = Types.storageTypeToRaw StorageLvmVg
355 stRados = Types.storageTypeToRaw StorageRados
357 storageTypes :: FrozenSet String
358 storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
361 -- ** First two are valid in LU context only, not passed to backend
369 -- ** and the rest are valid in backend
371 sfAllocatable :: String
372 sfAllocatable = Types.storageFieldToRaw SFAllocatable
375 sfFree = Types.storageFieldToRaw SFFree
378 sfName = Types.storageFieldToRaw SFName
381 sfSize = Types.storageFieldToRaw SFSize
384 sfUsed = Types.storageFieldToRaw SFUsed
386 -- * Disk template types
389 dtDiskless = Types.diskTemplateToRaw DTDiskless
392 dtFile = Types.diskTemplateToRaw DTFile
394 dtSharedFile :: String
395 dtSharedFile = Types.diskTemplateToRaw DTSharedFile
398 dtPlain = Types.diskTemplateToRaw DTPlain
401 dtBlock = Types.diskTemplateToRaw DTBlock
404 dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
407 dtRbd = Types.diskTemplateToRaw DTRbd
410 dtExt = Types.diskTemplateToRaw DTExt
412 -- | This is used to order determine the default disk template when
413 -- the list of enabled disk templates is inferred from the current
414 -- state of the cluster. This only happens on an upgrade from a
415 -- version of Ganeti that did not support the 'enabled_disk_templates'
417 diskTemplatePreference :: [String]
418 diskTemplatePreference =
419 map Types.diskTemplateToRaw
420 [DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile]
422 diskTemplates :: FrozenSet String
423 diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
425 -- | Disk templates that are enabled by default
426 defaultEnabledDiskTemplates :: [String]
427 defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
429 -- * File backend driver
432 fdBlktap = Types.fileDriverToRaw FileBlktap
435 fdLoop = Types.fileDriverToRaw FileLoop
437 -- * Disk access mode
440 diskRdonly = Types.diskModeToRaw DiskRdOnly
443 diskRdwr = Types.diskModeToRaw DiskRdWr
445 diskAccessSet :: FrozenSet String
446 diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..]
448 -- * Instance export mode
450 exportModeLocal :: String
451 exportModeLocal = Types.exportModeToRaw ExportModeLocal
453 exportModeRemote :: String
454 exportModeRemote = Types.exportModeToRaw ExportModeRemote
456 exportModes :: FrozenSet String
457 exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
459 -- * Instance creation modes
461 instanceCreate :: String
462 instanceCreate = Types.instCreateModeToRaw InstCreate
464 instanceImport :: String
465 instanceImport = Types.instCreateModeToRaw InstImport
467 instanceRemoteImport :: String
468 instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
470 instanceCreateModes :: FrozenSet String
471 instanceCreateModes =
472 ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
474 -- * Dynamic device modification
477 ddmAdd = Types.ddmFullToRaw DdmFullAdd
480 ddmModify = Types.ddmFullToRaw DdmFullModify
483 ddmRemove = Types.ddmFullToRaw DdmFullRemove
485 ddmsValues :: FrozenSet String
486 ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
488 ddmsValuesWithModify :: FrozenSet String
489 ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
491 -- * Common exit codes
497 exitFailure = ConstantUtils.exitFailure
499 exitNotcluster :: Int
505 exitNodesetupError :: Int
506 exitNodesetupError = 12
508 -- | Need user confirmation
509 exitConfirmation :: Int
510 exitConfirmation = 13
512 -- | Exit code for query operations with unknown fields
513 exitUnknownField :: Int
514 exitUnknownField = 14
519 tagCluster = Types.tagKindToRaw TagKindCluster
521 tagInstance :: String
522 tagInstance = Types.tagKindToRaw TagKindInstance
525 tagNetwork = Types.tagKindToRaw TagKindNetwork
528 tagNode = Types.tagKindToRaw TagKindNode
530 tagNodegroup :: String
531 tagNodegroup = Types.tagKindToRaw TagKindGroup
533 validTagTypes :: FrozenSet String
534 validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
542 -- | Node clock skew in seconds
543 nodeMaxClockSkew :: Int
544 nodeMaxClockSkew = 150
546 -- | Disk index separator
547 diskSeparator :: String
548 diskSeparator = AutoConf.diskSeparator
550 ipCommandPath :: String
551 ipCommandPath = AutoConf.ipPath
555 instanceRebootSoft :: String
556 instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
558 instanceRebootHard :: String
559 instanceRebootHard = Types.rebootTypeToRaw RebootHard
561 instanceRebootFull :: String
562 instanceRebootFull = Types.rebootTypeToRaw RebootFull
564 rebootTypes :: FrozenSet String
565 rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
570 vtypeBool = Types.vTypeToRaw VTypeBool
573 vtypeInt = Types.vTypeToRaw VTypeInt
575 vtypeMaybeString :: String
576 vtypeMaybeString = Types.vTypeToRaw VTypeMaybeString
580 vtypeSize = Types.vTypeToRaw VTypeSize
582 vtypeString :: String
583 vtypeString = Types.vTypeToRaw VTypeString
585 enforceableTypes :: FrozenSet String
586 enforceableTypes = ConstantUtils.mkSet $ map Types.vTypeToRaw [minBound..]
588 -- * OOB supported commands
591 oobPowerOn = Types.oobCommandToRaw OobPowerOn
593 oobPowerOff :: String
594 oobPowerOff = Types.oobCommandToRaw OobPowerOff
596 oobPowerCycle :: String
597 oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
599 oobPowerStatus :: String
600 oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
603 oobHealth = Types.oobCommandToRaw OobHealth
605 oobCommands :: FrozenSet String
606 oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
608 oobPowerStatusPowered :: String
609 oobPowerStatusPowered = "powered"
616 oobPowerDelay :: Double
619 oobStatusCritical :: String
620 oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
622 oobStatusOk :: String
623 oobStatusOk = Types.oobStatusToRaw OobStatusOk
625 oobStatusUnknown :: String
626 oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
628 oobStatusWarning :: String
629 oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
631 oobStatuses :: FrozenSet String
632 oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
634 -- * NIC_* constants are used inside the ganeti config
645 nicModeBridged :: String
646 nicModeBridged = Types.nICModeToRaw NMBridged
648 nicModeRouted :: String
649 nicModeRouted = Types.nICModeToRaw NMRouted
652 nicModeOvs = Types.nICModeToRaw NMOvs
655 nicIpPool = Types.nICModeToRaw NMPool
657 nicValidModes :: FrozenSet String
658 nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
660 -- * Hypervisor constants
663 htXenPvm = Types.hypervisorToRaw XenPvm
666 htFake = Types.hypervisorToRaw Fake
669 htXenHvm = Types.hypervisorToRaw XenHvm
672 htKvm = Types.hypervisorToRaw Kvm
675 htChroot = Types.hypervisorToRaw Chroot
678 htLxc = Types.hypervisorToRaw Lxc
680 hyperTypes :: FrozenSet String
681 hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
683 htsReqPort :: FrozenSet String
684 htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
688 htMigrationLive :: String
689 htMigrationLive = Types.migrationModeToRaw MigrationLive
691 htMigrationNonlive :: String
692 htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
694 htMigrationModes :: FrozenSet String
696 ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
698 -- * Cluster verify steps
700 verifyNplusoneMem :: String
701 verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
703 verifyOptionalChecks :: FrozenSet String
704 verifyOptionalChecks =
705 ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
707 -- * Cluster Verify error classes
710 cvTcluster = "cluster"
718 cvTinstance :: String
719 cvTinstance = "instance"
721 -- * Cluster Verify error codes and documentation
723 cvEclustercert :: (String, String, String)
726 Types.cVErrorCodeToRaw CvECLUSTERCERT,
727 "Cluster certificate files verification failure")
729 cvEclustercfg :: (String, String, String)
732 Types.cVErrorCodeToRaw CvECLUSTERCFG,
733 "Cluster configuration verification failure")
735 cvEclusterdanglinginst :: (String, String, String)
736 cvEclusterdanglinginst =
738 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
739 "Some instances have a non-existing primary node")
741 cvEclusterdanglingnodes :: (String, String, String)
742 cvEclusterdanglingnodes =
744 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
745 "Some nodes belong to non-existing groups")
747 cvEclusterfilecheck :: (String, String, String)
748 cvEclusterfilecheck =
750 Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
751 "Cluster configuration verification failure")
753 cvEgroupdifferentpvsize :: (String, String, String)
754 cvEgroupdifferentpvsize =
756 Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
757 "PVs in the group have different sizes")
759 cvEinstancebadnode :: (String, String, String)
762 Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
763 "Instance marked as running lives on an offline node")
765 cvEinstancedown :: (String, String, String)
768 Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
769 "Instance not running on its primary node")
771 cvEinstancefaultydisk :: (String, String, String)
772 cvEinstancefaultydisk =
774 Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
775 "Impossible to retrieve status for a disk")
777 cvEinstancelayout :: (String, String, String)
780 Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
781 "Instance has multiple secondary nodes")
783 cvEinstancemissingcfgparameter :: (String, String, String)
784 cvEinstancemissingcfgparameter =
786 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
787 "A configuration parameter for an instance is missing")
789 cvEinstancemissingdisk :: (String, String, String)
790 cvEinstancemissingdisk =
792 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
793 "Missing volume on an instance")
795 cvEinstancepolicy :: (String, String, String)
798 Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
799 "Instance does not meet policy")
801 cvEinstancesplitgroups :: (String, String, String)
802 cvEinstancesplitgroups =
804 Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
805 "Instance with primary and secondary nodes in different groups")
807 cvEinstanceunsuitablenode :: (String, String, String)
808 cvEinstanceunsuitablenode =
810 Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
811 "Instance running on nodes that are not suitable for it")
813 cvEinstancewrongnode :: (String, String, String)
814 cvEinstancewrongnode =
816 Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
817 "Instance running on the wrong node")
819 cvEnodedrbd :: (String, String, String)
822 Types.cVErrorCodeToRaw CvENODEDRBD,
823 "Error parsing the DRBD status file")
825 cvEnodedrbdhelper :: (String, String, String)
828 Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
829 "Error caused by the DRBD helper")
831 cvEnodedrbdversion :: (String, String, String)
834 Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
835 "DRBD version mismatch within a node group")
837 cvEnodefilecheck :: (String, String, String)
840 Types.cVErrorCodeToRaw CvENODEFILECHECK,
841 "Error retrieving the checksum of the node files")
843 cvEnodefilestoragepaths :: (String, String, String)
844 cvEnodefilestoragepaths =
846 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
847 "Detected bad file storage paths")
849 cvEnodefilestoragepathunusable :: (String, String, String)
850 cvEnodefilestoragepathunusable =
852 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
853 "File storage path unusable")
855 cvEnodehooks :: (String, String, String)
858 Types.cVErrorCodeToRaw CvENODEHOOKS,
859 "Communication failure in hooks execution")
861 cvEnodehv :: (String, String, String)
864 Types.cVErrorCodeToRaw CvENODEHV,
865 "Hypervisor parameters verification failure")
867 cvEnodelvm :: (String, String, String)
870 Types.cVErrorCodeToRaw CvENODELVM,
871 "LVM-related node error")
873 cvEnoden1 :: (String, String, String)
876 Types.cVErrorCodeToRaw CvENODEN1,
877 "Not enough memory to accommodate instance failovers")
879 cvEnodenet :: (String, String, String)
882 Types.cVErrorCodeToRaw CvENODENET,
883 "Network-related node error")
885 cvEnodeoobpath :: (String, String, String)
888 Types.cVErrorCodeToRaw CvENODEOOBPATH,
889 "Invalid Out Of Band path")
891 cvEnodeorphaninstance :: (String, String, String)
892 cvEnodeorphaninstance =
894 Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
895 "Unknown intance running on a node")
897 cvEnodeorphanlv :: (String, String, String)
900 Types.cVErrorCodeToRaw CvENODEORPHANLV,
901 "Unknown LVM logical volume")
903 cvEnodeos :: (String, String, String)
906 Types.cVErrorCodeToRaw CvENODEOS,
907 "OS-related node error")
909 cvEnoderpc :: (String, String, String)
912 Types.cVErrorCodeToRaw CvENODERPC,
913 "Error during connection to the primary node of an instance")
915 cvEnodesetup :: (String, String, String)
918 Types.cVErrorCodeToRaw CvENODESETUP,
921 cvEnodesharedfilestoragepathunusable :: (String, String, String)
922 cvEnodesharedfilestoragepathunusable =
924 Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
925 "Shared file storage path unusable")
927 cvEnodessh :: (String, String, String)
930 Types.cVErrorCodeToRaw CvENODESSH,
931 "SSH-related node error")
933 cvEnodetime :: (String, String, String)
936 Types.cVErrorCodeToRaw CvENODETIME,
937 "Node returned invalid time")
939 cvEnodeuserscripts :: (String, String, String)
942 Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
943 "User scripts not present or not executable")
945 cvEnodeversion :: (String, String, String)
948 Types.cVErrorCodeToRaw CvENODEVERSION,
949 "Protocol version mismatch or Ganeti version mismatch")
951 cvAllEcodes :: FrozenSet (String, String, String)
956 cvEclusterdanglinginst,
957 cvEclusterdanglingnodes,
959 cvEgroupdifferentpvsize,
962 cvEinstancefaultydisk,
964 cvEinstancemissingcfgparameter,
965 cvEinstancemissingdisk,
967 cvEinstancesplitgroups,
968 cvEinstanceunsuitablenode,
969 cvEinstancewrongnode,
974 cvEnodefilestoragepaths,
975 cvEnodefilestoragepathunusable,
982 cvEnodeorphaninstance,
987 cvEnodesharedfilestoragepathunusable,
993 cvAllEcodesStrings :: FrozenSet String
995 ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
999 inststAdmindown :: String
1000 inststAdmindown = Types.instanceStatusToRaw StatusDown
1002 inststAdminoffline :: String
1003 inststAdminoffline = Types.instanceStatusToRaw StatusOffline
1005 inststErrordown :: String
1006 inststErrordown = Types.instanceStatusToRaw ErrorDown
1008 inststErrorup :: String
1009 inststErrorup = Types.instanceStatusToRaw ErrorUp
1011 inststNodedown :: String
1012 inststNodedown = Types.instanceStatusToRaw NodeDown
1014 inststNodeoffline :: String
1015 inststNodeoffline = Types.instanceStatusToRaw NodeOffline
1017 inststRunning :: String
1018 inststRunning = Types.instanceStatusToRaw Running
1020 inststWrongnode :: String
1021 inststWrongnode = Types.instanceStatusToRaw WrongNode
1023 inststAll :: FrozenSet String
1024 inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
1028 adminstDown :: String
1029 adminstDown = Types.adminStateToRaw AdminDown
1031 adminstOffline :: String
1032 adminstOffline = Types.adminStateToRaw AdminOffline
1035 adminstUp = Types.adminStateToRaw AdminUp
1037 adminstAll :: FrozenSet String
1038 adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
1043 nrDrained = Types.nodeRoleToRaw NRDrained
1046 nrMaster = Types.nodeRoleToRaw NRMaster
1048 nrMcandidate :: String
1049 nrMcandidate = Types.nodeRoleToRaw NRCandidate
1052 nrOffline = Types.nodeRoleToRaw NROffline
1055 nrRegular = Types.nodeRoleToRaw NRRegular
1057 nrAll :: FrozenSet String
1058 nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
1060 -- * Allocator framework constants
1062 iallocatorVersion :: Int
1063 iallocatorVersion = 2
1065 iallocatorDirIn :: String
1066 iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
1068 iallocatorDirOut :: String
1069 iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
1071 validIallocatorDirections :: FrozenSet String
1072 validIallocatorDirections =
1073 ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
1075 iallocatorModeAlloc :: String
1076 iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
1078 iallocatorModeChgGroup :: String
1079 iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
1081 iallocatorModeMultiAlloc :: String
1082 iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
1084 iallocatorModeNodeEvac :: String
1085 iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
1087 iallocatorModeReloc :: String
1088 iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
1090 validIallocatorModes :: FrozenSet String
1091 validIallocatorModes =
1092 ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
1094 iallocatorSearchPath :: [String]
1095 iallocatorSearchPath = AutoConf.iallocatorSearchPath
1097 defaultIallocatorShortcut :: String
1098 defaultIallocatorShortcut = "."
1100 -- * Node evacuation
1102 nodeEvacPri :: String
1103 nodeEvacPri = Types.evacModeToRaw ChangePrimary
1105 nodeEvacSec :: String
1106 nodeEvacSec = Types.evacModeToRaw ChangeSecondary
1108 nodeEvacAll :: String
1109 nodeEvacAll = Types.evacModeToRaw ChangeAll
1111 nodeEvacModes :: FrozenSet String
1112 nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..]
1116 jobStatusQueued :: String
1117 jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
1119 jobStatusWaiting :: String
1120 jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
1122 jobStatusCanceling :: String
1123 jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
1125 jobStatusRunning :: String
1126 jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
1128 jobStatusCanceled :: String
1129 jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
1131 jobStatusSuccess :: String
1132 jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
1134 jobStatusError :: String
1135 jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
1137 jobsPending :: FrozenSet String
1139 ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
1141 jobsFinalized :: FrozenSet String
1143 ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
1145 jobStatusAll :: FrozenSet String
1146 jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
1150 -- ** Not yet finalized opcodes
1152 opStatusCanceling :: String
1153 opStatusCanceling = "canceling"
1155 opStatusQueued :: String
1156 opStatusQueued = "queued"
1158 opStatusRunning :: String
1159 opStatusRunning = "running"
1161 opStatusWaiting :: String
1162 opStatusWaiting = "waiting"
1164 -- ** Finalized opcodes
1166 opStatusCanceled :: String
1167 opStatusCanceled = "canceled"
1169 opStatusError :: String
1170 opStatusError = "error"
1172 opStatusSuccess :: String
1173 opStatusSuccess = "success"
1175 opsFinalized :: FrozenSet String
1177 ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
1179 -- * OpCode priority
1184 opPrioHighest :: Int
1188 opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
1191 opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
1194 opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
1196 opPrioSubmitValid :: FrozenSet Int
1197 opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
1199 opPrioDefault :: Int
1200 opPrioDefault = opPrioNormal
1202 -- * Execution log types
1204 elogMessage :: String
1205 elogMessage = Types.eLogTypeToRaw ELogMessage
1207 elogRemoteImport :: String
1208 elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
1210 elogJqueueTest :: String
1211 elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
1213 -- * A few common errors for confd
1215 confdErrorArgument :: Int
1216 confdErrorArgument = 3
1218 confdErrorInternal :: Int
1219 confdErrorInternal = 2
1221 confdErrorUnknownEntry :: Int
1222 confdErrorUnknownEntry = 1
1224 -- | Each request is "salted" by the current timestamp.
1226 -- This constant decides how many seconds of skew to accept.
1228 -- TODO: make this a default and allow the value to be more
1230 confdMaxClockSkew :: Int
1231 confdMaxClockSkew = 2 * nodeMaxClockSkew
1233 -- | When we haven't reloaded the config for more than this amount of
1234 -- seconds, we force a test to see if inotify is betraying us. Using a
1235 -- prime number to ensure we get less chance of 'same wakeup' with
1237 confdConfigReloadTimeout :: Int
1238 confdConfigReloadTimeout = 17
1240 -- | If we receive more than one update in this amount of
1241 -- microseconds, we move to polling every RATELIMIT seconds, rather
1242 -- than relying on inotify, to be able to serve more requests.
1243 confdConfigReloadRatelimit :: Int
1244 confdConfigReloadRatelimit = 250000
1246 -- | Magic number prepended to all confd queries.
1248 -- This allows us to distinguish different types of confd protocols
1249 -- and handle them. For example by changing this we can move the whole
1250 -- payload to be compressed, or move away from json.
1251 confdMagicFourcc :: String
1252 confdMagicFourcc = "plj0"
1254 -- | By default a confd request is sent to the minimum between this
1255 -- number and all MCs. 6 was chosen because even in the case of a
1256 -- disastrous 50% response rate, we should have enough answers to be
1257 -- able to compare more than one.
1258 confdDefaultReqCoverage :: Int
1259 confdDefaultReqCoverage = 6
1261 -- | Timeout in seconds to expire pending query request in the confd
1262 -- client library. We don't actually expect any answer more than 10
1263 -- seconds after we sent a request.
1264 confdClientExpireTimeout :: Int
1265 confdClientExpireTimeout = 10
1267 -- * Possible values for NodeGroup.alloc_policy
1269 allocPolicyLastResort :: String
1270 allocPolicyLastResort = Types.allocPolicyToRaw AllocLastResort
1272 allocPolicyPreferred :: String
1273 allocPolicyPreferred = Types.allocPolicyToRaw AllocPreferred
1275 allocPolicyUnallocable :: String
1276 allocPolicyUnallocable = Types.allocPolicyToRaw AllocUnallocable
1278 validAllocPolicies :: [String]
1279 validAllocPolicies = map Types.allocPolicyToRaw [minBound..]
1281 -- | Temporary external/shared storage parameters
1282 blockdevDriverManual :: String
1283 blockdevDriverManual = Types.blockDriverToRaw BlockDrvManual
1285 -- | 'qemu-img' path, required for 'ovfconverter'
1286 qemuimgPath :: String
1287 qemuimgPath = AutoConf.qemuimgPath
1289 -- | Whether htools was enabled at compilation time
1291 -- FIXME: this should be moved next to the other enable constants,
1292 -- such as, 'enableConfd', and renamed to 'enableHtools'.
1294 htools = AutoConf.htools
1296 -- | Path generating random UUID
1297 randomUuidFile :: String
1298 randomUuidFile = ConstantUtils.randomUuidFile
1300 -- * Auto-repair tag prefixes
1302 autoRepairTagPrefix :: String
1303 autoRepairTagPrefix = "ganeti:watcher:autorepair:"
1305 autoRepairTagEnabled :: String
1306 autoRepairTagEnabled = autoRepairTagPrefix
1308 autoRepairTagPending :: String
1309 autoRepairTagPending = autoRepairTagPrefix ++ "pending:"
1311 autoRepairTagResult :: String
1312 autoRepairTagResult = autoRepairTagPrefix ++ "result:"
1314 autoRepairTagSuspended :: String
1315 autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:"
1317 -- * Auto-repair levels
1319 autoRepairFailover :: String
1320 autoRepairFailover = "failover"
1322 autoRepairFixStorage :: String
1323 autoRepairFixStorage = "fix-storage"
1325 autoRepairMigrate :: String
1326 autoRepairMigrate = "migrate"
1328 autoRepairReinstall :: String
1329 autoRepairReinstall = "reinstall"
1331 autoRepairAllTypes :: FrozenSet String
1332 autoRepairAllTypes =
1333 ConstantUtils.mkSet [autoRepairFailover,
1334 autoRepairFixStorage,
1336 autoRepairReinstall]
1338 -- * Auto-repair results
1340 autoRepairEnoperm :: String
1341 autoRepairEnoperm = "enoperm"
1343 autoRepairFailure :: String
1344 autoRepairFailure = "failure"
1346 autoRepairSuccess :: String
1347 autoRepairSuccess = "success"
1349 autoRepairAllResults :: FrozenSet String
1350 autoRepairAllResults =
1351 ConstantUtils.mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess]
1353 -- | The version identifier for builtin data collectors
1354 builtinDataCollectorVersion :: String
1355 builtinDataCollectorVersion = "B"
1357 -- | The reason trail opcode parameter name
1358 opcodeReason :: String
1359 opcodeReason = "reason"
1361 diskstatsFile :: String
1362 diskstatsFile = "/proc/diskstats"
1364 -- | CPU load collector
1366 statFile = "/proc/stat"
1368 -- | Mond's variable for periodical data collection
1369 mondTimeInterval :: Int
1370 mondTimeInterval = 5