+{-# OPTIONS -fno-warn-type-defaults #-}
{-| HsConstants contains the Haskell constants
This is a transitional module complementary to 'Ganeti.Constants'. It
import Data.Map (Map)
import qualified Data.Map as Map (fromList, keys, insert)
-import AutoConf
+import qualified AutoConf
import Ganeti.ConstantUtils (PythonChar(..), FrozenSet, Protocol(..),
buildVersion)
import qualified Ganeti.ConstantUtils as ConstantUtils
-import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..),
- ExtraLogReason(..))
import Ganeti.HTools.Types (AutoRepairResult(..), AutoRepairType(..))
import qualified Ganeti.HTools.Types as Types
import Ganeti.Logging (SyslogUsage(..))
import qualified Ganeti.Logging as Logging (syslogUsageToRaw)
import qualified Ganeti.Runtime as Runtime
+import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..),
+ ExtraLogReason(..))
import Ganeti.Types
import qualified Ganeti.Types as Types
import Ganeti.Confd.Types (ConfdRequestType(..), ConfdReqField(..),
lvmStripecount :: Int
lvmStripecount = AutoConf.lvmStripecount
+hasGnuLn :: Bool
+hasGnuLn = AutoConf.hasGnuLn
+
-- * 'autoconf' constants for Python only ('lib/pathutils.py')
-- ** Build-time constants
map Types.fileDriverToRaw [minBound..]
-- | The set of drbd-like disk types
-ldsDrbd :: FrozenSet String
-ldsDrbd = ConstantUtils.mkSet [Types.diskTemplateToRaw DTDrbd8]
+dtsDrbd :: FrozenSet String
+dtsDrbd = ConstantUtils.mkSet [Types.diskTemplateToRaw DTDrbd8]
-- * Disk access mode
(ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMaxISpec),
(ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMaxISpec)])]
+masterPoolSizeDefault :: Int
+masterPoolSizeDefault = 10
+
+-- * Exclusive storage
+
+-- | Error margin used to compare physical disks
+partMargin :: Double
+partMargin = 0.01
+
+-- | Space reserved when creating instance disks
+partReserved :: Double
+partReserved = 0.02
+
-- * Confd
confdProtocolVersion :: Int
confdClientExpireTimeout :: Int
confdClientExpireTimeout = 10
+-- | Maximum UDP datagram size.
+--
+-- On IPv4: 64K - 20 (ip header size) - 8 (udp header size) = 65507
+-- On IPv6: 64K - 40 (ip6 header size) - 8 (udp header size) = 65487
+-- (assuming we can't use jumbo frames)
+-- We just set this to 60K, which should be enough
+maxUdpDataSize :: Int
+maxUdpDataSize = 61440
+
+-- * User-id pool minimum/maximum acceptable user-ids
+
+uidpoolUidMin :: Int
+uidpoolUidMin = 0
+
+-- | Assuming 32 bit user-ids
+uidpoolUidMax :: Integer
+uidpoolUidMax = 2 ^ 32 - 1
+
+-- | Name or path of the pgrep command
+pgrep :: String
+pgrep = "pgrep"
+
+-- | Name of the node group that gets created at cluster init or
+-- upgrade
+initialNodeGroupName :: String
+initialNodeGroupName = "default"
+
-- * Possible values for NodeGroup.alloc_policy
allocPolicyLastResort :: String
htools :: Bool
htools = AutoConf.htools
+-- | The hail iallocator
+iallocHail :: String
+iallocHail = "hail"
+
+-- * Fake opcodes for functions that have hooks attached to them via
+-- backend.RunLocalHooks
+
+fakeOpMasterTurndown :: String
+fakeOpMasterTurndown = "OP_CLUSTER_IP_TURNDOWN"
+
+fakeOpMasterTurnup :: String
+fakeOpMasterTurnup = "OP_CLUSTER_IP_TURNUP"
+
+-- * SSH key types
+
+sshkDsa :: String
+sshkDsa = "dsa"
+
+sshkRsa :: String
+sshkRsa = "rsa"
+
+sshkAll :: FrozenSet String
+sshkAll = ConstantUtils.mkSet [sshkRsa, sshkDsa]
+
+-- * SSH authorized key types
+
+sshakDss :: String
+sshakDss = "ssh-dss"
+
+sshakRsa :: String
+sshakRsa = "ssh-rsa"
+
+sshakAll :: FrozenSet String
+sshakAll = ConstantUtils.mkSet [sshakDss, sshakRsa]
+
+-- * SSH setup
+
+sshsClusterName :: String
+sshsClusterName = "cluster_name"
+
+sshsSshHostKey :: String
+sshsSshHostKey = "ssh_host_key"
+
+sshsSshRootKey :: String
+sshsSshRootKey = "ssh_root_key"
+
+sshsNodeDaemonCertificate :: String
+sshsNodeDaemonCertificate = "node_daemon_certificate"
+
-- * Key files for SSH daemon
sshHostDsaPriv :: String
sshHostRsaPub :: String
sshHostRsaPub = sshHostRsaPriv ++ ".pub"
+-- * Node daemon setup
+
+ndsClusterName :: String
+ndsClusterName = "cluster_name"
+
+ndsNodeDaemonCertificate :: String
+ndsNodeDaemonCertificate = "node_daemon_certificate"
+
+ndsSsconf :: String
+ndsSsconf = "ssconf"
+
+ndsStartNodeDaemon :: String
+ndsStartNodeDaemon = "start_node_daemon"
+
+-- * The source reasons for the execution of an OpCode
+
+opcodeReasonSrcClient :: String
+opcodeReasonSrcClient = "gnt:client"
+
+opcodeReasonSrcNoded :: String
+opcodeReasonSrcNoded = "gnt:daemon:noded"
+
+opcodeReasonSrcOpcode :: String
+opcodeReasonSrcOpcode = "gnt:opcode"
+
+opcodeReasonSrcRlib2 :: String
+opcodeReasonSrcRlib2 = "gnt:library:rlib2"
+
+opcodeReasonSrcUser :: String
+opcodeReasonSrcUser = "gnt:user"
+
+opcodeReasonSources :: FrozenSet String
+opcodeReasonSources =
+ ConstantUtils.mkSet [opcodeReasonSrcClient,
+ opcodeReasonSrcNoded,
+ opcodeReasonSrcOpcode,
+ opcodeReasonSrcRlib2,
+ opcodeReasonSrcUser]
+
-- | Path generating random UUID
randomUuidFile :: String
randomUuidFile = ConstantUtils.randomUuidFile
-- * Auto-repair levels
autoRepairFailover :: String
-autoRepairFailover = "failover"
+autoRepairFailover = Types.autoRepairTypeToRaw ArFailover
autoRepairFixStorage :: String
-autoRepairFixStorage = "fix-storage"
+autoRepairFixStorage = Types.autoRepairTypeToRaw ArFixStorage
autoRepairMigrate :: String
-autoRepairMigrate = "migrate"
+autoRepairMigrate = Types.autoRepairTypeToRaw ArMigrate
autoRepairReinstall :: String
-autoRepairReinstall = "reinstall"
+autoRepairReinstall = Types.autoRepairTypeToRaw ArReinstall
autoRepairAllTypes :: FrozenSet String
autoRepairAllTypes =
-- * Auto-repair results
autoRepairEnoperm :: String
-autoRepairEnoperm = "enoperm"
+autoRepairEnoperm = Types.autoRepairResultToRaw ArEnoperm
autoRepairFailure :: String
-autoRepairFailure = "failure"
+autoRepairFailure = Types.autoRepairResultToRaw ArFailure
autoRepairSuccess :: String
-autoRepairSuccess = "success"
+autoRepairSuccess = Types.autoRepairResultToRaw ArSuccess
autoRepairAllResults :: FrozenSet String
autoRepairAllResults =