import qualified Data.Map as Map (fromList)
import AutoConf
-import Ganeti.ConstantUtils (FrozenSet, Protocol(..))
+import Ganeti.ConstantUtils (FrozenSet, Protocol(..), buildVersion)
import qualified Ganeti.ConstantUtils as ConstantUtils
import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..),
ExtraLogReason(..))
import Ganeti.Types
import qualified Ganeti.Types as Types
--- * OOB supported commands
+-- * 'autoconf' constants for Python only ('autotools/build-bash-completion')
-oobPowerOn :: String
-oobPowerOn = Types.oobCommandToRaw OobHealth
+htoolsProgs :: [String]
+htoolsProgs = AutoConf.htoolsProgs
-oobPowerOff :: String
-oobPowerOff = Types.oobCommandToRaw OobPowerOff
+-- * 'autoconf' constants for Python only ('lib/constants.py')
-oobPowerCycle :: String
-oobPowerCycle = Types.oobCommandToRaw OobPowerOn
+drbdBarriers :: String
+drbdBarriers = AutoConf.drbdBarriers
-oobPowerStatus :: String
-oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
+drbdNoMetaFlush :: Bool
+drbdNoMetaFlush = AutoConf.drbdNoMetaFlush
-oobHealth :: String
-oobHealth = Types.oobCommandToRaw OobHealth
+lvmStripecount :: Int
+lvmStripecount = AutoConf.lvmStripecount
-oobCommands :: FrozenSet String
-oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
+-- * 'autoconf' constants for Python only ('lib/pathutils.py')
-oobPowerStatusPowered :: String
-oobPowerStatusPowered = "powered"
+-- ** Build-time constants
--- | 60 seconds
-oobTimeout :: Int
-oobTimeout = 60
+exportDir :: String
+exportDir = AutoConf.exportDir
--- | 2 seconds
-oobPowerDelay :: Double
-oobPowerDelay = 2.0
+osSearchPath :: [String]
+osSearchPath = AutoConf.osSearchPath
-oobStatusCritical :: String
-oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
+esSearchPath :: [String]
+esSearchPath = AutoConf.esSearchPath
-oobStatusOk :: String
-oobStatusOk = Types.oobStatusToRaw OobStatusOk
+sshConfigDir :: String
+sshConfigDir = AutoConf.sshConfigDir
-oobStatusUnknown :: String
-oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
+xenConfigDir :: String
+xenConfigDir = AutoConf.xenConfigDir
-oobStatusWarning :: String
-oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
+sysconfdir :: String
+sysconfdir = AutoConf.sysconfdir
-oobStatuses :: FrozenSet String
-oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
+toolsdir :: String
+toolsdir = AutoConf.toolsdir
--- * NIC_* constants are used inside the ganeti config
+localstatedir :: String
+localstatedir = AutoConf.localstatedir
-nicLink :: String
-nicLink = "link"
+-- ** Paths which don't change for a virtual cluster
-nicMode :: String
-nicMode = "mode"
+pkglibdir :: String
+pkglibdir = AutoConf.pkglibdir
-nicVlan :: String
-nicVlan = "vlan"
+-- * 'autoconf' constants for Python only ('lib/build/sphinx_ext.py')
-nicModeBridged :: String
-nicModeBridged = Types.nICModeToRaw NMBridged
+manPages :: Map String Int
+manPages = Map.fromList AutoConf.manPages
-nicModeRouted :: String
-nicModeRouted = Types.nICModeToRaw NMRouted
+-- * 'autoconf' constants for QA cluster only ('qa/qa_cluster.py')
-nicModeOvs :: String
-nicModeOvs = Types.nICModeToRaw NMOvs
+versionedsharedir :: String
+versionedsharedir = AutoConf.versionedsharedir
-nicIpPool :: String
-nicIpPool = Types.nICModeToRaw NMPool
+-- * 'autoconf' constants for Python only ('tests/py/docs_unittest.py')
-nicValidModes :: FrozenSet String
-nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
+gntScripts :: [String]
+gntScripts = AutoConf.gntScripts
--- * Hypervisor constants
+-- * Various versions
-htXenPvm :: String
-htXenPvm = Types.hypervisorToRaw XenPvm
+releaseVersion :: String
+releaseVersion = AutoConf.packageVersion
-htFake :: String
-htFake = Types.hypervisorToRaw Fake
+configMajor :: Int
+configMajor = AutoConf.versionMajor
-htXenHvm :: String
-htXenHvm = Types.hypervisorToRaw XenHvm
+configMinor :: Int
+configMinor = AutoConf.versionMinor
-htKvm :: String
-htKvm = Types.hypervisorToRaw Kvm
+-- | The configuration is supposed to remain stable across
+-- revisions. Therefore, the revision number is cleared to '0'.
+configRevision :: Int
+configRevision = 0
-htChroot :: String
-htChroot = Types.hypervisorToRaw Chroot
+configVersion :: Int
+configVersion = buildVersion configMajor configMinor configRevision
-htLxc :: String
-htLxc = Types.hypervisorToRaw Lxc
+-- | Similarly to the configuration (see 'configRevision'), the
+-- protocols are supposed to remain stable across revisions.
+protocolVersion :: Int
+protocolVersion = buildVersion configMajor configMinor configRevision
-hyperTypes :: FrozenSet String
-hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
+-- * User separation
+daemonsGroup :: String
+daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
-htsReqPort :: FrozenSet String
-htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
+adminGroup :: String
+adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
--- * Migration type
+masterdUser :: String
+masterdUser = Runtime.daemonUser GanetiMasterd
-htMigrationLive :: String
-htMigrationLive = Types.migrationModeToRaw MigrationLive
+masterdGroup :: String
+masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
-htMigrationNonlive :: String
-htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
+rapiUser :: String
+rapiUser = Runtime.daemonUser GanetiRapi
-htMigrationModes :: FrozenSet String
-htMigrationModes =
- ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
+rapiGroup :: String
+rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
--- * Cluster verify steps
+confdUser :: String
+confdUser = Runtime.daemonUser GanetiConfd
-verifyNplusoneMem :: String
-verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
+confdGroup :: String
+confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
-verifyOptionalChecks :: FrozenSet String
-verifyOptionalChecks =
- ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
+luxidUser :: String
+luxidUser = Runtime.daemonUser GanetiLuxid
--- * Cluster Verify error classes
+luxidGroup :: String
+luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
-cvTcluster :: String
-cvTcluster = "cluster"
+nodedUser :: String
+nodedUser = Runtime.daemonUser GanetiNoded
-cvTgroup :: String
-cvTgroup = "group"
+nodedGroup :: String
+nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
-cvTnode :: String
-cvTnode = "node"
+mondUser :: String
+mondUser = Runtime.daemonUser GanetiMond
-cvTinstance :: String
-cvTinstance = "instance"
+mondGroup :: String
+mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
--- * Cluster Verify error codes and documentation
+sshLoginUser :: String
+sshLoginUser = AutoConf.sshLoginUser
-cvEclustercert :: (String, String, String)
-cvEclustercert =
- ("cluster",
- Types.cVErrorCodeToRaw CvECLUSTERCERT,
- "Cluster certificate files verification failure")
+sshConsoleUser :: String
+sshConsoleUser = AutoConf.sshConsoleUser
-cvEclustercfg :: (String, String, String)
-cvEclustercfg =
- ("cluster",
- Types.cVErrorCodeToRaw CvECLUSTERCFG,
- "Cluster configuration verification failure")
+-- * 'autoconf' enable/disable
-cvEclusterdanglinginst :: (String, String, String)
-cvEclusterdanglinginst =
- ("node",
- Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
- "Some instances have a non-existing primary node")
+enableConfd :: Bool
+enableConfd = AutoConf.enableConfd
-cvEclusterdanglingnodes :: (String, String, String)
-cvEclusterdanglingnodes =
- ("node",
- Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
- "Some nodes belong to non-existing groups")
+enableMond :: Bool
+enableMond = AutoConf.enableMond
-cvEclusterfilecheck :: (String, String, String)
-cvEclusterfilecheck =
- ("cluster",
- Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
- "Cluster configuration verification failure")
+enableRestrictedCommands :: Bool
+enableRestrictedCommands = AutoConf.enableRestrictedCommands
-cvEgroupdifferentpvsize :: (String, String, String)
-cvEgroupdifferentpvsize =
- ("group",
- Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
- "PVs in the group have different sizes")
+enableSplitQuery :: Bool
+enableSplitQuery = AutoConf.enableSplitQuery
-cvEinstancebadnode :: (String, String, String)
-cvEinstancebadnode =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
- "Instance marked as running lives on an offline node")
+-- * SSH constants
-cvEinstancedown :: (String, String, String)
-cvEinstancedown =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
- "Instance not running on its primary node")
+ssh :: String
+ssh = "ssh"
-cvEinstancefaultydisk :: (String, String, String)
-cvEinstancefaultydisk =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
- "Impossible to retrieve status for a disk")
+scp :: String
+scp = "scp"
-cvEinstancelayout :: (String, String, String)
-cvEinstancelayout =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
- "Instance has multiple secondary nodes")
+-- * Daemons
-cvEinstancemissingcfgparameter :: (String, String, String)
-cvEinstancemissingcfgparameter =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
- "A configuration parameter for an instance is missing")
+confd :: String
+confd = Runtime.daemonName GanetiConfd
-cvEinstancemissingdisk :: (String, String, String)
-cvEinstancemissingdisk =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
- "Missing volume on an instance")
+masterd :: String
+masterd = Runtime.daemonName GanetiMasterd
-cvEinstancepolicy :: (String, String, String)
-cvEinstancepolicy =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
- "Instance does not meet policy")
+mond :: String
+mond = Runtime.daemonName GanetiMond
-cvEinstancesplitgroups :: (String, String, String)
-cvEinstancesplitgroups =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
- "Instance with primary and secondary nodes in different groups")
+noded :: String
+noded = Runtime.daemonName GanetiNoded
-cvEinstanceunsuitablenode :: (String, String, String)
-cvEinstanceunsuitablenode =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
- "Instance running on nodes that are not suitable for it")
+luxid :: String
+luxid = Runtime.daemonName GanetiLuxid
-cvEinstancewrongnode :: (String, String, String)
-cvEinstancewrongnode =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
- "Instance running on the wrong node")
+rapi :: String
+rapi = Runtime.daemonName GanetiRapi
-cvEnodedrbd :: (String, String, String)
-cvEnodedrbd =
- ("node",
- Types.cVErrorCodeToRaw CvENODEDRBD,
- "Error parsing the DRBD status file")
+daemons :: FrozenSet String
+daemons =
+ ConstantUtils.mkSet [confd,
+ luxid,
+ masterd,
+ mond,
+ noded,
+ rapi]
-cvEnodedrbdhelper :: (String, String, String)
-cvEnodedrbdhelper =
- ("node",
- Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
- "Error caused by the DRBD helper")
+defaultConfdPort :: Int
+defaultConfdPort = 1814
-cvEnodedrbdversion :: (String, String, String)
-cvEnodedrbdversion =
- ("node",
- Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
- "DRBD version mismatch within a node group")
+defaultMondPort :: Int
+defaultMondPort = 1815
-cvEnodefilecheck :: (String, String, String)
-cvEnodefilecheck =
- ("node",
- Types.cVErrorCodeToRaw CvENODEFILECHECK,
- "Error retrieving the checksum of the node files")
+defaultNodedPort :: Int
+defaultNodedPort = 1811
-cvEnodefilestoragepaths :: (String, String, String)
-cvEnodefilestoragepaths =
- ("node",
- Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
- "Detected bad file storage paths")
+defaultRapiPort :: Int
+defaultRapiPort = 5080
-cvEnodefilestoragepathunusable :: (String, String, String)
-cvEnodefilestoragepathunusable =
- ("node",
- Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
- "File storage path unusable")
+daemonsPorts :: Map String (Protocol, Int)
+daemonsPorts =
+ Map.fromList [(confd, (Udp, defaultConfdPort)),
+ (mond, (Tcp, defaultMondPort)),
+ (noded, (Tcp, defaultNodedPort)),
+ (rapi, (Tcp, defaultRapiPort)),
+ (ssh, (Tcp, 22))]
-cvEnodehooks :: (String, String, String)
-cvEnodehooks =
- ("node",
- Types.cVErrorCodeToRaw CvENODEHOOKS,
- "Communication failure in hooks execution")
+daemonsLogbase :: Map String String
+daemonsLogbase =
+ Map.fromList
+ [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
-cvEnodehv :: (String, String, String)
-cvEnodehv =
- ("node",
- Types.cVErrorCodeToRaw CvENODEHV,
- "Hypervisor parameters verification failure")
+extraLogreasonAccess :: String
+extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
-cvEnodelvm :: (String, String, String)
-cvEnodelvm =
- ("node",
- Types.cVErrorCodeToRaw CvENODELVM,
- "LVM-related node error")
+extraLogreasonError :: String
+extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
-cvEnoden1 :: (String, String, String)
-cvEnoden1 =
- ("node",
- Types.cVErrorCodeToRaw CvENODEN1,
- "Not enough memory to accommodate instance failovers")
+devConsole :: String
+devConsole = ConstantUtils.devConsole
-cvEnodenet :: (String, String, String)
-cvEnodenet =
- ("node",
- Types.cVErrorCodeToRaw CvENODENET,
- "Network-related node error")
+-- * Syslog
-cvEnodeoobpath :: (String, String, String)
-cvEnodeoobpath =
- ("node",
- Types.cVErrorCodeToRaw CvENODEOOBPATH,
- "Invalid Out Of Band path")
+syslogUsage :: String
+syslogUsage = AutoConf.syslogUsage
-cvEnodeorphaninstance :: (String, String, String)
-cvEnodeorphaninstance =
- ("node",
- Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
- "Unknown intance running on a node")
+syslogNo :: String
+syslogNo = Logging.syslogUsageToRaw SyslogNo
-cvEnodeorphanlv :: (String, String, String)
-cvEnodeorphanlv =
- ("node",
- Types.cVErrorCodeToRaw CvENODEORPHANLV,
- "Unknown LVM logical volume")
+syslogYes :: String
+syslogYes = Logging.syslogUsageToRaw SyslogYes
-cvEnodeos :: (String, String, String)
-cvEnodeos =
- ("node",
- Types.cVErrorCodeToRaw CvENODEOS,
- "OS-related node error")
+syslogOnly :: String
+syslogOnly = Logging.syslogUsageToRaw SyslogOnly
-cvEnoderpc :: (String, String, String)
-cvEnoderpc =
- ("node",
- Types.cVErrorCodeToRaw CvENODERPC,
- "Error during connection to the primary node of an instance")
+syslogSocket :: String
+syslogSocket = "/dev/log"
-cvEnodesetup :: (String, String, String)
-cvEnodesetup =
- ("node",
- Types.cVErrorCodeToRaw CvENODESETUP,
- "Node setup error")
+-- * Xen
-cvEnodesharedfilestoragepathunusable :: (String, String, String)
-cvEnodesharedfilestoragepathunusable =
- ("node",
- Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
- "Shared file storage path unusable")
+xenBootloader :: String
+xenBootloader = AutoConf.xenBootloader
-cvEnodessh :: (String, String, String)
-cvEnodessh =
- ("node",
- Types.cVErrorCodeToRaw CvENODESSH,
- "SSH-related node error")
+xenCmdXl :: String
+xenCmdXl = "xl"
-cvEnodetime :: (String, String, String)
-cvEnodetime =
- ("node",
- Types.cVErrorCodeToRaw CvENODETIME,
- "Node returned invalid time")
+xenCmdXm :: String
+xenCmdXm = "xm"
-cvEnodeuserscripts :: (String, String, String)
-cvEnodeuserscripts =
- ("node",
- Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
- "User scripts not present or not executable")
+xenInitrd :: String
+xenInitrd = AutoConf.xenInitrd
-cvEnodeversion :: (String, String, String)
-cvEnodeversion =
- ("node",
- Types.cVErrorCodeToRaw CvENODEVERSION,
- "Protocol version mismatch or Ganeti version mismatch")
+xenKernel :: String
+xenKernel = AutoConf.xenKernel
-cvAllEcodes :: FrozenSet (String, String, String)
-cvAllEcodes =
- ConstantUtils.mkSet
- [cvEclustercert,
- cvEclustercfg,
- cvEclusterdanglinginst,
- cvEclusterdanglingnodes,
- cvEclusterfilecheck,
- cvEgroupdifferentpvsize,
- cvEinstancebadnode,
- cvEinstancedown,
- cvEinstancefaultydisk,
- cvEinstancelayout,
- cvEinstancemissingcfgparameter,
- cvEinstancemissingdisk,
- cvEinstancepolicy,
- cvEinstancesplitgroups,
- cvEinstanceunsuitablenode,
- cvEinstancewrongnode,
- cvEnodedrbd,
- cvEnodedrbdhelper,
- cvEnodedrbdversion,
- cvEnodefilecheck,
- cvEnodefilestoragepaths,
- cvEnodefilestoragepathunusable,
- cvEnodehooks,
- cvEnodehv,
- cvEnodelvm,
- cvEnoden1,
- cvEnodenet,
- cvEnodeoobpath,
- cvEnodeorphaninstance,
- cvEnodeorphanlv,
- cvEnodeos,
- cvEnoderpc,
- cvEnodesetup,
- cvEnodesharedfilestoragepathunusable,
- cvEnodessh,
- cvEnodetime,
- cvEnodeuserscripts,
- cvEnodeversion]
+-- FIXME: perhaps rename to 'validXenCommands' for consistency with
+-- other constants
+knownXenCommands :: FrozenSet String
+knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
-cvAllEcodesStrings :: FrozenSet String
-cvAllEcodesStrings =
- ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
+-- * KVM and socat
--- * Instance status
+kvmPath :: String
+kvmPath = AutoConf.kvmPath
-inststAdmindown :: String
-inststAdmindown = Types.instanceStatusToRaw StatusDown
+kvmKernel :: String
+kvmKernel = AutoConf.kvmKernel
-inststAdminoffline :: String
-inststAdminoffline = Types.instanceStatusToRaw StatusOffline
+socatEscapeCode :: String
+socatEscapeCode = "0x1d"
-inststErrordown :: String
-inststErrordown = Types.instanceStatusToRaw ErrorDown
+socatPath :: String
+socatPath = AutoConf.socatPath
-inststErrorup :: String
-inststErrorup = Types.instanceStatusToRaw ErrorUp
+socatUseCompress :: Bool
+socatUseCompress = AutoConf.socatUseCompress
-inststNodedown :: String
-inststNodedown = Types.instanceStatusToRaw NodeDown
+socatUseEscape :: Bool
+socatUseEscape = AutoConf.socatUseEscape
-inststNodeoffline :: String
-inststNodeoffline = Types.instanceStatusToRaw NodeOffline
+-- * Storage types
-inststRunning :: String
-inststRunning = Types.instanceStatusToRaw Running
+stBlock :: String
+stBlock = Types.storageTypeToRaw StorageBlock
-inststWrongnode :: String
-inststWrongnode = Types.instanceStatusToRaw WrongNode
+stDiskless :: String
+stDiskless = Types.storageTypeToRaw StorageDiskless
-inststAll :: FrozenSet String
-inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
+stExt :: String
+stExt = Types.storageTypeToRaw StorageExt
--- * Admin states
+stFile :: String
+stFile = Types.storageTypeToRaw StorageFile
-adminstDown :: String
-adminstDown = "down"
+stLvmPv :: String
+stLvmPv = Types.storageTypeToRaw StorageLvmPv
-adminstOffline :: String
-adminstOffline = "offline"
+stLvmVg :: String
+stLvmVg = Types.storageTypeToRaw StorageLvmVg
-adminstUp :: String
-adminstUp = "up"
+stRados :: String
+stRados = Types.storageTypeToRaw StorageRados
-adminstAll :: FrozenSet String
-adminstAll = ConstantUtils.mkSet [adminstDown, adminstOffline, adminstUp]
+storageTypes :: FrozenSet String
+storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
--- * Allocator framework constants
+-- * Storage fields
+-- ** First two are valid in LU context only, not passed to backend
-iallocatorVersion :: Int
-iallocatorVersion = 2
+sfNode :: String
+sfNode = "node"
-iallocatorDirIn :: String
-iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
+sfType :: String
+sfType = "type"
-iallocatorDirOut :: String
-iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
+-- ** and the rest are valid in backend
-validIallocatorDirections :: FrozenSet String
-validIallocatorDirections =
- ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
+sfAllocatable :: String
+sfAllocatable = Types.storageFieldToRaw SFAllocatable
-iallocatorModeAlloc :: String
-iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
+sfFree :: String
+sfFree = Types.storageFieldToRaw SFFree
-iallocatorModeChgGroup :: String
-iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
+sfName :: String
+sfName = Types.storageFieldToRaw SFName
-iallocatorModeMultiAlloc :: String
-iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
+sfSize :: String
+sfSize = Types.storageFieldToRaw SFSize
-iallocatorModeNodeEvac :: String
-iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
+sfUsed :: String
+sfUsed = Types.storageFieldToRaw SFUsed
-iallocatorModeReloc :: String
-iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
+-- * Disk template types
-validIallocatorModes :: FrozenSet String
-validIallocatorModes =
- ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
+dtDiskless :: String
+dtDiskless = Types.diskTemplateToRaw DTDiskless
-iallocatorSearchPath :: [String]
-iallocatorSearchPath = AutoConf.iallocatorSearchPath
+dtFile :: String
+dtFile = Types.diskTemplateToRaw DTFile
-defaultIallocatorShortcut :: String
-defaultIallocatorShortcut = "."
+dtSharedFile :: String
+dtSharedFile = Types.diskTemplateToRaw DTSharedFile
-iallocatorNevacPri :: String
-iallocatorNevacPri = Types.nodeEvacModeToRaw NEvacPrimary
+dtPlain :: String
+dtPlain = Types.diskTemplateToRaw DTPlain
-iallocatorNevacSec :: String
-iallocatorNevacSec = Types.nodeEvacModeToRaw NEvacSecondary
+dtBlock :: String
+dtBlock = Types.diskTemplateToRaw DTBlock
-iallocatorNevacAll :: String
-iallocatorNevacAll = Types.nodeEvacModeToRaw NEvacAll
+dtDrbd8 :: String
+dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
-iallocatorNevacModes :: FrozenSet String
-iallocatorNevacModes =
- ConstantUtils.mkSet $ map Types.nodeEvacModeToRaw [minBound..]
+dtRbd :: String
+dtRbd = Types.diskTemplateToRaw DTRbd
--- * Node evacuation
+dtExt :: String
+dtExt = Types.diskTemplateToRaw DTExt
-nodeEvacPri :: String
-nodeEvacPri = Types.nodeEvacModeToRaw NEvacPrimary
+-- | This is used to order determine the default disk template when
+-- the list of enabled disk templates is inferred from the current
+-- state of the cluster. This only happens on an upgrade from a
+-- version of Ganeti that did not support the 'enabled_disk_templates'
+-- so far.
+diskTemplatePreference :: [String]
+diskTemplatePreference =
+ map Types.diskTemplateToRaw
+ [DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile]
-nodeEvacSec :: String
-nodeEvacSec = Types.nodeEvacModeToRaw NEvacSecondary
+diskTemplates :: FrozenSet String
+diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
-nodeEvacAll :: String
-nodeEvacAll = Types.nodeEvacModeToRaw NEvacAll
+-- | Disk templates that are enabled by default
+defaultEnabledDiskTemplates :: [String]
+defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
-nodeEvacModes :: FrozenSet String
-nodeEvacModes = ConstantUtils.mkSet $ map Types.nodeEvacModeToRaw [minBound..]
+-- * File backend driver
--- * Job status
+fdBlktap :: String
+fdBlktap = Types.fileDriverToRaw FileBlktap
-jobStatusQueued :: String
-jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
+fdLoop :: String
+fdLoop = Types.fileDriverToRaw FileLoop
-jobStatusWaiting :: String
-jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
+-- * Disk access mode
-jobStatusCanceling :: String
-jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
+diskRdonly :: String
+diskRdonly = Types.diskModeToRaw DiskRdOnly
-jobStatusRunning :: String
-jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
+diskRdwr :: String
+diskRdwr = Types.diskModeToRaw DiskRdWr
-jobStatusCanceled :: String
-jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
+diskAccessSet :: FrozenSet String
+diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..]
-jobStatusSuccess :: String
-jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
+-- * Instance export mode
-jobStatusError :: String
-jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
+exportModeLocal :: String
+exportModeLocal = Types.exportModeToRaw ExportModeLocal
-jobsPending :: FrozenSet String
-jobsPending =
- ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
+exportModeRemote :: String
+exportModeRemote = Types.exportModeToRaw ExportModeRemote
-jobsFinalized :: FrozenSet String
-jobsFinalized =
- ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
+exportModes :: FrozenSet String
+exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
-jobStatusAll :: FrozenSet String
-jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
+-- * Instance creation modes
--- * OpCode status
+instanceCreate :: String
+instanceCreate = Types.instCreateModeToRaw InstCreate
--- ** Not yet finalized opcodes
+instanceImport :: String
+instanceImport = Types.instCreateModeToRaw InstImport
-opStatusCanceling :: String
-opStatusCanceling = "canceling"
+instanceRemoteImport :: String
+instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
-opStatusQueued :: String
-opStatusQueued = "queued"
+instanceCreateModes :: FrozenSet String
+instanceCreateModes =
+ ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
-opStatusRunning :: String
-opStatusRunning = "running"
+-- * Dynamic device modification
-opStatusWaiting :: String
-opStatusWaiting = "waiting"
+ddmAdd :: String
+ddmAdd = Types.ddmFullToRaw DdmFullAdd
--- ** Finalized opcodes
+ddmModify :: String
+ddmModify = Types.ddmFullToRaw DdmFullModify
-opStatusCanceled :: String
-opStatusCanceled = "canceled"
+ddmRemove :: String
+ddmRemove = Types.ddmFullToRaw DdmFullRemove
-opStatusError :: String
-opStatusError = "error"
+ddmsValues :: FrozenSet String
+ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
-opStatusSuccess :: String
-opStatusSuccess = "success"
+ddmsValuesWithModify :: FrozenSet String
+ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
-opsFinalized :: FrozenSet String
-opsFinalized =
- ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
+-- * Common exit codes
--- * OpCode priority
+exitSuccess :: Int
+exitSuccess = 0
-opPrioLowest :: Int
-opPrioLowest = 19
+exitFailure :: Int
+exitFailure = ConstantUtils.exitFailure
-opPrioHighest :: Int
-opPrioHighest = -20
+exitNotcluster :: Int
+exitNotcluster = 5
-opPrioLow :: Int
-opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
+exitNotmaster :: Int
+exitNotmaster = 11
-opPrioNormal :: Int
-opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
+exitNodesetupError :: Int
+exitNodesetupError = 12
-opPrioHigh :: Int
-opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
+-- | Need user confirmation
+exitConfirmation :: Int
+exitConfirmation = 13
-opPrioSubmitValid :: FrozenSet Int
-opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
+-- | Exit code for query operations with unknown fields
+exitUnknownField :: Int
+exitUnknownField = 14
-opPrioDefault :: Int
-opPrioDefault = opPrioNormal
+-- * Tags
--- * Execution log types
+tagCluster :: String
+tagCluster = Types.tagKindToRaw TagKindCluster
-elogMessage :: String
-elogMessage = Types.eLogTypeToRaw ELogMessage
+tagInstance :: String
+tagInstance = Types.tagKindToRaw TagKindInstance
-elogRemoteImport :: String
-elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
+tagNetwork :: String
+tagNetwork = Types.tagKindToRaw TagKindNetwork
-elogJqueueTest :: String
-elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
+tagNode :: String
+tagNode = Types.tagKindToRaw TagKindNode
--- * User separation
+tagNodegroup :: String
+tagNodegroup = Types.tagKindToRaw TagKindGroup
-daemonsGroup :: String
-daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
+validTagTypes :: FrozenSet String
+validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
-adminGroup :: String
-adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
+maxTagLen :: Int
+maxTagLen = 128
-masterdUser :: String
-masterdUser = Runtime.daemonUser GanetiMasterd
+maxTagsPerObj :: Int
+maxTagsPerObj = 4096
-masterdGroup :: String
-masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
+-- | Node clock skew in seconds
+nodeMaxClockSkew :: Int
+nodeMaxClockSkew = 150
-rapiUser :: String
-rapiUser = Runtime.daemonUser GanetiRapi
+-- | Disk index separator
+diskSeparator :: String
+diskSeparator = AutoConf.diskSeparator
-rapiGroup :: String
-rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
+ipCommandPath :: String
+ipCommandPath = AutoConf.ipPath
-confdUser :: String
-confdUser = Runtime.daemonUser GanetiConfd
+-- * Reboot types
-confdGroup :: String
-confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
+instanceRebootSoft :: String
+instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
-luxidUser :: String
-luxidUser = Runtime.daemonUser GanetiLuxid
+instanceRebootHard :: String
+instanceRebootHard = Types.rebootTypeToRaw RebootHard
-luxidGroup :: String
-luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
+instanceRebootFull :: String
+instanceRebootFull = Types.rebootTypeToRaw RebootFull
-nodedUser :: String
-nodedUser = Runtime.daemonUser GanetiNoded
+rebootTypes :: FrozenSet String
+rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
-nodedGroup :: String
-nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
+-- * VTypes
-mondUser :: String
-mondUser = Runtime.daemonUser GanetiMond
+vtypeBool :: String
+vtypeBool = Types.vTypeToRaw VTypeBool
-mondGroup :: String
-mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
+vtypeInt :: String
+vtypeInt = Types.vTypeToRaw VTypeInt
-sshLoginUser :: String
-sshLoginUser = AutoConf.sshLoginUser
+vtypeMaybeString :: String
+vtypeMaybeString = Types.vTypeToRaw VTypeMaybeString
-sshConsoleUser :: String
-sshConsoleUser = AutoConf.sshConsoleUser
+-- | Size in MiBs
+vtypeSize :: String
+vtypeSize = Types.vTypeToRaw VTypeSize
--- * SSH constants
+vtypeString :: String
+vtypeString = Types.vTypeToRaw VTypeString
-ssh :: String
-ssh = "ssh"
+enforceableTypes :: FrozenSet String
+enforceableTypes = ConstantUtils.mkSet $ map Types.vTypeToRaw [minBound..]
-scp :: String
-scp = "scp"
+-- * OOB supported commands
--- * Daemons
+oobPowerOn :: String
+oobPowerOn = Types.oobCommandToRaw OobPowerOn
-confd :: String
-confd = Runtime.daemonName GanetiConfd
+oobPowerOff :: String
+oobPowerOff = Types.oobCommandToRaw OobPowerOff
-masterd :: String
-masterd = Runtime.daemonName GanetiMasterd
+oobPowerCycle :: String
+oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
-mond :: String
-mond = Runtime.daemonName GanetiMond
+oobPowerStatus :: String
+oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
-noded :: String
-noded = Runtime.daemonName GanetiNoded
+oobHealth :: String
+oobHealth = Types.oobCommandToRaw OobHealth
-luxid :: String
-luxid = Runtime.daemonName GanetiLuxid
+oobCommands :: FrozenSet String
+oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
-rapi :: String
-rapi = Runtime.daemonName GanetiRapi
+oobPowerStatusPowered :: String
+oobPowerStatusPowered = "powered"
-daemons :: FrozenSet String
-daemons =
- ConstantUtils.mkSet [confd,
- luxid,
- masterd,
- mond,
- noded,
- rapi]
+-- | 60 seconds
+oobTimeout :: Int
+oobTimeout = 60
-defaultConfdPort :: Int
-defaultConfdPort = 1814
+-- | 2 seconds
+oobPowerDelay :: Double
+oobPowerDelay = 2.0
-defaultMondPort :: Int
-defaultMondPort = 1815
+oobStatusCritical :: String
+oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
-defaultNodedPort :: Int
-defaultNodedPort = 1811
+oobStatusOk :: String
+oobStatusOk = Types.oobStatusToRaw OobStatusOk
-defaultRapiPort :: Int
-defaultRapiPort = 5080
+oobStatusUnknown :: String
+oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
-daemonsPorts :: Map String (Protocol, Int)
-daemonsPorts =
- Map.fromList [(confd, (Udp, defaultConfdPort)),
- (mond, (Tcp, defaultMondPort)),
- (noded, (Tcp, defaultNodedPort)),
- (rapi, (Tcp, defaultRapiPort)),
- (ssh, (Tcp, 22))]
+oobStatusWarning :: String
+oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
-daemonsLogbase :: Map String String
-daemonsLogbase =
- Map.fromList
- [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
+oobStatuses :: FrozenSet String
+oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
-extraLogreasonAccess :: String
-extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
+-- * NIC_* constants are used inside the ganeti config
-extraLogreasonError :: String
-extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
+nicLink :: String
+nicLink = "link"
-devConsole :: String
-devConsole = ConstantUtils.devConsole
+nicMode :: String
+nicMode = "mode"
--- * Syslog
+nicVlan :: String
+nicVlan = "vlan"
-syslogUsage :: String
-syslogUsage = AutoConf.syslogUsage
+nicModeBridged :: String
+nicModeBridged = Types.nICModeToRaw NMBridged
-syslogNo :: String
-syslogNo = Logging.syslogUsageToRaw SyslogNo
+nicModeRouted :: String
+nicModeRouted = Types.nICModeToRaw NMRouted
-syslogYes :: String
-syslogYes = Logging.syslogUsageToRaw SyslogYes
+nicModeOvs :: String
+nicModeOvs = Types.nICModeToRaw NMOvs
-syslogOnly :: String
-syslogOnly = Logging.syslogUsageToRaw SyslogOnly
+nicIpPool :: String
+nicIpPool = Types.nICModeToRaw NMPool
-syslogSocket :: String
-syslogSocket = "/dev/log"
+nicValidModes :: FrozenSet String
+nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
+
+-- * Hypervisor constants
+
+htXenPvm :: String
+htXenPvm = Types.hypervisorToRaw XenPvm
+
+htFake :: String
+htFake = Types.hypervisorToRaw Fake
+
+htXenHvm :: String
+htXenHvm = Types.hypervisorToRaw XenHvm
+
+htKvm :: String
+htKvm = Types.hypervisorToRaw Kvm
+
+htChroot :: String
+htChroot = Types.hypervisorToRaw Chroot
+
+htLxc :: String
+htLxc = Types.hypervisorToRaw Lxc
+
+hyperTypes :: FrozenSet String
+hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
+
+htsReqPort :: FrozenSet String
+htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
+
+-- * Migration type
+
+htMigrationLive :: String
+htMigrationLive = Types.migrationModeToRaw MigrationLive
+
+htMigrationNonlive :: String
+htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
+
+htMigrationModes :: FrozenSet String
+htMigrationModes =
+ ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
+
+-- * Cluster verify steps
+
+verifyNplusoneMem :: String
+verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
+
+verifyOptionalChecks :: FrozenSet String
+verifyOptionalChecks =
+ ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
+
+-- * Cluster Verify error classes
+
+cvTcluster :: String
+cvTcluster = "cluster"
+
+cvTgroup :: String
+cvTgroup = "group"
+
+cvTnode :: String
+cvTnode = "node"
+
+cvTinstance :: String
+cvTinstance = "instance"
+
+-- * Cluster Verify error codes and documentation
+
+cvEclustercert :: (String, String, String)
+cvEclustercert =
+ ("cluster",
+ Types.cVErrorCodeToRaw CvECLUSTERCERT,
+ "Cluster certificate files verification failure")
+
+cvEclustercfg :: (String, String, String)
+cvEclustercfg =
+ ("cluster",
+ Types.cVErrorCodeToRaw CvECLUSTERCFG,
+ "Cluster configuration verification failure")
+
+cvEclusterdanglinginst :: (String, String, String)
+cvEclusterdanglinginst =
+ ("node",
+ Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
+ "Some instances have a non-existing primary node")
+
+cvEclusterdanglingnodes :: (String, String, String)
+cvEclusterdanglingnodes =
+ ("node",
+ Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
+ "Some nodes belong to non-existing groups")
+
+cvEclusterfilecheck :: (String, String, String)
+cvEclusterfilecheck =
+ ("cluster",
+ Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
+ "Cluster configuration verification failure")
+
+cvEgroupdifferentpvsize :: (String, String, String)
+cvEgroupdifferentpvsize =
+ ("group",
+ Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
+ "PVs in the group have different sizes")
+
+cvEinstancebadnode :: (String, String, String)
+cvEinstancebadnode =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
+ "Instance marked as running lives on an offline node")
+
+cvEinstancedown :: (String, String, String)
+cvEinstancedown =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
+ "Instance not running on its primary node")
+
+cvEinstancefaultydisk :: (String, String, String)
+cvEinstancefaultydisk =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
+ "Impossible to retrieve status for a disk")
+
+cvEinstancelayout :: (String, String, String)
+cvEinstancelayout =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
+ "Instance has multiple secondary nodes")
+
+cvEinstancemissingcfgparameter :: (String, String, String)
+cvEinstancemissingcfgparameter =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
+ "A configuration parameter for an instance is missing")
+
+cvEinstancemissingdisk :: (String, String, String)
+cvEinstancemissingdisk =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
+ "Missing volume on an instance")
+
+cvEinstancepolicy :: (String, String, String)
+cvEinstancepolicy =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
+ "Instance does not meet policy")
+
+cvEinstancesplitgroups :: (String, String, String)
+cvEinstancesplitgroups =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
+ "Instance with primary and secondary nodes in different groups")
+
+cvEinstanceunsuitablenode :: (String, String, String)
+cvEinstanceunsuitablenode =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
+ "Instance running on nodes that are not suitable for it")
+
+cvEinstancewrongnode :: (String, String, String)
+cvEinstancewrongnode =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
+ "Instance running on the wrong node")
+
+cvEnodedrbd :: (String, String, String)
+cvEnodedrbd =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEDRBD,
+ "Error parsing the DRBD status file")
+
+cvEnodedrbdhelper :: (String, String, String)
+cvEnodedrbdhelper =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
+ "Error caused by the DRBD helper")
+
+cvEnodedrbdversion :: (String, String, String)
+cvEnodedrbdversion =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
+ "DRBD version mismatch within a node group")
+
+cvEnodefilecheck :: (String, String, String)
+cvEnodefilecheck =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEFILECHECK,
+ "Error retrieving the checksum of the node files")
+
+cvEnodefilestoragepaths :: (String, String, String)
+cvEnodefilestoragepaths =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
+ "Detected bad file storage paths")
+
+cvEnodefilestoragepathunusable :: (String, String, String)
+cvEnodefilestoragepathunusable =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
+ "File storage path unusable")
+
+cvEnodehooks :: (String, String, String)
+cvEnodehooks =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEHOOKS,
+ "Communication failure in hooks execution")
+
+cvEnodehv :: (String, String, String)
+cvEnodehv =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEHV,
+ "Hypervisor parameters verification failure")
+
+cvEnodelvm :: (String, String, String)
+cvEnodelvm =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODELVM,
+ "LVM-related node error")
+
+cvEnoden1 :: (String, String, String)
+cvEnoden1 =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEN1,
+ "Not enough memory to accommodate instance failovers")
+
+cvEnodenet :: (String, String, String)
+cvEnodenet =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODENET,
+ "Network-related node error")
+
+cvEnodeoobpath :: (String, String, String)
+cvEnodeoobpath =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEOOBPATH,
+ "Invalid Out Of Band path")
+
+cvEnodeorphaninstance :: (String, String, String)
+cvEnodeorphaninstance =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
+ "Unknown intance running on a node")
+
+cvEnodeorphanlv :: (String, String, String)
+cvEnodeorphanlv =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEORPHANLV,
+ "Unknown LVM logical volume")
+
+cvEnodeos :: (String, String, String)
+cvEnodeos =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEOS,
+ "OS-related node error")
+
+cvEnoderpc :: (String, String, String)
+cvEnoderpc =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODERPC,
+ "Error during connection to the primary node of an instance")
+
+cvEnodesetup :: (String, String, String)
+cvEnodesetup =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODESETUP,
+ "Node setup error")
+
+cvEnodesharedfilestoragepathunusable :: (String, String, String)
+cvEnodesharedfilestoragepathunusable =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
+ "Shared file storage path unusable")
+
+cvEnodessh :: (String, String, String)
+cvEnodessh =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODESSH,
+ "SSH-related node error")
+
+cvEnodetime :: (String, String, String)
+cvEnodetime =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODETIME,
+ "Node returned invalid time")
+
+cvEnodeuserscripts :: (String, String, String)
+cvEnodeuserscripts =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
+ "User scripts not present or not executable")
+
+cvEnodeversion :: (String, String, String)
+cvEnodeversion =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEVERSION,
+ "Protocol version mismatch or Ganeti version mismatch")
+
+cvAllEcodes :: FrozenSet (String, String, String)
+cvAllEcodes =
+ ConstantUtils.mkSet
+ [cvEclustercert,
+ cvEclustercfg,
+ cvEclusterdanglinginst,
+ cvEclusterdanglingnodes,
+ cvEclusterfilecheck,
+ cvEgroupdifferentpvsize,
+ cvEinstancebadnode,
+ cvEinstancedown,
+ cvEinstancefaultydisk,
+ cvEinstancelayout,
+ cvEinstancemissingcfgparameter,
+ cvEinstancemissingdisk,
+ cvEinstancepolicy,
+ cvEinstancesplitgroups,
+ cvEinstanceunsuitablenode,
+ cvEinstancewrongnode,
+ cvEnodedrbd,
+ cvEnodedrbdhelper,
+ cvEnodedrbdversion,
+ cvEnodefilecheck,
+ cvEnodefilestoragepaths,
+ cvEnodefilestoragepathunusable,
+ cvEnodehooks,
+ cvEnodehv,
+ cvEnodelvm,
+ cvEnoden1,
+ cvEnodenet,
+ cvEnodeoobpath,
+ cvEnodeorphaninstance,
+ cvEnodeorphanlv,
+ cvEnodeos,
+ cvEnoderpc,
+ cvEnodesetup,
+ cvEnodesharedfilestoragepathunusable,
+ cvEnodessh,
+ cvEnodetime,
+ cvEnodeuserscripts,
+ cvEnodeversion]
+
+cvAllEcodesStrings :: FrozenSet String
+cvAllEcodesStrings =
+ ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
+
+-- * Instance status
+
+inststAdmindown :: String
+inststAdmindown = Types.instanceStatusToRaw StatusDown
+
+inststAdminoffline :: String
+inststAdminoffline = Types.instanceStatusToRaw StatusOffline
+
+inststErrordown :: String
+inststErrordown = Types.instanceStatusToRaw ErrorDown
+
+inststErrorup :: String
+inststErrorup = Types.instanceStatusToRaw ErrorUp
+
+inststNodedown :: String
+inststNodedown = Types.instanceStatusToRaw NodeDown
--- * Xen
+inststNodeoffline :: String
+inststNodeoffline = Types.instanceStatusToRaw NodeOffline
-xenBootloader :: String
-xenBootloader = AutoConf.xenBootloader
+inststRunning :: String
+inststRunning = Types.instanceStatusToRaw Running
-xenCmdXl :: String
-xenCmdXl = "xl"
+inststWrongnode :: String
+inststWrongnode = Types.instanceStatusToRaw WrongNode
-xenCmdXm :: String
-xenCmdXm = "xm"
+inststAll :: FrozenSet String
+inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
-xenInitrd :: String
-xenInitrd = AutoConf.xenInitrd
+-- * Admin states
-xenKernel :: String
-xenKernel = AutoConf.xenKernel
+adminstDown :: String
+adminstDown = Types.adminStateToRaw AdminDown
--- FIXME: perhaps rename to 'validXenCommands' for consistency with
--- other constants
-knownXenCommands :: FrozenSet String
-knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
+adminstOffline :: String
+adminstOffline = Types.adminStateToRaw AdminOffline
--- * Storage types
+adminstUp :: String
+adminstUp = Types.adminStateToRaw AdminUp
-stBlock :: String
-stBlock = Types.storageTypeToRaw StorageBlock
+adminstAll :: FrozenSet String
+adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
-stDiskless :: String
-stDiskless = Types.storageTypeToRaw StorageDiskless
+-- * Node roles
-stExt :: String
-stExt = Types.storageTypeToRaw StorageExt
+nrDrained :: String
+nrDrained = Types.nodeRoleToRaw NRDrained
-stFile :: String
-stFile = Types.storageTypeToRaw StorageFile
+nrMaster :: String
+nrMaster = Types.nodeRoleToRaw NRMaster
-stLvmPv :: String
-stLvmPv = Types.storageTypeToRaw StorageLvmPv
+nrMcandidate :: String
+nrMcandidate = Types.nodeRoleToRaw NRCandidate
-stLvmVg :: String
-stLvmVg = Types.storageTypeToRaw StorageLvmVg
+nrOffline :: String
+nrOffline = Types.nodeRoleToRaw NROffline
-stRados :: String
-stRados = Types.storageTypeToRaw StorageRados
+nrRegular :: String
+nrRegular = Types.nodeRoleToRaw NRRegular
-storageTypes :: FrozenSet String
-storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
+nrAll :: FrozenSet String
+nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
--- * Disk template types
+-- * Allocator framework constants
-dtDiskless :: String
-dtDiskless = Types.diskTemplateToRaw DTDiskless
+iallocatorVersion :: Int
+iallocatorVersion = 2
-dtFile :: String
-dtFile = Types.diskTemplateToRaw DTFile
+iallocatorDirIn :: String
+iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
-dtSharedFile :: String
-dtSharedFile = Types.diskTemplateToRaw DTSharedFile
+iallocatorDirOut :: String
+iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
-dtPlain :: String
-dtPlain = Types.diskTemplateToRaw DTPlain
+validIallocatorDirections :: FrozenSet String
+validIallocatorDirections =
+ ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
-dtBlock :: String
-dtBlock = Types.diskTemplateToRaw DTBlock
+iallocatorModeAlloc :: String
+iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
-dtDrbd8 :: String
-dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
+iallocatorModeChgGroup :: String
+iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
-dtRbd :: String
-dtRbd = Types.diskTemplateToRaw DTRbd
+iallocatorModeMultiAlloc :: String
+iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
-dtExt :: String
-dtExt = Types.diskTemplateToRaw DTExt
+iallocatorModeNodeEvac :: String
+iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
--- | This is used to order determine the default disk template when
--- the list of enabled disk templates is inferred from the current
--- state of the cluster. This only happens on an upgrade from a
--- version of Ganeti that did not support the 'enabled_disk_templates'
--- so far.
-diskTemplatePreference :: [String]
-diskTemplatePreference =
- map Types.diskTemplateToRaw
- [DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile]
+iallocatorModeReloc :: String
+iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
-diskTemplates :: FrozenSet String
-diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
+validIallocatorModes :: FrozenSet String
+validIallocatorModes =
+ ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
--- | Disk templates that are enabled by default
-defaultEnabledDiskTemplates :: [String]
-defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
+iallocatorSearchPath :: [String]
+iallocatorSearchPath = AutoConf.iallocatorSearchPath
--- * File backend driver
+defaultIallocatorShortcut :: String
+defaultIallocatorShortcut = "."
-fdBlktap :: String
-fdBlktap = Types.fileDriverToRaw FileBlktap
+-- * Node evacuation
-fdLoop :: String
-fdLoop = Types.fileDriverToRaw FileLoop
+nodeEvacPri :: String
+nodeEvacPri = Types.evacModeToRaw ChangePrimary
--- * Instance export mode
+nodeEvacSec :: String
+nodeEvacSec = Types.evacModeToRaw ChangeSecondary
-exportModeLocal :: String
-exportModeLocal = Types.exportModeToRaw ExportModeLocal
+nodeEvacAll :: String
+nodeEvacAll = Types.evacModeToRaw ChangeAll
-exportModeRemote :: String
-exportModeRemote = Types.exportModeToRaw ExportModeRemote
+nodeEvacModes :: FrozenSet String
+nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..]
-exportModes :: FrozenSet String
-exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
+-- * Job status
--- * Instance creation modes
+jobStatusQueued :: String
+jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
-instanceCreate :: String
-instanceCreate = Types.instCreateModeToRaw InstCreate
+jobStatusWaiting :: String
+jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
-instanceImport :: String
-instanceImport = Types.instCreateModeToRaw InstImport
+jobStatusCanceling :: String
+jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
-instanceRemoteImport :: String
-instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
+jobStatusRunning :: String
+jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
-instanceCreateModes :: FrozenSet String
-instanceCreateModes =
- ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
+jobStatusCanceled :: String
+jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
--- * Dynamic device modification
+jobStatusSuccess :: String
+jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
-ddmAdd :: String
-ddmAdd = Types.ddmFullToRaw DdmFullAdd
+jobStatusError :: String
+jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
-ddmModify :: String
-ddmModify = Types.ddmFullToRaw DdmFullModify
+jobsPending :: FrozenSet String
+jobsPending =
+ ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
-ddmRemove :: String
-ddmRemove = Types.ddmFullToRaw DdmFullRemove
+jobsFinalized :: FrozenSet String
+jobsFinalized =
+ ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
-ddmsValues :: FrozenSet String
-ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
+jobStatusAll :: FrozenSet String
+jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
-ddmsValuesWithModify :: FrozenSet String
-ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
+-- * OpCode status
--- * Common exit codes
+-- ** Not yet finalized opcodes
-exitSuccess :: Int
-exitSuccess = 0
+opStatusCanceling :: String
+opStatusCanceling = "canceling"
-exitFailure :: Int
-exitFailure = ConstantUtils.exitFailure
+opStatusQueued :: String
+opStatusQueued = "queued"
-exitNotcluster :: Int
-exitNotcluster = 5
+opStatusRunning :: String
+opStatusRunning = "running"
-exitNotmaster :: Int
-exitNotmaster = 11
+opStatusWaiting :: String
+opStatusWaiting = "waiting"
-exitNodesetupError :: Int
-exitNodesetupError = 12
+-- ** Finalized opcodes
--- | Need user confirmation
-exitConfirmation :: Int
-exitConfirmation = 13
+opStatusCanceled :: String
+opStatusCanceled = "canceled"
--- | Exit code for query operations with unknown fields
-exitUnknownField :: Int
-exitUnknownField = 14
+opStatusError :: String
+opStatusError = "error"
--- * Tags
+opStatusSuccess :: String
+opStatusSuccess = "success"
-tagCluster :: String
-tagCluster = Types.tagKindToRaw TagKindCluster
+opsFinalized :: FrozenSet String
+opsFinalized =
+ ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
-tagInstance :: String
-tagInstance = Types.tagKindToRaw TagKindInstance
+-- * OpCode priority
-tagNetwork :: String
-tagNetwork = Types.tagKindToRaw TagKindNetwork
+opPrioLowest :: Int
+opPrioLowest = 19
-tagNode :: String
-tagNode = Types.tagKindToRaw TagKindNode
+opPrioHighest :: Int
+opPrioHighest = -20
-tagNodegroup :: String
-tagNodegroup = Types.tagKindToRaw TagKindGroup
+opPrioLow :: Int
+opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
-validTagTypes :: FrozenSet String
-validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
+opPrioNormal :: Int
+opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
-maxTagLen :: Int
-maxTagLen = 128
+opPrioHigh :: Int
+opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
-maxTagsPerObj :: Int
-maxTagsPerObj = 4096
+opPrioSubmitValid :: FrozenSet Int
+opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
--- * Reboot types
+opPrioDefault :: Int
+opPrioDefault = opPrioNormal
-instanceRebootSoft :: String
-instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
+-- * Execution log types
-instanceRebootHard :: String
-instanceRebootHard = Types.rebootTypeToRaw RebootHard
+elogMessage :: String
+elogMessage = Types.eLogTypeToRaw ELogMessage
-instanceRebootFull :: String
-instanceRebootFull = Types.rebootTypeToRaw RebootFull
+elogRemoteImport :: String
+elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
-rebootTypes :: FrozenSet String
-rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
+elogJqueueTest :: String
+elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
+
+-- * A few common errors for confd
+
+confdErrorArgument :: Int
+confdErrorArgument = 3
+
+confdErrorInternal :: Int
+confdErrorInternal = 2
+
+confdErrorUnknownEntry :: Int
+confdErrorUnknownEntry = 1
+
+-- | Each request is "salted" by the current timestamp.
+--
+-- This constant decides how many seconds of skew to accept.
+--
+-- TODO: make this a default and allow the value to be more
+-- configurable
+confdMaxClockSkew :: Int
+confdMaxClockSkew = 2 * nodeMaxClockSkew
+
+-- | When we haven't reloaded the config for more than this amount of
+-- seconds, we force a test to see if inotify is betraying us. Using a
+-- prime number to ensure we get less chance of 'same wakeup' with
+-- other processes.
+confdConfigReloadTimeout :: Int
+confdConfigReloadTimeout = 17
+
+-- | If we receive more than one update in this amount of
+-- microseconds, we move to polling every RATELIMIT seconds, rather
+-- than relying on inotify, to be able to serve more requests.
+confdConfigReloadRatelimit :: Int
+confdConfigReloadRatelimit = 250000
+
+-- | Magic number prepended to all confd queries.
+--
+-- This allows us to distinguish different types of confd protocols
+-- and handle them. For example by changing this we can move the whole
+-- payload to be compressed, or move away from json.
+confdMagicFourcc :: String
+confdMagicFourcc = "plj0"
+
+-- | By default a confd request is sent to the minimum between this
+-- number and all MCs. 6 was chosen because even in the case of a
+-- disastrous 50% response rate, we should have enough answers to be
+-- able to compare more than one.
+confdDefaultReqCoverage :: Int
+confdDefaultReqCoverage = 6
+
+-- | Timeout in seconds to expire pending query request in the confd
+-- client library. We don't actually expect any answer more than 10
+-- seconds after we sent a request.
+confdClientExpireTimeout :: Int
+confdClientExpireTimeout = 10
-- * Possible values for NodeGroup.alloc_policy
-- | Temporary external/shared storage parameters
blockdevDriverManual :: String
-blockdevDriverManual = "manual"
+blockdevDriverManual = Types.blockDriverToRaw BlockDrvManual
+
+-- | 'qemu-img' path, required for 'ovfconverter'
+qemuimgPath :: String
+qemuimgPath = AutoConf.qemuimgPath
+
+-- | Whether htools was enabled at compilation time
+--
+-- FIXME: this should be moved next to the other enable constants,
+-- such as, 'enableConfd', and renamed to 'enableHtools'.
+htools :: Bool
+htools = AutoConf.htools
-- | Path generating random UUID
randomUuidFile :: String
-- | The version identifier for builtin data collectors
builtinDataCollectorVersion :: String
builtinDataCollectorVersion = "B"
+
+-- | The reason trail opcode parameter name
+opcodeReason :: String
+opcodeReason = "reason"
+
+diskstatsFile :: String
+diskstatsFile = "/proc/diskstats"
+
+-- | CPU load collector
+statFile :: String
+statFile = "/proc/stat"
+
+-- | Mond's variable for periodical data collection
+mondTimeInterval :: Int
+mondTimeInterval = 5