1 {-# OPTIONS -fno-warn-type-defaults #-}
2 {-| HsConstants contains the Haskell constants
4 This is a transitional module complementary to 'Ganeti.Constants'. It
5 is intended to contain the Haskell constants that are meant to be
8 Do not write any definitions in this file other than constants. Do
9 not even write helper functions. The definitions in this module are
10 automatically stripped to build the Makefile.am target
11 'ListConstants.hs'. If there are helper functions in this module,
12 they will also be dragged and it will cause compilation to fail.
13 Therefore, all helper functions should go to a separate module and
20 Copyright (C) 2013 Google Inc.
22 This program is free software; you can redistribute it and/or modify
23 it under the terms of the GNU General Public License as published by
24 the Free Software Foundation; either version 2 of the License, or
25 (at your option) any later version.
27 This program is distributed in the hope that it will be useful, but
28 WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 General Public License for more details.
32 You should have received a copy of the GNU General Public License
33 along with this program; if not, write to the Free Software
34 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
38 module Ganeti.HsConstants where
40 import Control.Arrow ((***))
41 import Data.List ((\\))
43 import qualified Data.Map as Map (fromList, keys, insert)
45 import qualified AutoConf
46 import Ganeti.ConstantUtils (PythonChar(..), FrozenSet, Protocol(..),
48 import qualified Ganeti.ConstantUtils as ConstantUtils
49 import Ganeti.HTools.Types (AutoRepairResult(..), AutoRepairType(..))
50 import qualified Ganeti.HTools.Types as Types
51 import Ganeti.Logging (SyslogUsage(..))
52 import qualified Ganeti.Logging as Logging (syslogUsageToRaw)
53 import qualified Ganeti.Runtime as Runtime
54 import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..),
57 import qualified Ganeti.Types as Types
58 import Ganeti.Confd.Types (ConfdRequestType(..), ConfdReqField(..),
59 ConfdReplyStatus(..), ConfdNodeRole(..),
61 import qualified Ganeti.Confd.Types as Types
63 {-# ANN module "HLint: ignore Use camelCase" #-}
65 -- * 'autoconf' constants for Python only ('autotools/build-bash-completion')
67 htoolsProgs :: [String]
68 htoolsProgs = AutoConf.htoolsProgs
70 -- * 'autoconf' constants for Python only ('lib/constants.py')
72 drbdBarriers :: String
73 drbdBarriers = AutoConf.drbdBarriers
75 drbdNoMetaFlush :: Bool
76 drbdNoMetaFlush = AutoConf.drbdNoMetaFlush
79 lvmStripecount = AutoConf.lvmStripecount
82 hasGnuLn = AutoConf.hasGnuLn
84 -- * 'autoconf' constants for Python only ('lib/pathutils.py')
86 -- ** Build-time constants
89 exportDir = AutoConf.exportDir
91 osSearchPath :: [String]
92 osSearchPath = AutoConf.osSearchPath
94 esSearchPath :: [String]
95 esSearchPath = AutoConf.esSearchPath
97 sshConfigDir :: String
98 sshConfigDir = AutoConf.sshConfigDir
100 xenConfigDir :: String
101 xenConfigDir = AutoConf.xenConfigDir
104 sysconfdir = AutoConf.sysconfdir
107 toolsdir = AutoConf.toolsdir
109 localstatedir :: String
110 localstatedir = AutoConf.localstatedir
112 -- ** Paths which don't change for a virtual cluster
115 pkglibdir = AutoConf.pkglibdir
118 sharedir = AutoConf.sharedir
120 -- * 'autoconf' constants for Python only ('lib/build/sphinx_ext.py')
122 manPages :: Map String Int
123 manPages = Map.fromList AutoConf.manPages
125 -- * 'autoconf' constants for QA cluster only ('qa/qa_cluster.py')
127 versionedsharedir :: String
128 versionedsharedir = AutoConf.versionedsharedir
130 -- * 'autoconf' constants for Python only ('tests/py/docs_unittest.py')
132 gntScripts :: [String]
133 gntScripts = AutoConf.gntScripts
135 -- * Various versions
137 releaseVersion :: String
138 releaseVersion = AutoConf.packageVersion
141 versionMajor = AutoConf.versionMajor
144 versionMinor = AutoConf.versionMinor
146 versionRevision :: Int
147 versionRevision = AutoConf.versionRevision
150 dirVersion = AutoConf.dirVersion
161 osApiVersions :: FrozenSet Int
162 osApiVersions = ConstantUtils.mkSet [osApiV10, osApiV15, osApiV20]
171 configMajor = AutoConf.versionMajor
174 configMinor = AutoConf.versionMinor
176 -- | The configuration is supposed to remain stable across
177 -- revisions. Therefore, the revision number is cleared to '0'.
178 configRevision :: Int
182 configVersion = buildVersion configMajor configMinor configRevision
184 -- | Similarly to the configuration (see 'configRevision'), the
185 -- protocols are supposed to remain stable across revisions.
186 protocolVersion :: Int
187 protocolVersion = buildVersion configMajor configMinor configRevision
191 daemonsGroup :: String
192 daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
195 adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
197 masterdUser :: String
198 masterdUser = Runtime.daemonUser GanetiMasterd
200 masterdGroup :: String
201 masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
204 rapiUser = Runtime.daemonUser GanetiRapi
207 rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
210 confdUser = Runtime.daemonUser GanetiConfd
213 confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
216 luxidUser = Runtime.daemonUser GanetiLuxid
219 luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
222 nodedUser = Runtime.daemonUser GanetiNoded
225 nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
228 mondUser = Runtime.daemonUser GanetiMond
231 mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
233 sshLoginUser :: String
234 sshLoginUser = AutoConf.sshLoginUser
236 sshConsoleUser :: String
237 sshConsoleUser = AutoConf.sshConsoleUser
239 -- * Cpu pinning separators and constants
241 cpuPinningSep :: String
244 cpuPinningAll :: String
245 cpuPinningAll = "all"
247 -- | Internal representation of "all"
248 cpuPinningAllVal :: Int
249 cpuPinningAllVal = -1
251 -- | One "all" entry in a CPU list means CPU pinning is off
252 cpuPinningOff :: [Int]
253 cpuPinningOff = [cpuPinningAllVal]
255 -- | A Xen-specific implementation detail is that there is no way to
256 -- actually say "use any cpu for pinning" in a Xen configuration file,
257 -- as opposed to the command line, where you can say
259 -- xm vcpu-pin <domain> <vcpu> all
262 -- The workaround used in Xen is "0-63" (see source code function
263 -- "xm_vcpu_pin" in @<xen-source>/tools/python/xen/xm/main.py@).
265 -- To support future changes, the following constant is treated as a
266 -- blackbox string that simply means "use any cpu for pinning under
268 cpuPinningAllXen :: String
269 cpuPinningAllXen = "0-63"
271 -- | A KVM-specific implementation detail - the following value is
272 -- used to set CPU affinity to all processors (--0 through --31), per
275 -- FIXME: This only works for machines with up to 32 CPU cores
276 cpuPinningAllKvm :: Int
277 cpuPinningAllKvm = 0xFFFFFFFF
288 minWipeChunkPercent :: Int
289 minWipeChunkPercent = 10
297 secureDirMode = 0o700
299 secureFileMode :: Int
300 secureFileMode = 0o600
302 adoptableBlockdevRoot :: String
303 adoptableBlockdevRoot = "/dev/disk/"
305 -- * 'autoconf' enable/disable
308 enableConfd = AutoConf.enableConfd
311 enableMond = AutoConf.enableMond
313 enableRestrictedCommands :: Bool
314 enableRestrictedCommands = AutoConf.enableRestrictedCommands
316 enableSplitQuery :: Bool
317 enableSplitQuery = AutoConf.enableSplitQuery
330 confd = Runtime.daemonName GanetiConfd
333 masterd = Runtime.daemonName GanetiMasterd
336 mond = Runtime.daemonName GanetiMond
339 noded = Runtime.daemonName GanetiNoded
342 luxid = Runtime.daemonName GanetiLuxid
345 rapi = Runtime.daemonName GanetiRapi
347 daemons :: FrozenSet String
349 ConstantUtils.mkSet [confd,
356 defaultConfdPort :: Int
357 defaultConfdPort = 1814
359 defaultMondPort :: Int
360 defaultMondPort = 1815
362 defaultNodedPort :: Int
363 defaultNodedPort = 1811
365 defaultRapiPort :: Int
366 defaultRapiPort = 5080
368 daemonsPorts :: Map String (Protocol, Int)
370 Map.fromList [(confd, (Udp, defaultConfdPort)),
371 (mond, (Tcp, defaultMondPort)),
372 (noded, (Tcp, defaultNodedPort)),
373 (rapi, (Tcp, defaultRapiPort)),
377 firstDrbdPort = 11000
382 daemonsLogbase :: Map String String
385 [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
387 extraLogreasonAccess :: String
388 extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
390 extraLogreasonError :: String
391 extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
394 devConsole = ConstantUtils.devConsole
397 procMounts = "/proc/mounts"
399 -- * Luxi (Local UniX Interface) related constants
401 luxiEom :: PythonChar
402 luxiEom = PythonChar '\x03'
404 -- | Environment variable for the luxi override socket
405 luxiOverride :: String
406 luxiOverride = "FORCE_LUXI_SOCKET"
408 luxiOverrideMaster :: String
409 luxiOverrideMaster = "master"
411 luxiOverrideQuery :: String
412 luxiOverrideQuery = "query"
415 luxiVersion = configVersion
419 syslogUsage :: String
420 syslogUsage = AutoConf.syslogUsage
423 syslogNo = Logging.syslogUsageToRaw SyslogNo
426 syslogYes = Logging.syslogUsageToRaw SyslogYes
429 syslogOnly = Logging.syslogUsageToRaw SyslogOnly
431 syslogSocket :: String
432 syslogSocket = "/dev/log"
434 exportConfFile :: String
435 exportConfFile = "config.ini"
439 xenBootloader :: String
440 xenBootloader = AutoConf.xenBootloader
449 xenInitrd = AutoConf.xenInitrd
452 xenKernel = AutoConf.xenKernel
454 -- FIXME: perhaps rename to 'validXenCommands' for consistency with
456 knownXenCommands :: FrozenSet String
457 knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
462 kvmPath = AutoConf.kvmPath
465 kvmKernel = AutoConf.kvmKernel
467 socatEscapeCode :: String
468 socatEscapeCode = "0x1d"
471 socatPath = AutoConf.socatPath
473 socatUseCompress :: Bool
474 socatUseCompress = AutoConf.socatUseCompress
476 socatUseEscape :: Bool
477 socatUseEscape = AutoConf.socatUseEscape
481 -- | Display a message for console access
482 consMessage :: String
485 -- | Console as SPICE server
489 -- | Console as SSH command
493 -- | Console as VNC server
497 consAll :: FrozenSet String
498 consAll = ConstantUtils.mkSet [consMessage, consSpice, consSsh, consVnc]
500 -- | RSA key bit length
502 -- For RSA keys more bits are better, but they also make operations
503 -- more expensive. NIST SP 800-131 recommends a minimum of 2048 bits
504 -- from the year 2010 on.
508 -- | Ciphers allowed for SSL connections.
510 -- For the format, see ciphers(1). A better way to disable ciphers
511 -- would be to use the exclamation mark (!), but socat versions below
512 -- 1.5 can't parse exclamation marks in options properly. When
513 -- modifying the ciphers, ensure not to accidentially add something
514 -- after it's been removed. Use the "openssl" utility to check the
515 -- allowed ciphers, e.g. "openssl ciphers -v HIGH:-DES".
516 opensslCiphers :: String
517 opensslCiphers = "HIGH:-DES:-3DES:-EXPORT:-ADH"
521 -- | commonName (CN) used in certificates
523 x509CertCn = "ganeti.example.com"
525 -- | Default validity of certificates in days
526 x509CertDefaultValidity :: Int
527 x509CertDefaultValidity = 365 * 5
529 x509CertSignatureHeader :: String
530 x509CertSignatureHeader = "X-Ganeti-Signature"
532 -- | Digest used to sign certificates ("openssl x509" uses SHA1 by default)
533 x509CertSignDigest :: String
534 x509CertSignDigest = "SHA1"
536 -- * Import/export daemon mode
544 -- * Import/export transport compression
553 iecAll = [iecGzip, iecNone]
555 ieCustomSize :: String
558 -- * Import/export I/O
560 -- | Direct file I/O, equivalent to a shell's I/O redirection using
565 -- | Raw block device I/O using "dd"
566 ieioRawDisk :: String
569 -- | OS definition import/export script
571 ieioScript = "script"
575 hooksNameCfgupdate :: String
576 hooksNameCfgupdate = "config-update"
578 hooksNameWatcher :: String
579 hooksNameWatcher = "watcher"
582 hooksPath = "/sbin:/bin:/usr/sbin:/usr/bin"
584 hooksPhasePost :: String
585 hooksPhasePost = "post"
587 hooksPhasePre :: String
588 hooksPhasePre = "pre"
593 -- * Hooks subject type (what object type does the LU deal with)
595 htypeCluster :: String
596 htypeCluster = "CLUSTER"
601 htypeInstance :: String
602 htypeInstance = "INSTANCE"
604 htypeNetwork :: String
605 htypeNetwork = "NETWORK"
624 stBlock = Types.storageTypeToRaw StorageBlock
627 stDiskless = Types.storageTypeToRaw StorageDiskless
630 stExt = Types.storageTypeToRaw StorageExt
633 stFile = Types.storageTypeToRaw StorageFile
636 stLvmPv = Types.storageTypeToRaw StorageLvmPv
639 stLvmVg = Types.storageTypeToRaw StorageLvmVg
642 stRados = Types.storageTypeToRaw StorageRados
644 storageTypes :: FrozenSet String
645 storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
647 -- | The set of storage types for which storage reporting is available
649 -- FIXME: Remove this, once storage reporting is available for all
651 stsReport :: FrozenSet String
652 stsReport = ConstantUtils.mkSet [stFile, stLvmPv, stLvmVg]
655 -- ** First two are valid in LU context only, not passed to backend
663 -- ** and the rest are valid in backend
665 sfAllocatable :: String
666 sfAllocatable = Types.storageFieldToRaw SFAllocatable
669 sfFree = Types.storageFieldToRaw SFFree
672 sfName = Types.storageFieldToRaw SFName
675 sfSize = Types.storageFieldToRaw SFSize
678 sfUsed = Types.storageFieldToRaw SFUsed
680 validStorageFields :: FrozenSet String
682 ConstantUtils.mkSet $ map Types.storageFieldToRaw [minBound..] ++
685 modifiableStorageFields :: Map String (FrozenSet String)
686 modifiableStorageFields =
687 Map.fromList [(Types.storageTypeToRaw StorageLvmPv,
688 ConstantUtils.mkSet [sfAllocatable])]
690 -- * Storage operations
692 soFixConsistency :: String
693 soFixConsistency = "fix-consistency"
695 validStorageOperations :: Map String (FrozenSet String)
696 validStorageOperations =
697 Map.fromList [(Types.storageTypeToRaw StorageLvmVg,
698 ConstantUtils.mkSet [soFixConsistency])]
706 vfInstance = "instance"
723 -- * Local disk status
726 ldsFaulty = Types.localDiskStatusToRaw DiskStatusFaulty
729 ldsOkay = Types.localDiskStatusToRaw DiskStatusOk
732 ldsUnknown = Types.localDiskStatusToRaw DiskStatusUnknown
734 ldsNames :: Map Int String
736 Map.fromList [ (Types.localDiskStatusToRaw ds,
737 localDiskStatusName ds) | ds <- [minBound..] ]
739 -- * Disk template types
742 dtDiskless = Types.diskTemplateToRaw DTDiskless
745 dtFile = Types.diskTemplateToRaw DTFile
747 dtSharedFile :: String
748 dtSharedFile = Types.diskTemplateToRaw DTSharedFile
751 dtPlain = Types.diskTemplateToRaw DTPlain
754 dtBlock = Types.diskTemplateToRaw DTBlock
757 dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
760 dtRbd = Types.diskTemplateToRaw DTRbd
763 dtExt = Types.diskTemplateToRaw DTExt
765 -- | This is used to order determine the default disk template when
766 -- the list of enabled disk templates is inferred from the current
767 -- state of the cluster. This only happens on an upgrade from a
768 -- version of Ganeti that did not support the 'enabled_disk_templates'
770 diskTemplatePreference :: [String]
771 diskTemplatePreference =
772 map Types.diskTemplateToRaw
773 [DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile]
775 diskTemplates :: FrozenSet String
776 diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
778 -- | Disk templates that are enabled by default
779 defaultEnabledDiskTemplates :: [String]
780 defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
782 -- | Mapping of disk templates to storage types
783 mapDiskTemplateStorageType :: Map String String
784 mapDiskTemplateStorageType =
786 map (Types.diskTemplateToRaw *** Types.storageTypeToRaw)
787 [(DTBlock, StorageBlock),
788 (DTDrbd8, StorageLvmVg),
790 (DTSharedFile, StorageFile),
791 (DTFile, StorageFile),
792 (DTDiskless, StorageDiskless),
793 (DTPlain, StorageLvmVg),
794 (DTRbd, StorageRados)]
796 -- | The set of network-mirrored disk templates
797 dtsIntMirror :: FrozenSet String
798 dtsIntMirror = ConstantUtils.mkSet [dtDrbd8]
800 -- | 'DTDiskless' is 'trivially' externally mirrored
801 dtsExtMirror :: FrozenSet String
803 ConstantUtils.mkSet $
804 map Types.diskTemplateToRaw [DTDiskless, DTBlock, DTExt, DTSharedFile, DTRbd]
806 -- | The set of non-lvm-based disk templates
807 dtsNotLvm :: FrozenSet String
809 ConstantUtils.mkSet $
810 map Types.diskTemplateToRaw
811 [DTSharedFile, DTDiskless, DTBlock, DTExt, DTFile, DTRbd]
813 -- | The set of disk templates which can be grown
814 dtsGrowable :: FrozenSet String
816 ConstantUtils.mkSet $
817 map Types.diskTemplateToRaw
818 [DTSharedFile, DTDrbd8, DTPlain, DTExt, DTFile, DTRbd]
820 -- | The set of disk templates that allow adoption
821 dtsMayAdopt :: FrozenSet String
823 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTBlock, DTPlain]
825 -- | The set of disk templates that *must* use adoption
826 dtsMustAdopt :: FrozenSet String
827 dtsMustAdopt = ConstantUtils.mkSet [Types.diskTemplateToRaw DTBlock]
829 -- | The set of disk templates that allow migrations
830 dtsMirrored :: FrozenSet String
831 dtsMirrored = dtsIntMirror `ConstantUtils.union` dtsExtMirror
833 -- | The set of file based disk templates
834 dtsFilebased :: FrozenSet String
836 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTSharedFile, DTFile]
838 -- | The set of disk templates that can be moved by copying
840 -- Note: a requirement is that they're not accessed externally or
841 -- shared between nodes; in particular, sharedfile is not suitable.
842 dtsCopyable :: FrozenSet String
844 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain, DTFile]
846 -- | The set of disk templates that are supported by exclusive_storage
847 dtsExclStorage :: FrozenSet String
848 dtsExclStorage = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain]
850 -- | Templates for which we don't perform checks on free space
851 dtsNoFreeSpaceCheck :: FrozenSet String
852 dtsNoFreeSpaceCheck =
853 ConstantUtils.mkSet $
854 map Types.diskTemplateToRaw [DTExt, DTSharedFile, DTFile, DTRbd]
856 dtsBlock :: FrozenSet String
858 ConstantUtils.mkSet $
859 map Types.diskTemplateToRaw [DTPlain, DTDrbd8, DTBlock, DTRbd, DTExt]
863 drbdHmacAlg :: String
866 drbdDefaultNetProtocol :: String
867 drbdDefaultNetProtocol = "C"
869 drbdMigrationNetProtocol :: String
870 drbdMigrationNetProtocol = "C"
872 drbdStatusFile :: String
873 drbdStatusFile = "/proc/drbd"
875 -- | Size of DRBD meta block device
879 -- * Drbd barrier types
881 drbdBDiskBarriers :: String
882 drbdBDiskBarriers = "b"
884 drbdBDiskDrain :: String
887 drbdBDiskFlush :: String
893 -- | Rbd tool command
897 -- * File backend driver
900 fdBlktap = Types.fileDriverToRaw FileBlktap
903 fdLoop = Types.fileDriverToRaw FileLoop
905 fileDriver :: FrozenSet String
907 ConstantUtils.mkSet $
908 map Types.fileDriverToRaw [minBound..]
910 -- | The set of drbd-like disk types
911 ldsDrbd :: FrozenSet String
912 ldsDrbd = ConstantUtils.mkSet [Types.diskTemplateToRaw DTDrbd8]
914 -- * Disk access mode
917 diskRdonly = Types.diskModeToRaw DiskRdOnly
920 diskRdwr = Types.diskModeToRaw DiskRdWr
922 diskAccessSet :: FrozenSet String
923 diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..]
925 -- * Disk replacement mode
927 replaceDiskAuto :: String
928 replaceDiskAuto = Types.replaceDisksModeToRaw ReplaceAuto
930 replaceDiskChg :: String
931 replaceDiskChg = Types.replaceDisksModeToRaw ReplaceNewSecondary
933 replaceDiskPri :: String
934 replaceDiskPri = Types.replaceDisksModeToRaw ReplaceOnPrimary
936 replaceDiskSec :: String
937 replaceDiskSec = Types.replaceDisksModeToRaw ReplaceOnSecondary
939 replaceModes :: FrozenSet String
941 ConstantUtils.mkSet $ map Types.replaceDisksModeToRaw [minBound..]
943 -- * Instance export mode
945 exportModeLocal :: String
946 exportModeLocal = Types.exportModeToRaw ExportModeLocal
948 exportModeRemote :: String
949 exportModeRemote = Types.exportModeToRaw ExportModeRemote
951 exportModes :: FrozenSet String
952 exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
954 -- * Instance creation modes
956 instanceCreate :: String
957 instanceCreate = Types.instCreateModeToRaw InstCreate
959 instanceImport :: String
960 instanceImport = Types.instCreateModeToRaw InstImport
962 instanceRemoteImport :: String
963 instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
965 instanceCreateModes :: FrozenSet String
966 instanceCreateModes =
967 ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
969 -- * Remote import/export handshake message and version
971 rieHandshake :: String
972 rieHandshake = "Hi, I'm Ganeti"
977 -- | Remote import/export certificate validity in seconds
978 rieCertValidity :: Int
979 rieCertValidity = 24 * 60 * 60
981 -- | Export only: how long to wait per connection attempt (seconds)
982 rieConnectAttemptTimeout :: Int
983 rieConnectAttemptTimeout = 20
985 -- | Export only: number of attempts to connect
986 rieConnectRetries :: Int
987 rieConnectRetries = 10
989 -- | Overall timeout for establishing connection
990 rieConnectTimeout :: Int
991 rieConnectTimeout = 180
993 -- | Give child process up to 5 seconds to exit after sending a signal
994 childLingerTimeout :: Double
995 childLingerTimeout = 5.0
997 -- * Import/export config options
1000 inisectBep = "backend"
1002 inisectExp :: String
1003 inisectExp = "export"
1005 inisectHyp :: String
1006 inisectHyp = "hypervisor"
1008 inisectIns :: String
1009 inisectIns = "instance"
1011 inisectOsp :: String
1014 -- * Dynamic device modification
1017 ddmAdd = Types.ddmFullToRaw DdmFullAdd
1020 ddmModify = Types.ddmFullToRaw DdmFullModify
1023 ddmRemove = Types.ddmFullToRaw DdmFullRemove
1025 ddmsValues :: FrozenSet String
1026 ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
1028 ddmsValuesWithModify :: FrozenSet String
1029 ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
1031 -- * Common exit codes
1037 exitFailure = ConstantUtils.exitFailure
1039 exitNotcluster :: Int
1042 exitNotmaster :: Int
1045 exitNodesetupError :: Int
1046 exitNodesetupError = 12
1048 -- | Need user confirmation
1049 exitConfirmation :: Int
1050 exitConfirmation = 13
1052 -- | Exit code for query operations with unknown fields
1053 exitUnknownField :: Int
1054 exitUnknownField = 14
1058 tagCluster :: String
1059 tagCluster = Types.tagKindToRaw TagKindCluster
1061 tagInstance :: String
1062 tagInstance = Types.tagKindToRaw TagKindInstance
1064 tagNetwork :: String
1065 tagNetwork = Types.tagKindToRaw TagKindNetwork
1068 tagNode = Types.tagKindToRaw TagKindNode
1070 tagNodegroup :: String
1071 tagNodegroup = Types.tagKindToRaw TagKindGroup
1073 validTagTypes :: FrozenSet String
1074 validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
1079 maxTagsPerObj :: Int
1080 maxTagsPerObj = 4096
1084 defaultBridge :: String
1085 defaultBridge = "xen-br0"
1087 defaultOvs :: String
1088 defaultOvs = "switch1"
1090 -- | 60 MiB, expressed in KiB
1091 classicDrbdSyncSpeed :: Int
1092 classicDrbdSyncSpeed = 60 * 1024
1094 ip4AddressAny :: String
1095 ip4AddressAny = "0.0.0.0"
1097 ip4AddressLocalhost :: String
1098 ip4AddressLocalhost = "127.0.0.1"
1100 ip6AddressAny :: String
1101 ip6AddressAny = "::"
1103 ip6AddressLocalhost :: String
1104 ip6AddressLocalhost = "::1"
1112 validIpVersions :: FrozenSet Int
1113 validIpVersions = ConstantUtils.mkSet [ip4Version, ip6Version]
1115 tcpPingTimeout :: Int
1121 defaultDrbdHelper :: String
1122 defaultDrbdHelper = "/bin/true"
1127 defaultMacPrefix :: String
1128 defaultMacPrefix = "aa:00:00"
1130 -- | Default maximum instance wait time, in seconds.
1131 defaultShutdownTimeout :: Int
1132 defaultShutdownTimeout = 120
1134 -- | Node clock skew in seconds
1135 nodeMaxClockSkew :: Int
1136 nodeMaxClockSkew = 150
1138 -- | Time for an intra-cluster disk transfer to wait for a connection
1139 diskTransferConnectTimeout :: Int
1140 diskTransferConnectTimeout = 60
1142 -- | Disk index separator
1143 diskSeparator :: String
1144 diskSeparator = AutoConf.diskSeparator
1146 ipCommandPath :: String
1147 ipCommandPath = AutoConf.ipPath
1149 -- | Key for job IDs in opcode result
1153 -- * Runparts results
1164 runpartsStatus :: [Int]
1165 runpartsStatus = [runpartsErr, runpartsRun, runpartsSkip]
1169 rpcEncodingNone :: Int
1172 rpcEncodingZlibBase64 :: Int
1173 rpcEncodingZlibBase64 = 1
1177 -- Various time constants for the timeout table
1180 rpcTmoUrgent = Types.rpcTimeoutToRaw Urgent
1183 rpcTmoFast = Types.rpcTimeoutToRaw Fast
1186 rpcTmoNormal = Types.rpcTimeoutToRaw Normal
1189 rpcTmoSlow = Types.rpcTimeoutToRaw Slow
1191 -- | 'rpcTmo_4hrs' contains an underscore to circumvent a limitation
1192 -- in the 'Ganeti.THH.deCamelCase' function and generate the correct
1195 rpcTmo_4hrs = Types.rpcTimeoutToRaw FourHours
1197 -- | 'rpcTmo_1day' contains an underscore to circumvent a limitation
1198 -- in the 'Ganeti.THH.deCamelCase' function and generate the correct
1201 rpcTmo_1day = Types.rpcTimeoutToRaw OneDay
1203 -- | Timeout for connecting to nodes (seconds)
1204 rpcConnectTimeout :: Int
1205 rpcConnectTimeout = 5
1209 osScriptCreate :: String
1210 osScriptCreate = "create"
1212 osScriptExport :: String
1213 osScriptExport = "export"
1215 osScriptImport :: String
1216 osScriptImport = "import"
1218 osScriptRename :: String
1219 osScriptRename = "rename"
1221 osScriptVerify :: String
1222 osScriptVerify = "verify"
1224 osScripts :: [String]
1225 osScripts = [osScriptCreate, osScriptExport, osScriptImport, osScriptRename,
1229 osApiFile = "ganeti_api_version"
1231 osVariantsFile :: String
1232 osVariantsFile = "variants.list"
1234 osParametersFile :: String
1235 osParametersFile = "parameters.list"
1237 osValidateParameters :: String
1238 osValidateParameters = "parameters"
1240 osValidateCalls :: FrozenSet String
1241 osValidateCalls = ConstantUtils.mkSet [osValidateParameters]
1243 -- | External Storage (ES) related constants
1245 esActionAttach :: String
1246 esActionAttach = "attach"
1248 esActionCreate :: String
1249 esActionCreate = "create"
1251 esActionDetach :: String
1252 esActionDetach = "detach"
1254 esActionGrow :: String
1255 esActionGrow = "grow"
1257 esActionRemove :: String
1258 esActionRemove = "remove"
1260 esActionSetinfo :: String
1261 esActionSetinfo = "setinfo"
1263 esActionVerify :: String
1264 esActionVerify = "verify"
1266 esScriptCreate :: String
1267 esScriptCreate = esActionCreate
1269 esScriptRemove :: String
1270 esScriptRemove = esActionRemove
1272 esScriptGrow :: String
1273 esScriptGrow = esActionGrow
1275 esScriptAttach :: String
1276 esScriptAttach = esActionAttach
1278 esScriptDetach :: String
1279 esScriptDetach = esActionDetach
1281 esScriptSetinfo :: String
1282 esScriptSetinfo = esActionSetinfo
1284 esScriptVerify :: String
1285 esScriptVerify = esActionVerify
1287 esScripts :: FrozenSet String
1289 ConstantUtils.mkSet [esScriptAttach,
1297 esParametersFile :: String
1298 esParametersFile = "parameters.list"
1302 instanceRebootSoft :: String
1303 instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
1305 instanceRebootHard :: String
1306 instanceRebootHard = Types.rebootTypeToRaw RebootHard
1308 instanceRebootFull :: String
1309 instanceRebootFull = Types.rebootTypeToRaw RebootFull
1311 rebootTypes :: FrozenSet String
1312 rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
1314 -- * Instance reboot behaviors
1316 instanceRebootAllowed :: String
1317 instanceRebootAllowed = "reboot"
1319 instanceRebootExit :: String
1320 instanceRebootExit = "exit"
1322 rebootBehaviors :: [String]
1323 rebootBehaviors = [instanceRebootAllowed, instanceRebootExit]
1328 vtypeBool = VTypeBool
1333 vtypeMaybeString :: VType
1334 vtypeMaybeString = VTypeMaybeString
1338 vtypeSize = VTypeSize
1340 vtypeString :: VType
1341 vtypeString = VTypeString
1343 enforceableTypes :: FrozenSet VType
1344 enforceableTypes = ConstantUtils.mkSet [minBound..]
1346 -- | Constant representing that the user does not specify any IP version
1347 ifaceNoIpVersionSpecified :: Int
1348 ifaceNoIpVersionSpecified = 0
1350 validSerialSpeeds :: [Int]
1371 -- * HV parameter names (global namespace)
1376 hvBlockdevPrefix :: String
1377 hvBlockdevPrefix = "blockdev_prefix"
1379 hvBootloaderArgs :: String
1380 hvBootloaderArgs = "bootloader_args"
1382 hvBootloaderPath :: String
1383 hvBootloaderPath = "bootloader_path"
1385 hvBootOrder :: String
1386 hvBootOrder = "boot_order"
1388 hvCdromImagePath :: String
1389 hvCdromImagePath = "cdrom_image_path"
1392 hvCpuCap = "cpu_cap"
1394 hvCpuCores :: String
1395 hvCpuCores = "cpu_cores"
1398 hvCpuMask = "cpu_mask"
1400 hvCpuSockets :: String
1401 hvCpuSockets = "cpu_sockets"
1403 hvCpuThreads :: String
1404 hvCpuThreads = "cpu_threads"
1407 hvCpuType = "cpu_type"
1409 hvCpuWeight :: String
1410 hvCpuWeight = "cpu_weight"
1412 hvDeviceModel :: String
1413 hvDeviceModel = "device_model"
1415 hvDiskCache :: String
1416 hvDiskCache = "disk_cache"
1418 hvDiskType :: String
1419 hvDiskType = "disk_type"
1421 hvInitrdPath :: String
1422 hvInitrdPath = "initrd_path"
1424 hvInitScript :: String
1425 hvInitScript = "init_script"
1427 hvKernelArgs :: String
1428 hvKernelArgs = "kernel_args"
1430 hvKernelPath :: String
1431 hvKernelPath = "kernel_path"
1436 hvKvmCdrom2ImagePath :: String
1437 hvKvmCdrom2ImagePath = "cdrom2_image_path"
1439 hvKvmCdromDiskType :: String
1440 hvKvmCdromDiskType = "cdrom_disk_type"
1442 hvKvmExtra :: String
1443 hvKvmExtra = "kvm_extra"
1446 hvKvmFlag = "kvm_flag"
1448 hvKvmFloppyImagePath :: String
1449 hvKvmFloppyImagePath = "floppy_image_path"
1451 hvKvmMachineVersion :: String
1452 hvKvmMachineVersion = "machine_version"
1455 hvKvmPath = "kvm_path"
1457 hvKvmSpiceAudioCompr :: String
1458 hvKvmSpiceAudioCompr = "spice_playback_compression"
1460 hvKvmSpiceBind :: String
1461 hvKvmSpiceBind = "spice_bind"
1463 hvKvmSpiceIpVersion :: String
1464 hvKvmSpiceIpVersion = "spice_ip_version"
1466 hvKvmSpiceJpegImgCompr :: String
1467 hvKvmSpiceJpegImgCompr = "spice_jpeg_wan_compression"
1469 hvKvmSpiceLosslessImgCompr :: String
1470 hvKvmSpiceLosslessImgCompr = "spice_image_compression"
1472 hvKvmSpicePasswordFile :: String
1473 hvKvmSpicePasswordFile = "spice_password_file"
1475 hvKvmSpiceStreamingVideoDetection :: String
1476 hvKvmSpiceStreamingVideoDetection = "spice_streaming_video"
1478 hvKvmSpiceTlsCiphers :: String
1479 hvKvmSpiceTlsCiphers = "spice_tls_ciphers"
1481 hvKvmSpiceUseTls :: String
1482 hvKvmSpiceUseTls = "spice_use_tls"
1484 hvKvmSpiceUseVdagent :: String
1485 hvKvmSpiceUseVdagent = "spice_use_vdagent"
1487 hvKvmSpiceZlibGlzImgCompr :: String
1488 hvKvmSpiceZlibGlzImgCompr = "spice_zlib_glz_wan_compression"
1490 hvKvmUseChroot :: String
1491 hvKvmUseChroot = "use_chroot"
1494 hvMemPath = "mem_path"
1496 hvMigrationBandwidth :: String
1497 hvMigrationBandwidth = "migration_bandwidth"
1499 hvMigrationDowntime :: String
1500 hvMigrationDowntime = "migration_downtime"
1502 hvMigrationMode :: String
1503 hvMigrationMode = "migration_mode"
1505 hvMigrationPort :: String
1506 hvMigrationPort = "migration_port"
1509 hvNicType = "nic_type"
1514 hvPassthrough :: String
1515 hvPassthrough = "pci_pass"
1517 hvRebootBehavior :: String
1518 hvRebootBehavior = "reboot_behavior"
1520 hvRootPath :: String
1521 hvRootPath = "root_path"
1523 hvSecurityDomain :: String
1524 hvSecurityDomain = "security_domain"
1526 hvSecurityModel :: String
1527 hvSecurityModel = "security_model"
1529 hvSerialConsole :: String
1530 hvSerialConsole = "serial_console"
1532 hvSerialSpeed :: String
1533 hvSerialSpeed = "serial_speed"
1536 hvSoundhw = "soundhw"
1538 hvUsbDevices :: String
1539 hvUsbDevices = "usb_devices"
1541 hvUsbMouse :: String
1542 hvUsbMouse = "usb_mouse"
1544 hvUseBootloader :: String
1545 hvUseBootloader = "use_bootloader"
1547 hvUseLocaltime :: String
1548 hvUseLocaltime = "use_localtime"
1553 hvVhostNet :: String
1554 hvVhostNet = "vhost_net"
1556 hvVifScript :: String
1557 hvVifScript = "vif_script"
1560 hvVifType = "vif_type"
1562 hvViridian :: String
1563 hvViridian = "viridian"
1565 hvVncBindAddress :: String
1566 hvVncBindAddress = "vnc_bind_address"
1568 hvVncPasswordFile :: String
1569 hvVncPasswordFile = "vnc_password_file"
1572 hvVncTls = "vnc_tls"
1575 hvVncX509 = "vnc_x509_path"
1577 hvVncX509Verify :: String
1578 hvVncX509Verify = "vnc_x509_verify"
1581 hvVnetHdr = "vnet_hdr"
1584 hvXenCmd = "xen_cmd"
1586 hvXenCpuid :: String
1587 hvXenCpuid = "cpuid"
1589 hvsParameterTitles :: Map String String
1590 hvsParameterTitles =
1593 (hvBootOrder, "Boot_order"),
1594 (hvCdromImagePath, "CDROM_image_path"),
1595 (hvCpuType, "cpu_type"),
1596 (hvDiskType, "Disk_type"),
1597 (hvInitrdPath, "Initrd_path"),
1598 (hvKernelPath, "Kernel_path"),
1599 (hvNicType, "NIC_type"),
1601 (hvPassthrough, "pci_pass"),
1602 (hvVncBindAddress, "VNC_bind_address")]
1604 -- * Migration statuses
1606 hvMigrationActive :: String
1607 hvMigrationActive = "active"
1609 hvMigrationCancelled :: String
1610 hvMigrationCancelled = "cancelled"
1612 hvMigrationCompleted :: String
1613 hvMigrationCompleted = "completed"
1615 hvMigrationFailed :: String
1616 hvMigrationFailed = "failed"
1618 hvMigrationValidStatuses :: FrozenSet String
1619 hvMigrationValidStatuses =
1620 ConstantUtils.mkSet [hvMigrationActive,
1621 hvMigrationCancelled,
1622 hvMigrationCompleted,
1625 hvMigrationFailedStatuses :: FrozenSet String
1626 hvMigrationFailedStatuses =
1627 ConstantUtils.mkSet [hvMigrationFailed, hvMigrationCancelled]
1629 -- | KVM-specific statuses
1631 -- FIXME: this constant seems unnecessary
1632 hvKvmMigrationValidStatuses :: FrozenSet String
1633 hvKvmMigrationValidStatuses = hvMigrationValidStatuses
1636 hvNodeinfoKeyVersion :: String
1637 hvNodeinfoKeyVersion = "hv_version"
1639 -- * Hypervisor state
1641 hvstCpuNode :: String
1642 hvstCpuNode = "cpu_node"
1644 hvstCpuTotal :: String
1645 hvstCpuTotal = "cpu_total"
1647 hvstMemoryHv :: String
1648 hvstMemoryHv = "mem_hv"
1650 hvstMemoryNode :: String
1651 hvstMemoryNode = "mem_node"
1653 hvstMemoryTotal :: String
1654 hvstMemoryTotal = "mem_total"
1656 hvstsParameters :: FrozenSet String
1658 ConstantUtils.mkSet [hvstCpuNode,
1664 hvstDefaults :: Map String Int
1670 (hvstMemoryTotal, 0),
1671 (hvstMemoryNode, 0)]
1673 hvstsParameterTypes :: Map String VType
1674 hvstsParameterTypes =
1675 Map.fromList [(hvstMemoryTotal, VTypeInt),
1676 (hvstMemoryNode, VTypeInt),
1677 (hvstMemoryHv, VTypeInt),
1678 (hvstCpuTotal, VTypeInt),
1679 (hvstCpuNode, VTypeInt)]
1683 dsDiskOverhead :: String
1684 dsDiskOverhead = "disk_overhead"
1686 dsDiskReserved :: String
1687 dsDiskReserved = "disk_reserved"
1689 dsDiskTotal :: String
1690 dsDiskTotal = "disk_total"
1692 dsDefaults :: Map String Int
1696 (dsDiskReserved, 0),
1697 (dsDiskOverhead, 0)]
1699 dssParameterTypes :: Map String VType
1701 Map.fromList [(dsDiskTotal, VTypeInt),
1702 (dsDiskReserved, VTypeInt),
1703 (dsDiskOverhead, VTypeInt)]
1705 dssParameters :: FrozenSet String
1707 ConstantUtils.mkSet [dsDiskTotal, dsDiskReserved, dsDiskOverhead]
1709 dsValidTypes :: FrozenSet String
1710 dsValidTypes = ConstantUtils.mkSet [Types.diskTemplateToRaw DTPlain]
1712 -- Backend parameter names
1714 beAlwaysFailover :: String
1715 beAlwaysFailover = "always_failover"
1717 beAutoBalance :: String
1718 beAutoBalance = "auto_balance"
1723 -- | Deprecated and replaced by max and min mem
1730 beSpindleUse :: String
1731 beSpindleUse = "spindle_use"
1736 besParameterTypes :: Map String VType
1738 Map.fromList [(beAlwaysFailover, VTypeBool),
1739 (beAutoBalance, VTypeBool),
1740 (beMaxmem, VTypeSize),
1741 (beMinmem, VTypeSize),
1742 (beSpindleUse, VTypeInt),
1743 (beVcpus, VTypeInt)]
1745 besParameterTitles :: Map String String
1746 besParameterTitles =
1747 Map.fromList [(beAutoBalance, "Auto_balance"),
1748 (beMinmem, "ConfigMinMem"),
1749 (beVcpus, "ConfigVCPUs"),
1750 (beMaxmem, "ConfigMaxMem")]
1752 besParameterCompat :: Map String VType
1753 besParameterCompat = Map.insert beMemory VTypeSize besParameterTypes
1755 besParameters :: FrozenSet String
1757 ConstantUtils.mkSet [beAlwaysFailover,
1766 -- FIXME: these should be associated with 'Ganeti.HTools.Types.ISpec'
1768 ispecMemSize :: String
1769 ispecMemSize = ConstantUtils.ispecMemSize
1771 ispecCpuCount :: String
1772 ispecCpuCount = ConstantUtils.ispecCpuCount
1774 ispecDiskCount :: String
1775 ispecDiskCount = ConstantUtils.ispecDiskCount
1777 ispecDiskSize :: String
1778 ispecDiskSize = ConstantUtils.ispecDiskSize
1780 ispecNicCount :: String
1781 ispecNicCount = ConstantUtils.ispecNicCount
1783 ispecSpindleUse :: String
1784 ispecSpindleUse = ConstantUtils.ispecSpindleUse
1786 ispecsParameterTypes :: Map String VType
1787 ispecsParameterTypes =
1789 [(ConstantUtils.ispecDiskSize, VTypeInt),
1790 (ConstantUtils.ispecCpuCount, VTypeInt),
1791 (ConstantUtils.ispecSpindleUse, VTypeInt),
1792 (ConstantUtils.ispecMemSize, VTypeInt),
1793 (ConstantUtils.ispecNicCount, VTypeInt),
1794 (ConstantUtils.ispecDiskCount, VTypeInt)]
1796 ispecsParameters :: FrozenSet String
1798 ConstantUtils.mkSet [ConstantUtils.ispecCpuCount,
1799 ConstantUtils.ispecDiskCount,
1800 ConstantUtils.ispecDiskSize,
1801 ConstantUtils.ispecMemSize,
1802 ConstantUtils.ispecNicCount,
1803 ConstantUtils.ispecSpindleUse]
1805 ispecsMinmax :: String
1806 ispecsMinmax = ConstantUtils.ispecsMinmax
1815 ispecsStd = ConstantUtils.ispecsStd
1817 ipolicyDts :: String
1818 ipolicyDts = ConstantUtils.ipolicyDts
1820 ipolicyVcpuRatio :: String
1821 ipolicyVcpuRatio = ConstantUtils.ipolicyVcpuRatio
1823 ipolicySpindleRatio :: String
1824 ipolicySpindleRatio = ConstantUtils.ipolicySpindleRatio
1826 ispecsMinmaxKeys :: FrozenSet String
1827 ispecsMinmaxKeys = ConstantUtils.mkSet [ispecsMax, ispecsMin]
1829 ipolicyParameters :: FrozenSet String
1831 ConstantUtils.mkSet [ConstantUtils.ipolicyVcpuRatio,
1832 ConstantUtils.ipolicySpindleRatio]
1834 ipolicyAllKeys :: FrozenSet String
1836 ConstantUtils.union ipolicyParameters $
1837 ConstantUtils.mkSet [ConstantUtils.ipolicyDts,
1838 ConstantUtils.ispecsMinmax,
1841 -- | Node parameter names
1843 ndExclusiveStorage :: String
1844 ndExclusiveStorage = "exclusive_storage"
1846 ndOobProgram :: String
1847 ndOobProgram = "oob_program"
1849 ndSpindleCount :: String
1850 ndSpindleCount = "spindle_count"
1856 ndOvsLink = "ovs_link"
1859 ndOvsName = "ovs_name"
1861 ndsParameterTypes :: Map String VType
1864 [(ndExclusiveStorage, VTypeBool),
1865 (ndOobProgram, VTypeString),
1867 (ndOvsLink, VTypeMaybeString),
1868 (ndOvsName, VTypeMaybeString),
1869 (ndSpindleCount, VTypeInt)]
1871 ndsParameters :: FrozenSet String
1872 ndsParameters = ConstantUtils.mkSet (Map.keys ndsParameterTypes)
1874 ndsParameterTitles :: Map String String
1875 ndsParameterTitles =
1877 [(ndExclusiveStorage, "ExclusiveStorage"),
1878 (ndOobProgram, "OutOfBandProgram"),
1879 (ndOvs, "OpenvSwitch"),
1880 (ndOvsLink, "OpenvSwitchLink"),
1881 (ndOvsName, "OpenvSwitchName"),
1882 (ndSpindleCount, "SpindleCount")]
1884 -- * Logical Disks parameters
1887 ldpAccess = "access"
1889 ldpBarriers :: String
1890 ldpBarriers = "disabled-barriers"
1892 ldpDefaultMetavg :: String
1893 ldpDefaultMetavg = "default-metavg"
1895 ldpDelayTarget :: String
1896 ldpDelayTarget = "c-delay-target"
1898 ldpDiskCustom :: String
1899 ldpDiskCustom = "disk-custom"
1901 ldpDynamicResync :: String
1902 ldpDynamicResync = "dynamic-resync"
1904 ldpFillTarget :: String
1905 ldpFillTarget = "c-fill-target"
1907 ldpMaxRate :: String
1908 ldpMaxRate = "c-max-rate"
1910 ldpMinRate :: String
1911 ldpMinRate = "c-min-rate"
1913 ldpNetCustom :: String
1914 ldpNetCustom = "net-custom"
1916 ldpNoMetaFlush :: String
1917 ldpNoMetaFlush = "disable-meta-flush"
1919 ldpPlanAhead :: String
1920 ldpPlanAhead = "c-plan-ahead"
1925 ldpProtocol :: String
1926 ldpProtocol = "protocol"
1928 ldpResyncRate :: String
1929 ldpResyncRate = "resync-rate"
1931 ldpStripes :: String
1932 ldpStripes = "stripes"
1934 diskLdTypes :: Map String VType
1937 [(ldpAccess, VTypeString),
1938 (ldpResyncRate, VTypeInt),
1939 (ldpStripes, VTypeInt),
1940 (ldpBarriers, VTypeString),
1941 (ldpNoMetaFlush, VTypeBool),
1942 (ldpDefaultMetavg, VTypeString),
1943 (ldpDiskCustom, VTypeString),
1944 (ldpNetCustom, VTypeString),
1945 (ldpProtocol, VTypeString),
1946 (ldpDynamicResync, VTypeBool),
1947 (ldpPlanAhead, VTypeInt),
1948 (ldpFillTarget, VTypeInt),
1949 (ldpDelayTarget, VTypeInt),
1950 (ldpMaxRate, VTypeInt),
1951 (ldpMinRate, VTypeInt),
1952 (ldpPool, VTypeString)]
1954 diskLdParameters :: FrozenSet String
1955 diskLdParameters = ConstantUtils.mkSet (Map.keys diskLdTypes)
1957 -- * Disk template parameters
1959 -- Disk template parameters can be set/changed by the user via
1960 -- gnt-cluster and gnt-group)
1962 drbdResyncRate :: String
1963 drbdResyncRate = "resync-rate"
1965 drbdDataStripes :: String
1966 drbdDataStripes = "data-stripes"
1968 drbdMetaStripes :: String
1969 drbdMetaStripes = "meta-stripes"
1971 drbdDiskBarriers :: String
1972 drbdDiskBarriers = "disk-barriers"
1974 drbdMetaBarriers :: String
1975 drbdMetaBarriers = "meta-barriers"
1977 drbdDefaultMetavg :: String
1978 drbdDefaultMetavg = "metavg"
1980 drbdDiskCustom :: String
1981 drbdDiskCustom = "disk-custom"
1983 drbdNetCustom :: String
1984 drbdNetCustom = "net-custom"
1986 drbdProtocol :: String
1987 drbdProtocol = "protocol"
1989 drbdDynamicResync :: String
1990 drbdDynamicResync = "dynamic-resync"
1992 drbdPlanAhead :: String
1993 drbdPlanAhead = "c-plan-ahead"
1995 drbdFillTarget :: String
1996 drbdFillTarget = "c-fill-target"
1998 drbdDelayTarget :: String
1999 drbdDelayTarget = "c-delay-target"
2001 drbdMaxRate :: String
2002 drbdMaxRate = "c-max-rate"
2004 drbdMinRate :: String
2005 drbdMinRate = "c-min-rate"
2008 lvStripes = "stripes"
2011 rbdAccess = "access"
2016 diskDtTypes :: Map String VType
2018 Map.fromList [(drbdResyncRate, VTypeInt),
2019 (drbdDataStripes, VTypeInt),
2020 (drbdMetaStripes, VTypeInt),
2021 (drbdDiskBarriers, VTypeString),
2022 (drbdMetaBarriers, VTypeBool),
2023 (drbdDefaultMetavg, VTypeString),
2024 (drbdDiskCustom, VTypeString),
2025 (drbdNetCustom, VTypeString),
2026 (drbdProtocol, VTypeString),
2027 (drbdDynamicResync, VTypeBool),
2028 (drbdPlanAhead, VTypeInt),
2029 (drbdFillTarget, VTypeInt),
2030 (drbdDelayTarget, VTypeInt),
2031 (drbdMaxRate, VTypeInt),
2032 (drbdMinRate, VTypeInt),
2033 (lvStripes, VTypeInt),
2034 (rbdAccess, VTypeString),
2035 (rbdPool, VTypeString)]
2037 diskDtParameters :: FrozenSet String
2038 diskDtParameters = ConstantUtils.mkSet (Map.keys diskDtTypes)
2040 -- * Dynamic disk parameters
2042 ddpLocalIp :: String
2043 ddpLocalIp = "local-ip"
2045 ddpRemoteIp :: String
2046 ddpRemoteIp = "remote-ip"
2051 ddpLocalMinor :: String
2052 ddpLocalMinor = "local-minor"
2054 ddpRemoteMinor :: String
2055 ddpRemoteMinor = "remote-minor"
2057 -- * OOB supported commands
2059 oobPowerOn :: String
2060 oobPowerOn = Types.oobCommandToRaw OobPowerOn
2062 oobPowerOff :: String
2063 oobPowerOff = Types.oobCommandToRaw OobPowerOff
2065 oobPowerCycle :: String
2066 oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
2068 oobPowerStatus :: String
2069 oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
2072 oobHealth = Types.oobCommandToRaw OobHealth
2074 oobCommands :: FrozenSet String
2075 oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
2077 oobPowerStatusPowered :: String
2078 oobPowerStatusPowered = "powered"
2085 oobPowerDelay :: Double
2088 oobStatusCritical :: String
2089 oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
2091 oobStatusOk :: String
2092 oobStatusOk = Types.oobStatusToRaw OobStatusOk
2094 oobStatusUnknown :: String
2095 oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
2097 oobStatusWarning :: String
2098 oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
2100 oobStatuses :: FrozenSet String
2101 oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
2103 -- | Instance Parameters Profile
2105 ppDefault = "default"
2107 -- * nic* constants are used inside the ganeti config
2118 nicsParameterTypes :: Map String VType
2119 nicsParameterTypes =
2120 Map.fromList [(nicMode, vtypeString),
2121 (nicLink, vtypeString),
2122 (nicVlan, vtypeMaybeString)]
2124 nicsParameters :: FrozenSet String
2125 nicsParameters = ConstantUtils.mkSet (Map.keys nicsParameterTypes)
2127 nicModeBridged :: String
2128 nicModeBridged = Types.nICModeToRaw NMBridged
2130 nicModeRouted :: String
2131 nicModeRouted = Types.nICModeToRaw NMRouted
2133 nicModeOvs :: String
2134 nicModeOvs = Types.nICModeToRaw NMOvs
2137 nicIpPool = Types.nICModeToRaw NMPool
2139 nicValidModes :: FrozenSet String
2140 nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
2142 releaseAction :: String
2143 releaseAction = "release"
2145 reserveAction :: String
2146 reserveAction = "reserve"
2148 -- * idisk* constants are used in opcodes, to create/change disks
2150 idiskAdopt :: String
2151 idiskAdopt = "adopt"
2153 idiskMetavg :: String
2154 idiskMetavg = "metavg"
2165 idiskSpindles :: String
2166 idiskSpindles = "spindles"
2171 idiskProvider :: String
2172 idiskProvider = "provider"
2174 idiskParamsTypes :: Map String VType
2176 Map.fromList [(idiskSize, VTypeSize),
2177 (idiskSpindles, VTypeInt),
2178 (idiskMode, VTypeString),
2179 (idiskAdopt, VTypeString),
2180 (idiskVg, VTypeString),
2181 (idiskMetavg, VTypeString),
2182 (idiskProvider, VTypeString),
2183 (idiskName, VTypeMaybeString)]
2185 idiskParams :: FrozenSet String
2186 idiskParams = ConstantUtils.mkSet (Map.keys idiskParamsTypes)
2188 -- * inic* constants are used in opcodes, to create/change nics
2190 inicBridge :: String
2191 inicBridge = "bridge"
2208 inicNetwork :: String
2209 inicNetwork = "network"
2214 inicParamsTypes :: Map String VType
2216 Map.fromList [(inicBridge, VTypeMaybeString),
2217 (inicIp, VTypeMaybeString),
2218 (inicLink, VTypeString),
2219 (inicMac, VTypeString),
2220 (inicMode, VTypeString),
2221 (inicName, VTypeMaybeString),
2222 (inicNetwork, VTypeMaybeString),
2223 (inicVlan, VTypeMaybeString)]
2225 inicParams :: FrozenSet String
2226 inicParams = ConstantUtils.mkSet (Map.keys inicParamsTypes)
2228 -- * Hypervisor constants
2231 htXenPvm = Types.hypervisorToRaw XenPvm
2234 htFake = Types.hypervisorToRaw Fake
2237 htXenHvm = Types.hypervisorToRaw XenHvm
2240 htKvm = Types.hypervisorToRaw Kvm
2243 htChroot = Types.hypervisorToRaw Chroot
2246 htLxc = Types.hypervisorToRaw Lxc
2248 hyperTypes :: FrozenSet String
2249 hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
2251 htsReqPort :: FrozenSet String
2252 htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
2257 vncDefaultBindAddress :: String
2258 vncDefaultBindAddress = ip4AddressAny
2262 htNicE1000 :: String
2263 htNicE1000 = "e1000"
2265 htNicI82551 :: String
2266 htNicI82551 = "i82551"
2268 htNicI8259er :: String
2269 htNicI8259er = "i82559er"
2271 htNicI85557b :: String
2272 htNicI85557b = "i82557b"
2274 htNicNe2kIsa :: String
2275 htNicNe2kIsa = "ne2k_isa"
2277 htNicNe2kPci :: String
2278 htNicNe2kPci = "ne2k_pci"
2280 htNicParavirtual :: String
2281 htNicParavirtual = "paravirtual"
2283 htNicPcnet :: String
2284 htNicPcnet = "pcnet"
2286 htNicRtl8139 :: String
2287 htNicRtl8139 = "rtl8139"
2289 htHvmValidNicTypes :: FrozenSet String
2290 htHvmValidNicTypes =
2291 ConstantUtils.mkSet [htNicE1000,
2297 htKvmValidNicTypes :: FrozenSet String
2298 htKvmValidNicTypes =
2299 ConstantUtils.mkSet [htNicE1000,
2311 -- | Default vif type in xen-hvm
2312 htHvmVifIoemu :: String
2313 htHvmVifIoemu = "ioemu"
2315 htHvmVifVif :: String
2318 htHvmValidVifTypes :: FrozenSet String
2319 htHvmValidVifTypes = ConstantUtils.mkSet [htHvmVifIoemu, htHvmVifVif]
2326 htDiskIoemu :: String
2327 htDiskIoemu = "ioemu"
2332 htDiskParavirtual :: String
2333 htDiskParavirtual = "paravirtual"
2335 htDiskPflash :: String
2336 htDiskPflash = "pflash"
2338 htDiskScsi :: String
2344 htHvmValidDiskTypes :: FrozenSet String
2345 htHvmValidDiskTypes = ConstantUtils.mkSet [htDiskIoemu, htDiskParavirtual]
2347 htKvmValidDiskTypes :: FrozenSet String
2348 htKvmValidDiskTypes =
2349 ConstantUtils.mkSet [htDiskIde,
2356 htCacheDefault :: String
2357 htCacheDefault = "default"
2359 htCacheNone :: String
2360 htCacheNone = "none"
2362 htCacheWback :: String
2363 htCacheWback = "writeback"
2365 htCacheWthrough :: String
2366 htCacheWthrough = "writethrough"
2368 htValidCacheTypes :: FrozenSet String
2370 ConstantUtils.mkSet [htCacheDefault,
2377 htMouseMouse :: String
2378 htMouseMouse = "mouse"
2380 htMouseTablet :: String
2381 htMouseTablet = "tablet"
2383 htKvmValidMouseTypes :: FrozenSet String
2384 htKvmValidMouseTypes = ConstantUtils.mkSet [htMouseMouse, htMouseTablet]
2394 htBoFloppy :: String
2395 htBoFloppy = "floppy"
2397 htBoNetwork :: String
2398 htBoNetwork = "network"
2400 htKvmValidBoTypes :: FrozenSet String
2402 ConstantUtils.mkSet [htBoCdrom, htBoDisk, htBoFloppy, htBoNetwork]
2404 -- * SPICE lossless image compression options
2406 htKvmSpiceLosslessImgComprAutoGlz :: String
2407 htKvmSpiceLosslessImgComprAutoGlz = "auto_glz"
2409 htKvmSpiceLosslessImgComprAutoLz :: String
2410 htKvmSpiceLosslessImgComprAutoLz = "auto_lz"
2412 htKvmSpiceLosslessImgComprGlz :: String
2413 htKvmSpiceLosslessImgComprGlz = "glz"
2415 htKvmSpiceLosslessImgComprLz :: String
2416 htKvmSpiceLosslessImgComprLz = "lz"
2418 htKvmSpiceLosslessImgComprOff :: String
2419 htKvmSpiceLosslessImgComprOff = "off"
2421 htKvmSpiceLosslessImgComprQuic :: String
2422 htKvmSpiceLosslessImgComprQuic = "quic"
2424 htKvmSpiceValidLosslessImgComprOptions :: FrozenSet String
2425 htKvmSpiceValidLosslessImgComprOptions =
2426 ConstantUtils.mkSet [htKvmSpiceLosslessImgComprAutoGlz,
2427 htKvmSpiceLosslessImgComprAutoLz,
2428 htKvmSpiceLosslessImgComprGlz,
2429 htKvmSpiceLosslessImgComprLz,
2430 htKvmSpiceLosslessImgComprOff,
2431 htKvmSpiceLosslessImgComprQuic]
2433 htKvmSpiceLossyImgComprAlways :: String
2434 htKvmSpiceLossyImgComprAlways = "always"
2436 htKvmSpiceLossyImgComprAuto :: String
2437 htKvmSpiceLossyImgComprAuto = "auto"
2439 htKvmSpiceLossyImgComprNever :: String
2440 htKvmSpiceLossyImgComprNever = "never"
2442 htKvmSpiceValidLossyImgComprOptions :: FrozenSet String
2443 htKvmSpiceValidLossyImgComprOptions =
2444 ConstantUtils.mkSet [htKvmSpiceLossyImgComprAlways,
2445 htKvmSpiceLossyImgComprAuto,
2446 htKvmSpiceLossyImgComprNever]
2448 -- * SPICE video stream detection
2450 htKvmSpiceVideoStreamDetectionAll :: String
2451 htKvmSpiceVideoStreamDetectionAll = "all"
2453 htKvmSpiceVideoStreamDetectionFilter :: String
2454 htKvmSpiceVideoStreamDetectionFilter = "filter"
2456 htKvmSpiceVideoStreamDetectionOff :: String
2457 htKvmSpiceVideoStreamDetectionOff = "off"
2459 htKvmSpiceValidVideoStreamDetectionOptions :: FrozenSet String
2460 htKvmSpiceValidVideoStreamDetectionOptions =
2461 ConstantUtils.mkSet [htKvmSpiceVideoStreamDetectionAll,
2462 htKvmSpiceVideoStreamDetectionFilter,
2463 htKvmSpiceVideoStreamDetectionOff]
2465 -- * Security models
2476 htKvmValidSmTypes :: FrozenSet String
2477 htKvmValidSmTypes = ConstantUtils.mkSet [htSmNone, htSmPool, htSmUser]
2479 -- * Kvm flag values
2481 htKvmDisabled :: String
2482 htKvmDisabled = "disabled"
2484 htKvmEnabled :: String
2485 htKvmEnabled = "enabled"
2487 htKvmFlagValues :: FrozenSet String
2488 htKvmFlagValues = ConstantUtils.mkSet [htKvmDisabled, htKvmEnabled]
2492 htMigrationLive :: String
2493 htMigrationLive = Types.migrationModeToRaw MigrationLive
2495 htMigrationNonlive :: String
2496 htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
2498 htMigrationModes :: FrozenSet String
2500 ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
2502 -- * Cluster verify steps
2504 verifyNplusoneMem :: String
2505 verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
2507 verifyOptionalChecks :: FrozenSet String
2508 verifyOptionalChecks =
2509 ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
2511 -- * Cluster Verify error classes
2513 cvTcluster :: String
2514 cvTcluster = "cluster"
2522 cvTinstance :: String
2523 cvTinstance = "instance"
2525 -- * Cluster Verify error codes and documentation
2527 cvEclustercert :: (String, String, String)
2530 Types.cVErrorCodeToRaw CvECLUSTERCERT,
2531 "Cluster certificate files verification failure")
2533 cvEclustercfg :: (String, String, String)
2536 Types.cVErrorCodeToRaw CvECLUSTERCFG,
2537 "Cluster configuration verification failure")
2539 cvEclusterdanglinginst :: (String, String, String)
2540 cvEclusterdanglinginst =
2542 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
2543 "Some instances have a non-existing primary node")
2545 cvEclusterdanglingnodes :: (String, String, String)
2546 cvEclusterdanglingnodes =
2548 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
2549 "Some nodes belong to non-existing groups")
2551 cvEclusterfilecheck :: (String, String, String)
2552 cvEclusterfilecheck =
2554 Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
2555 "Cluster configuration verification failure")
2557 cvEgroupdifferentpvsize :: (String, String, String)
2558 cvEgroupdifferentpvsize =
2560 Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
2561 "PVs in the group have different sizes")
2563 cvEinstancebadnode :: (String, String, String)
2564 cvEinstancebadnode =
2566 Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
2567 "Instance marked as running lives on an offline node")
2569 cvEinstancedown :: (String, String, String)
2572 Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
2573 "Instance not running on its primary node")
2575 cvEinstancefaultydisk :: (String, String, String)
2576 cvEinstancefaultydisk =
2578 Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
2579 "Impossible to retrieve status for a disk")
2581 cvEinstancelayout :: (String, String, String)
2584 Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
2585 "Instance has multiple secondary nodes")
2587 cvEinstancemissingcfgparameter :: (String, String, String)
2588 cvEinstancemissingcfgparameter =
2590 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
2591 "A configuration parameter for an instance is missing")
2593 cvEinstancemissingdisk :: (String, String, String)
2594 cvEinstancemissingdisk =
2596 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
2597 "Missing volume on an instance")
2599 cvEinstancepolicy :: (String, String, String)
2602 Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
2603 "Instance does not meet policy")
2605 cvEinstancesplitgroups :: (String, String, String)
2606 cvEinstancesplitgroups =
2608 Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
2609 "Instance with primary and secondary nodes in different groups")
2611 cvEinstanceunsuitablenode :: (String, String, String)
2612 cvEinstanceunsuitablenode =
2614 Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
2615 "Instance running on nodes that are not suitable for it")
2617 cvEinstancewrongnode :: (String, String, String)
2618 cvEinstancewrongnode =
2620 Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
2621 "Instance running on the wrong node")
2623 cvEnodedrbd :: (String, String, String)
2626 Types.cVErrorCodeToRaw CvENODEDRBD,
2627 "Error parsing the DRBD status file")
2629 cvEnodedrbdhelper :: (String, String, String)
2632 Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
2633 "Error caused by the DRBD helper")
2635 cvEnodedrbdversion :: (String, String, String)
2636 cvEnodedrbdversion =
2638 Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
2639 "DRBD version mismatch within a node group")
2641 cvEnodefilecheck :: (String, String, String)
2644 Types.cVErrorCodeToRaw CvENODEFILECHECK,
2645 "Error retrieving the checksum of the node files")
2647 cvEnodefilestoragepaths :: (String, String, String)
2648 cvEnodefilestoragepaths =
2650 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
2651 "Detected bad file storage paths")
2653 cvEnodefilestoragepathunusable :: (String, String, String)
2654 cvEnodefilestoragepathunusable =
2656 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
2657 "File storage path unusable")
2659 cvEnodehooks :: (String, String, String)
2662 Types.cVErrorCodeToRaw CvENODEHOOKS,
2663 "Communication failure in hooks execution")
2665 cvEnodehv :: (String, String, String)
2668 Types.cVErrorCodeToRaw CvENODEHV,
2669 "Hypervisor parameters verification failure")
2671 cvEnodelvm :: (String, String, String)
2674 Types.cVErrorCodeToRaw CvENODELVM,
2675 "LVM-related node error")
2677 cvEnoden1 :: (String, String, String)
2680 Types.cVErrorCodeToRaw CvENODEN1,
2681 "Not enough memory to accommodate instance failovers")
2683 cvEnodenet :: (String, String, String)
2686 Types.cVErrorCodeToRaw CvENODENET,
2687 "Network-related node error")
2689 cvEnodeoobpath :: (String, String, String)
2692 Types.cVErrorCodeToRaw CvENODEOOBPATH,
2693 "Invalid Out Of Band path")
2695 cvEnodeorphaninstance :: (String, String, String)
2696 cvEnodeorphaninstance =
2698 Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
2699 "Unknown intance running on a node")
2701 cvEnodeorphanlv :: (String, String, String)
2704 Types.cVErrorCodeToRaw CvENODEORPHANLV,
2705 "Unknown LVM logical volume")
2707 cvEnodeos :: (String, String, String)
2710 Types.cVErrorCodeToRaw CvENODEOS,
2711 "OS-related node error")
2713 cvEnoderpc :: (String, String, String)
2716 Types.cVErrorCodeToRaw CvENODERPC,
2717 "Error during connection to the primary node of an instance")
2719 cvEnodesetup :: (String, String, String)
2722 Types.cVErrorCodeToRaw CvENODESETUP,
2725 cvEnodesharedfilestoragepathunusable :: (String, String, String)
2726 cvEnodesharedfilestoragepathunusable =
2728 Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
2729 "Shared file storage path unusable")
2731 cvEnodessh :: (String, String, String)
2734 Types.cVErrorCodeToRaw CvENODESSH,
2735 "SSH-related node error")
2737 cvEnodetime :: (String, String, String)
2740 Types.cVErrorCodeToRaw CvENODETIME,
2741 "Node returned invalid time")
2743 cvEnodeuserscripts :: (String, String, String)
2744 cvEnodeuserscripts =
2746 Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
2747 "User scripts not present or not executable")
2749 cvEnodeversion :: (String, String, String)
2752 Types.cVErrorCodeToRaw CvENODEVERSION,
2753 "Protocol version mismatch or Ganeti version mismatch")
2755 cvAllEcodes :: FrozenSet (String, String, String)
2760 cvEclusterdanglinginst,
2761 cvEclusterdanglingnodes,
2762 cvEclusterfilecheck,
2763 cvEgroupdifferentpvsize,
2766 cvEinstancefaultydisk,
2768 cvEinstancemissingcfgparameter,
2769 cvEinstancemissingdisk,
2771 cvEinstancesplitgroups,
2772 cvEinstanceunsuitablenode,
2773 cvEinstancewrongnode,
2778 cvEnodefilestoragepaths,
2779 cvEnodefilestoragepathunusable,
2786 cvEnodeorphaninstance,
2791 cvEnodesharedfilestoragepathunusable,
2797 cvAllEcodesStrings :: FrozenSet String
2798 cvAllEcodesStrings =
2799 ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
2801 -- * Node verify constants
2804 nvBridges = "bridges"
2806 nvDrbdhelper :: String
2807 nvDrbdhelper = "drbd-helper"
2809 nvDrbdversion :: String
2810 nvDrbdversion = "drbd-version"
2812 nvDrbdlist :: String
2813 nvDrbdlist = "drbd-list"
2815 nvExclusivepvs :: String
2816 nvExclusivepvs = "exclusive-pvs"
2818 nvFilelist :: String
2819 nvFilelist = "filelist"
2821 nvAcceptedStoragePaths :: String
2822 nvAcceptedStoragePaths = "allowed-file-storage-paths"
2824 nvFileStoragePath :: String
2825 nvFileStoragePath = "file-storage-path"
2827 nvSharedFileStoragePath :: String
2828 nvSharedFileStoragePath = "shared-file-storage-path"
2833 nvHvparams :: String
2834 nvHvparams = "hvparms"
2836 nvHypervisor :: String
2837 nvHypervisor = "hypervisor"
2839 nvInstancelist :: String
2840 nvInstancelist = "instancelist"
2845 nvMasterip :: String
2846 nvMasterip = "master-ip"
2848 nvNodelist :: String
2849 nvNodelist = "nodelist"
2851 nvNodenettest :: String
2852 nvNodenettest = "node-net-test"
2854 nvNodesetup :: String
2855 nvNodesetup = "nodesetup"
2857 nvOobPaths :: String
2858 nvOobPaths = "oob-paths"
2869 nvUserscripts :: String
2870 nvUserscripts = "user-scripts"
2873 nvVersion = "version"
2879 nvVmnodes = "vmnodes"
2881 -- * Instance status
2883 inststAdmindown :: String
2884 inststAdmindown = Types.instanceStatusToRaw StatusDown
2886 inststAdminoffline :: String
2887 inststAdminoffline = Types.instanceStatusToRaw StatusOffline
2889 inststErrordown :: String
2890 inststErrordown = Types.instanceStatusToRaw ErrorDown
2892 inststErrorup :: String
2893 inststErrorup = Types.instanceStatusToRaw ErrorUp
2895 inststNodedown :: String
2896 inststNodedown = Types.instanceStatusToRaw NodeDown
2898 inststNodeoffline :: String
2899 inststNodeoffline = Types.instanceStatusToRaw NodeOffline
2901 inststRunning :: String
2902 inststRunning = Types.instanceStatusToRaw Running
2904 inststWrongnode :: String
2905 inststWrongnode = Types.instanceStatusToRaw WrongNode
2907 inststAll :: FrozenSet String
2908 inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
2912 adminstDown :: String
2913 adminstDown = Types.adminStateToRaw AdminDown
2915 adminstOffline :: String
2916 adminstOffline = Types.adminStateToRaw AdminOffline
2919 adminstUp = Types.adminStateToRaw AdminUp
2921 adminstAll :: FrozenSet String
2922 adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
2927 nrDrained = Types.nodeRoleToRaw NRDrained
2930 nrMaster = Types.nodeRoleToRaw NRMaster
2932 nrMcandidate :: String
2933 nrMcandidate = Types.nodeRoleToRaw NRCandidate
2936 nrOffline = Types.nodeRoleToRaw NROffline
2939 nrRegular = Types.nodeRoleToRaw NRRegular
2941 nrAll :: FrozenSet String
2942 nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
2944 -- * SSL certificate check constants (in days)
2946 sslCertExpirationError :: Int
2947 sslCertExpirationError = 7
2949 sslCertExpirationWarn :: Int
2950 sslCertExpirationWarn = 30
2952 -- * Allocator framework constants
2954 iallocatorVersion :: Int
2955 iallocatorVersion = 2
2957 iallocatorDirIn :: String
2958 iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
2960 iallocatorDirOut :: String
2961 iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
2963 validIallocatorDirections :: FrozenSet String
2964 validIallocatorDirections =
2965 ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
2967 iallocatorModeAlloc :: String
2968 iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
2970 iallocatorModeChgGroup :: String
2971 iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
2973 iallocatorModeMultiAlloc :: String
2974 iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
2976 iallocatorModeNodeEvac :: String
2977 iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
2979 iallocatorModeReloc :: String
2980 iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
2982 validIallocatorModes :: FrozenSet String
2983 validIallocatorModes =
2984 ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
2986 iallocatorSearchPath :: [String]
2987 iallocatorSearchPath = AutoConf.iallocatorSearchPath
2989 defaultIallocatorShortcut :: String
2990 defaultIallocatorShortcut = "."
2992 -- * Node evacuation
2994 nodeEvacPri :: String
2995 nodeEvacPri = Types.evacModeToRaw ChangePrimary
2997 nodeEvacSec :: String
2998 nodeEvacSec = Types.evacModeToRaw ChangeSecondary
3000 nodeEvacAll :: String
3001 nodeEvacAll = Types.evacModeToRaw ChangeAll
3003 nodeEvacModes :: FrozenSet String
3004 nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..]
3008 jobQueueVersion :: Int
3011 jobQueueSizeHardLimit :: Int
3012 jobQueueSizeHardLimit = 5000
3014 jobQueueFilesPerms :: Int
3015 jobQueueFilesPerms = 0o640
3017 -- * Unchanged job return
3019 jobNotchanged :: String
3020 jobNotchanged = "nochange"
3024 jobStatusQueued :: String
3025 jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
3027 jobStatusWaiting :: String
3028 jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
3030 jobStatusCanceling :: String
3031 jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
3033 jobStatusRunning :: String
3034 jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
3036 jobStatusCanceled :: String
3037 jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
3039 jobStatusSuccess :: String
3040 jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
3042 jobStatusError :: String
3043 jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
3045 jobsPending :: FrozenSet String
3047 ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
3049 jobsFinalized :: FrozenSet String
3051 ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
3053 jobStatusAll :: FrozenSet String
3054 jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
3058 -- ** Not yet finalized opcodes
3060 opStatusCanceling :: String
3061 opStatusCanceling = "canceling"
3063 opStatusQueued :: String
3064 opStatusQueued = "queued"
3066 opStatusRunning :: String
3067 opStatusRunning = "running"
3069 opStatusWaiting :: String
3070 opStatusWaiting = "waiting"
3072 -- ** Finalized opcodes
3074 opStatusCanceled :: String
3075 opStatusCanceled = "canceled"
3077 opStatusError :: String
3078 opStatusError = "error"
3080 opStatusSuccess :: String
3081 opStatusSuccess = "success"
3083 opsFinalized :: FrozenSet String
3085 ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
3087 -- * OpCode priority
3092 opPrioHighest :: Int
3096 opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
3099 opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
3102 opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
3104 opPrioSubmitValid :: FrozenSet Int
3105 opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
3107 opPrioDefault :: Int
3108 opPrioDefault = opPrioNormal
3110 -- * Lock recalculate mode
3112 locksAppend :: String
3113 locksAppend = "append"
3115 locksReplace :: String
3116 locksReplace = "replace"
3120 -- The lock timeout (sum) before we transition into blocking acquire
3121 -- (this can still be reset by priority change). Computed as max time
3122 -- (10 hours) before we should actually go into blocking acquire,
3123 -- given that we start from the default priority level.
3125 lockAttemptsMaxwait :: Double
3126 lockAttemptsMaxwait = 15.0
3128 lockAttemptsMinwait :: Double
3129 lockAttemptsMinwait = 1.0
3131 lockAttemptsTimeout :: Int
3132 lockAttemptsTimeout = (10 * 3600) `div` (opPrioDefault - opPrioHighest)
3134 -- * Execution log types
3136 elogMessage :: String
3137 elogMessage = Types.eLogTypeToRaw ELogMessage
3139 elogRemoteImport :: String
3140 elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
3142 elogJqueueTest :: String
3143 elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
3145 -- * /etc/hosts modification
3147 etcHostsAdd :: String
3150 etcHostsRemove :: String
3151 etcHostsRemove = "remove"
3155 jqtMsgprefix :: String
3156 jqtMsgprefix = "TESTMSG="
3161 jqtExpandnames :: String
3162 jqtExpandnames = "expandnames"
3165 jqtLogmsg = "logmsg"
3167 jqtStartmsg :: String
3168 jqtStartmsg = "startmsg"
3170 jqtAll :: FrozenSet String
3171 jqtAll = ConstantUtils.mkSet [jqtExec, jqtExpandnames, jqtLogmsg, jqtStartmsg]
3173 -- * Query resources
3176 qrCluster = "cluster"
3181 qrExtstorage :: String
3182 qrExtstorage = "extstorage"
3187 qrInstance :: String
3188 qrInstance = "instance"
3197 qrNetwork = "network"
3205 -- | List of resources which can be queried using 'Ganeti.OpCodes.OpQuery'
3206 qrViaOp :: FrozenSet String
3208 ConstantUtils.mkSet [qrCluster,
3217 -- | List of resources which can be queried using Local UniX Interface
3218 qrViaLuxi :: FrozenSet String
3219 qrViaLuxi = ConstantUtils.mkSet [qrLock, qrJob]
3221 -- | List of resources which can be queried using RAPI
3222 qrViaRapi :: FrozenSet String
3223 qrViaRapi = qrViaLuxi
3225 -- * Query field types
3231 qftNumber = "number"
3239 qftTimestamp :: String
3240 qftTimestamp = "timestamp"
3245 qftUnknown :: String
3246 qftUnknown = "unknown"
3248 qftAll :: FrozenSet String
3250 ConstantUtils.mkSet [qftBool,
3258 -- * Query result field status
3260 -- Don't change or reuse values as they're used by clients.
3262 -- FIXME: link with 'Ganeti.Query.Language.ResultStatus'
3264 -- | No data (e.g. RPC error), can be used instead of 'rsOffline'
3271 -- | Resource marked offline
3275 -- | Value unavailable/unsupported for item; if this field is
3276 -- supported but we cannot get the data for the moment, 'rsNodata' or
3277 -- 'rsOffline' should be used
3284 rsAll :: FrozenSet Int
3286 ConstantUtils.mkSet [rsNodata,
3292 -- | Special field cases and their verbose/terse formatting
3293 rssDescription :: Map Int (String, String)
3295 Map.fromList [(rsUnknown, ("(unknown)", "??")),
3296 (rsNodata, ("(nodata)", "?")),
3297 (rsOffline, ("(offline)", "*")),
3298 (rsUnavail, ("(unavail)", "-"))]
3300 -- * Max dynamic devices
3303 maxDisks = Types.maxDisks
3306 maxNics = Types.maxNics
3308 -- | SSCONF file prefix
3309 ssconfFileprefix :: String
3310 ssconfFileprefix = "ssconf_"
3314 ssClusterName :: String
3315 ssClusterName = "cluster_name"
3317 ssClusterTags :: String
3318 ssClusterTags = "cluster_tags"
3320 ssFileStorageDir :: String
3321 ssFileStorageDir = "file_storage_dir"
3323 ssSharedFileStorageDir :: String
3324 ssSharedFileStorageDir = "shared_file_storage_dir"
3326 ssMasterCandidates :: String
3327 ssMasterCandidates = "master_candidates"
3329 ssMasterCandidatesIps :: String
3330 ssMasterCandidatesIps = "master_candidates_ips"
3332 ssMasterIp :: String
3333 ssMasterIp = "master_ip"
3335 ssMasterNetdev :: String
3336 ssMasterNetdev = "master_netdev"
3338 ssMasterNetmask :: String
3339 ssMasterNetmask = "master_netmask"
3341 ssMasterNode :: String
3342 ssMasterNode = "master_node"
3344 ssNodeList :: String
3345 ssNodeList = "node_list"
3347 ssNodePrimaryIps :: String
3348 ssNodePrimaryIps = "node_primary_ips"
3350 ssNodeSecondaryIps :: String
3351 ssNodeSecondaryIps = "node_secondary_ips"
3353 ssOfflineNodes :: String
3354 ssOfflineNodes = "offline_nodes"
3356 ssOnlineNodes :: String
3357 ssOnlineNodes = "online_nodes"
3359 ssPrimaryIpFamily :: String
3360 ssPrimaryIpFamily = "primary_ip_family"
3362 ssInstanceList :: String
3363 ssInstanceList = "instance_list"
3365 ssReleaseVersion :: String
3366 ssReleaseVersion = "release_version"
3368 ssHypervisorList :: String
3369 ssHypervisorList = "hypervisor_list"
3371 ssMaintainNodeHealth :: String
3372 ssMaintainNodeHealth = "maintain_node_health"
3375 ssUidPool = "uid_pool"
3377 ssNodegroups :: String
3378 ssNodegroups = "nodegroups"
3380 ssNetworks :: String
3381 ssNetworks = "networks"
3383 -- | This is not a complete SSCONF key, but the prefix for the
3385 ssHvparamsPref :: String
3386 ssHvparamsPref = "hvparams_"
3390 ssHvparamsXenChroot :: String
3391 ssHvparamsXenChroot = ssHvparamsPref ++ htChroot
3393 ssHvparamsXenFake :: String
3394 ssHvparamsXenFake = ssHvparamsPref ++ htFake
3396 ssHvparamsXenHvm :: String
3397 ssHvparamsXenHvm = ssHvparamsPref ++ htXenHvm
3399 ssHvparamsXenKvm :: String
3400 ssHvparamsXenKvm = ssHvparamsPref ++ htKvm
3402 ssHvparamsXenLxc :: String
3403 ssHvparamsXenLxc = ssHvparamsPref ++ htLxc
3405 ssHvparamsXenPvm :: String
3406 ssHvparamsXenPvm = ssHvparamsPref ++ htXenPvm
3408 validSsHvparamsKeys :: FrozenSet String
3409 validSsHvparamsKeys =
3410 ConstantUtils.mkSet [ssHvparamsXenChroot,
3420 -- | Cluster wide default parameters
3421 defaultEnabledHypervisor :: String
3422 defaultEnabledHypervisor = htXenPvm
3424 hvcGlobals :: FrozenSet String
3426 ConstantUtils.mkSet [hvMigrationBandwidth,
3431 ndcGlobals :: FrozenSet String
3432 ndcGlobals = ConstantUtils.mkSet [ndExclusiveStorage]
3434 -- | All of the following values are quite arbitrary - there are no
3435 -- "good" defaults, these must be customised per-site
3436 ispecsMinmaxDefaults :: Map String (Map String Int)
3437 ispecsMinmaxDefaults =
3441 [(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMinISpec),
3442 (ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMinISpec),
3443 (ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMinISpec),
3444 (ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMinISpec),
3445 (ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMinISpec),
3446 (ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMinISpec)]),
3449 [(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMaxISpec),
3450 (ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMaxISpec),
3451 (ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMaxISpec),
3452 (ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMaxISpec),
3453 (ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMaxISpec),
3454 (ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMaxISpec)])]
3456 masterPoolSizeDefault :: Int
3457 masterPoolSizeDefault = 10
3459 -- * Exclusive storage
3461 -- | Error margin used to compare physical disks
3462 partMargin :: Double
3465 -- | Space reserved when creating instance disks
3466 partReserved :: Double
3471 confdProtocolVersion :: Int
3472 confdProtocolVersion = ConstantUtils.confdProtocolVersion
3474 -- Confd request type
3477 confdReqPing = Types.confdRequestTypeToRaw ReqPing
3479 confdReqNodeRoleByname :: Int
3480 confdReqNodeRoleByname = Types.confdRequestTypeToRaw ReqNodeRoleByName
3482 confdReqNodePipByInstanceIp :: Int
3483 confdReqNodePipByInstanceIp = Types.confdRequestTypeToRaw ReqNodePipByInstPip
3485 confdReqClusterMaster :: Int
3486 confdReqClusterMaster = Types.confdRequestTypeToRaw ReqClusterMaster
3488 confdReqNodePipList :: Int
3489 confdReqNodePipList = Types.confdRequestTypeToRaw ReqNodePipList
3491 confdReqMcPipList :: Int
3492 confdReqMcPipList = Types.confdRequestTypeToRaw ReqMcPipList
3494 confdReqInstancesIpsList :: Int
3495 confdReqInstancesIpsList = Types.confdRequestTypeToRaw ReqInstIpsList
3497 confdReqNodeDrbd :: Int
3498 confdReqNodeDrbd = Types.confdRequestTypeToRaw ReqNodeDrbd
3500 confdReqNodeInstances :: Int
3501 confdReqNodeInstances = Types.confdRequestTypeToRaw ReqNodeInstances
3503 confdReqs :: FrozenSet Int
3505 ConstantUtils.mkSet .
3506 map Types.confdRequestTypeToRaw $
3507 [minBound..] \\ [ReqNodeInstances]
3509 -- * Confd request type
3511 confdReqfieldName :: Int
3512 confdReqfieldName = Types.confdReqFieldToRaw ReqFieldName
3514 confdReqfieldIp :: Int
3515 confdReqfieldIp = Types.confdReqFieldToRaw ReqFieldIp
3517 confdReqfieldMnodePip :: Int
3518 confdReqfieldMnodePip = Types.confdReqFieldToRaw ReqFieldMNodePip
3520 -- * Confd repl status
3522 confdReplStatusOk :: Int
3523 confdReplStatusOk = Types.confdReplyStatusToRaw ReplyStatusOk
3525 confdReplStatusError :: Int
3526 confdReplStatusError = Types.confdReplyStatusToRaw ReplyStatusError
3528 confdReplStatusNotimplemented :: Int
3529 confdReplStatusNotimplemented = Types.confdReplyStatusToRaw ReplyStatusNotImpl
3531 confdReplStatuses :: FrozenSet Int
3533 ConstantUtils.mkSet $ map Types.confdReplyStatusToRaw [minBound..]
3535 -- * Confd node role
3537 confdNodeRoleMaster :: Int
3538 confdNodeRoleMaster = Types.confdNodeRoleToRaw NodeRoleMaster
3540 confdNodeRoleCandidate :: Int
3541 confdNodeRoleCandidate = Types.confdNodeRoleToRaw NodeRoleCandidate
3543 confdNodeRoleOffline :: Int
3544 confdNodeRoleOffline = Types.confdNodeRoleToRaw NodeRoleOffline
3546 confdNodeRoleDrained :: Int
3547 confdNodeRoleDrained = Types.confdNodeRoleToRaw NodeRoleDrained
3549 confdNodeRoleRegular :: Int
3550 confdNodeRoleRegular = Types.confdNodeRoleToRaw NodeRoleRegular
3552 -- * A few common errors for confd
3554 confdErrorUnknownEntry :: Int
3555 confdErrorUnknownEntry = Types.confdErrorTypeToRaw ConfdErrorUnknownEntry
3557 confdErrorInternal :: Int
3558 confdErrorInternal = Types.confdErrorTypeToRaw ConfdErrorInternal
3560 confdErrorArgument :: Int
3561 confdErrorArgument = Types.confdErrorTypeToRaw ConfdErrorArgument
3563 -- * Confd request query fields
3565 confdReqqLink :: String
3566 confdReqqLink = ConstantUtils.confdReqqLink
3568 confdReqqIp :: String
3569 confdReqqIp = ConstantUtils.confdReqqIp
3571 confdReqqIplist :: String
3572 confdReqqIplist = ConstantUtils.confdReqqIplist
3574 confdReqqFields :: String
3575 confdReqqFields = ConstantUtils.confdReqqFields
3577 -- | Each request is "salted" by the current timestamp.
3579 -- This constant decides how many seconds of skew to accept.
3581 -- TODO: make this a default and allow the value to be more
3583 confdMaxClockSkew :: Int
3584 confdMaxClockSkew = 2 * nodeMaxClockSkew
3586 -- | When we haven't reloaded the config for more than this amount of
3587 -- seconds, we force a test to see if inotify is betraying us. Using a
3588 -- prime number to ensure we get less chance of 'same wakeup' with
3590 confdConfigReloadTimeout :: Int
3591 confdConfigReloadTimeout = 17
3593 -- | If we receive more than one update in this amount of
3594 -- microseconds, we move to polling every RATELIMIT seconds, rather
3595 -- than relying on inotify, to be able to serve more requests.
3596 confdConfigReloadRatelimit :: Int
3597 confdConfigReloadRatelimit = 250000
3599 -- | Magic number prepended to all confd queries.
3601 -- This allows us to distinguish different types of confd protocols
3602 -- and handle them. For example by changing this we can move the whole
3603 -- payload to be compressed, or move away from json.
3604 confdMagicFourcc :: String
3605 confdMagicFourcc = "plj0"
3607 -- | By default a confd request is sent to the minimum between this
3608 -- number and all MCs. 6 was chosen because even in the case of a
3609 -- disastrous 50% response rate, we should have enough answers to be
3610 -- able to compare more than one.
3611 confdDefaultReqCoverage :: Int
3612 confdDefaultReqCoverage = 6
3614 -- | Timeout in seconds to expire pending query request in the confd
3615 -- client library. We don't actually expect any answer more than 10
3616 -- seconds after we sent a request.
3617 confdClientExpireTimeout :: Int
3618 confdClientExpireTimeout = 10
3620 -- | Maximum UDP datagram size.
3622 -- On IPv4: 64K - 20 (ip header size) - 8 (udp header size) = 65507
3623 -- On IPv6: 64K - 40 (ip6 header size) - 8 (udp header size) = 65487
3624 -- (assuming we can't use jumbo frames)
3625 -- We just set this to 60K, which should be enough
3626 maxUdpDataSize :: Int
3627 maxUdpDataSize = 61440
3629 -- * User-id pool minimum/maximum acceptable user-ids
3631 uidpoolUidMin :: Int
3634 -- | Assuming 32 bit user-ids
3635 uidpoolUidMax :: Integer
3636 uidpoolUidMax = 2 ^ 32 - 1
3638 -- | Name or path of the pgrep command
3642 -- | Name of the node group that gets created at cluster init or
3644 initialNodeGroupName :: String
3645 initialNodeGroupName = "default"
3647 -- * Possible values for NodeGroup.alloc_policy
3649 allocPolicyLastResort :: String
3650 allocPolicyLastResort = Types.allocPolicyToRaw AllocLastResort
3652 allocPolicyPreferred :: String
3653 allocPolicyPreferred = Types.allocPolicyToRaw AllocPreferred
3655 allocPolicyUnallocable :: String
3656 allocPolicyUnallocable = Types.allocPolicyToRaw AllocUnallocable
3658 validAllocPolicies :: [String]
3659 validAllocPolicies = map Types.allocPolicyToRaw [minBound..]
3661 -- | Temporary external/shared storage parameters
3662 blockdevDriverManual :: String
3663 blockdevDriverManual = Types.blockDriverToRaw BlockDrvManual
3665 -- | 'qemu-img' path, required for 'ovfconverter'
3666 qemuimgPath :: String
3667 qemuimgPath = AutoConf.qemuimgPath
3669 -- | Whether htools was enabled at compilation time
3671 -- FIXME: this should be moved next to the other enable constants,
3672 -- such as, 'enableConfd', and renamed to 'enableHtools'.
3674 htools = AutoConf.htools
3676 -- | The hail iallocator
3677 iallocHail :: String
3680 -- * Fake opcodes for functions that have hooks attached to them via
3681 -- backend.RunLocalHooks
3683 fakeOpMasterTurndown :: String
3684 fakeOpMasterTurndown = "OP_CLUSTER_IP_TURNDOWN"
3686 fakeOpMasterTurnup :: String
3687 fakeOpMasterTurnup = "OP_CLUSTER_IP_TURNUP"
3697 sshkAll :: FrozenSet String
3698 sshkAll = ConstantUtils.mkSet [sshkRsa, sshkDsa]
3700 -- * SSH authorized key types
3703 sshakDss = "ssh-dss"
3706 sshakRsa = "ssh-rsa"
3708 sshakAll :: FrozenSet String
3709 sshakAll = ConstantUtils.mkSet [sshakDss, sshakRsa]
3713 sshsClusterName :: String
3714 sshsClusterName = "cluster_name"
3716 sshsSshHostKey :: String
3717 sshsSshHostKey = "ssh_host_key"
3719 sshsSshRootKey :: String
3720 sshsSshRootKey = "ssh_root_key"
3722 sshsNodeDaemonCertificate :: String
3723 sshsNodeDaemonCertificate = "node_daemon_certificate"
3725 -- * Key files for SSH daemon
3727 sshHostDsaPriv :: String
3728 sshHostDsaPriv = sshConfigDir ++ "/ssh_host_dsa_key"
3730 sshHostDsaPub :: String
3731 sshHostDsaPub = sshHostDsaPriv ++ ".pub"
3733 sshHostRsaPriv :: String
3734 sshHostRsaPriv = sshConfigDir ++ "/ssh_host_rsa_key"
3736 sshHostRsaPub :: String
3737 sshHostRsaPub = sshHostRsaPriv ++ ".pub"
3739 -- * Node daemon setup
3741 ndsClusterName :: String
3742 ndsClusterName = "cluster_name"
3744 ndsNodeDaemonCertificate :: String
3745 ndsNodeDaemonCertificate = "node_daemon_certificate"
3748 ndsSsconf = "ssconf"
3750 ndsStartNodeDaemon :: String
3751 ndsStartNodeDaemon = "start_node_daemon"
3753 -- * The source reasons for the execution of an OpCode
3755 opcodeReasonSrcClient :: String
3756 opcodeReasonSrcClient = "gnt:client"
3758 opcodeReasonSrcNoded :: String
3759 opcodeReasonSrcNoded = "gnt:daemon:noded"
3761 opcodeReasonSrcOpcode :: String
3762 opcodeReasonSrcOpcode = "gnt:opcode"
3764 opcodeReasonSrcRlib2 :: String
3765 opcodeReasonSrcRlib2 = "gnt:library:rlib2"
3767 opcodeReasonSrcUser :: String
3768 opcodeReasonSrcUser = "gnt:user"
3770 opcodeReasonSources :: FrozenSet String
3771 opcodeReasonSources =
3772 ConstantUtils.mkSet [opcodeReasonSrcClient,
3773 opcodeReasonSrcNoded,
3774 opcodeReasonSrcOpcode,
3775 opcodeReasonSrcRlib2,
3776 opcodeReasonSrcUser]
3778 -- | Path generating random UUID
3779 randomUuidFile :: String
3780 randomUuidFile = ConstantUtils.randomUuidFile
3782 -- * Auto-repair tag prefixes
3784 autoRepairTagPrefix :: String
3785 autoRepairTagPrefix = "ganeti:watcher:autorepair:"
3787 autoRepairTagEnabled :: String
3788 autoRepairTagEnabled = autoRepairTagPrefix
3790 autoRepairTagPending :: String
3791 autoRepairTagPending = autoRepairTagPrefix ++ "pending:"
3793 autoRepairTagResult :: String
3794 autoRepairTagResult = autoRepairTagPrefix ++ "result:"
3796 autoRepairTagSuspended :: String
3797 autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:"
3799 -- * Auto-repair levels
3801 autoRepairFailover :: String
3802 autoRepairFailover = Types.autoRepairTypeToRaw ArFailover
3804 autoRepairFixStorage :: String
3805 autoRepairFixStorage = Types.autoRepairTypeToRaw ArFixStorage
3807 autoRepairMigrate :: String
3808 autoRepairMigrate = Types.autoRepairTypeToRaw ArMigrate
3810 autoRepairReinstall :: String
3811 autoRepairReinstall = Types.autoRepairTypeToRaw ArReinstall
3813 autoRepairAllTypes :: FrozenSet String
3814 autoRepairAllTypes =
3815 ConstantUtils.mkSet [autoRepairFailover,
3816 autoRepairFixStorage,
3818 autoRepairReinstall]
3820 -- * Auto-repair results
3822 autoRepairEnoperm :: String
3823 autoRepairEnoperm = Types.autoRepairResultToRaw ArEnoperm
3825 autoRepairFailure :: String
3826 autoRepairFailure = Types.autoRepairResultToRaw ArFailure
3828 autoRepairSuccess :: String
3829 autoRepairSuccess = Types.autoRepairResultToRaw ArSuccess
3831 autoRepairAllResults :: FrozenSet String
3832 autoRepairAllResults =
3833 ConstantUtils.mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess]
3835 -- | The version identifier for builtin data collectors
3836 builtinDataCollectorVersion :: String
3837 builtinDataCollectorVersion = "B"
3839 -- | The reason trail opcode parameter name
3840 opcodeReason :: String
3841 opcodeReason = "reason"
3843 diskstatsFile :: String
3844 diskstatsFile = "/proc/diskstats"
3846 -- * CPU load collector
3849 statFile = "/proc/stat"
3851 cpuavgloadBufferSize :: Int
3852 cpuavgloadBufferSize = 150
3854 cpuavgloadWindowSize :: Int
3855 cpuavgloadWindowSize = 600
3857 -- | Mond's variable for periodical data collection
3858 mondTimeInterval :: Int
3859 mondTimeInterval = 5
3861 -- * Disk access modes
3863 diskUserspace :: String
3864 diskUserspace = Types.diskAccessModeToRaw DiskUserspace
3866 diskKernelspace :: String
3867 diskKernelspace = Types.diskAccessModeToRaw DiskKernelspace
3869 diskValidAccessModes :: FrozenSet String
3870 diskValidAccessModes =
3871 ConstantUtils.mkSet $ map Types.diskAccessModeToRaw [minBound..]
3873 -- | Timeout for queue draining in upgrades
3874 upgradeQueueDrainTimeout :: Int
3875 upgradeQueueDrainTimeout = 36 * 60 * 60 -- 1.5 days
3877 -- | Intervall at which the queue is polled during upgrades
3878 upgradeQueuePollInterval :: Int
3879 upgradeQueuePollInterval = 10