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)
46 import Ganeti.ConstantUtils (PythonChar(..), FrozenSet, Protocol(..),
48 import qualified Ganeti.ConstantUtils as ConstantUtils
49 import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..),
51 import Ganeti.HTools.Types (AutoRepairResult(..), AutoRepairType(..))
52 import qualified Ganeti.HTools.Types as Types
53 import Ganeti.Logging (SyslogUsage(..))
54 import qualified Ganeti.Logging as Logging (syslogUsageToRaw)
55 import qualified Ganeti.Runtime as Runtime
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
81 -- * 'autoconf' constants for Python only ('lib/pathutils.py')
83 -- ** Build-time constants
86 exportDir = AutoConf.exportDir
88 osSearchPath :: [String]
89 osSearchPath = AutoConf.osSearchPath
91 esSearchPath :: [String]
92 esSearchPath = AutoConf.esSearchPath
94 sshConfigDir :: String
95 sshConfigDir = AutoConf.sshConfigDir
97 xenConfigDir :: String
98 xenConfigDir = AutoConf.xenConfigDir
101 sysconfdir = AutoConf.sysconfdir
104 toolsdir = AutoConf.toolsdir
106 localstatedir :: String
107 localstatedir = AutoConf.localstatedir
109 -- ** Paths which don't change for a virtual cluster
112 pkglibdir = AutoConf.pkglibdir
115 sharedir = AutoConf.sharedir
117 -- * 'autoconf' constants for Python only ('lib/build/sphinx_ext.py')
119 manPages :: Map String Int
120 manPages = Map.fromList AutoConf.manPages
122 -- * 'autoconf' constants for QA cluster only ('qa/qa_cluster.py')
124 versionedsharedir :: String
125 versionedsharedir = AutoConf.versionedsharedir
127 -- * 'autoconf' constants for Python only ('tests/py/docs_unittest.py')
129 gntScripts :: [String]
130 gntScripts = AutoConf.gntScripts
132 -- * Various versions
134 releaseVersion :: String
135 releaseVersion = AutoConf.packageVersion
138 versionMajor = AutoConf.versionMajor
141 versionMinor = AutoConf.versionMinor
143 versionRevision :: Int
144 versionRevision = AutoConf.versionRevision
147 dirVersion = AutoConf.dirVersion
158 osApiVersions :: FrozenSet Int
159 osApiVersions = ConstantUtils.mkSet [osApiV10, osApiV15, osApiV20]
168 configMajor = AutoConf.versionMajor
171 configMinor = AutoConf.versionMinor
173 -- | The configuration is supposed to remain stable across
174 -- revisions. Therefore, the revision number is cleared to '0'.
175 configRevision :: Int
179 configVersion = buildVersion configMajor configMinor configRevision
181 -- | Similarly to the configuration (see 'configRevision'), the
182 -- protocols are supposed to remain stable across revisions.
183 protocolVersion :: Int
184 protocolVersion = buildVersion configMajor configMinor configRevision
188 daemonsGroup :: String
189 daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
192 adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
194 masterdUser :: String
195 masterdUser = Runtime.daemonUser GanetiMasterd
197 masterdGroup :: String
198 masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
201 rapiUser = Runtime.daemonUser GanetiRapi
204 rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
207 confdUser = Runtime.daemonUser GanetiConfd
210 confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
213 luxidUser = Runtime.daemonUser GanetiLuxid
216 luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
219 nodedUser = Runtime.daemonUser GanetiNoded
222 nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
225 mondUser = Runtime.daemonUser GanetiMond
228 mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
230 sshLoginUser :: String
231 sshLoginUser = AutoConf.sshLoginUser
233 sshConsoleUser :: String
234 sshConsoleUser = AutoConf.sshConsoleUser
236 -- * Cpu pinning separators and constants
238 cpuPinningSep :: String
241 cpuPinningAll :: String
242 cpuPinningAll = "all"
244 -- | Internal representation of "all"
245 cpuPinningAllVal :: Int
246 cpuPinningAllVal = -1
248 -- | One "all" entry in a CPU list means CPU pinning is off
249 cpuPinningOff :: [Int]
250 cpuPinningOff = [cpuPinningAllVal]
252 -- | A Xen-specific implementation detail is that there is no way to
253 -- actually say "use any cpu for pinning" in a Xen configuration file,
254 -- as opposed to the command line, where you can say
256 -- xm vcpu-pin <domain> <vcpu> all
259 -- The workaround used in Xen is "0-63" (see source code function
260 -- "xm_vcpu_pin" in @<xen-source>/tools/python/xen/xm/main.py@).
262 -- To support future changes, the following constant is treated as a
263 -- blackbox string that simply means "use any cpu for pinning under
265 cpuPinningAllXen :: String
266 cpuPinningAllXen = "0-63"
268 -- | A KVM-specific implementation detail - the following value is
269 -- used to set CPU affinity to all processors (--0 through --31), per
272 -- FIXME: This only works for machines with up to 32 CPU cores
273 cpuPinningAllKvm :: Int
274 cpuPinningAllKvm = 0xFFFFFFFF
285 minWipeChunkPercent :: Int
286 minWipeChunkPercent = 10
294 secureDirMode = 0o700
296 secureFileMode :: Int
297 secureFileMode = 0o600
299 adoptableBlockdevRoot :: String
300 adoptableBlockdevRoot = "/dev/disk/"
302 -- * 'autoconf' enable/disable
305 enableConfd = AutoConf.enableConfd
308 enableMond = AutoConf.enableMond
310 enableRestrictedCommands :: Bool
311 enableRestrictedCommands = AutoConf.enableRestrictedCommands
313 enableSplitQuery :: Bool
314 enableSplitQuery = AutoConf.enableSplitQuery
327 confd = Runtime.daemonName GanetiConfd
330 masterd = Runtime.daemonName GanetiMasterd
333 mond = Runtime.daemonName GanetiMond
336 noded = Runtime.daemonName GanetiNoded
339 luxid = Runtime.daemonName GanetiLuxid
342 rapi = Runtime.daemonName GanetiRapi
344 daemons :: FrozenSet String
346 ConstantUtils.mkSet [confd,
353 defaultConfdPort :: Int
354 defaultConfdPort = 1814
356 defaultMondPort :: Int
357 defaultMondPort = 1815
359 defaultNodedPort :: Int
360 defaultNodedPort = 1811
362 defaultRapiPort :: Int
363 defaultRapiPort = 5080
365 daemonsPorts :: Map String (Protocol, Int)
367 Map.fromList [(confd, (Udp, defaultConfdPort)),
368 (mond, (Tcp, defaultMondPort)),
369 (noded, (Tcp, defaultNodedPort)),
370 (rapi, (Tcp, defaultRapiPort)),
374 firstDrbdPort = 11000
379 daemonsLogbase :: Map String String
382 [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
384 extraLogreasonAccess :: String
385 extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
387 extraLogreasonError :: String
388 extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
391 devConsole = ConstantUtils.devConsole
394 procMounts = "/proc/mounts"
396 -- * Luxi (Local UniX Interface) related constants
398 luxiEom :: PythonChar
399 luxiEom = PythonChar '\x03'
401 -- | Environment variable for the luxi override socket
402 luxiOverride :: String
403 luxiOverride = "FORCE_LUXI_SOCKET"
405 luxiOverrideMaster :: String
406 luxiOverrideMaster = "master"
408 luxiOverrideQuery :: String
409 luxiOverrideQuery = "query"
412 luxiVersion = configVersion
416 syslogUsage :: String
417 syslogUsage = AutoConf.syslogUsage
420 syslogNo = Logging.syslogUsageToRaw SyslogNo
423 syslogYes = Logging.syslogUsageToRaw SyslogYes
426 syslogOnly = Logging.syslogUsageToRaw SyslogOnly
428 syslogSocket :: String
429 syslogSocket = "/dev/log"
431 exportConfFile :: String
432 exportConfFile = "config.ini"
436 xenBootloader :: String
437 xenBootloader = AutoConf.xenBootloader
446 xenInitrd = AutoConf.xenInitrd
449 xenKernel = AutoConf.xenKernel
451 -- FIXME: perhaps rename to 'validXenCommands' for consistency with
453 knownXenCommands :: FrozenSet String
454 knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
459 kvmPath = AutoConf.kvmPath
462 kvmKernel = AutoConf.kvmKernel
464 socatEscapeCode :: String
465 socatEscapeCode = "0x1d"
468 socatPath = AutoConf.socatPath
470 socatUseCompress :: Bool
471 socatUseCompress = AutoConf.socatUseCompress
473 socatUseEscape :: Bool
474 socatUseEscape = AutoConf.socatUseEscape
478 -- | Display a message for console access
479 consMessage :: String
482 -- | Console as SPICE server
486 -- | Console as SSH command
490 -- | Console as VNC server
494 consAll :: FrozenSet String
495 consAll = ConstantUtils.mkSet [consMessage, consSpice, consSsh, consVnc]
497 -- | RSA key bit length
499 -- For RSA keys more bits are better, but they also make operations
500 -- more expensive. NIST SP 800-131 recommends a minimum of 2048 bits
501 -- from the year 2010 on.
505 -- | Ciphers allowed for SSL connections.
507 -- For the format, see ciphers(1). A better way to disable ciphers
508 -- would be to use the exclamation mark (!), but socat versions below
509 -- 1.5 can't parse exclamation marks in options properly. When
510 -- modifying the ciphers, ensure not to accidentially add something
511 -- after it's been removed. Use the "openssl" utility to check the
512 -- allowed ciphers, e.g. "openssl ciphers -v HIGH:-DES".
513 opensslCiphers :: String
514 opensslCiphers = "HIGH:-DES:-3DES:-EXPORT:-ADH"
518 -- | commonName (CN) used in certificates
520 x509CertCn = "ganeti.example.com"
522 -- | Default validity of certificates in days
523 x509CertDefaultValidity :: Int
524 x509CertDefaultValidity = 365 * 5
526 x509CertSignatureHeader :: String
527 x509CertSignatureHeader = "X-Ganeti-Signature"
529 -- | Digest used to sign certificates ("openssl x509" uses SHA1 by default)
530 x509CertSignDigest :: String
531 x509CertSignDigest = "SHA1"
533 -- * Import/export daemon mode
541 -- * Import/export transport compression
550 iecAll = [iecGzip, iecNone]
552 ieCustomSize :: String
555 -- * Import/export I/O
557 -- | Direct file I/O, equivalent to a shell's I/O redirection using
562 -- | Raw block device I/O using "dd"
563 ieioRawDisk :: String
566 -- | OS definition import/export script
568 ieioScript = "script"
572 hooksNameCfgupdate :: String
573 hooksNameCfgupdate = "config-update"
575 hooksNameWatcher :: String
576 hooksNameWatcher = "watcher"
579 hooksPath = "/sbin:/bin:/usr/sbin:/usr/bin"
581 hooksPhasePost :: String
582 hooksPhasePost = "post"
584 hooksPhasePre :: String
585 hooksPhasePre = "pre"
590 -- * Hooks subject type (what object type does the LU deal with)
592 htypeCluster :: String
593 htypeCluster = "CLUSTER"
598 htypeInstance :: String
599 htypeInstance = "INSTANCE"
601 htypeNetwork :: String
602 htypeNetwork = "NETWORK"
621 stBlock = Types.storageTypeToRaw StorageBlock
624 stDiskless = Types.storageTypeToRaw StorageDiskless
627 stExt = Types.storageTypeToRaw StorageExt
630 stFile = Types.storageTypeToRaw StorageFile
633 stLvmPv = Types.storageTypeToRaw StorageLvmPv
636 stLvmVg = Types.storageTypeToRaw StorageLvmVg
639 stRados = Types.storageTypeToRaw StorageRados
641 storageTypes :: FrozenSet String
642 storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
644 -- | The set of storage types for which storage reporting is available
646 -- FIXME: Remove this, once storage reporting is available for all
648 stsReport :: FrozenSet String
649 stsReport = ConstantUtils.mkSet [stFile, stLvmPv, stLvmVg]
652 -- ** First two are valid in LU context only, not passed to backend
660 -- ** and the rest are valid in backend
662 sfAllocatable :: String
663 sfAllocatable = Types.storageFieldToRaw SFAllocatable
666 sfFree = Types.storageFieldToRaw SFFree
669 sfName = Types.storageFieldToRaw SFName
672 sfSize = Types.storageFieldToRaw SFSize
675 sfUsed = Types.storageFieldToRaw SFUsed
677 validStorageFields :: FrozenSet String
679 ConstantUtils.mkSet $ map Types.storageFieldToRaw [minBound..] ++
682 modifiableStorageFields :: Map String (FrozenSet String)
683 modifiableStorageFields =
684 Map.fromList [(Types.storageTypeToRaw StorageLvmPv,
685 ConstantUtils.mkSet [sfAllocatable])]
687 -- * Storage operations
689 soFixConsistency :: String
690 soFixConsistency = "fix-consistency"
692 validStorageOperations :: Map String (FrozenSet String)
693 validStorageOperations =
694 Map.fromList [(Types.storageTypeToRaw StorageLvmVg,
695 ConstantUtils.mkSet [soFixConsistency])]
703 vfInstance = "instance"
720 -- * Local disk status
723 ldsFaulty = Types.localDiskStatusToRaw DiskStatusFaulty
726 ldsOkay = Types.localDiskStatusToRaw DiskStatusOk
729 ldsUnknown = Types.localDiskStatusToRaw DiskStatusUnknown
731 ldsNames :: Map Int String
733 Map.fromList [ (Types.localDiskStatusToRaw ds,
734 localDiskStatusName ds) | ds <- [minBound..] ]
736 -- * Disk template types
739 dtDiskless = Types.diskTemplateToRaw DTDiskless
742 dtFile = Types.diskTemplateToRaw DTFile
744 dtSharedFile :: String
745 dtSharedFile = Types.diskTemplateToRaw DTSharedFile
748 dtPlain = Types.diskTemplateToRaw DTPlain
751 dtBlock = Types.diskTemplateToRaw DTBlock
754 dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
757 dtRbd = Types.diskTemplateToRaw DTRbd
760 dtExt = Types.diskTemplateToRaw DTExt
762 -- | This is used to order determine the default disk template when
763 -- the list of enabled disk templates is inferred from the current
764 -- state of the cluster. This only happens on an upgrade from a
765 -- version of Ganeti that did not support the 'enabled_disk_templates'
767 diskTemplatePreference :: [String]
768 diskTemplatePreference =
769 map Types.diskTemplateToRaw
770 [DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile]
772 diskTemplates :: FrozenSet String
773 diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
775 -- | Disk templates that are enabled by default
776 defaultEnabledDiskTemplates :: [String]
777 defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
779 -- | Mapping of disk templates to storage types
780 mapDiskTemplateStorageType :: Map String String
781 mapDiskTemplateStorageType =
783 map (Types.diskTemplateToRaw *** Types.storageTypeToRaw)
784 [(DTBlock, StorageBlock),
785 (DTDrbd8, StorageLvmVg),
787 (DTSharedFile, StorageFile),
788 (DTFile, StorageFile),
789 (DTDiskless, StorageDiskless),
790 (DTPlain, StorageLvmVg),
791 (DTRbd, StorageRados)]
793 -- | The set of network-mirrored disk templates
794 dtsIntMirror :: FrozenSet String
795 dtsIntMirror = ConstantUtils.mkSet [dtDrbd8]
797 -- | 'DTDiskless' is 'trivially' externally mirrored
798 dtsExtMirror :: FrozenSet String
800 ConstantUtils.mkSet $
801 map Types.diskTemplateToRaw [DTDiskless, DTBlock, DTExt, DTSharedFile, DTRbd]
803 -- | The set of non-lvm-based disk templates
804 dtsNotLvm :: FrozenSet String
806 ConstantUtils.mkSet $
807 map Types.diskTemplateToRaw
808 [DTSharedFile, DTDiskless, DTBlock, DTExt, DTFile, DTRbd]
810 -- | The set of disk templates which can be grown
811 dtsGrowable :: FrozenSet String
813 ConstantUtils.mkSet $
814 map Types.diskTemplateToRaw
815 [DTSharedFile, DTDrbd8, DTPlain, DTExt, DTFile, DTRbd]
817 -- | The set of disk templates that allow adoption
818 dtsMayAdopt :: FrozenSet String
820 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTBlock, DTPlain]
822 -- | The set of disk templates that *must* use adoption
823 dtsMustAdopt :: FrozenSet String
824 dtsMustAdopt = ConstantUtils.mkSet [Types.diskTemplateToRaw DTBlock]
826 -- | The set of disk templates that allow migrations
827 dtsMirrored :: FrozenSet String
828 dtsMirrored = dtsIntMirror `ConstantUtils.union` dtsExtMirror
830 -- | The set of file based disk templates
831 dtsFilebased :: FrozenSet String
833 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTSharedFile, DTFile]
835 -- | The set of disk templates that can be moved by copying
837 -- Note: a requirement is that they're not accessed externally or
838 -- shared between nodes; in particular, sharedfile is not suitable.
839 dtsCopyable :: FrozenSet String
841 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain, DTFile]
843 -- | The set of disk templates that are supported by exclusive_storage
844 dtsExclStorage :: FrozenSet String
845 dtsExclStorage = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain]
847 -- | Templates for which we don't perform checks on free space
848 dtsNoFreeSpaceCheck :: FrozenSet String
849 dtsNoFreeSpaceCheck =
850 ConstantUtils.mkSet $
851 map Types.diskTemplateToRaw [DTExt, DTSharedFile, DTFile, DTRbd]
853 dtsBlock :: FrozenSet String
855 ConstantUtils.mkSet $
856 map Types.diskTemplateToRaw [DTPlain, DTDrbd8, DTBlock, DTRbd, DTExt]
860 drbdHmacAlg :: String
863 drbdDefaultNetProtocol :: String
864 drbdDefaultNetProtocol = "C"
866 drbdMigrationNetProtocol :: String
867 drbdMigrationNetProtocol = "C"
869 drbdStatusFile :: String
870 drbdStatusFile = "/proc/drbd"
872 -- | Size of DRBD meta block device
876 -- * Drbd barrier types
878 drbdBDiskBarriers :: String
879 drbdBDiskBarriers = "b"
881 drbdBDiskDrain :: String
884 drbdBDiskFlush :: String
890 -- | Rbd tool command
894 -- * File backend driver
897 fdBlktap = Types.fileDriverToRaw FileBlktap
900 fdLoop = Types.fileDriverToRaw FileLoop
902 fileDriver :: FrozenSet String
904 ConstantUtils.mkSet $
905 map Types.fileDriverToRaw [minBound..]
907 -- | The set of drbd-like disk types
908 ldsDrbd :: FrozenSet String
909 ldsDrbd = ConstantUtils.mkSet [Types.diskTemplateToRaw DTDrbd8]
911 -- * Disk access mode
914 diskRdonly = Types.diskModeToRaw DiskRdOnly
917 diskRdwr = Types.diskModeToRaw DiskRdWr
919 diskAccessSet :: FrozenSet String
920 diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..]
922 -- * Disk replacement mode
924 replaceDiskAuto :: String
925 replaceDiskAuto = Types.replaceDisksModeToRaw ReplaceAuto
927 replaceDiskChg :: String
928 replaceDiskChg = Types.replaceDisksModeToRaw ReplaceNewSecondary
930 replaceDiskPri :: String
931 replaceDiskPri = Types.replaceDisksModeToRaw ReplaceOnPrimary
933 replaceDiskSec :: String
934 replaceDiskSec = Types.replaceDisksModeToRaw ReplaceOnSecondary
936 replaceModes :: FrozenSet String
938 ConstantUtils.mkSet $ map Types.replaceDisksModeToRaw [minBound..]
940 -- * Instance export mode
942 exportModeLocal :: String
943 exportModeLocal = Types.exportModeToRaw ExportModeLocal
945 exportModeRemote :: String
946 exportModeRemote = Types.exportModeToRaw ExportModeRemote
948 exportModes :: FrozenSet String
949 exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
951 -- * Instance creation modes
953 instanceCreate :: String
954 instanceCreate = Types.instCreateModeToRaw InstCreate
956 instanceImport :: String
957 instanceImport = Types.instCreateModeToRaw InstImport
959 instanceRemoteImport :: String
960 instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
962 instanceCreateModes :: FrozenSet String
963 instanceCreateModes =
964 ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
966 -- * Remote import/export handshake message and version
968 rieHandshake :: String
969 rieHandshake = "Hi, I'm Ganeti"
974 -- | Remote import/export certificate validity in seconds
975 rieCertValidity :: Int
976 rieCertValidity = 24 * 60 * 60
978 -- | Export only: how long to wait per connection attempt (seconds)
979 rieConnectAttemptTimeout :: Int
980 rieConnectAttemptTimeout = 20
982 -- | Export only: number of attempts to connect
983 rieConnectRetries :: Int
984 rieConnectRetries = 10
986 -- | Overall timeout for establishing connection
987 rieConnectTimeout :: Int
988 rieConnectTimeout = 180
990 -- | Give child process up to 5 seconds to exit after sending a signal
991 childLingerTimeout :: Double
992 childLingerTimeout = 5.0
994 -- * Import/export config options
997 inisectBep = "backend"
1000 inisectExp = "export"
1002 inisectHyp :: String
1003 inisectHyp = "hypervisor"
1005 inisectIns :: String
1006 inisectIns = "instance"
1008 inisectOsp :: String
1011 -- * Dynamic device modification
1014 ddmAdd = Types.ddmFullToRaw DdmFullAdd
1017 ddmModify = Types.ddmFullToRaw DdmFullModify
1020 ddmRemove = Types.ddmFullToRaw DdmFullRemove
1022 ddmsValues :: FrozenSet String
1023 ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
1025 ddmsValuesWithModify :: FrozenSet String
1026 ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
1028 -- * Common exit codes
1034 exitFailure = ConstantUtils.exitFailure
1036 exitNotcluster :: Int
1039 exitNotmaster :: Int
1042 exitNodesetupError :: Int
1043 exitNodesetupError = 12
1045 -- | Need user confirmation
1046 exitConfirmation :: Int
1047 exitConfirmation = 13
1049 -- | Exit code for query operations with unknown fields
1050 exitUnknownField :: Int
1051 exitUnknownField = 14
1055 tagCluster :: String
1056 tagCluster = Types.tagKindToRaw TagKindCluster
1058 tagInstance :: String
1059 tagInstance = Types.tagKindToRaw TagKindInstance
1061 tagNetwork :: String
1062 tagNetwork = Types.tagKindToRaw TagKindNetwork
1065 tagNode = Types.tagKindToRaw TagKindNode
1067 tagNodegroup :: String
1068 tagNodegroup = Types.tagKindToRaw TagKindGroup
1070 validTagTypes :: FrozenSet String
1071 validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
1076 maxTagsPerObj :: Int
1077 maxTagsPerObj = 4096
1081 defaultBridge :: String
1082 defaultBridge = "xen-br0"
1084 defaultOvs :: String
1085 defaultOvs = "switch1"
1087 -- | 60 MiB, expressed in KiB
1088 classicDrbdSyncSpeed :: Int
1089 classicDrbdSyncSpeed = 60 * 1024
1091 ip4AddressAny :: String
1092 ip4AddressAny = "0.0.0.0"
1094 ip4AddressLocalhost :: String
1095 ip4AddressLocalhost = "127.0.0.1"
1097 ip6AddressAny :: String
1098 ip6AddressAny = "::"
1100 ip6AddressLocalhost :: String
1101 ip6AddressLocalhost = "::1"
1109 validIpVersions :: FrozenSet Int
1110 validIpVersions = ConstantUtils.mkSet [ip4Version, ip6Version]
1112 tcpPingTimeout :: Int
1118 defaultDrbdHelper :: String
1119 defaultDrbdHelper = "/bin/true"
1124 defaultMacPrefix :: String
1125 defaultMacPrefix = "aa:00:00"
1127 -- | Default maximum instance wait time, in seconds.
1128 defaultShutdownTimeout :: Int
1129 defaultShutdownTimeout = 120
1131 -- | Node clock skew in seconds
1132 nodeMaxClockSkew :: Int
1133 nodeMaxClockSkew = 150
1135 -- | Time for an intra-cluster disk transfer to wait for a connection
1136 diskTransferConnectTimeout :: Int
1137 diskTransferConnectTimeout = 60
1139 -- | Disk index separator
1140 diskSeparator :: String
1141 diskSeparator = AutoConf.diskSeparator
1143 ipCommandPath :: String
1144 ipCommandPath = AutoConf.ipPath
1146 -- | Key for job IDs in opcode result
1150 -- * Runparts results
1161 runpartsStatus :: [Int]
1162 runpartsStatus = [runpartsErr, runpartsRun, runpartsSkip]
1166 rpcEncodingNone :: Int
1169 rpcEncodingZlibBase64 :: Int
1170 rpcEncodingZlibBase64 = 1
1174 -- Various time constants for the timeout table
1177 rpcTmoUrgent = Types.rpcTimeoutToRaw Urgent
1180 rpcTmoFast = Types.rpcTimeoutToRaw Fast
1183 rpcTmoNormal = Types.rpcTimeoutToRaw Normal
1186 rpcTmoSlow = Types.rpcTimeoutToRaw Slow
1188 -- | 'rpcTmo_4hrs' contains an underscore to circumvent a limitation
1189 -- in the 'Ganeti.THH.deCamelCase' function and generate the correct
1192 rpcTmo_4hrs = Types.rpcTimeoutToRaw FourHours
1194 -- | 'rpcTmo_1day' contains an underscore to circumvent a limitation
1195 -- in the 'Ganeti.THH.deCamelCase' function and generate the correct
1198 rpcTmo_1day = Types.rpcTimeoutToRaw OneDay
1200 -- | Timeout for connecting to nodes (seconds)
1201 rpcConnectTimeout :: Int
1202 rpcConnectTimeout = 5
1206 osScriptCreate :: String
1207 osScriptCreate = "create"
1209 osScriptExport :: String
1210 osScriptExport = "export"
1212 osScriptImport :: String
1213 osScriptImport = "import"
1215 osScriptRename :: String
1216 osScriptRename = "rename"
1218 osScriptVerify :: String
1219 osScriptVerify = "verify"
1221 osScripts :: [String]
1222 osScripts = [osScriptCreate, osScriptExport, osScriptImport, osScriptRename,
1226 osApiFile = "ganeti_api_version"
1228 osVariantsFile :: String
1229 osVariantsFile = "variants.list"
1231 osParametersFile :: String
1232 osParametersFile = "parameters.list"
1234 osValidateParameters :: String
1235 osValidateParameters = "parameters"
1237 osValidateCalls :: FrozenSet String
1238 osValidateCalls = ConstantUtils.mkSet [osValidateParameters]
1240 -- | External Storage (ES) related constants
1242 esActionAttach :: String
1243 esActionAttach = "attach"
1245 esActionCreate :: String
1246 esActionCreate = "create"
1248 esActionDetach :: String
1249 esActionDetach = "detach"
1251 esActionGrow :: String
1252 esActionGrow = "grow"
1254 esActionRemove :: String
1255 esActionRemove = "remove"
1257 esActionSetinfo :: String
1258 esActionSetinfo = "setinfo"
1260 esActionVerify :: String
1261 esActionVerify = "verify"
1263 esScriptCreate :: String
1264 esScriptCreate = esActionCreate
1266 esScriptRemove :: String
1267 esScriptRemove = esActionRemove
1269 esScriptGrow :: String
1270 esScriptGrow = esActionGrow
1272 esScriptAttach :: String
1273 esScriptAttach = esActionAttach
1275 esScriptDetach :: String
1276 esScriptDetach = esActionDetach
1278 esScriptSetinfo :: String
1279 esScriptSetinfo = esActionSetinfo
1281 esScriptVerify :: String
1282 esScriptVerify = esActionVerify
1284 esScripts :: FrozenSet String
1286 ConstantUtils.mkSet [esScriptAttach,
1294 esParametersFile :: String
1295 esParametersFile = "parameters.list"
1299 instanceRebootSoft :: String
1300 instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
1302 instanceRebootHard :: String
1303 instanceRebootHard = Types.rebootTypeToRaw RebootHard
1305 instanceRebootFull :: String
1306 instanceRebootFull = Types.rebootTypeToRaw RebootFull
1308 rebootTypes :: FrozenSet String
1309 rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
1311 -- * Instance reboot behaviors
1313 instanceRebootAllowed :: String
1314 instanceRebootAllowed = "reboot"
1316 instanceRebootExit :: String
1317 instanceRebootExit = "exit"
1319 rebootBehaviors :: [String]
1320 rebootBehaviors = [instanceRebootAllowed, instanceRebootExit]
1325 vtypeBool = VTypeBool
1330 vtypeMaybeString :: VType
1331 vtypeMaybeString = VTypeMaybeString
1335 vtypeSize = VTypeSize
1337 vtypeString :: VType
1338 vtypeString = VTypeString
1340 enforceableTypes :: FrozenSet VType
1341 enforceableTypes = ConstantUtils.mkSet [minBound..]
1343 -- | Constant representing that the user does not specify any IP version
1344 ifaceNoIpVersionSpecified :: Int
1345 ifaceNoIpVersionSpecified = 0
1347 validSerialSpeeds :: [Int]
1368 -- * HV parameter names (global namespace)
1373 hvBlockdevPrefix :: String
1374 hvBlockdevPrefix = "blockdev_prefix"
1376 hvBootloaderArgs :: String
1377 hvBootloaderArgs = "bootloader_args"
1379 hvBootloaderPath :: String
1380 hvBootloaderPath = "bootloader_path"
1382 hvBootOrder :: String
1383 hvBootOrder = "boot_order"
1385 hvCdromImagePath :: String
1386 hvCdromImagePath = "cdrom_image_path"
1389 hvCpuCap = "cpu_cap"
1391 hvCpuCores :: String
1392 hvCpuCores = "cpu_cores"
1395 hvCpuMask = "cpu_mask"
1397 hvCpuSockets :: String
1398 hvCpuSockets = "cpu_sockets"
1400 hvCpuThreads :: String
1401 hvCpuThreads = "cpu_threads"
1404 hvCpuType = "cpu_type"
1406 hvCpuWeight :: String
1407 hvCpuWeight = "cpu_weight"
1409 hvDeviceModel :: String
1410 hvDeviceModel = "device_model"
1412 hvDiskCache :: String
1413 hvDiskCache = "disk_cache"
1415 hvDiskType :: String
1416 hvDiskType = "disk_type"
1418 hvInitrdPath :: String
1419 hvInitrdPath = "initrd_path"
1421 hvInitScript :: String
1422 hvInitScript = "init_script"
1424 hvKernelArgs :: String
1425 hvKernelArgs = "kernel_args"
1427 hvKernelPath :: String
1428 hvKernelPath = "kernel_path"
1433 hvKvmCdrom2ImagePath :: String
1434 hvKvmCdrom2ImagePath = "cdrom2_image_path"
1436 hvKvmCdromDiskType :: String
1437 hvKvmCdromDiskType = "cdrom_disk_type"
1439 hvKvmExtra :: String
1440 hvKvmExtra = "kvm_extra"
1443 hvKvmFlag = "kvm_flag"
1445 hvKvmFloppyImagePath :: String
1446 hvKvmFloppyImagePath = "floppy_image_path"
1448 hvKvmMachineVersion :: String
1449 hvKvmMachineVersion = "machine_version"
1452 hvKvmPath = "kvm_path"
1454 hvKvmSpiceAudioCompr :: String
1455 hvKvmSpiceAudioCompr = "spice_playback_compression"
1457 hvKvmSpiceBind :: String
1458 hvKvmSpiceBind = "spice_bind"
1460 hvKvmSpiceIpVersion :: String
1461 hvKvmSpiceIpVersion = "spice_ip_version"
1463 hvKvmSpiceJpegImgCompr :: String
1464 hvKvmSpiceJpegImgCompr = "spice_jpeg_wan_compression"
1466 hvKvmSpiceLosslessImgCompr :: String
1467 hvKvmSpiceLosslessImgCompr = "spice_image_compression"
1469 hvKvmSpicePasswordFile :: String
1470 hvKvmSpicePasswordFile = "spice_password_file"
1472 hvKvmSpiceStreamingVideoDetection :: String
1473 hvKvmSpiceStreamingVideoDetection = "spice_streaming_video"
1475 hvKvmSpiceTlsCiphers :: String
1476 hvKvmSpiceTlsCiphers = "spice_tls_ciphers"
1478 hvKvmSpiceUseTls :: String
1479 hvKvmSpiceUseTls = "spice_use_tls"
1481 hvKvmSpiceUseVdagent :: String
1482 hvKvmSpiceUseVdagent = "spice_use_vdagent"
1484 hvKvmSpiceZlibGlzImgCompr :: String
1485 hvKvmSpiceZlibGlzImgCompr = "spice_zlib_glz_wan_compression"
1487 hvKvmUseChroot :: String
1488 hvKvmUseChroot = "use_chroot"
1491 hvMemPath = "mem_path"
1493 hvMigrationBandwidth :: String
1494 hvMigrationBandwidth = "migration_bandwidth"
1496 hvMigrationDowntime :: String
1497 hvMigrationDowntime = "migration_downtime"
1499 hvMigrationMode :: String
1500 hvMigrationMode = "migration_mode"
1502 hvMigrationPort :: String
1503 hvMigrationPort = "migration_port"
1506 hvNicType = "nic_type"
1511 hvPassthrough :: String
1512 hvPassthrough = "pci_pass"
1514 hvRebootBehavior :: String
1515 hvRebootBehavior = "reboot_behavior"
1517 hvRootPath :: String
1518 hvRootPath = "root_path"
1520 hvSecurityDomain :: String
1521 hvSecurityDomain = "security_domain"
1523 hvSecurityModel :: String
1524 hvSecurityModel = "security_model"
1526 hvSerialConsole :: String
1527 hvSerialConsole = "serial_console"
1529 hvSerialSpeed :: String
1530 hvSerialSpeed = "serial_speed"
1533 hvSoundhw = "soundhw"
1535 hvUsbDevices :: String
1536 hvUsbDevices = "usb_devices"
1538 hvUsbMouse :: String
1539 hvUsbMouse = "usb_mouse"
1541 hvUseBootloader :: String
1542 hvUseBootloader = "use_bootloader"
1544 hvUseLocaltime :: String
1545 hvUseLocaltime = "use_localtime"
1550 hvVhostNet :: String
1551 hvVhostNet = "vhost_net"
1553 hvVifScript :: String
1554 hvVifScript = "vif_script"
1557 hvVifType = "vif_type"
1559 hvViridian :: String
1560 hvViridian = "viridian"
1562 hvVncBindAddress :: String
1563 hvVncBindAddress = "vnc_bind_address"
1565 hvVncPasswordFile :: String
1566 hvVncPasswordFile = "vnc_password_file"
1569 hvVncTls = "vnc_tls"
1572 hvVncX509 = "vnc_x509_path"
1574 hvVncX509Verify :: String
1575 hvVncX509Verify = "vnc_x509_verify"
1578 hvVnetHdr = "vnet_hdr"
1581 hvXenCmd = "xen_cmd"
1583 hvXenCpuid :: String
1584 hvXenCpuid = "cpuid"
1586 hvsParameterTitles :: Map String String
1587 hvsParameterTitles =
1590 (hvBootOrder, "Boot_order"),
1591 (hvCdromImagePath, "CDROM_image_path"),
1592 (hvCpuType, "cpu_type"),
1593 (hvDiskType, "Disk_type"),
1594 (hvInitrdPath, "Initrd_path"),
1595 (hvKernelPath, "Kernel_path"),
1596 (hvNicType, "NIC_type"),
1598 (hvPassthrough, "pci_pass"),
1599 (hvVncBindAddress, "VNC_bind_address")]
1601 -- * Migration statuses
1603 hvMigrationActive :: String
1604 hvMigrationActive = "active"
1606 hvMigrationCancelled :: String
1607 hvMigrationCancelled = "cancelled"
1609 hvMigrationCompleted :: String
1610 hvMigrationCompleted = "completed"
1612 hvMigrationFailed :: String
1613 hvMigrationFailed = "failed"
1615 hvMigrationValidStatuses :: FrozenSet String
1616 hvMigrationValidStatuses =
1617 ConstantUtils.mkSet [hvMigrationActive,
1618 hvMigrationCancelled,
1619 hvMigrationCompleted,
1622 hvMigrationFailedStatuses :: FrozenSet String
1623 hvMigrationFailedStatuses =
1624 ConstantUtils.mkSet [hvMigrationFailed, hvMigrationCancelled]
1626 -- | KVM-specific statuses
1628 -- FIXME: this constant seems unnecessary
1629 hvKvmMigrationValidStatuses :: FrozenSet String
1630 hvKvmMigrationValidStatuses = hvMigrationValidStatuses
1633 hvNodeinfoKeyVersion :: String
1634 hvNodeinfoKeyVersion = "hv_version"
1636 -- * Hypervisor state
1638 hvstCpuNode :: String
1639 hvstCpuNode = "cpu_node"
1641 hvstCpuTotal :: String
1642 hvstCpuTotal = "cpu_total"
1644 hvstMemoryHv :: String
1645 hvstMemoryHv = "mem_hv"
1647 hvstMemoryNode :: String
1648 hvstMemoryNode = "mem_node"
1650 hvstMemoryTotal :: String
1651 hvstMemoryTotal = "mem_total"
1653 hvstsParameters :: FrozenSet String
1655 ConstantUtils.mkSet [hvstCpuNode,
1661 hvstDefaults :: Map String Int
1667 (hvstMemoryTotal, 0),
1668 (hvstMemoryNode, 0)]
1670 hvstsParameterTypes :: Map String VType
1671 hvstsParameterTypes =
1672 Map.fromList [(hvstMemoryTotal, VTypeInt),
1673 (hvstMemoryNode, VTypeInt),
1674 (hvstMemoryHv, VTypeInt),
1675 (hvstCpuTotal, VTypeInt),
1676 (hvstCpuNode, VTypeInt)]
1680 dsDiskOverhead :: String
1681 dsDiskOverhead = "disk_overhead"
1683 dsDiskReserved :: String
1684 dsDiskReserved = "disk_reserved"
1686 dsDiskTotal :: String
1687 dsDiskTotal = "disk_total"
1689 dsDefaults :: Map String Int
1693 (dsDiskReserved, 0),
1694 (dsDiskOverhead, 0)]
1696 dssParameterTypes :: Map String VType
1698 Map.fromList [(dsDiskTotal, VTypeInt),
1699 (dsDiskReserved, VTypeInt),
1700 (dsDiskOverhead, VTypeInt)]
1702 dssParameters :: FrozenSet String
1704 ConstantUtils.mkSet [dsDiskTotal, dsDiskReserved, dsDiskOverhead]
1706 dsValidTypes :: FrozenSet String
1707 dsValidTypes = ConstantUtils.mkSet [Types.diskTemplateToRaw DTPlain]
1709 -- Backend parameter names
1711 beAlwaysFailover :: String
1712 beAlwaysFailover = "always_failover"
1714 beAutoBalance :: String
1715 beAutoBalance = "auto_balance"
1720 -- | Deprecated and replaced by max and min mem
1727 beSpindleUse :: String
1728 beSpindleUse = "spindle_use"
1733 besParameterTypes :: Map String VType
1735 Map.fromList [(beAlwaysFailover, VTypeBool),
1736 (beAutoBalance, VTypeBool),
1737 (beMaxmem, VTypeSize),
1738 (beMinmem, VTypeSize),
1739 (beSpindleUse, VTypeInt),
1740 (beVcpus, VTypeInt)]
1742 besParameterTitles :: Map String String
1743 besParameterTitles =
1744 Map.fromList [(beAutoBalance, "Auto_balance"),
1745 (beMinmem, "ConfigMinMem"),
1746 (beVcpus, "ConfigVCPUs"),
1747 (beMaxmem, "ConfigMaxMem")]
1749 besParameterCompat :: Map String VType
1750 besParameterCompat = Map.insert beMemory VTypeSize besParameterTypes
1752 besParameters :: FrozenSet String
1754 ConstantUtils.mkSet [beAlwaysFailover,
1763 -- FIXME: these should be associated with 'Ganeti.HTools.Types.ISpec'
1765 ispecMemSize :: String
1766 ispecMemSize = ConstantUtils.ispecMemSize
1768 ispecCpuCount :: String
1769 ispecCpuCount = ConstantUtils.ispecCpuCount
1771 ispecDiskCount :: String
1772 ispecDiskCount = ConstantUtils.ispecDiskCount
1774 ispecDiskSize :: String
1775 ispecDiskSize = ConstantUtils.ispecDiskSize
1777 ispecNicCount :: String
1778 ispecNicCount = ConstantUtils.ispecNicCount
1780 ispecSpindleUse :: String
1781 ispecSpindleUse = ConstantUtils.ispecSpindleUse
1783 ispecsParameterTypes :: Map String VType
1784 ispecsParameterTypes =
1786 [(ConstantUtils.ispecDiskSize, VTypeInt),
1787 (ConstantUtils.ispecCpuCount, VTypeInt),
1788 (ConstantUtils.ispecSpindleUse, VTypeInt),
1789 (ConstantUtils.ispecMemSize, VTypeInt),
1790 (ConstantUtils.ispecNicCount, VTypeInt),
1791 (ConstantUtils.ispecDiskCount, VTypeInt)]
1793 ispecsParameters :: FrozenSet String
1795 ConstantUtils.mkSet [ConstantUtils.ispecCpuCount,
1796 ConstantUtils.ispecDiskCount,
1797 ConstantUtils.ispecDiskSize,
1798 ConstantUtils.ispecMemSize,
1799 ConstantUtils.ispecNicCount,
1800 ConstantUtils.ispecSpindleUse]
1802 ispecsMinmax :: String
1803 ispecsMinmax = ConstantUtils.ispecsMinmax
1812 ispecsStd = ConstantUtils.ispecsStd
1814 ipolicyDts :: String
1815 ipolicyDts = ConstantUtils.ipolicyDts
1817 ipolicyVcpuRatio :: String
1818 ipolicyVcpuRatio = ConstantUtils.ipolicyVcpuRatio
1820 ipolicySpindleRatio :: String
1821 ipolicySpindleRatio = ConstantUtils.ipolicySpindleRatio
1823 ispecsMinmaxKeys :: FrozenSet String
1824 ispecsMinmaxKeys = ConstantUtils.mkSet [ispecsMax, ispecsMin]
1826 ipolicyParameters :: FrozenSet String
1828 ConstantUtils.mkSet [ConstantUtils.ipolicyVcpuRatio,
1829 ConstantUtils.ipolicySpindleRatio]
1831 ipolicyAllKeys :: FrozenSet String
1833 ConstantUtils.union ipolicyParameters $
1834 ConstantUtils.mkSet [ConstantUtils.ipolicyDts,
1835 ConstantUtils.ispecsMinmax,
1838 -- | Node parameter names
1840 ndExclusiveStorage :: String
1841 ndExclusiveStorage = "exclusive_storage"
1843 ndOobProgram :: String
1844 ndOobProgram = "oob_program"
1846 ndSpindleCount :: String
1847 ndSpindleCount = "spindle_count"
1853 ndOvsLink = "ovs_link"
1856 ndOvsName = "ovs_name"
1858 ndsParameterTypes :: Map String VType
1861 [(ndExclusiveStorage, VTypeBool),
1862 (ndOobProgram, VTypeString),
1864 (ndOvsLink, VTypeMaybeString),
1865 (ndOvsName, VTypeMaybeString),
1866 (ndSpindleCount, VTypeInt)]
1868 ndsParameters :: FrozenSet String
1869 ndsParameters = ConstantUtils.mkSet (Map.keys ndsParameterTypes)
1871 ndsParameterTitles :: Map String String
1872 ndsParameterTitles =
1874 [(ndExclusiveStorage, "ExclusiveStorage"),
1875 (ndOobProgram, "OutOfBandProgram"),
1876 (ndOvs, "OpenvSwitch"),
1877 (ndOvsLink, "OpenvSwitchLink"),
1878 (ndOvsName, "OpenvSwitchName"),
1879 (ndSpindleCount, "SpindleCount")]
1881 -- * Logical Disks parameters
1884 ldpAccess = "access"
1886 ldpBarriers :: String
1887 ldpBarriers = "disabled-barriers"
1889 ldpDefaultMetavg :: String
1890 ldpDefaultMetavg = "default-metavg"
1892 ldpDelayTarget :: String
1893 ldpDelayTarget = "c-delay-target"
1895 ldpDiskCustom :: String
1896 ldpDiskCustom = "disk-custom"
1898 ldpDynamicResync :: String
1899 ldpDynamicResync = "dynamic-resync"
1901 ldpFillTarget :: String
1902 ldpFillTarget = "c-fill-target"
1904 ldpMaxRate :: String
1905 ldpMaxRate = "c-max-rate"
1907 ldpMinRate :: String
1908 ldpMinRate = "c-min-rate"
1910 ldpNetCustom :: String
1911 ldpNetCustom = "net-custom"
1913 ldpNoMetaFlush :: String
1914 ldpNoMetaFlush = "disable-meta-flush"
1916 ldpPlanAhead :: String
1917 ldpPlanAhead = "c-plan-ahead"
1922 ldpProtocol :: String
1923 ldpProtocol = "protocol"
1925 ldpResyncRate :: String
1926 ldpResyncRate = "resync-rate"
1928 ldpStripes :: String
1929 ldpStripes = "stripes"
1931 diskLdTypes :: Map String VType
1934 [(ldpAccess, VTypeString),
1935 (ldpResyncRate, VTypeInt),
1936 (ldpStripes, VTypeInt),
1937 (ldpBarriers, VTypeString),
1938 (ldpNoMetaFlush, VTypeBool),
1939 (ldpDefaultMetavg, VTypeString),
1940 (ldpDiskCustom, VTypeString),
1941 (ldpNetCustom, VTypeString),
1942 (ldpProtocol, VTypeString),
1943 (ldpDynamicResync, VTypeBool),
1944 (ldpPlanAhead, VTypeInt),
1945 (ldpFillTarget, VTypeInt),
1946 (ldpDelayTarget, VTypeInt),
1947 (ldpMaxRate, VTypeInt),
1948 (ldpMinRate, VTypeInt),
1949 (ldpPool, VTypeString)]
1951 diskLdParameters :: FrozenSet String
1952 diskLdParameters = ConstantUtils.mkSet (Map.keys diskLdTypes)
1954 -- * Disk template parameters
1956 -- Disk template parameters can be set/changed by the user via
1957 -- gnt-cluster and gnt-group)
1959 drbdResyncRate :: String
1960 drbdResyncRate = "resync-rate"
1962 drbdDataStripes :: String
1963 drbdDataStripes = "data-stripes"
1965 drbdMetaStripes :: String
1966 drbdMetaStripes = "meta-stripes"
1968 drbdDiskBarriers :: String
1969 drbdDiskBarriers = "disk-barriers"
1971 drbdMetaBarriers :: String
1972 drbdMetaBarriers = "meta-barriers"
1974 drbdDefaultMetavg :: String
1975 drbdDefaultMetavg = "metavg"
1977 drbdDiskCustom :: String
1978 drbdDiskCustom = "disk-custom"
1980 drbdNetCustom :: String
1981 drbdNetCustom = "net-custom"
1983 drbdProtocol :: String
1984 drbdProtocol = "protocol"
1986 drbdDynamicResync :: String
1987 drbdDynamicResync = "dynamic-resync"
1989 drbdPlanAhead :: String
1990 drbdPlanAhead = "c-plan-ahead"
1992 drbdFillTarget :: String
1993 drbdFillTarget = "c-fill-target"
1995 drbdDelayTarget :: String
1996 drbdDelayTarget = "c-delay-target"
1998 drbdMaxRate :: String
1999 drbdMaxRate = "c-max-rate"
2001 drbdMinRate :: String
2002 drbdMinRate = "c-min-rate"
2005 lvStripes = "stripes"
2008 rbdAccess = "access"
2013 diskDtTypes :: Map String VType
2015 Map.fromList [(drbdResyncRate, VTypeInt),
2016 (drbdDataStripes, VTypeInt),
2017 (drbdMetaStripes, VTypeInt),
2018 (drbdDiskBarriers, VTypeString),
2019 (drbdMetaBarriers, VTypeBool),
2020 (drbdDefaultMetavg, VTypeString),
2021 (drbdDiskCustom, VTypeString),
2022 (drbdNetCustom, VTypeString),
2023 (drbdProtocol, VTypeString),
2024 (drbdDynamicResync, VTypeBool),
2025 (drbdPlanAhead, VTypeInt),
2026 (drbdFillTarget, VTypeInt),
2027 (drbdDelayTarget, VTypeInt),
2028 (drbdMaxRate, VTypeInt),
2029 (drbdMinRate, VTypeInt),
2030 (lvStripes, VTypeInt),
2031 (rbdAccess, VTypeString),
2032 (rbdPool, VTypeString)]
2034 diskDtParameters :: FrozenSet String
2035 diskDtParameters = ConstantUtils.mkSet (Map.keys diskDtTypes)
2037 -- * Dynamic disk parameters
2039 ddpLocalIp :: String
2040 ddpLocalIp = "local-ip"
2042 ddpRemoteIp :: String
2043 ddpRemoteIp = "remote-ip"
2048 ddpLocalMinor :: String
2049 ddpLocalMinor = "local-minor"
2051 ddpRemoteMinor :: String
2052 ddpRemoteMinor = "remote-minor"
2054 -- * OOB supported commands
2056 oobPowerOn :: String
2057 oobPowerOn = Types.oobCommandToRaw OobPowerOn
2059 oobPowerOff :: String
2060 oobPowerOff = Types.oobCommandToRaw OobPowerOff
2062 oobPowerCycle :: String
2063 oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
2065 oobPowerStatus :: String
2066 oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
2069 oobHealth = Types.oobCommandToRaw OobHealth
2071 oobCommands :: FrozenSet String
2072 oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
2074 oobPowerStatusPowered :: String
2075 oobPowerStatusPowered = "powered"
2082 oobPowerDelay :: Double
2085 oobStatusCritical :: String
2086 oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
2088 oobStatusOk :: String
2089 oobStatusOk = Types.oobStatusToRaw OobStatusOk
2091 oobStatusUnknown :: String
2092 oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
2094 oobStatusWarning :: String
2095 oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
2097 oobStatuses :: FrozenSet String
2098 oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
2100 -- | Instance Parameters Profile
2102 ppDefault = "default"
2104 -- * nic* constants are used inside the ganeti config
2115 nicsParameterTypes :: Map String VType
2116 nicsParameterTypes =
2117 Map.fromList [(nicMode, vtypeString),
2118 (nicLink, vtypeString),
2119 (nicVlan, vtypeMaybeString)]
2121 nicsParameters :: FrozenSet String
2122 nicsParameters = ConstantUtils.mkSet (Map.keys nicsParameterTypes)
2124 nicModeBridged :: String
2125 nicModeBridged = Types.nICModeToRaw NMBridged
2127 nicModeRouted :: String
2128 nicModeRouted = Types.nICModeToRaw NMRouted
2130 nicModeOvs :: String
2131 nicModeOvs = Types.nICModeToRaw NMOvs
2134 nicIpPool = Types.nICModeToRaw NMPool
2136 nicValidModes :: FrozenSet String
2137 nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
2139 releaseAction :: String
2140 releaseAction = "release"
2142 reserveAction :: String
2143 reserveAction = "reserve"
2145 -- * idisk* constants are used in opcodes, to create/change disks
2147 idiskAdopt :: String
2148 idiskAdopt = "adopt"
2150 idiskMetavg :: String
2151 idiskMetavg = "metavg"
2162 idiskSpindles :: String
2163 idiskSpindles = "spindles"
2168 idiskProvider :: String
2169 idiskProvider = "provider"
2171 idiskParamsTypes :: Map String VType
2173 Map.fromList [(idiskSize, VTypeSize),
2174 (idiskSpindles, VTypeInt),
2175 (idiskMode, VTypeString),
2176 (idiskAdopt, VTypeString),
2177 (idiskVg, VTypeString),
2178 (idiskMetavg, VTypeString),
2179 (idiskProvider, VTypeString),
2180 (idiskName, VTypeMaybeString)]
2182 idiskParams :: FrozenSet String
2183 idiskParams = ConstantUtils.mkSet (Map.keys idiskParamsTypes)
2185 -- * inic* constants are used in opcodes, to create/change nics
2187 inicBridge :: String
2188 inicBridge = "bridge"
2205 inicNetwork :: String
2206 inicNetwork = "network"
2211 inicParamsTypes :: Map String VType
2213 Map.fromList [(inicBridge, VTypeMaybeString),
2214 (inicIp, VTypeMaybeString),
2215 (inicLink, VTypeString),
2216 (inicMac, VTypeString),
2217 (inicMode, VTypeString),
2218 (inicName, VTypeMaybeString),
2219 (inicNetwork, VTypeMaybeString),
2220 (inicVlan, VTypeMaybeString)]
2222 inicParams :: FrozenSet String
2223 inicParams = ConstantUtils.mkSet (Map.keys inicParamsTypes)
2225 -- * Hypervisor constants
2228 htXenPvm = Types.hypervisorToRaw XenPvm
2231 htFake = Types.hypervisorToRaw Fake
2234 htXenHvm = Types.hypervisorToRaw XenHvm
2237 htKvm = Types.hypervisorToRaw Kvm
2240 htChroot = Types.hypervisorToRaw Chroot
2243 htLxc = Types.hypervisorToRaw Lxc
2245 hyperTypes :: FrozenSet String
2246 hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
2248 htsReqPort :: FrozenSet String
2249 htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
2254 vncDefaultBindAddress :: String
2255 vncDefaultBindAddress = ip4AddressAny
2259 htNicE1000 :: String
2260 htNicE1000 = "e1000"
2262 htNicI82551 :: String
2263 htNicI82551 = "i82551"
2265 htNicI8259er :: String
2266 htNicI8259er = "i82559er"
2268 htNicI85557b :: String
2269 htNicI85557b = "i82557b"
2271 htNicNe2kIsa :: String
2272 htNicNe2kIsa = "ne2k_isa"
2274 htNicNe2kPci :: String
2275 htNicNe2kPci = "ne2k_pci"
2277 htNicParavirtual :: String
2278 htNicParavirtual = "paravirtual"
2280 htNicPcnet :: String
2281 htNicPcnet = "pcnet"
2283 htNicRtl8139 :: String
2284 htNicRtl8139 = "rtl8139"
2286 htHvmValidNicTypes :: FrozenSet String
2287 htHvmValidNicTypes =
2288 ConstantUtils.mkSet [htNicE1000,
2294 htKvmValidNicTypes :: FrozenSet String
2295 htKvmValidNicTypes =
2296 ConstantUtils.mkSet [htNicE1000,
2308 -- | Default vif type in xen-hvm
2309 htHvmVifIoemu :: String
2310 htHvmVifIoemu = "ioemu"
2312 htHvmVifVif :: String
2315 htHvmValidVifTypes :: FrozenSet String
2316 htHvmValidVifTypes = ConstantUtils.mkSet [htHvmVifIoemu, htHvmVifVif]
2323 htDiskIoemu :: String
2324 htDiskIoemu = "ioemu"
2329 htDiskParavirtual :: String
2330 htDiskParavirtual = "paravirtual"
2332 htDiskPflash :: String
2333 htDiskPflash = "pflash"
2335 htDiskScsi :: String
2341 htHvmValidDiskTypes :: FrozenSet String
2342 htHvmValidDiskTypes = ConstantUtils.mkSet [htDiskIoemu, htDiskParavirtual]
2344 htKvmValidDiskTypes :: FrozenSet String
2345 htKvmValidDiskTypes =
2346 ConstantUtils.mkSet [htDiskIde,
2353 htCacheDefault :: String
2354 htCacheDefault = "default"
2356 htCacheNone :: String
2357 htCacheNone = "none"
2359 htCacheWback :: String
2360 htCacheWback = "writeback"
2362 htCacheWthrough :: String
2363 htCacheWthrough = "writethrough"
2365 htValidCacheTypes :: FrozenSet String
2367 ConstantUtils.mkSet [htCacheDefault,
2374 htMouseMouse :: String
2375 htMouseMouse = "mouse"
2377 htMouseTablet :: String
2378 htMouseTablet = "tablet"
2380 htKvmValidMouseTypes :: FrozenSet String
2381 htKvmValidMouseTypes = ConstantUtils.mkSet [htMouseMouse, htMouseTablet]
2391 htBoFloppy :: String
2392 htBoFloppy = "floppy"
2394 htBoNetwork :: String
2395 htBoNetwork = "network"
2397 htKvmValidBoTypes :: FrozenSet String
2399 ConstantUtils.mkSet [htBoCdrom, htBoDisk, htBoFloppy, htBoNetwork]
2401 -- * SPICE lossless image compression options
2403 htKvmSpiceLosslessImgComprAutoGlz :: String
2404 htKvmSpiceLosslessImgComprAutoGlz = "auto_glz"
2406 htKvmSpiceLosslessImgComprAutoLz :: String
2407 htKvmSpiceLosslessImgComprAutoLz = "auto_lz"
2409 htKvmSpiceLosslessImgComprGlz :: String
2410 htKvmSpiceLosslessImgComprGlz = "glz"
2412 htKvmSpiceLosslessImgComprLz :: String
2413 htKvmSpiceLosslessImgComprLz = "lz"
2415 htKvmSpiceLosslessImgComprOff :: String
2416 htKvmSpiceLosslessImgComprOff = "off"
2418 htKvmSpiceLosslessImgComprQuic :: String
2419 htKvmSpiceLosslessImgComprQuic = "quic"
2421 htKvmSpiceValidLosslessImgComprOptions :: FrozenSet String
2422 htKvmSpiceValidLosslessImgComprOptions =
2423 ConstantUtils.mkSet [htKvmSpiceLosslessImgComprAutoGlz,
2424 htKvmSpiceLosslessImgComprAutoLz,
2425 htKvmSpiceLosslessImgComprGlz,
2426 htKvmSpiceLosslessImgComprLz,
2427 htKvmSpiceLosslessImgComprOff,
2428 htKvmSpiceLosslessImgComprQuic]
2430 htKvmSpiceLossyImgComprAlways :: String
2431 htKvmSpiceLossyImgComprAlways = "always"
2433 htKvmSpiceLossyImgComprAuto :: String
2434 htKvmSpiceLossyImgComprAuto = "auto"
2436 htKvmSpiceLossyImgComprNever :: String
2437 htKvmSpiceLossyImgComprNever = "never"
2439 htKvmSpiceValidLossyImgComprOptions :: FrozenSet String
2440 htKvmSpiceValidLossyImgComprOptions =
2441 ConstantUtils.mkSet [htKvmSpiceLossyImgComprAlways,
2442 htKvmSpiceLossyImgComprAuto,
2443 htKvmSpiceLossyImgComprNever]
2445 -- * SPICE video stream detection
2447 htKvmSpiceVideoStreamDetectionAll :: String
2448 htKvmSpiceVideoStreamDetectionAll = "all"
2450 htKvmSpiceVideoStreamDetectionFilter :: String
2451 htKvmSpiceVideoStreamDetectionFilter = "filter"
2453 htKvmSpiceVideoStreamDetectionOff :: String
2454 htKvmSpiceVideoStreamDetectionOff = "off"
2456 htKvmSpiceValidVideoStreamDetectionOptions :: FrozenSet String
2457 htKvmSpiceValidVideoStreamDetectionOptions =
2458 ConstantUtils.mkSet [htKvmSpiceVideoStreamDetectionAll,
2459 htKvmSpiceVideoStreamDetectionFilter,
2460 htKvmSpiceVideoStreamDetectionOff]
2462 -- * Security models
2473 htKvmValidSmTypes :: FrozenSet String
2474 htKvmValidSmTypes = ConstantUtils.mkSet [htSmNone, htSmPool, htSmUser]
2476 -- * Kvm flag values
2478 htKvmDisabled :: String
2479 htKvmDisabled = "disabled"
2481 htKvmEnabled :: String
2482 htKvmEnabled = "enabled"
2484 htKvmFlagValues :: FrozenSet String
2485 htKvmFlagValues = ConstantUtils.mkSet [htKvmDisabled, htKvmEnabled]
2489 htMigrationLive :: String
2490 htMigrationLive = Types.migrationModeToRaw MigrationLive
2492 htMigrationNonlive :: String
2493 htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
2495 htMigrationModes :: FrozenSet String
2497 ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
2499 -- * Cluster verify steps
2501 verifyNplusoneMem :: String
2502 verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
2504 verifyOptionalChecks :: FrozenSet String
2505 verifyOptionalChecks =
2506 ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
2508 -- * Cluster Verify error classes
2510 cvTcluster :: String
2511 cvTcluster = "cluster"
2519 cvTinstance :: String
2520 cvTinstance = "instance"
2522 -- * Cluster Verify error codes and documentation
2524 cvEclustercert :: (String, String, String)
2527 Types.cVErrorCodeToRaw CvECLUSTERCERT,
2528 "Cluster certificate files verification failure")
2530 cvEclustercfg :: (String, String, String)
2533 Types.cVErrorCodeToRaw CvECLUSTERCFG,
2534 "Cluster configuration verification failure")
2536 cvEclusterdanglinginst :: (String, String, String)
2537 cvEclusterdanglinginst =
2539 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
2540 "Some instances have a non-existing primary node")
2542 cvEclusterdanglingnodes :: (String, String, String)
2543 cvEclusterdanglingnodes =
2545 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
2546 "Some nodes belong to non-existing groups")
2548 cvEclusterfilecheck :: (String, String, String)
2549 cvEclusterfilecheck =
2551 Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
2552 "Cluster configuration verification failure")
2554 cvEgroupdifferentpvsize :: (String, String, String)
2555 cvEgroupdifferentpvsize =
2557 Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
2558 "PVs in the group have different sizes")
2560 cvEinstancebadnode :: (String, String, String)
2561 cvEinstancebadnode =
2563 Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
2564 "Instance marked as running lives on an offline node")
2566 cvEinstancedown :: (String, String, String)
2569 Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
2570 "Instance not running on its primary node")
2572 cvEinstancefaultydisk :: (String, String, String)
2573 cvEinstancefaultydisk =
2575 Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
2576 "Impossible to retrieve status for a disk")
2578 cvEinstancelayout :: (String, String, String)
2581 Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
2582 "Instance has multiple secondary nodes")
2584 cvEinstancemissingcfgparameter :: (String, String, String)
2585 cvEinstancemissingcfgparameter =
2587 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
2588 "A configuration parameter for an instance is missing")
2590 cvEinstancemissingdisk :: (String, String, String)
2591 cvEinstancemissingdisk =
2593 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
2594 "Missing volume on an instance")
2596 cvEinstancepolicy :: (String, String, String)
2599 Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
2600 "Instance does not meet policy")
2602 cvEinstancesplitgroups :: (String, String, String)
2603 cvEinstancesplitgroups =
2605 Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
2606 "Instance with primary and secondary nodes in different groups")
2608 cvEinstanceunsuitablenode :: (String, String, String)
2609 cvEinstanceunsuitablenode =
2611 Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
2612 "Instance running on nodes that are not suitable for it")
2614 cvEinstancewrongnode :: (String, String, String)
2615 cvEinstancewrongnode =
2617 Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
2618 "Instance running on the wrong node")
2620 cvEnodedrbd :: (String, String, String)
2623 Types.cVErrorCodeToRaw CvENODEDRBD,
2624 "Error parsing the DRBD status file")
2626 cvEnodedrbdhelper :: (String, String, String)
2629 Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
2630 "Error caused by the DRBD helper")
2632 cvEnodedrbdversion :: (String, String, String)
2633 cvEnodedrbdversion =
2635 Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
2636 "DRBD version mismatch within a node group")
2638 cvEnodefilecheck :: (String, String, String)
2641 Types.cVErrorCodeToRaw CvENODEFILECHECK,
2642 "Error retrieving the checksum of the node files")
2644 cvEnodefilestoragepaths :: (String, String, String)
2645 cvEnodefilestoragepaths =
2647 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
2648 "Detected bad file storage paths")
2650 cvEnodefilestoragepathunusable :: (String, String, String)
2651 cvEnodefilestoragepathunusable =
2653 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
2654 "File storage path unusable")
2656 cvEnodehooks :: (String, String, String)
2659 Types.cVErrorCodeToRaw CvENODEHOOKS,
2660 "Communication failure in hooks execution")
2662 cvEnodehv :: (String, String, String)
2665 Types.cVErrorCodeToRaw CvENODEHV,
2666 "Hypervisor parameters verification failure")
2668 cvEnodelvm :: (String, String, String)
2671 Types.cVErrorCodeToRaw CvENODELVM,
2672 "LVM-related node error")
2674 cvEnoden1 :: (String, String, String)
2677 Types.cVErrorCodeToRaw CvENODEN1,
2678 "Not enough memory to accommodate instance failovers")
2680 cvEnodenet :: (String, String, String)
2683 Types.cVErrorCodeToRaw CvENODENET,
2684 "Network-related node error")
2686 cvEnodeoobpath :: (String, String, String)
2689 Types.cVErrorCodeToRaw CvENODEOOBPATH,
2690 "Invalid Out Of Band path")
2692 cvEnodeorphaninstance :: (String, String, String)
2693 cvEnodeorphaninstance =
2695 Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
2696 "Unknown intance running on a node")
2698 cvEnodeorphanlv :: (String, String, String)
2701 Types.cVErrorCodeToRaw CvENODEORPHANLV,
2702 "Unknown LVM logical volume")
2704 cvEnodeos :: (String, String, String)
2707 Types.cVErrorCodeToRaw CvENODEOS,
2708 "OS-related node error")
2710 cvEnoderpc :: (String, String, String)
2713 Types.cVErrorCodeToRaw CvENODERPC,
2714 "Error during connection to the primary node of an instance")
2716 cvEnodesetup :: (String, String, String)
2719 Types.cVErrorCodeToRaw CvENODESETUP,
2722 cvEnodesharedfilestoragepathunusable :: (String, String, String)
2723 cvEnodesharedfilestoragepathunusable =
2725 Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
2726 "Shared file storage path unusable")
2728 cvEnodessh :: (String, String, String)
2731 Types.cVErrorCodeToRaw CvENODESSH,
2732 "SSH-related node error")
2734 cvEnodetime :: (String, String, String)
2737 Types.cVErrorCodeToRaw CvENODETIME,
2738 "Node returned invalid time")
2740 cvEnodeuserscripts :: (String, String, String)
2741 cvEnodeuserscripts =
2743 Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
2744 "User scripts not present or not executable")
2746 cvEnodeversion :: (String, String, String)
2749 Types.cVErrorCodeToRaw CvENODEVERSION,
2750 "Protocol version mismatch or Ganeti version mismatch")
2752 cvAllEcodes :: FrozenSet (String, String, String)
2757 cvEclusterdanglinginst,
2758 cvEclusterdanglingnodes,
2759 cvEclusterfilecheck,
2760 cvEgroupdifferentpvsize,
2763 cvEinstancefaultydisk,
2765 cvEinstancemissingcfgparameter,
2766 cvEinstancemissingdisk,
2768 cvEinstancesplitgroups,
2769 cvEinstanceunsuitablenode,
2770 cvEinstancewrongnode,
2775 cvEnodefilestoragepaths,
2776 cvEnodefilestoragepathunusable,
2783 cvEnodeorphaninstance,
2788 cvEnodesharedfilestoragepathunusable,
2794 cvAllEcodesStrings :: FrozenSet String
2795 cvAllEcodesStrings =
2796 ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
2798 -- * Node verify constants
2801 nvBridges = "bridges"
2803 nvDrbdhelper :: String
2804 nvDrbdhelper = "drbd-helper"
2806 nvDrbdversion :: String
2807 nvDrbdversion = "drbd-version"
2809 nvDrbdlist :: String
2810 nvDrbdlist = "drbd-list"
2812 nvExclusivepvs :: String
2813 nvExclusivepvs = "exclusive-pvs"
2815 nvFilelist :: String
2816 nvFilelist = "filelist"
2818 nvAcceptedStoragePaths :: String
2819 nvAcceptedStoragePaths = "allowed-file-storage-paths"
2821 nvFileStoragePath :: String
2822 nvFileStoragePath = "file-storage-path"
2824 nvSharedFileStoragePath :: String
2825 nvSharedFileStoragePath = "shared-file-storage-path"
2830 nvHvparams :: String
2831 nvHvparams = "hvparms"
2833 nvHypervisor :: String
2834 nvHypervisor = "hypervisor"
2836 nvInstancelist :: String
2837 nvInstancelist = "instancelist"
2842 nvMasterip :: String
2843 nvMasterip = "master-ip"
2845 nvNodelist :: String
2846 nvNodelist = "nodelist"
2848 nvNodenettest :: String
2849 nvNodenettest = "node-net-test"
2851 nvNodesetup :: String
2852 nvNodesetup = "nodesetup"
2854 nvOobPaths :: String
2855 nvOobPaths = "oob-paths"
2866 nvUserscripts :: String
2867 nvUserscripts = "user-scripts"
2870 nvVersion = "version"
2876 nvVmnodes = "vmnodes"
2878 -- * Instance status
2880 inststAdmindown :: String
2881 inststAdmindown = Types.instanceStatusToRaw StatusDown
2883 inststAdminoffline :: String
2884 inststAdminoffline = Types.instanceStatusToRaw StatusOffline
2886 inststErrordown :: String
2887 inststErrordown = Types.instanceStatusToRaw ErrorDown
2889 inststErrorup :: String
2890 inststErrorup = Types.instanceStatusToRaw ErrorUp
2892 inststNodedown :: String
2893 inststNodedown = Types.instanceStatusToRaw NodeDown
2895 inststNodeoffline :: String
2896 inststNodeoffline = Types.instanceStatusToRaw NodeOffline
2898 inststRunning :: String
2899 inststRunning = Types.instanceStatusToRaw Running
2901 inststWrongnode :: String
2902 inststWrongnode = Types.instanceStatusToRaw WrongNode
2904 inststAll :: FrozenSet String
2905 inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
2909 adminstDown :: String
2910 adminstDown = Types.adminStateToRaw AdminDown
2912 adminstOffline :: String
2913 adminstOffline = Types.adminStateToRaw AdminOffline
2916 adminstUp = Types.adminStateToRaw AdminUp
2918 adminstAll :: FrozenSet String
2919 adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
2924 nrDrained = Types.nodeRoleToRaw NRDrained
2927 nrMaster = Types.nodeRoleToRaw NRMaster
2929 nrMcandidate :: String
2930 nrMcandidate = Types.nodeRoleToRaw NRCandidate
2933 nrOffline = Types.nodeRoleToRaw NROffline
2936 nrRegular = Types.nodeRoleToRaw NRRegular
2938 nrAll :: FrozenSet String
2939 nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
2941 -- * SSL certificate check constants (in days)
2943 sslCertExpirationError :: Int
2944 sslCertExpirationError = 7
2946 sslCertExpirationWarn :: Int
2947 sslCertExpirationWarn = 30
2949 -- * Allocator framework constants
2951 iallocatorVersion :: Int
2952 iallocatorVersion = 2
2954 iallocatorDirIn :: String
2955 iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
2957 iallocatorDirOut :: String
2958 iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
2960 validIallocatorDirections :: FrozenSet String
2961 validIallocatorDirections =
2962 ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
2964 iallocatorModeAlloc :: String
2965 iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
2967 iallocatorModeChgGroup :: String
2968 iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
2970 iallocatorModeMultiAlloc :: String
2971 iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
2973 iallocatorModeNodeEvac :: String
2974 iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
2976 iallocatorModeReloc :: String
2977 iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
2979 validIallocatorModes :: FrozenSet String
2980 validIallocatorModes =
2981 ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
2983 iallocatorSearchPath :: [String]
2984 iallocatorSearchPath = AutoConf.iallocatorSearchPath
2986 defaultIallocatorShortcut :: String
2987 defaultIallocatorShortcut = "."
2989 -- * Node evacuation
2991 nodeEvacPri :: String
2992 nodeEvacPri = Types.evacModeToRaw ChangePrimary
2994 nodeEvacSec :: String
2995 nodeEvacSec = Types.evacModeToRaw ChangeSecondary
2997 nodeEvacAll :: String
2998 nodeEvacAll = Types.evacModeToRaw ChangeAll
3000 nodeEvacModes :: FrozenSet String
3001 nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..]
3005 jobQueueVersion :: Int
3008 jobQueueSizeHardLimit :: Int
3009 jobQueueSizeHardLimit = 5000
3011 jobQueueFilesPerms :: Int
3012 jobQueueFilesPerms = 0o640
3014 -- * Unchanged job return
3016 jobNotchanged :: String
3017 jobNotchanged = "nochange"
3021 jobStatusQueued :: String
3022 jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
3024 jobStatusWaiting :: String
3025 jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
3027 jobStatusCanceling :: String
3028 jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
3030 jobStatusRunning :: String
3031 jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
3033 jobStatusCanceled :: String
3034 jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
3036 jobStatusSuccess :: String
3037 jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
3039 jobStatusError :: String
3040 jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
3042 jobsPending :: FrozenSet String
3044 ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
3046 jobsFinalized :: FrozenSet String
3048 ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
3050 jobStatusAll :: FrozenSet String
3051 jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
3055 -- ** Not yet finalized opcodes
3057 opStatusCanceling :: String
3058 opStatusCanceling = "canceling"
3060 opStatusQueued :: String
3061 opStatusQueued = "queued"
3063 opStatusRunning :: String
3064 opStatusRunning = "running"
3066 opStatusWaiting :: String
3067 opStatusWaiting = "waiting"
3069 -- ** Finalized opcodes
3071 opStatusCanceled :: String
3072 opStatusCanceled = "canceled"
3074 opStatusError :: String
3075 opStatusError = "error"
3077 opStatusSuccess :: String
3078 opStatusSuccess = "success"
3080 opsFinalized :: FrozenSet String
3082 ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
3084 -- * OpCode priority
3089 opPrioHighest :: Int
3093 opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
3096 opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
3099 opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
3101 opPrioSubmitValid :: FrozenSet Int
3102 opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
3104 opPrioDefault :: Int
3105 opPrioDefault = opPrioNormal
3107 -- * Lock recalculate mode
3109 locksAppend :: String
3110 locksAppend = "append"
3112 locksReplace :: String
3113 locksReplace = "replace"
3117 -- The lock timeout (sum) before we transition into blocking acquire
3118 -- (this can still be reset by priority change). Computed as max time
3119 -- (10 hours) before we should actually go into blocking acquire,
3120 -- given that we start from the default priority level.
3122 lockAttemptsMaxwait :: Double
3123 lockAttemptsMaxwait = 15.0
3125 lockAttemptsMinwait :: Double
3126 lockAttemptsMinwait = 1.0
3128 lockAttemptsTimeout :: Int
3129 lockAttemptsTimeout = (10 * 3600) `div` (opPrioDefault - opPrioHighest)
3131 -- * Execution log types
3133 elogMessage :: String
3134 elogMessage = Types.eLogTypeToRaw ELogMessage
3136 elogRemoteImport :: String
3137 elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
3139 elogJqueueTest :: String
3140 elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
3142 -- * /etc/hosts modification
3144 etcHostsAdd :: String
3147 etcHostsRemove :: String
3148 etcHostsRemove = "remove"
3152 jqtMsgprefix :: String
3153 jqtMsgprefix = "TESTMSG="
3158 jqtExpandnames :: String
3159 jqtExpandnames = "expandnames"
3162 jqtLogmsg = "logmsg"
3164 jqtStartmsg :: String
3165 jqtStartmsg = "startmsg"
3167 jqtAll :: FrozenSet String
3168 jqtAll = ConstantUtils.mkSet [jqtExec, jqtExpandnames, jqtLogmsg, jqtStartmsg]
3170 -- * Query resources
3173 qrCluster = "cluster"
3178 qrExtstorage :: String
3179 qrExtstorage = "extstorage"
3184 qrInstance :: String
3185 qrInstance = "instance"
3194 qrNetwork = "network"
3202 -- | List of resources which can be queried using 'Ganeti.OpCodes.OpQuery'
3203 qrViaOp :: FrozenSet String
3205 ConstantUtils.mkSet [qrCluster,
3214 -- | List of resources which can be queried using Local UniX Interface
3215 qrViaLuxi :: FrozenSet String
3216 qrViaLuxi = ConstantUtils.mkSet [qrLock, qrJob]
3218 -- | List of resources which can be queried using RAPI
3219 qrViaRapi :: FrozenSet String
3220 qrViaRapi = qrViaLuxi
3222 -- * Query field types
3228 qftNumber = "number"
3236 qftTimestamp :: String
3237 qftTimestamp = "timestamp"
3242 qftUnknown :: String
3243 qftUnknown = "unknown"
3245 qftAll :: FrozenSet String
3247 ConstantUtils.mkSet [qftBool,
3255 -- * Query result field status
3257 -- Don't change or reuse values as they're used by clients.
3259 -- FIXME: link with 'Ganeti.Query.Language.ResultStatus'
3261 -- | No data (e.g. RPC error), can be used instead of 'rsOffline'
3268 -- | Resource marked offline
3272 -- | Value unavailable/unsupported for item; if this field is
3273 -- supported but we cannot get the data for the moment, 'rsNodata' or
3274 -- 'rsOffline' should be used
3281 rsAll :: FrozenSet Int
3283 ConstantUtils.mkSet [rsNodata,
3289 -- | Special field cases and their verbose/terse formatting
3290 rssDescription :: Map Int (String, String)
3292 Map.fromList [(rsUnknown, ("(unknown)", "??")),
3293 (rsNodata, ("(nodata)", "?")),
3294 (rsOffline, ("(offline)", "*")),
3295 (rsUnavail, ("(unavail)", "-"))]
3297 -- * Max dynamic devices
3300 maxDisks = Types.maxDisks
3303 maxNics = Types.maxNics
3305 -- | SSCONF file prefix
3306 ssconfFileprefix :: String
3307 ssconfFileprefix = "ssconf_"
3311 ssClusterName :: String
3312 ssClusterName = "cluster_name"
3314 ssClusterTags :: String
3315 ssClusterTags = "cluster_tags"
3317 ssFileStorageDir :: String
3318 ssFileStorageDir = "file_storage_dir"
3320 ssSharedFileStorageDir :: String
3321 ssSharedFileStorageDir = "shared_file_storage_dir"
3323 ssMasterCandidates :: String
3324 ssMasterCandidates = "master_candidates"
3326 ssMasterCandidatesIps :: String
3327 ssMasterCandidatesIps = "master_candidates_ips"
3329 ssMasterIp :: String
3330 ssMasterIp = "master_ip"
3332 ssMasterNetdev :: String
3333 ssMasterNetdev = "master_netdev"
3335 ssMasterNetmask :: String
3336 ssMasterNetmask = "master_netmask"
3338 ssMasterNode :: String
3339 ssMasterNode = "master_node"
3341 ssNodeList :: String
3342 ssNodeList = "node_list"
3344 ssNodePrimaryIps :: String
3345 ssNodePrimaryIps = "node_primary_ips"
3347 ssNodeSecondaryIps :: String
3348 ssNodeSecondaryIps = "node_secondary_ips"
3350 ssOfflineNodes :: String
3351 ssOfflineNodes = "offline_nodes"
3353 ssOnlineNodes :: String
3354 ssOnlineNodes = "online_nodes"
3356 ssPrimaryIpFamily :: String
3357 ssPrimaryIpFamily = "primary_ip_family"
3359 ssInstanceList :: String
3360 ssInstanceList = "instance_list"
3362 ssReleaseVersion :: String
3363 ssReleaseVersion = "release_version"
3365 ssHypervisorList :: String
3366 ssHypervisorList = "hypervisor_list"
3368 ssMaintainNodeHealth :: String
3369 ssMaintainNodeHealth = "maintain_node_health"
3372 ssUidPool = "uid_pool"
3374 ssNodegroups :: String
3375 ssNodegroups = "nodegroups"
3377 ssNetworks :: String
3378 ssNetworks = "networks"
3380 -- | This is not a complete SSCONF key, but the prefix for the
3382 ssHvparamsPref :: String
3383 ssHvparamsPref = "hvparams_"
3387 ssHvparamsXenChroot :: String
3388 ssHvparamsXenChroot = ssHvparamsPref ++ htChroot
3390 ssHvparamsXenFake :: String
3391 ssHvparamsXenFake = ssHvparamsPref ++ htFake
3393 ssHvparamsXenHvm :: String
3394 ssHvparamsXenHvm = ssHvparamsPref ++ htXenHvm
3396 ssHvparamsXenKvm :: String
3397 ssHvparamsXenKvm = ssHvparamsPref ++ htKvm
3399 ssHvparamsXenLxc :: String
3400 ssHvparamsXenLxc = ssHvparamsPref ++ htLxc
3402 ssHvparamsXenPvm :: String
3403 ssHvparamsXenPvm = ssHvparamsPref ++ htXenPvm
3405 validSsHvparamsKeys :: FrozenSet String
3406 validSsHvparamsKeys =
3407 ConstantUtils.mkSet [ssHvparamsXenChroot,
3417 -- | Cluster wide default parameters
3418 defaultEnabledHypervisor :: String
3419 defaultEnabledHypervisor = htXenPvm
3421 hvcGlobals :: FrozenSet String
3423 ConstantUtils.mkSet [hvMigrationBandwidth,
3428 ndcGlobals :: FrozenSet String
3429 ndcGlobals = ConstantUtils.mkSet [ndExclusiveStorage]
3431 -- | All of the following values are quite arbitrary - there are no
3432 -- "good" defaults, these must be customised per-site
3433 ispecsMinmaxDefaults :: Map String (Map String Int)
3434 ispecsMinmaxDefaults =
3438 [(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMinISpec),
3439 (ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMinISpec),
3440 (ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMinISpec),
3441 (ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMinISpec),
3442 (ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMinISpec),
3443 (ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMinISpec)]),
3446 [(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMaxISpec),
3447 (ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMaxISpec),
3448 (ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMaxISpec),
3449 (ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMaxISpec),
3450 (ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMaxISpec),
3451 (ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMaxISpec)])]
3453 masterPoolSizeDefault :: Int
3454 masterPoolSizeDefault = 10
3456 -- * Exclusive storage
3458 -- | Error margin used to compare physical disks
3459 partMargin :: Double
3462 -- | Space reserved when creating instance disks
3463 partReserved :: Double
3468 confdProtocolVersion :: Int
3469 confdProtocolVersion = ConstantUtils.confdProtocolVersion
3471 -- Confd request type
3474 confdReqPing = Types.confdRequestTypeToRaw ReqPing
3476 confdReqNodeRoleByname :: Int
3477 confdReqNodeRoleByname = Types.confdRequestTypeToRaw ReqNodeRoleByName
3479 confdReqNodePipByInstanceIp :: Int
3480 confdReqNodePipByInstanceIp = Types.confdRequestTypeToRaw ReqNodePipByInstPip
3482 confdReqClusterMaster :: Int
3483 confdReqClusterMaster = Types.confdRequestTypeToRaw ReqClusterMaster
3485 confdReqNodePipList :: Int
3486 confdReqNodePipList = Types.confdRequestTypeToRaw ReqNodePipList
3488 confdReqMcPipList :: Int
3489 confdReqMcPipList = Types.confdRequestTypeToRaw ReqMcPipList
3491 confdReqInstancesIpsList :: Int
3492 confdReqInstancesIpsList = Types.confdRequestTypeToRaw ReqInstIpsList
3494 confdReqNodeDrbd :: Int
3495 confdReqNodeDrbd = Types.confdRequestTypeToRaw ReqNodeDrbd
3497 confdReqNodeInstances :: Int
3498 confdReqNodeInstances = Types.confdRequestTypeToRaw ReqNodeInstances
3500 confdReqs :: FrozenSet Int
3502 ConstantUtils.mkSet .
3503 map Types.confdRequestTypeToRaw $
3504 [minBound..] \\ [ReqNodeInstances]
3506 -- * Confd request type
3508 confdReqfieldName :: Int
3509 confdReqfieldName = Types.confdReqFieldToRaw ReqFieldName
3511 confdReqfieldIp :: Int
3512 confdReqfieldIp = Types.confdReqFieldToRaw ReqFieldIp
3514 confdReqfieldMnodePip :: Int
3515 confdReqfieldMnodePip = Types.confdReqFieldToRaw ReqFieldMNodePip
3517 -- * Confd repl status
3519 confdReplStatusOk :: Int
3520 confdReplStatusOk = Types.confdReplyStatusToRaw ReplyStatusOk
3522 confdReplStatusError :: Int
3523 confdReplStatusError = Types.confdReplyStatusToRaw ReplyStatusError
3525 confdReplStatusNotimplemented :: Int
3526 confdReplStatusNotimplemented = Types.confdReplyStatusToRaw ReplyStatusNotImpl
3528 confdReplStatuses :: FrozenSet Int
3530 ConstantUtils.mkSet $ map Types.confdReplyStatusToRaw [minBound..]
3532 -- * Confd node role
3534 confdNodeRoleMaster :: Int
3535 confdNodeRoleMaster = Types.confdNodeRoleToRaw NodeRoleMaster
3537 confdNodeRoleCandidate :: Int
3538 confdNodeRoleCandidate = Types.confdNodeRoleToRaw NodeRoleCandidate
3540 confdNodeRoleOffline :: Int
3541 confdNodeRoleOffline = Types.confdNodeRoleToRaw NodeRoleOffline
3543 confdNodeRoleDrained :: Int
3544 confdNodeRoleDrained = Types.confdNodeRoleToRaw NodeRoleDrained
3546 confdNodeRoleRegular :: Int
3547 confdNodeRoleRegular = Types.confdNodeRoleToRaw NodeRoleRegular
3549 -- * A few common errors for confd
3551 confdErrorUnknownEntry :: Int
3552 confdErrorUnknownEntry = Types.confdErrorTypeToRaw ConfdErrorUnknownEntry
3554 confdErrorInternal :: Int
3555 confdErrorInternal = Types.confdErrorTypeToRaw ConfdErrorInternal
3557 confdErrorArgument :: Int
3558 confdErrorArgument = Types.confdErrorTypeToRaw ConfdErrorArgument
3560 -- * Confd request query fields
3562 confdReqqLink :: String
3563 confdReqqLink = ConstantUtils.confdReqqLink
3565 confdReqqIp :: String
3566 confdReqqIp = ConstantUtils.confdReqqIp
3568 confdReqqIplist :: String
3569 confdReqqIplist = ConstantUtils.confdReqqIplist
3571 confdReqqFields :: String
3572 confdReqqFields = ConstantUtils.confdReqqFields
3574 -- | Each request is "salted" by the current timestamp.
3576 -- This constant decides how many seconds of skew to accept.
3578 -- TODO: make this a default and allow the value to be more
3580 confdMaxClockSkew :: Int
3581 confdMaxClockSkew = 2 * nodeMaxClockSkew
3583 -- | When we haven't reloaded the config for more than this amount of
3584 -- seconds, we force a test to see if inotify is betraying us. Using a
3585 -- prime number to ensure we get less chance of 'same wakeup' with
3587 confdConfigReloadTimeout :: Int
3588 confdConfigReloadTimeout = 17
3590 -- | If we receive more than one update in this amount of
3591 -- microseconds, we move to polling every RATELIMIT seconds, rather
3592 -- than relying on inotify, to be able to serve more requests.
3593 confdConfigReloadRatelimit :: Int
3594 confdConfigReloadRatelimit = 250000
3596 -- | Magic number prepended to all confd queries.
3598 -- This allows us to distinguish different types of confd protocols
3599 -- and handle them. For example by changing this we can move the whole
3600 -- payload to be compressed, or move away from json.
3601 confdMagicFourcc :: String
3602 confdMagicFourcc = "plj0"
3604 -- | By default a confd request is sent to the minimum between this
3605 -- number and all MCs. 6 was chosen because even in the case of a
3606 -- disastrous 50% response rate, we should have enough answers to be
3607 -- able to compare more than one.
3608 confdDefaultReqCoverage :: Int
3609 confdDefaultReqCoverage = 6
3611 -- | Timeout in seconds to expire pending query request in the confd
3612 -- client library. We don't actually expect any answer more than 10
3613 -- seconds after we sent a request.
3614 confdClientExpireTimeout :: Int
3615 confdClientExpireTimeout = 10
3617 -- | Maximum UDP datagram size.
3619 -- On IPv4: 64K - 20 (ip header size) - 8 (udp header size) = 65507
3620 -- On IPv6: 64K - 40 (ip6 header size) - 8 (udp header size) = 65487
3621 -- (assuming we can't use jumbo frames)
3622 -- We just set this to 60K, which should be enough
3623 maxUdpDataSize :: Int
3624 maxUdpDataSize = 61440
3626 -- * User-id pool minimum/maximum acceptable user-ids
3628 uidpoolUidMin :: Int
3631 -- | Assuming 32 bit user-ids
3632 uidpoolUidMax :: Integer
3633 uidpoolUidMax = 2 ^ 32 - 1
3635 -- | Name or path of the pgrep command
3639 -- | Name of the node group that gets created at cluster init or
3641 initialNodeGroupName :: String
3642 initialNodeGroupName = "default"
3644 -- * Possible values for NodeGroup.alloc_policy
3646 allocPolicyLastResort :: String
3647 allocPolicyLastResort = Types.allocPolicyToRaw AllocLastResort
3649 allocPolicyPreferred :: String
3650 allocPolicyPreferred = Types.allocPolicyToRaw AllocPreferred
3652 allocPolicyUnallocable :: String
3653 allocPolicyUnallocable = Types.allocPolicyToRaw AllocUnallocable
3655 validAllocPolicies :: [String]
3656 validAllocPolicies = map Types.allocPolicyToRaw [minBound..]
3658 -- | Temporary external/shared storage parameters
3659 blockdevDriverManual :: String
3660 blockdevDriverManual = Types.blockDriverToRaw BlockDrvManual
3662 -- | 'qemu-img' path, required for 'ovfconverter'
3663 qemuimgPath :: String
3664 qemuimgPath = AutoConf.qemuimgPath
3666 -- | Whether htools was enabled at compilation time
3668 -- FIXME: this should be moved next to the other enable constants,
3669 -- such as, 'enableConfd', and renamed to 'enableHtools'.
3671 htools = AutoConf.htools
3673 -- | The hail iallocator
3674 iallocHail :: String
3677 -- * Fake opcodes for functions that have hooks attached to them via
3678 -- backend.RunLocalHooks
3680 fakeOpMasterTurndown :: String
3681 fakeOpMasterTurndown = "OP_CLUSTER_IP_TURNDOWN"
3683 fakeOpMasterTurnup :: String
3684 fakeOpMasterTurnup = "OP_CLUSTER_IP_TURNUP"
3694 sshkAll :: FrozenSet String
3695 sshkAll = ConstantUtils.mkSet [sshkRsa, sshkDsa]
3697 -- * SSH authorized key types
3700 sshakDss = "ssh-dss"
3703 sshakRsa = "ssh-rsa"
3705 sshakAll :: FrozenSet String
3706 sshakAll = ConstantUtils.mkSet [sshakDss, sshakRsa]
3710 sshsClusterName :: String
3711 sshsClusterName = "cluster_name"
3713 sshsSshHostKey :: String
3714 sshsSshHostKey = "ssh_host_key"
3716 sshsSshRootKey :: String
3717 sshsSshRootKey = "ssh_root_key"
3719 sshsNodeDaemonCertificate :: String
3720 sshsNodeDaemonCertificate = "node_daemon_certificate"
3722 -- * Key files for SSH daemon
3724 sshHostDsaPriv :: String
3725 sshHostDsaPriv = sshConfigDir ++ "/ssh_host_dsa_key"
3727 sshHostDsaPub :: String
3728 sshHostDsaPub = sshHostDsaPriv ++ ".pub"
3730 sshHostRsaPriv :: String
3731 sshHostRsaPriv = sshConfigDir ++ "/ssh_host_rsa_key"
3733 sshHostRsaPub :: String
3734 sshHostRsaPub = sshHostRsaPriv ++ ".pub"
3736 -- * Node daemon setup
3738 ndsClusterName :: String
3739 ndsClusterName = "cluster_name"
3741 ndsNodeDaemonCertificate :: String
3742 ndsNodeDaemonCertificate = "node_daemon_certificate"
3745 ndsSsconf = "ssconf"
3747 ndsStartNodeDaemon :: String
3748 ndsStartNodeDaemon = "start_node_daemon"
3750 -- * The source reasons for the execution of an OpCode
3752 opcodeReasonSrcClient :: String
3753 opcodeReasonSrcClient = "gnt:client"
3755 opcodeReasonSrcNoded :: String
3756 opcodeReasonSrcNoded = "gnt:daemon:noded"
3758 opcodeReasonSrcOpcode :: String
3759 opcodeReasonSrcOpcode = "gnt:opcode"
3761 opcodeReasonSrcRlib2 :: String
3762 opcodeReasonSrcRlib2 = "gnt:library:rlib2"
3764 opcodeReasonSrcUser :: String
3765 opcodeReasonSrcUser = "gnt:user"
3767 opcodeReasonSources :: FrozenSet String
3768 opcodeReasonSources =
3769 ConstantUtils.mkSet [opcodeReasonSrcClient,
3770 opcodeReasonSrcNoded,
3771 opcodeReasonSrcOpcode,
3772 opcodeReasonSrcRlib2,
3773 opcodeReasonSrcUser]
3775 -- | Path generating random UUID
3776 randomUuidFile :: String
3777 randomUuidFile = ConstantUtils.randomUuidFile
3779 -- * Auto-repair tag prefixes
3781 autoRepairTagPrefix :: String
3782 autoRepairTagPrefix = "ganeti:watcher:autorepair:"
3784 autoRepairTagEnabled :: String
3785 autoRepairTagEnabled = autoRepairTagPrefix
3787 autoRepairTagPending :: String
3788 autoRepairTagPending = autoRepairTagPrefix ++ "pending:"
3790 autoRepairTagResult :: String
3791 autoRepairTagResult = autoRepairTagPrefix ++ "result:"
3793 autoRepairTagSuspended :: String
3794 autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:"
3796 -- * Auto-repair levels
3798 autoRepairFailover :: String
3799 autoRepairFailover = Types.autoRepairTypeToRaw ArFailover
3801 autoRepairFixStorage :: String
3802 autoRepairFixStorage = Types.autoRepairTypeToRaw ArFixStorage
3804 autoRepairMigrate :: String
3805 autoRepairMigrate = Types.autoRepairTypeToRaw ArMigrate
3807 autoRepairReinstall :: String
3808 autoRepairReinstall = Types.autoRepairTypeToRaw ArReinstall
3810 autoRepairAllTypes :: FrozenSet String
3811 autoRepairAllTypes =
3812 ConstantUtils.mkSet [autoRepairFailover,
3813 autoRepairFixStorage,
3815 autoRepairReinstall]
3817 -- * Auto-repair results
3819 autoRepairEnoperm :: String
3820 autoRepairEnoperm = Types.autoRepairResultToRaw ArEnoperm
3822 autoRepairFailure :: String
3823 autoRepairFailure = Types.autoRepairResultToRaw ArFailure
3825 autoRepairSuccess :: String
3826 autoRepairSuccess = Types.autoRepairResultToRaw ArSuccess
3828 autoRepairAllResults :: FrozenSet String
3829 autoRepairAllResults =
3830 ConstantUtils.mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess]
3832 -- | The version identifier for builtin data collectors
3833 builtinDataCollectorVersion :: String
3834 builtinDataCollectorVersion = "B"
3836 -- | The reason trail opcode parameter name
3837 opcodeReason :: String
3838 opcodeReason = "reason"
3840 diskstatsFile :: String
3841 diskstatsFile = "/proc/diskstats"
3843 -- * CPU load collector
3846 statFile = "/proc/stat"
3848 cpuavgloadBufferSize :: Int
3849 cpuavgloadBufferSize = 150
3851 cpuavgloadWindowSize :: Int
3852 cpuavgloadWindowSize = 600
3854 -- | Mond's variable for periodical data collection
3855 mondTimeInterval :: Int
3856 mondTimeInterval = 5
3858 -- * Disk access modes
3860 diskUserspace :: String
3861 diskUserspace = Types.diskAccessModeToRaw DiskUserspace
3863 diskKernelspace :: String
3864 diskKernelspace = Types.diskAccessModeToRaw DiskKernelspace
3866 diskValidAccessModes :: FrozenSet String
3867 diskValidAccessModes =
3868 ConstantUtils.mkSet $ map Types.diskAccessModeToRaw [minBound..]
3870 -- | Timeout for queue draining in upgrades
3871 upgradeQueueDrainTimeout :: Int
3872 upgradeQueueDrainTimeout = 36 * 60 * 60 -- 1.5 days
3874 -- | Intervall at which the queue is polled during upgrades
3875 upgradeQueuePollInterval :: Int
3876 upgradeQueuePollInterval = 10