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 (empty, fromList, keys, insert)
45 import qualified AutoConf
46 import Ganeti.ConstantUtils (PythonChar(..), PythonNone(..), FrozenSet,
47 Protocol(..), buildVersion)
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(..),
56 import Ganeti.THH (PyValueEx(..))
58 import qualified Ganeti.Types as Types
59 import Ganeti.Confd.Types (ConfdRequestType(..), ConfdReqField(..),
60 ConfdReplyStatus(..), ConfdNodeRole(..),
62 import qualified Ganeti.Confd.Types as Types
64 {-# ANN module "HLint: ignore Use camelCase" #-}
66 -- * 'autoconf' constants for Python only ('autotools/build-bash-completion')
68 htoolsProgs :: [String]
69 htoolsProgs = AutoConf.htoolsProgs
71 -- * 'autoconf' constants for Python only ('lib/constants.py')
73 drbdBarriers :: String
74 drbdBarriers = AutoConf.drbdBarriers
76 drbdNoMetaFlush :: Bool
77 drbdNoMetaFlush = AutoConf.drbdNoMetaFlush
80 lvmStripecount = AutoConf.lvmStripecount
83 hasGnuLn = AutoConf.hasGnuLn
85 -- * 'autoconf' constants for Python only ('lib/pathutils.py')
87 -- ** Build-time constants
90 exportDir = AutoConf.exportDir
92 osSearchPath :: [String]
93 osSearchPath = AutoConf.osSearchPath
95 esSearchPath :: [String]
96 esSearchPath = AutoConf.esSearchPath
98 sshConfigDir :: String
99 sshConfigDir = AutoConf.sshConfigDir
101 xenConfigDir :: String
102 xenConfigDir = AutoConf.xenConfigDir
105 sysconfdir = AutoConf.sysconfdir
108 toolsdir = AutoConf.toolsdir
110 localstatedir :: String
111 localstatedir = AutoConf.localstatedir
113 -- ** Paths which don't change for a virtual cluster
116 pkglibdir = AutoConf.pkglibdir
119 sharedir = AutoConf.sharedir
121 -- * 'autoconf' constants for Python only ('lib/build/sphinx_ext.py')
123 manPages :: Map String Int
124 manPages = Map.fromList AutoConf.manPages
126 -- * 'autoconf' constants for QA cluster only ('qa/qa_cluster.py')
128 versionedsharedir :: String
129 versionedsharedir = AutoConf.versionedsharedir
131 -- * 'autoconf' constants for Python only ('tests/py/docs_unittest.py')
133 gntScripts :: [String]
134 gntScripts = AutoConf.gntScripts
136 -- * Various versions
138 releaseVersion :: String
139 releaseVersion = AutoConf.packageVersion
142 versionMajor = AutoConf.versionMajor
145 versionMinor = AutoConf.versionMinor
147 versionRevision :: Int
148 versionRevision = AutoConf.versionRevision
151 dirVersion = AutoConf.dirVersion
162 osApiVersions :: FrozenSet Int
163 osApiVersions = ConstantUtils.mkSet [osApiV10, osApiV15, osApiV20]
172 configMajor = AutoConf.versionMajor
175 configMinor = AutoConf.versionMinor
177 -- | The configuration is supposed to remain stable across
178 -- revisions. Therefore, the revision number is cleared to '0'.
179 configRevision :: Int
183 configVersion = buildVersion configMajor configMinor configRevision
185 -- | Similarly to the configuration (see 'configRevision'), the
186 -- protocols are supposed to remain stable across revisions.
187 protocolVersion :: Int
188 protocolVersion = buildVersion configMajor configMinor configRevision
192 daemonsGroup :: String
193 daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
196 adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
198 masterdUser :: String
199 masterdUser = Runtime.daemonUser GanetiMasterd
201 masterdGroup :: String
202 masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
205 rapiUser = Runtime.daemonUser GanetiRapi
208 rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
211 confdUser = Runtime.daemonUser GanetiConfd
214 confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
217 luxidUser = Runtime.daemonUser GanetiLuxid
220 luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
223 nodedUser = Runtime.daemonUser GanetiNoded
226 nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
229 mondUser = Runtime.daemonUser GanetiMond
232 mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
234 sshLoginUser :: String
235 sshLoginUser = AutoConf.sshLoginUser
237 sshConsoleUser :: String
238 sshConsoleUser = AutoConf.sshConsoleUser
240 -- * Cpu pinning separators and constants
242 cpuPinningSep :: String
245 cpuPinningAll :: String
246 cpuPinningAll = "all"
248 -- | Internal representation of "all"
249 cpuPinningAllVal :: Int
250 cpuPinningAllVal = -1
252 -- | One "all" entry in a CPU list means CPU pinning is off
253 cpuPinningOff :: [Int]
254 cpuPinningOff = [cpuPinningAllVal]
256 -- | A Xen-specific implementation detail is that there is no way to
257 -- actually say "use any cpu for pinning" in a Xen configuration file,
258 -- as opposed to the command line, where you can say
260 -- xm vcpu-pin <domain> <vcpu> all
263 -- The workaround used in Xen is "0-63" (see source code function
264 -- "xm_vcpu_pin" in @<xen-source>/tools/python/xen/xm/main.py@).
266 -- To support future changes, the following constant is treated as a
267 -- blackbox string that simply means "use any cpu for pinning under
269 cpuPinningAllXen :: String
270 cpuPinningAllXen = "0-63"
272 -- | A KVM-specific implementation detail - the following value is
273 -- used to set CPU affinity to all processors (--0 through --31), per
276 -- FIXME: This only works for machines with up to 32 CPU cores
277 cpuPinningAllKvm :: Int
278 cpuPinningAllKvm = 0xFFFFFFFF
289 minWipeChunkPercent :: Int
290 minWipeChunkPercent = 10
298 secureDirMode = 0o700
300 secureFileMode :: Int
301 secureFileMode = 0o600
303 adoptableBlockdevRoot :: String
304 adoptableBlockdevRoot = "/dev/disk/"
306 -- * 'autoconf' enable/disable
309 enableConfd = AutoConf.enableConfd
312 enableMond = AutoConf.enableMond
314 enableRestrictedCommands :: Bool
315 enableRestrictedCommands = AutoConf.enableRestrictedCommands
317 enableSplitQuery :: Bool
318 enableSplitQuery = AutoConf.enableSplitQuery
331 confd = Runtime.daemonName GanetiConfd
334 masterd = Runtime.daemonName GanetiMasterd
337 mond = Runtime.daemonName GanetiMond
340 noded = Runtime.daemonName GanetiNoded
343 luxid = Runtime.daemonName GanetiLuxid
346 rapi = Runtime.daemonName GanetiRapi
348 daemons :: FrozenSet String
350 ConstantUtils.mkSet [confd,
357 defaultConfdPort :: Int
358 defaultConfdPort = 1814
360 defaultMondPort :: Int
361 defaultMondPort = 1815
363 defaultNodedPort :: Int
364 defaultNodedPort = 1811
366 defaultRapiPort :: Int
367 defaultRapiPort = 5080
369 daemonsPorts :: Map String (Protocol, Int)
371 Map.fromList [(confd, (Udp, defaultConfdPort)),
372 (mond, (Tcp, defaultMondPort)),
373 (noded, (Tcp, defaultNodedPort)),
374 (rapi, (Tcp, defaultRapiPort)),
378 firstDrbdPort = 11000
383 daemonsLogbase :: Map String String
386 [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
388 daemonsExtraLogbase :: Map String (Map String String)
389 daemonsExtraLogbase =
391 map (Runtime.daemonName *** id)
392 [ (GanetiMond, Map.fromList
393 [ ("access", Runtime.daemonsExtraLogbase GanetiMond AccessLog)
394 , ("error", Runtime.daemonsExtraLogbase GanetiMond ErrorLog)
398 extraLogreasonAccess :: String
399 extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
401 extraLogreasonError :: String
402 extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
405 devConsole = ConstantUtils.devConsole
408 procMounts = "/proc/mounts"
410 -- * Luxi (Local UniX Interface) related constants
412 luxiEom :: PythonChar
413 luxiEom = PythonChar '\x03'
415 -- | Environment variable for the luxi override socket
416 luxiOverride :: String
417 luxiOverride = "FORCE_LUXI_SOCKET"
419 luxiOverrideMaster :: String
420 luxiOverrideMaster = "master"
422 luxiOverrideQuery :: String
423 luxiOverrideQuery = "query"
426 luxiVersion = configVersion
430 syslogUsage :: String
431 syslogUsage = AutoConf.syslogUsage
434 syslogNo = Logging.syslogUsageToRaw SyslogNo
437 syslogYes = Logging.syslogUsageToRaw SyslogYes
440 syslogOnly = Logging.syslogUsageToRaw SyslogOnly
442 syslogSocket :: String
443 syslogSocket = "/dev/log"
445 exportConfFile :: String
446 exportConfFile = "config.ini"
450 xenBootloader :: String
451 xenBootloader = AutoConf.xenBootloader
460 xenInitrd = AutoConf.xenInitrd
463 xenKernel = AutoConf.xenKernel
465 -- FIXME: perhaps rename to 'validXenCommands' for consistency with
467 knownXenCommands :: FrozenSet String
468 knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
473 kvmPath = AutoConf.kvmPath
476 kvmKernel = AutoConf.kvmKernel
478 socatEscapeCode :: String
479 socatEscapeCode = "0x1d"
482 socatPath = AutoConf.socatPath
484 socatUseCompress :: Bool
485 socatUseCompress = AutoConf.socatUseCompress
487 socatUseEscape :: Bool
488 socatUseEscape = AutoConf.socatUseEscape
492 -- | Display a message for console access
493 consMessage :: String
496 -- | Console as SPICE server
500 -- | Console as SSH command
504 -- | Console as VNC server
508 consAll :: FrozenSet String
509 consAll = ConstantUtils.mkSet [consMessage, consSpice, consSsh, consVnc]
511 -- | RSA key bit length
513 -- For RSA keys more bits are better, but they also make operations
514 -- more expensive. NIST SP 800-131 recommends a minimum of 2048 bits
515 -- from the year 2010 on.
519 -- | Ciphers allowed for SSL connections.
521 -- For the format, see ciphers(1). A better way to disable ciphers
522 -- would be to use the exclamation mark (!), but socat versions below
523 -- 1.5 can't parse exclamation marks in options properly. When
524 -- modifying the ciphers, ensure not to accidentially add something
525 -- after it's been removed. Use the "openssl" utility to check the
526 -- allowed ciphers, e.g. "openssl ciphers -v HIGH:-DES".
527 opensslCiphers :: String
528 opensslCiphers = "HIGH:-DES:-3DES:-EXPORT:-ADH"
532 -- | commonName (CN) used in certificates
534 x509CertCn = "ganeti.example.com"
536 -- | Default validity of certificates in days
537 x509CertDefaultValidity :: Int
538 x509CertDefaultValidity = 365 * 5
540 x509CertSignatureHeader :: String
541 x509CertSignatureHeader = "X-Ganeti-Signature"
543 -- | Digest used to sign certificates ("openssl x509" uses SHA1 by default)
544 x509CertSignDigest :: String
545 x509CertSignDigest = "SHA1"
547 -- * Import/export daemon mode
555 -- * Import/export transport compression
564 iecAll = [iecGzip, iecNone]
566 ieCustomSize :: String
569 -- * Import/export I/O
571 -- | Direct file I/O, equivalent to a shell's I/O redirection using
576 -- | Raw block device I/O using "dd"
577 ieioRawDisk :: String
580 -- | OS definition import/export script
582 ieioScript = "script"
586 valueDefault :: String
587 valueDefault = "default"
592 valueGenerate :: String
593 valueGenerate = "generate"
604 valueHsNothing :: Map String PythonNone
605 valueHsNothing = Map.fromList [("Nothing", PythonNone)]
609 hooksNameCfgupdate :: String
610 hooksNameCfgupdate = "config-update"
612 hooksNameWatcher :: String
613 hooksNameWatcher = "watcher"
616 hooksPath = "/sbin:/bin:/usr/sbin:/usr/bin"
618 hooksPhasePost :: String
619 hooksPhasePost = "post"
621 hooksPhasePre :: String
622 hooksPhasePre = "pre"
627 -- * Hooks subject type (what object type does the LU deal with)
629 htypeCluster :: String
630 htypeCluster = "CLUSTER"
635 htypeInstance :: String
636 htypeInstance = "INSTANCE"
638 htypeNetwork :: String
639 htypeNetwork = "NETWORK"
658 stBlock = Types.storageTypeToRaw StorageBlock
661 stDiskless = Types.storageTypeToRaw StorageDiskless
664 stExt = Types.storageTypeToRaw StorageExt
667 stFile = Types.storageTypeToRaw StorageFile
670 stLvmPv = Types.storageTypeToRaw StorageLvmPv
673 stLvmVg = Types.storageTypeToRaw StorageLvmVg
676 stRados = Types.storageTypeToRaw StorageRados
678 storageTypes :: FrozenSet String
679 storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
681 -- | The set of storage types for which storage reporting is available
683 -- FIXME: Remove this, once storage reporting is available for all
685 stsReport :: FrozenSet String
686 stsReport = ConstantUtils.mkSet [stFile, stLvmPv, stLvmVg]
689 -- ** First two are valid in LU context only, not passed to backend
697 -- ** and the rest are valid in backend
699 sfAllocatable :: String
700 sfAllocatable = Types.storageFieldToRaw SFAllocatable
703 sfFree = Types.storageFieldToRaw SFFree
706 sfName = Types.storageFieldToRaw SFName
709 sfSize = Types.storageFieldToRaw SFSize
712 sfUsed = Types.storageFieldToRaw SFUsed
714 validStorageFields :: FrozenSet String
716 ConstantUtils.mkSet $ map Types.storageFieldToRaw [minBound..] ++
719 modifiableStorageFields :: Map String (FrozenSet String)
720 modifiableStorageFields =
721 Map.fromList [(Types.storageTypeToRaw StorageLvmPv,
722 ConstantUtils.mkSet [sfAllocatable])]
724 -- * Storage operations
726 soFixConsistency :: String
727 soFixConsistency = "fix-consistency"
729 validStorageOperations :: Map String (FrozenSet String)
730 validStorageOperations =
731 Map.fromList [(Types.storageTypeToRaw StorageLvmVg,
732 ConstantUtils.mkSet [soFixConsistency])]
740 vfInstance = "instance"
757 -- * Local disk status
760 ldsFaulty = Types.localDiskStatusToRaw DiskStatusFaulty
763 ldsOkay = Types.localDiskStatusToRaw DiskStatusOk
766 ldsUnknown = Types.localDiskStatusToRaw DiskStatusUnknown
768 ldsNames :: Map Int String
770 Map.fromList [ (Types.localDiskStatusToRaw ds,
771 localDiskStatusName ds) | ds <- [minBound..] ]
773 -- * Disk template types
776 dtDiskless = Types.diskTemplateToRaw DTDiskless
779 dtFile = Types.diskTemplateToRaw DTFile
781 dtSharedFile :: String
782 dtSharedFile = Types.diskTemplateToRaw DTSharedFile
785 dtPlain = Types.diskTemplateToRaw DTPlain
788 dtBlock = Types.diskTemplateToRaw DTBlock
791 dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
794 dtRbd = Types.diskTemplateToRaw DTRbd
797 dtExt = Types.diskTemplateToRaw DTExt
799 -- | This is used to order determine the default disk template when
800 -- the list of enabled disk templates is inferred from the current
801 -- state of the cluster. This only happens on an upgrade from a
802 -- version of Ganeti that did not support the 'enabled_disk_templates'
804 diskTemplatePreference :: [String]
805 diskTemplatePreference =
806 map Types.diskTemplateToRaw
807 [DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile]
809 diskTemplates :: FrozenSet String
810 diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
812 -- | Disk templates that are enabled by default
813 defaultEnabledDiskTemplates :: [String]
814 defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
816 -- | Mapping of disk templates to storage types
817 mapDiskTemplateStorageType :: Map String String
818 mapDiskTemplateStorageType =
820 map (Types.diskTemplateToRaw *** Types.storageTypeToRaw)
821 [(DTBlock, StorageBlock),
822 (DTDrbd8, StorageLvmVg),
824 (DTSharedFile, StorageFile),
825 (DTFile, StorageFile),
826 (DTDiskless, StorageDiskless),
827 (DTPlain, StorageLvmVg),
828 (DTRbd, StorageRados)]
830 -- | The set of network-mirrored disk templates
831 dtsIntMirror :: FrozenSet String
832 dtsIntMirror = ConstantUtils.mkSet [dtDrbd8]
834 -- | 'DTDiskless' is 'trivially' externally mirrored
835 dtsExtMirror :: FrozenSet String
837 ConstantUtils.mkSet $
838 map Types.diskTemplateToRaw [DTDiskless, DTBlock, DTExt, DTSharedFile, DTRbd]
840 -- | The set of non-lvm-based disk templates
841 dtsNotLvm :: FrozenSet String
843 ConstantUtils.mkSet $
844 map Types.diskTemplateToRaw
845 [DTSharedFile, DTDiskless, DTBlock, DTExt, DTFile, DTRbd]
847 -- | The set of disk templates which can be grown
848 dtsGrowable :: FrozenSet String
850 ConstantUtils.mkSet $
851 map Types.diskTemplateToRaw
852 [DTSharedFile, DTDrbd8, DTPlain, DTExt, DTFile, DTRbd]
854 -- | The set of disk templates that allow adoption
855 dtsMayAdopt :: FrozenSet String
857 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTBlock, DTPlain]
859 -- | The set of disk templates that *must* use adoption
860 dtsMustAdopt :: FrozenSet String
861 dtsMustAdopt = ConstantUtils.mkSet [Types.diskTemplateToRaw DTBlock]
863 -- | The set of disk templates that allow migrations
864 dtsMirrored :: FrozenSet String
865 dtsMirrored = dtsIntMirror `ConstantUtils.union` dtsExtMirror
867 -- | The set of file based disk templates
868 dtsFilebased :: FrozenSet String
870 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTSharedFile, DTFile]
872 -- | The set of disk templates that can be moved by copying
874 -- Note: a requirement is that they're not accessed externally or
875 -- shared between nodes; in particular, sharedfile is not suitable.
876 dtsCopyable :: FrozenSet String
878 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain, DTFile]
880 -- | The set of disk templates that are supported by exclusive_storage
881 dtsExclStorage :: FrozenSet String
882 dtsExclStorage = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain]
884 -- | Templates for which we don't perform checks on free space
885 dtsNoFreeSpaceCheck :: FrozenSet String
886 dtsNoFreeSpaceCheck =
887 ConstantUtils.mkSet $
888 map Types.diskTemplateToRaw [DTExt, DTSharedFile, DTFile, DTRbd]
890 dtsBlock :: FrozenSet String
892 ConstantUtils.mkSet $
893 map Types.diskTemplateToRaw [DTPlain, DTDrbd8, DTBlock, DTRbd, DTExt]
895 -- | The set of lvm-based disk templates
896 dtsLvm :: FrozenSet String
897 dtsLvm = diskTemplates `ConstantUtils.difference` dtsNotLvm
901 drbdHmacAlg :: String
904 drbdDefaultNetProtocol :: String
905 drbdDefaultNetProtocol = "C"
907 drbdMigrationNetProtocol :: String
908 drbdMigrationNetProtocol = "C"
910 drbdStatusFile :: String
911 drbdStatusFile = "/proc/drbd"
913 -- | Size of DRBD meta block device
917 -- * Drbd barrier types
919 drbdBDiskBarriers :: String
920 drbdBDiskBarriers = "b"
922 drbdBDiskDrain :: String
925 drbdBDiskFlush :: String
931 -- | Valid barrier combinations: "n" or any non-null subset of "bfd"
932 drbdValidBarrierOpt :: FrozenSet (FrozenSet String)
933 drbdValidBarrierOpt =
935 [ ConstantUtils.mkSet [drbdBNone]
936 , ConstantUtils.mkSet [drbdBDiskBarriers]
937 , ConstantUtils.mkSet [drbdBDiskDrain]
938 , ConstantUtils.mkSet [drbdBDiskFlush]
939 , ConstantUtils.mkSet [drbdBDiskDrain, drbdBDiskFlush]
940 , ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskDrain]
941 , ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskFlush]
942 , ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskFlush, drbdBDiskDrain]
945 -- | Rbd tool command
949 -- * File backend driver
952 fdBlktap = Types.fileDriverToRaw FileBlktap
955 fdLoop = Types.fileDriverToRaw FileLoop
957 fileDriver :: FrozenSet String
959 ConstantUtils.mkSet $
960 map Types.fileDriverToRaw [minBound..]
962 -- | The set of drbd-like disk types
963 dtsDrbd :: FrozenSet String
964 dtsDrbd = ConstantUtils.mkSet [Types.diskTemplateToRaw DTDrbd8]
966 -- * Disk access mode
969 diskRdonly = Types.diskModeToRaw DiskRdOnly
972 diskRdwr = Types.diskModeToRaw DiskRdWr
974 diskAccessSet :: FrozenSet String
975 diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..]
977 -- * Disk replacement mode
979 replaceDiskAuto :: String
980 replaceDiskAuto = Types.replaceDisksModeToRaw ReplaceAuto
982 replaceDiskChg :: String
983 replaceDiskChg = Types.replaceDisksModeToRaw ReplaceNewSecondary
985 replaceDiskPri :: String
986 replaceDiskPri = Types.replaceDisksModeToRaw ReplaceOnPrimary
988 replaceDiskSec :: String
989 replaceDiskSec = Types.replaceDisksModeToRaw ReplaceOnSecondary
991 replaceModes :: FrozenSet String
993 ConstantUtils.mkSet $ map Types.replaceDisksModeToRaw [minBound..]
995 -- * Instance export mode
997 exportModeLocal :: String
998 exportModeLocal = Types.exportModeToRaw ExportModeLocal
1000 exportModeRemote :: String
1001 exportModeRemote = Types.exportModeToRaw ExportModeRemote
1003 exportModes :: FrozenSet String
1004 exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
1006 -- * Instance creation modes
1008 instanceCreate :: String
1009 instanceCreate = Types.instCreateModeToRaw InstCreate
1011 instanceImport :: String
1012 instanceImport = Types.instCreateModeToRaw InstImport
1014 instanceRemoteImport :: String
1015 instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
1017 instanceCreateModes :: FrozenSet String
1018 instanceCreateModes =
1019 ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
1021 -- * Remote import/export handshake message and version
1023 rieHandshake :: String
1024 rieHandshake = "Hi, I'm Ganeti"
1029 -- | Remote import/export certificate validity in seconds
1030 rieCertValidity :: Int
1031 rieCertValidity = 24 * 60 * 60
1033 -- | Export only: how long to wait per connection attempt (seconds)
1034 rieConnectAttemptTimeout :: Int
1035 rieConnectAttemptTimeout = 20
1037 -- | Export only: number of attempts to connect
1038 rieConnectRetries :: Int
1039 rieConnectRetries = 10
1041 -- | Overall timeout for establishing connection
1042 rieConnectTimeout :: Int
1043 rieConnectTimeout = 180
1045 -- | Give child process up to 5 seconds to exit after sending a signal
1046 childLingerTimeout :: Double
1047 childLingerTimeout = 5.0
1049 -- * Import/export config options
1051 inisectBep :: String
1052 inisectBep = "backend"
1054 inisectExp :: String
1055 inisectExp = "export"
1057 inisectHyp :: String
1058 inisectHyp = "hypervisor"
1060 inisectIns :: String
1061 inisectIns = "instance"
1063 inisectOsp :: String
1066 -- * Dynamic device modification
1069 ddmAdd = Types.ddmFullToRaw DdmFullAdd
1072 ddmModify = Types.ddmFullToRaw DdmFullModify
1075 ddmRemove = Types.ddmFullToRaw DdmFullRemove
1077 ddmsValues :: FrozenSet String
1078 ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
1080 ddmsValuesWithModify :: FrozenSet String
1081 ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
1083 -- * Common exit codes
1089 exitFailure = ConstantUtils.exitFailure
1091 exitNotcluster :: Int
1094 exitNotmaster :: Int
1097 exitNodesetupError :: Int
1098 exitNodesetupError = 12
1100 -- | Need user confirmation
1101 exitConfirmation :: Int
1102 exitConfirmation = 13
1104 -- | Exit code for query operations with unknown fields
1105 exitUnknownField :: Int
1106 exitUnknownField = 14
1110 tagCluster :: String
1111 tagCluster = Types.tagKindToRaw TagKindCluster
1113 tagInstance :: String
1114 tagInstance = Types.tagKindToRaw TagKindInstance
1116 tagNetwork :: String
1117 tagNetwork = Types.tagKindToRaw TagKindNetwork
1120 tagNode = Types.tagKindToRaw TagKindNode
1122 tagNodegroup :: String
1123 tagNodegroup = Types.tagKindToRaw TagKindGroup
1125 validTagTypes :: FrozenSet String
1126 validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
1131 maxTagsPerObj :: Int
1132 maxTagsPerObj = 4096
1136 defaultBridge :: String
1137 defaultBridge = "xen-br0"
1139 defaultOvs :: String
1140 defaultOvs = "switch1"
1142 -- | 60 MiB, expressed in KiB
1143 classicDrbdSyncSpeed :: Int
1144 classicDrbdSyncSpeed = 60 * 1024
1146 ip4AddressAny :: String
1147 ip4AddressAny = "0.0.0.0"
1149 ip4AddressLocalhost :: String
1150 ip4AddressLocalhost = "127.0.0.1"
1152 ip6AddressAny :: String
1153 ip6AddressAny = "::"
1155 ip6AddressLocalhost :: String
1156 ip6AddressLocalhost = "::1"
1164 validIpVersions :: FrozenSet Int
1165 validIpVersions = ConstantUtils.mkSet [ip4Version, ip6Version]
1167 tcpPingTimeout :: Int
1173 defaultDrbdHelper :: String
1174 defaultDrbdHelper = "/bin/true"
1179 defaultMacPrefix :: String
1180 defaultMacPrefix = "aa:00:00"
1182 -- | Default maximum instance wait time, in seconds.
1183 defaultShutdownTimeout :: Int
1184 defaultShutdownTimeout = 120
1186 -- | Node clock skew in seconds
1187 nodeMaxClockSkew :: Int
1188 nodeMaxClockSkew = 150
1190 -- | Time for an intra-cluster disk transfer to wait for a connection
1191 diskTransferConnectTimeout :: Int
1192 diskTransferConnectTimeout = 60
1194 -- | Disk index separator
1195 diskSeparator :: String
1196 diskSeparator = AutoConf.diskSeparator
1198 ipCommandPath :: String
1199 ipCommandPath = AutoConf.ipPath
1201 -- | Key for job IDs in opcode result
1205 -- * Runparts results
1216 runpartsStatus :: [Int]
1217 runpartsStatus = [runpartsErr, runpartsRun, runpartsSkip]
1221 rpcEncodingNone :: Int
1224 rpcEncodingZlibBase64 :: Int
1225 rpcEncodingZlibBase64 = 1
1229 -- Various time constants for the timeout table
1232 rpcTmoUrgent = Types.rpcTimeoutToRaw Urgent
1235 rpcTmoFast = Types.rpcTimeoutToRaw Fast
1238 rpcTmoNormal = Types.rpcTimeoutToRaw Normal
1241 rpcTmoSlow = Types.rpcTimeoutToRaw Slow
1243 -- | 'rpcTmo_4hrs' contains an underscore to circumvent a limitation
1244 -- in the 'Ganeti.THH.deCamelCase' function and generate the correct
1247 rpcTmo_4hrs = Types.rpcTimeoutToRaw FourHours
1249 -- | 'rpcTmo_1day' contains an underscore to circumvent a limitation
1250 -- in the 'Ganeti.THH.deCamelCase' function and generate the correct
1253 rpcTmo_1day = Types.rpcTimeoutToRaw OneDay
1255 -- | Timeout for connecting to nodes (seconds)
1256 rpcConnectTimeout :: Int
1257 rpcConnectTimeout = 5
1261 osScriptCreate :: String
1262 osScriptCreate = "create"
1264 osScriptExport :: String
1265 osScriptExport = "export"
1267 osScriptImport :: String
1268 osScriptImport = "import"
1270 osScriptRename :: String
1271 osScriptRename = "rename"
1273 osScriptVerify :: String
1274 osScriptVerify = "verify"
1276 osScripts :: [String]
1277 osScripts = [osScriptCreate, osScriptExport, osScriptImport, osScriptRename,
1281 osApiFile = "ganeti_api_version"
1283 osVariantsFile :: String
1284 osVariantsFile = "variants.list"
1286 osParametersFile :: String
1287 osParametersFile = "parameters.list"
1289 osValidateParameters :: String
1290 osValidateParameters = "parameters"
1292 osValidateCalls :: FrozenSet String
1293 osValidateCalls = ConstantUtils.mkSet [osValidateParameters]
1295 -- | External Storage (ES) related constants
1297 esActionAttach :: String
1298 esActionAttach = "attach"
1300 esActionCreate :: String
1301 esActionCreate = "create"
1303 esActionDetach :: String
1304 esActionDetach = "detach"
1306 esActionGrow :: String
1307 esActionGrow = "grow"
1309 esActionRemove :: String
1310 esActionRemove = "remove"
1312 esActionSetinfo :: String
1313 esActionSetinfo = "setinfo"
1315 esActionVerify :: String
1316 esActionVerify = "verify"
1318 esScriptCreate :: String
1319 esScriptCreate = esActionCreate
1321 esScriptRemove :: String
1322 esScriptRemove = esActionRemove
1324 esScriptGrow :: String
1325 esScriptGrow = esActionGrow
1327 esScriptAttach :: String
1328 esScriptAttach = esActionAttach
1330 esScriptDetach :: String
1331 esScriptDetach = esActionDetach
1333 esScriptSetinfo :: String
1334 esScriptSetinfo = esActionSetinfo
1336 esScriptVerify :: String
1337 esScriptVerify = esActionVerify
1339 esScripts :: FrozenSet String
1341 ConstantUtils.mkSet [esScriptAttach,
1349 esParametersFile :: String
1350 esParametersFile = "parameters.list"
1354 instanceRebootSoft :: String
1355 instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
1357 instanceRebootHard :: String
1358 instanceRebootHard = Types.rebootTypeToRaw RebootHard
1360 instanceRebootFull :: String
1361 instanceRebootFull = Types.rebootTypeToRaw RebootFull
1363 rebootTypes :: FrozenSet String
1364 rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
1366 -- * Instance reboot behaviors
1368 instanceRebootAllowed :: String
1369 instanceRebootAllowed = "reboot"
1371 instanceRebootExit :: String
1372 instanceRebootExit = "exit"
1374 rebootBehaviors :: [String]
1375 rebootBehaviors = [instanceRebootAllowed, instanceRebootExit]
1380 vtypeBool = VTypeBool
1385 vtypeMaybeString :: VType
1386 vtypeMaybeString = VTypeMaybeString
1390 vtypeSize = VTypeSize
1392 vtypeString :: VType
1393 vtypeString = VTypeString
1395 enforceableTypes :: FrozenSet VType
1396 enforceableTypes = ConstantUtils.mkSet [minBound..]
1398 -- | Constant representing that the user does not specify any IP version
1399 ifaceNoIpVersionSpecified :: Int
1400 ifaceNoIpVersionSpecified = 0
1402 validSerialSpeeds :: [Int]
1423 -- * HV parameter names (global namespace)
1428 hvBlockdevPrefix :: String
1429 hvBlockdevPrefix = "blockdev_prefix"
1431 hvBootloaderArgs :: String
1432 hvBootloaderArgs = "bootloader_args"
1434 hvBootloaderPath :: String
1435 hvBootloaderPath = "bootloader_path"
1437 hvBootOrder :: String
1438 hvBootOrder = "boot_order"
1440 hvCdromImagePath :: String
1441 hvCdromImagePath = "cdrom_image_path"
1444 hvCpuCap = "cpu_cap"
1446 hvCpuCores :: String
1447 hvCpuCores = "cpu_cores"
1450 hvCpuMask = "cpu_mask"
1452 hvCpuSockets :: String
1453 hvCpuSockets = "cpu_sockets"
1455 hvCpuThreads :: String
1456 hvCpuThreads = "cpu_threads"
1459 hvCpuType = "cpu_type"
1461 hvCpuWeight :: String
1462 hvCpuWeight = "cpu_weight"
1464 hvDeviceModel :: String
1465 hvDeviceModel = "device_model"
1467 hvDiskCache :: String
1468 hvDiskCache = "disk_cache"
1470 hvDiskType :: String
1471 hvDiskType = "disk_type"
1473 hvInitrdPath :: String
1474 hvInitrdPath = "initrd_path"
1476 hvInitScript :: String
1477 hvInitScript = "init_script"
1479 hvKernelArgs :: String
1480 hvKernelArgs = "kernel_args"
1482 hvKernelPath :: String
1483 hvKernelPath = "kernel_path"
1488 hvKvmCdrom2ImagePath :: String
1489 hvKvmCdrom2ImagePath = "cdrom2_image_path"
1491 hvKvmCdromDiskType :: String
1492 hvKvmCdromDiskType = "cdrom_disk_type"
1494 hvKvmExtra :: String
1495 hvKvmExtra = "kvm_extra"
1498 hvKvmFlag = "kvm_flag"
1500 hvKvmFloppyImagePath :: String
1501 hvKvmFloppyImagePath = "floppy_image_path"
1503 hvKvmMachineVersion :: String
1504 hvKvmMachineVersion = "machine_version"
1507 hvKvmPath = "kvm_path"
1509 hvKvmSpiceAudioCompr :: String
1510 hvKvmSpiceAudioCompr = "spice_playback_compression"
1512 hvKvmSpiceBind :: String
1513 hvKvmSpiceBind = "spice_bind"
1515 hvKvmSpiceIpVersion :: String
1516 hvKvmSpiceIpVersion = "spice_ip_version"
1518 hvKvmSpiceJpegImgCompr :: String
1519 hvKvmSpiceJpegImgCompr = "spice_jpeg_wan_compression"
1521 hvKvmSpiceLosslessImgCompr :: String
1522 hvKvmSpiceLosslessImgCompr = "spice_image_compression"
1524 hvKvmSpicePasswordFile :: String
1525 hvKvmSpicePasswordFile = "spice_password_file"
1527 hvKvmSpiceStreamingVideoDetection :: String
1528 hvKvmSpiceStreamingVideoDetection = "spice_streaming_video"
1530 hvKvmSpiceTlsCiphers :: String
1531 hvKvmSpiceTlsCiphers = "spice_tls_ciphers"
1533 hvKvmSpiceUseTls :: String
1534 hvKvmSpiceUseTls = "spice_use_tls"
1536 hvKvmSpiceUseVdagent :: String
1537 hvKvmSpiceUseVdagent = "spice_use_vdagent"
1539 hvKvmSpiceZlibGlzImgCompr :: String
1540 hvKvmSpiceZlibGlzImgCompr = "spice_zlib_glz_wan_compression"
1542 hvKvmUseChroot :: String
1543 hvKvmUseChroot = "use_chroot"
1546 hvMemPath = "mem_path"
1548 hvMigrationBandwidth :: String
1549 hvMigrationBandwidth = "migration_bandwidth"
1551 hvMigrationDowntime :: String
1552 hvMigrationDowntime = "migration_downtime"
1554 hvMigrationMode :: String
1555 hvMigrationMode = "migration_mode"
1557 hvMigrationPort :: String
1558 hvMigrationPort = "migration_port"
1561 hvNicType = "nic_type"
1566 hvPassthrough :: String
1567 hvPassthrough = "pci_pass"
1569 hvRebootBehavior :: String
1570 hvRebootBehavior = "reboot_behavior"
1572 hvRootPath :: String
1573 hvRootPath = "root_path"
1575 hvSecurityDomain :: String
1576 hvSecurityDomain = "security_domain"
1578 hvSecurityModel :: String
1579 hvSecurityModel = "security_model"
1581 hvSerialConsole :: String
1582 hvSerialConsole = "serial_console"
1584 hvSerialSpeed :: String
1585 hvSerialSpeed = "serial_speed"
1588 hvSoundhw = "soundhw"
1590 hvUsbDevices :: String
1591 hvUsbDevices = "usb_devices"
1593 hvUsbMouse :: String
1594 hvUsbMouse = "usb_mouse"
1596 hvUseBootloader :: String
1597 hvUseBootloader = "use_bootloader"
1599 hvUseLocaltime :: String
1600 hvUseLocaltime = "use_localtime"
1605 hvVhostNet :: String
1606 hvVhostNet = "vhost_net"
1608 hvVifScript :: String
1609 hvVifScript = "vif_script"
1612 hvVifType = "vif_type"
1614 hvViridian :: String
1615 hvViridian = "viridian"
1617 hvVncBindAddress :: String
1618 hvVncBindAddress = "vnc_bind_address"
1620 hvVncPasswordFile :: String
1621 hvVncPasswordFile = "vnc_password_file"
1624 hvVncTls = "vnc_tls"
1627 hvVncX509 = "vnc_x509_path"
1629 hvVncX509Verify :: String
1630 hvVncX509Verify = "vnc_x509_verify"
1633 hvVnetHdr = "vnet_hdr"
1636 hvXenCmd = "xen_cmd"
1638 hvXenCpuid :: String
1639 hvXenCpuid = "cpuid"
1641 hvsParameterTitles :: Map String String
1642 hvsParameterTitles =
1645 (hvBootOrder, "Boot_order"),
1646 (hvCdromImagePath, "CDROM_image_path"),
1647 (hvCpuType, "cpu_type"),
1648 (hvDiskType, "Disk_type"),
1649 (hvInitrdPath, "Initrd_path"),
1650 (hvKernelPath, "Kernel_path"),
1651 (hvNicType, "NIC_type"),
1653 (hvPassthrough, "pci_pass"),
1654 (hvVncBindAddress, "VNC_bind_address")]
1656 -- * Migration statuses
1658 hvMigrationActive :: String
1659 hvMigrationActive = "active"
1661 hvMigrationCancelled :: String
1662 hvMigrationCancelled = "cancelled"
1664 hvMigrationCompleted :: String
1665 hvMigrationCompleted = "completed"
1667 hvMigrationFailed :: String
1668 hvMigrationFailed = "failed"
1670 hvMigrationValidStatuses :: FrozenSet String
1671 hvMigrationValidStatuses =
1672 ConstantUtils.mkSet [hvMigrationActive,
1673 hvMigrationCancelled,
1674 hvMigrationCompleted,
1677 hvMigrationFailedStatuses :: FrozenSet String
1678 hvMigrationFailedStatuses =
1679 ConstantUtils.mkSet [hvMigrationFailed, hvMigrationCancelled]
1681 -- | KVM-specific statuses
1683 -- FIXME: this constant seems unnecessary
1684 hvKvmMigrationValidStatuses :: FrozenSet String
1685 hvKvmMigrationValidStatuses = hvMigrationValidStatuses
1688 hvNodeinfoKeyVersion :: String
1689 hvNodeinfoKeyVersion = "hv_version"
1691 -- * Hypervisor state
1693 hvstCpuNode :: String
1694 hvstCpuNode = "cpu_node"
1696 hvstCpuTotal :: String
1697 hvstCpuTotal = "cpu_total"
1699 hvstMemoryHv :: String
1700 hvstMemoryHv = "mem_hv"
1702 hvstMemoryNode :: String
1703 hvstMemoryNode = "mem_node"
1705 hvstMemoryTotal :: String
1706 hvstMemoryTotal = "mem_total"
1708 hvstsParameters :: FrozenSet String
1710 ConstantUtils.mkSet [hvstCpuNode,
1716 hvstDefaults :: Map String Int
1722 (hvstMemoryTotal, 0),
1723 (hvstMemoryNode, 0)]
1725 hvstsParameterTypes :: Map String VType
1726 hvstsParameterTypes =
1727 Map.fromList [(hvstMemoryTotal, VTypeInt),
1728 (hvstMemoryNode, VTypeInt),
1729 (hvstMemoryHv, VTypeInt),
1730 (hvstCpuTotal, VTypeInt),
1731 (hvstCpuNode, VTypeInt)]
1735 dsDiskOverhead :: String
1736 dsDiskOverhead = "disk_overhead"
1738 dsDiskReserved :: String
1739 dsDiskReserved = "disk_reserved"
1741 dsDiskTotal :: String
1742 dsDiskTotal = "disk_total"
1744 dsDefaults :: Map String Int
1748 (dsDiskReserved, 0),
1749 (dsDiskOverhead, 0)]
1751 dssParameterTypes :: Map String VType
1753 Map.fromList [(dsDiskTotal, VTypeInt),
1754 (dsDiskReserved, VTypeInt),
1755 (dsDiskOverhead, VTypeInt)]
1757 dssParameters :: FrozenSet String
1759 ConstantUtils.mkSet [dsDiskTotal, dsDiskReserved, dsDiskOverhead]
1761 dsValidTypes :: FrozenSet String
1762 dsValidTypes = ConstantUtils.mkSet [Types.diskTemplateToRaw DTPlain]
1764 -- Backend parameter names
1766 beAlwaysFailover :: String
1767 beAlwaysFailover = "always_failover"
1769 beAutoBalance :: String
1770 beAutoBalance = "auto_balance"
1775 -- | Deprecated and replaced by max and min mem
1782 beSpindleUse :: String
1783 beSpindleUse = "spindle_use"
1788 besParameterTypes :: Map String VType
1790 Map.fromList [(beAlwaysFailover, VTypeBool),
1791 (beAutoBalance, VTypeBool),
1792 (beMaxmem, VTypeSize),
1793 (beMinmem, VTypeSize),
1794 (beSpindleUse, VTypeInt),
1795 (beVcpus, VTypeInt)]
1797 besParameterTitles :: Map String String
1798 besParameterTitles =
1799 Map.fromList [(beAutoBalance, "Auto_balance"),
1800 (beMinmem, "ConfigMinMem"),
1801 (beVcpus, "ConfigVCPUs"),
1802 (beMaxmem, "ConfigMaxMem")]
1804 besParameterCompat :: Map String VType
1805 besParameterCompat = Map.insert beMemory VTypeSize besParameterTypes
1807 besParameters :: FrozenSet String
1809 ConstantUtils.mkSet [beAlwaysFailover,
1818 -- FIXME: these should be associated with 'Ganeti.HTools.Types.ISpec'
1820 ispecMemSize :: String
1821 ispecMemSize = ConstantUtils.ispecMemSize
1823 ispecCpuCount :: String
1824 ispecCpuCount = ConstantUtils.ispecCpuCount
1826 ispecDiskCount :: String
1827 ispecDiskCount = ConstantUtils.ispecDiskCount
1829 ispecDiskSize :: String
1830 ispecDiskSize = ConstantUtils.ispecDiskSize
1832 ispecNicCount :: String
1833 ispecNicCount = ConstantUtils.ispecNicCount
1835 ispecSpindleUse :: String
1836 ispecSpindleUse = ConstantUtils.ispecSpindleUse
1838 ispecsParameterTypes :: Map String VType
1839 ispecsParameterTypes =
1841 [(ConstantUtils.ispecDiskSize, VTypeInt),
1842 (ConstantUtils.ispecCpuCount, VTypeInt),
1843 (ConstantUtils.ispecSpindleUse, VTypeInt),
1844 (ConstantUtils.ispecMemSize, VTypeInt),
1845 (ConstantUtils.ispecNicCount, VTypeInt),
1846 (ConstantUtils.ispecDiskCount, VTypeInt)]
1848 ispecsParameters :: FrozenSet String
1850 ConstantUtils.mkSet [ConstantUtils.ispecCpuCount,
1851 ConstantUtils.ispecDiskCount,
1852 ConstantUtils.ispecDiskSize,
1853 ConstantUtils.ispecMemSize,
1854 ConstantUtils.ispecNicCount,
1855 ConstantUtils.ispecSpindleUse]
1857 ispecsMinmax :: String
1858 ispecsMinmax = ConstantUtils.ispecsMinmax
1867 ispecsStd = ConstantUtils.ispecsStd
1869 ipolicyDts :: String
1870 ipolicyDts = ConstantUtils.ipolicyDts
1872 ipolicyVcpuRatio :: String
1873 ipolicyVcpuRatio = ConstantUtils.ipolicyVcpuRatio
1875 ipolicySpindleRatio :: String
1876 ipolicySpindleRatio = ConstantUtils.ipolicySpindleRatio
1878 ispecsMinmaxKeys :: FrozenSet String
1879 ispecsMinmaxKeys = ConstantUtils.mkSet [ispecsMax, ispecsMin]
1881 ipolicyParameters :: FrozenSet String
1883 ConstantUtils.mkSet [ConstantUtils.ipolicyVcpuRatio,
1884 ConstantUtils.ipolicySpindleRatio]
1886 ipolicyAllKeys :: FrozenSet String
1888 ConstantUtils.union ipolicyParameters $
1889 ConstantUtils.mkSet [ConstantUtils.ipolicyDts,
1890 ConstantUtils.ispecsMinmax,
1893 -- | Node parameter names
1895 ndExclusiveStorage :: String
1896 ndExclusiveStorage = "exclusive_storage"
1898 ndOobProgram :: String
1899 ndOobProgram = "oob_program"
1901 ndSpindleCount :: String
1902 ndSpindleCount = "spindle_count"
1908 ndOvsLink = "ovs_link"
1911 ndOvsName = "ovs_name"
1913 ndsParameterTypes :: Map String VType
1916 [(ndExclusiveStorage, VTypeBool),
1917 (ndOobProgram, VTypeString),
1919 (ndOvsLink, VTypeMaybeString),
1920 (ndOvsName, VTypeMaybeString),
1921 (ndSpindleCount, VTypeInt)]
1923 ndsParameters :: FrozenSet String
1924 ndsParameters = ConstantUtils.mkSet (Map.keys ndsParameterTypes)
1926 ndsParameterTitles :: Map String String
1927 ndsParameterTitles =
1929 [(ndExclusiveStorage, "ExclusiveStorage"),
1930 (ndOobProgram, "OutOfBandProgram"),
1931 (ndOvs, "OpenvSwitch"),
1932 (ndOvsLink, "OpenvSwitchLink"),
1933 (ndOvsName, "OpenvSwitchName"),
1934 (ndSpindleCount, "SpindleCount")]
1936 -- * Logical Disks parameters
1939 ldpAccess = "access"
1941 ldpBarriers :: String
1942 ldpBarriers = "disabled-barriers"
1944 ldpDefaultMetavg :: String
1945 ldpDefaultMetavg = "default-metavg"
1947 ldpDelayTarget :: String
1948 ldpDelayTarget = "c-delay-target"
1950 ldpDiskCustom :: String
1951 ldpDiskCustom = "disk-custom"
1953 ldpDynamicResync :: String
1954 ldpDynamicResync = "dynamic-resync"
1956 ldpFillTarget :: String
1957 ldpFillTarget = "c-fill-target"
1959 ldpMaxRate :: String
1960 ldpMaxRate = "c-max-rate"
1962 ldpMinRate :: String
1963 ldpMinRate = "c-min-rate"
1965 ldpNetCustom :: String
1966 ldpNetCustom = "net-custom"
1968 ldpNoMetaFlush :: String
1969 ldpNoMetaFlush = "disable-meta-flush"
1971 ldpPlanAhead :: String
1972 ldpPlanAhead = "c-plan-ahead"
1977 ldpProtocol :: String
1978 ldpProtocol = "protocol"
1980 ldpResyncRate :: String
1981 ldpResyncRate = "resync-rate"
1983 ldpStripes :: String
1984 ldpStripes = "stripes"
1986 diskLdTypes :: Map String VType
1989 [(ldpAccess, VTypeString),
1990 (ldpResyncRate, VTypeInt),
1991 (ldpStripes, VTypeInt),
1992 (ldpBarriers, VTypeString),
1993 (ldpNoMetaFlush, VTypeBool),
1994 (ldpDefaultMetavg, VTypeString),
1995 (ldpDiskCustom, VTypeString),
1996 (ldpNetCustom, VTypeString),
1997 (ldpProtocol, VTypeString),
1998 (ldpDynamicResync, VTypeBool),
1999 (ldpPlanAhead, VTypeInt),
2000 (ldpFillTarget, VTypeInt),
2001 (ldpDelayTarget, VTypeInt),
2002 (ldpMaxRate, VTypeInt),
2003 (ldpMinRate, VTypeInt),
2004 (ldpPool, VTypeString)]
2006 diskLdParameters :: FrozenSet String
2007 diskLdParameters = ConstantUtils.mkSet (Map.keys diskLdTypes)
2009 -- * Disk template parameters
2011 -- Disk template parameters can be set/changed by the user via
2012 -- gnt-cluster and gnt-group)
2014 drbdResyncRate :: String
2015 drbdResyncRate = "resync-rate"
2017 drbdDataStripes :: String
2018 drbdDataStripes = "data-stripes"
2020 drbdMetaStripes :: String
2021 drbdMetaStripes = "meta-stripes"
2023 drbdDiskBarriers :: String
2024 drbdDiskBarriers = "disk-barriers"
2026 drbdMetaBarriers :: String
2027 drbdMetaBarriers = "meta-barriers"
2029 drbdDefaultMetavg :: String
2030 drbdDefaultMetavg = "metavg"
2032 drbdDiskCustom :: String
2033 drbdDiskCustom = "disk-custom"
2035 drbdNetCustom :: String
2036 drbdNetCustom = "net-custom"
2038 drbdProtocol :: String
2039 drbdProtocol = "protocol"
2041 drbdDynamicResync :: String
2042 drbdDynamicResync = "dynamic-resync"
2044 drbdPlanAhead :: String
2045 drbdPlanAhead = "c-plan-ahead"
2047 drbdFillTarget :: String
2048 drbdFillTarget = "c-fill-target"
2050 drbdDelayTarget :: String
2051 drbdDelayTarget = "c-delay-target"
2053 drbdMaxRate :: String
2054 drbdMaxRate = "c-max-rate"
2056 drbdMinRate :: String
2057 drbdMinRate = "c-min-rate"
2060 lvStripes = "stripes"
2063 rbdAccess = "access"
2068 diskDtTypes :: Map String VType
2070 Map.fromList [(drbdResyncRate, VTypeInt),
2071 (drbdDataStripes, VTypeInt),
2072 (drbdMetaStripes, VTypeInt),
2073 (drbdDiskBarriers, VTypeString),
2074 (drbdMetaBarriers, VTypeBool),
2075 (drbdDefaultMetavg, VTypeString),
2076 (drbdDiskCustom, VTypeString),
2077 (drbdNetCustom, VTypeString),
2078 (drbdProtocol, VTypeString),
2079 (drbdDynamicResync, VTypeBool),
2080 (drbdPlanAhead, VTypeInt),
2081 (drbdFillTarget, VTypeInt),
2082 (drbdDelayTarget, VTypeInt),
2083 (drbdMaxRate, VTypeInt),
2084 (drbdMinRate, VTypeInt),
2085 (lvStripes, VTypeInt),
2086 (rbdAccess, VTypeString),
2087 (rbdPool, VTypeString)]
2089 diskDtParameters :: FrozenSet String
2090 diskDtParameters = ConstantUtils.mkSet (Map.keys diskDtTypes)
2092 -- * Dynamic disk parameters
2094 ddpLocalIp :: String
2095 ddpLocalIp = "local-ip"
2097 ddpRemoteIp :: String
2098 ddpRemoteIp = "remote-ip"
2103 ddpLocalMinor :: String
2104 ddpLocalMinor = "local-minor"
2106 ddpRemoteMinor :: String
2107 ddpRemoteMinor = "remote-minor"
2109 -- * OOB supported commands
2111 oobPowerOn :: String
2112 oobPowerOn = Types.oobCommandToRaw OobPowerOn
2114 oobPowerOff :: String
2115 oobPowerOff = Types.oobCommandToRaw OobPowerOff
2117 oobPowerCycle :: String
2118 oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
2120 oobPowerStatus :: String
2121 oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
2124 oobHealth = Types.oobCommandToRaw OobHealth
2126 oobCommands :: FrozenSet String
2127 oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
2129 oobPowerStatusPowered :: String
2130 oobPowerStatusPowered = "powered"
2137 oobPowerDelay :: Double
2140 oobStatusCritical :: String
2141 oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
2143 oobStatusOk :: String
2144 oobStatusOk = Types.oobStatusToRaw OobStatusOk
2146 oobStatusUnknown :: String
2147 oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
2149 oobStatusWarning :: String
2150 oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
2152 oobStatuses :: FrozenSet String
2153 oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
2155 -- | Instance Parameters Profile
2157 ppDefault = "default"
2159 -- * nic* constants are used inside the ganeti config
2170 nicsParameterTypes :: Map String VType
2171 nicsParameterTypes =
2172 Map.fromList [(nicMode, vtypeString),
2173 (nicLink, vtypeString),
2174 (nicVlan, vtypeMaybeString)]
2176 nicsParameters :: FrozenSet String
2177 nicsParameters = ConstantUtils.mkSet (Map.keys nicsParameterTypes)
2179 nicModeBridged :: String
2180 nicModeBridged = Types.nICModeToRaw NMBridged
2182 nicModeRouted :: String
2183 nicModeRouted = Types.nICModeToRaw NMRouted
2185 nicModeOvs :: String
2186 nicModeOvs = Types.nICModeToRaw NMOvs
2189 nicIpPool = Types.nICModeToRaw NMPool
2191 nicValidModes :: FrozenSet String
2192 nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
2194 releaseAction :: String
2195 releaseAction = "release"
2197 reserveAction :: String
2198 reserveAction = "reserve"
2200 -- * idisk* constants are used in opcodes, to create/change disks
2202 idiskAdopt :: String
2203 idiskAdopt = "adopt"
2205 idiskMetavg :: String
2206 idiskMetavg = "metavg"
2217 idiskSpindles :: String
2218 idiskSpindles = "spindles"
2223 idiskProvider :: String
2224 idiskProvider = "provider"
2226 idiskParamsTypes :: Map String VType
2228 Map.fromList [(idiskSize, VTypeSize),
2229 (idiskSpindles, VTypeInt),
2230 (idiskMode, VTypeString),
2231 (idiskAdopt, VTypeString),
2232 (idiskVg, VTypeString),
2233 (idiskMetavg, VTypeString),
2234 (idiskProvider, VTypeString),
2235 (idiskName, VTypeMaybeString)]
2237 idiskParams :: FrozenSet String
2238 idiskParams = ConstantUtils.mkSet (Map.keys idiskParamsTypes)
2240 -- * inic* constants are used in opcodes, to create/change nics
2242 inicBridge :: String
2243 inicBridge = "bridge"
2260 inicNetwork :: String
2261 inicNetwork = "network"
2266 inicParamsTypes :: Map String VType
2268 Map.fromList [(inicBridge, VTypeMaybeString),
2269 (inicIp, VTypeMaybeString),
2270 (inicLink, VTypeString),
2271 (inicMac, VTypeString),
2272 (inicMode, VTypeString),
2273 (inicName, VTypeMaybeString),
2274 (inicNetwork, VTypeMaybeString),
2275 (inicVlan, VTypeMaybeString)]
2277 inicParams :: FrozenSet String
2278 inicParams = ConstantUtils.mkSet (Map.keys inicParamsTypes)
2280 -- * Hypervisor constants
2283 htXenPvm = Types.hypervisorToRaw XenPvm
2286 htFake = Types.hypervisorToRaw Fake
2289 htXenHvm = Types.hypervisorToRaw XenHvm
2292 htKvm = Types.hypervisorToRaw Kvm
2295 htChroot = Types.hypervisorToRaw Chroot
2298 htLxc = Types.hypervisorToRaw Lxc
2300 hyperTypes :: FrozenSet String
2301 hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
2303 htsReqPort :: FrozenSet String
2304 htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
2309 vncDefaultBindAddress :: String
2310 vncDefaultBindAddress = ip4AddressAny
2314 htNicE1000 :: String
2315 htNicE1000 = "e1000"
2317 htNicI82551 :: String
2318 htNicI82551 = "i82551"
2320 htNicI8259er :: String
2321 htNicI8259er = "i82559er"
2323 htNicI85557b :: String
2324 htNicI85557b = "i82557b"
2326 htNicNe2kIsa :: String
2327 htNicNe2kIsa = "ne2k_isa"
2329 htNicNe2kPci :: String
2330 htNicNe2kPci = "ne2k_pci"
2332 htNicParavirtual :: String
2333 htNicParavirtual = "paravirtual"
2335 htNicPcnet :: String
2336 htNicPcnet = "pcnet"
2338 htNicRtl8139 :: String
2339 htNicRtl8139 = "rtl8139"
2341 htHvmValidNicTypes :: FrozenSet String
2342 htHvmValidNicTypes =
2343 ConstantUtils.mkSet [htNicE1000,
2349 htKvmValidNicTypes :: FrozenSet String
2350 htKvmValidNicTypes =
2351 ConstantUtils.mkSet [htNicE1000,
2363 -- | Default vif type in xen-hvm
2364 htHvmVifIoemu :: String
2365 htHvmVifIoemu = "ioemu"
2367 htHvmVifVif :: String
2370 htHvmValidVifTypes :: FrozenSet String
2371 htHvmValidVifTypes = ConstantUtils.mkSet [htHvmVifIoemu, htHvmVifVif]
2378 htDiskIoemu :: String
2379 htDiskIoemu = "ioemu"
2384 htDiskParavirtual :: String
2385 htDiskParavirtual = "paravirtual"
2387 htDiskPflash :: String
2388 htDiskPflash = "pflash"
2390 htDiskScsi :: String
2396 htHvmValidDiskTypes :: FrozenSet String
2397 htHvmValidDiskTypes = ConstantUtils.mkSet [htDiskIoemu, htDiskParavirtual]
2399 htKvmValidDiskTypes :: FrozenSet String
2400 htKvmValidDiskTypes =
2401 ConstantUtils.mkSet [htDiskIde,
2408 htCacheDefault :: String
2409 htCacheDefault = "default"
2411 htCacheNone :: String
2412 htCacheNone = "none"
2414 htCacheWback :: String
2415 htCacheWback = "writeback"
2417 htCacheWthrough :: String
2418 htCacheWthrough = "writethrough"
2420 htValidCacheTypes :: FrozenSet String
2422 ConstantUtils.mkSet [htCacheDefault,
2429 htMouseMouse :: String
2430 htMouseMouse = "mouse"
2432 htMouseTablet :: String
2433 htMouseTablet = "tablet"
2435 htKvmValidMouseTypes :: FrozenSet String
2436 htKvmValidMouseTypes = ConstantUtils.mkSet [htMouseMouse, htMouseTablet]
2446 htBoFloppy :: String
2447 htBoFloppy = "floppy"
2449 htBoNetwork :: String
2450 htBoNetwork = "network"
2452 htKvmValidBoTypes :: FrozenSet String
2454 ConstantUtils.mkSet [htBoCdrom, htBoDisk, htBoFloppy, htBoNetwork]
2456 -- * SPICE lossless image compression options
2458 htKvmSpiceLosslessImgComprAutoGlz :: String
2459 htKvmSpiceLosslessImgComprAutoGlz = "auto_glz"
2461 htKvmSpiceLosslessImgComprAutoLz :: String
2462 htKvmSpiceLosslessImgComprAutoLz = "auto_lz"
2464 htKvmSpiceLosslessImgComprGlz :: String
2465 htKvmSpiceLosslessImgComprGlz = "glz"
2467 htKvmSpiceLosslessImgComprLz :: String
2468 htKvmSpiceLosslessImgComprLz = "lz"
2470 htKvmSpiceLosslessImgComprOff :: String
2471 htKvmSpiceLosslessImgComprOff = "off"
2473 htKvmSpiceLosslessImgComprQuic :: String
2474 htKvmSpiceLosslessImgComprQuic = "quic"
2476 htKvmSpiceValidLosslessImgComprOptions :: FrozenSet String
2477 htKvmSpiceValidLosslessImgComprOptions =
2478 ConstantUtils.mkSet [htKvmSpiceLosslessImgComprAutoGlz,
2479 htKvmSpiceLosslessImgComprAutoLz,
2480 htKvmSpiceLosslessImgComprGlz,
2481 htKvmSpiceLosslessImgComprLz,
2482 htKvmSpiceLosslessImgComprOff,
2483 htKvmSpiceLosslessImgComprQuic]
2485 htKvmSpiceLossyImgComprAlways :: String
2486 htKvmSpiceLossyImgComprAlways = "always"
2488 htKvmSpiceLossyImgComprAuto :: String
2489 htKvmSpiceLossyImgComprAuto = "auto"
2491 htKvmSpiceLossyImgComprNever :: String
2492 htKvmSpiceLossyImgComprNever = "never"
2494 htKvmSpiceValidLossyImgComprOptions :: FrozenSet String
2495 htKvmSpiceValidLossyImgComprOptions =
2496 ConstantUtils.mkSet [htKvmSpiceLossyImgComprAlways,
2497 htKvmSpiceLossyImgComprAuto,
2498 htKvmSpiceLossyImgComprNever]
2500 -- * SPICE video stream detection
2502 htKvmSpiceVideoStreamDetectionAll :: String
2503 htKvmSpiceVideoStreamDetectionAll = "all"
2505 htKvmSpiceVideoStreamDetectionFilter :: String
2506 htKvmSpiceVideoStreamDetectionFilter = "filter"
2508 htKvmSpiceVideoStreamDetectionOff :: String
2509 htKvmSpiceVideoStreamDetectionOff = "off"
2511 htKvmSpiceValidVideoStreamDetectionOptions :: FrozenSet String
2512 htKvmSpiceValidVideoStreamDetectionOptions =
2513 ConstantUtils.mkSet [htKvmSpiceVideoStreamDetectionAll,
2514 htKvmSpiceVideoStreamDetectionFilter,
2515 htKvmSpiceVideoStreamDetectionOff]
2517 -- * Security models
2528 htKvmValidSmTypes :: FrozenSet String
2529 htKvmValidSmTypes = ConstantUtils.mkSet [htSmNone, htSmPool, htSmUser]
2531 -- * Kvm flag values
2533 htKvmDisabled :: String
2534 htKvmDisabled = "disabled"
2536 htKvmEnabled :: String
2537 htKvmEnabled = "enabled"
2539 htKvmFlagValues :: FrozenSet String
2540 htKvmFlagValues = ConstantUtils.mkSet [htKvmDisabled, htKvmEnabled]
2544 htMigrationLive :: String
2545 htMigrationLive = Types.migrationModeToRaw MigrationLive
2547 htMigrationNonlive :: String
2548 htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
2550 htMigrationModes :: FrozenSet String
2552 ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
2554 -- * Cluster verify steps
2556 verifyNplusoneMem :: String
2557 verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
2559 verifyOptionalChecks :: FrozenSet String
2560 verifyOptionalChecks =
2561 ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
2563 -- * Cluster Verify error classes
2565 cvTcluster :: String
2566 cvTcluster = "cluster"
2574 cvTinstance :: String
2575 cvTinstance = "instance"
2577 -- * Cluster Verify error codes and documentation
2579 cvEclustercert :: (String, String, String)
2582 Types.cVErrorCodeToRaw CvECLUSTERCERT,
2583 "Cluster certificate files verification failure")
2585 cvEclustercfg :: (String, String, String)
2588 Types.cVErrorCodeToRaw CvECLUSTERCFG,
2589 "Cluster configuration verification failure")
2591 cvEclusterdanglinginst :: (String, String, String)
2592 cvEclusterdanglinginst =
2594 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
2595 "Some instances have a non-existing primary node")
2597 cvEclusterdanglingnodes :: (String, String, String)
2598 cvEclusterdanglingnodes =
2600 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
2601 "Some nodes belong to non-existing groups")
2603 cvEclusterfilecheck :: (String, String, String)
2604 cvEclusterfilecheck =
2606 Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
2607 "Cluster configuration verification failure")
2609 cvEgroupdifferentpvsize :: (String, String, String)
2610 cvEgroupdifferentpvsize =
2612 Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
2613 "PVs in the group have different sizes")
2615 cvEinstancebadnode :: (String, String, String)
2616 cvEinstancebadnode =
2618 Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
2619 "Instance marked as running lives on an offline node")
2621 cvEinstancedown :: (String, String, String)
2624 Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
2625 "Instance not running on its primary node")
2627 cvEinstancefaultydisk :: (String, String, String)
2628 cvEinstancefaultydisk =
2630 Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
2631 "Impossible to retrieve status for a disk")
2633 cvEinstancelayout :: (String, String, String)
2636 Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
2637 "Instance has multiple secondary nodes")
2639 cvEinstancemissingcfgparameter :: (String, String, String)
2640 cvEinstancemissingcfgparameter =
2642 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
2643 "A configuration parameter for an instance is missing")
2645 cvEinstancemissingdisk :: (String, String, String)
2646 cvEinstancemissingdisk =
2648 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
2649 "Missing volume on an instance")
2651 cvEinstancepolicy :: (String, String, String)
2654 Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
2655 "Instance does not meet policy")
2657 cvEinstancesplitgroups :: (String, String, String)
2658 cvEinstancesplitgroups =
2660 Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
2661 "Instance with primary and secondary nodes in different groups")
2663 cvEinstanceunsuitablenode :: (String, String, String)
2664 cvEinstanceunsuitablenode =
2666 Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
2667 "Instance running on nodes that are not suitable for it")
2669 cvEinstancewrongnode :: (String, String, String)
2670 cvEinstancewrongnode =
2672 Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
2673 "Instance running on the wrong node")
2675 cvEnodedrbd :: (String, String, String)
2678 Types.cVErrorCodeToRaw CvENODEDRBD,
2679 "Error parsing the DRBD status file")
2681 cvEnodedrbdhelper :: (String, String, String)
2684 Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
2685 "Error caused by the DRBD helper")
2687 cvEnodedrbdversion :: (String, String, String)
2688 cvEnodedrbdversion =
2690 Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
2691 "DRBD version mismatch within a node group")
2693 cvEnodefilecheck :: (String, String, String)
2696 Types.cVErrorCodeToRaw CvENODEFILECHECK,
2697 "Error retrieving the checksum of the node files")
2699 cvEnodefilestoragepaths :: (String, String, String)
2700 cvEnodefilestoragepaths =
2702 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
2703 "Detected bad file storage paths")
2705 cvEnodefilestoragepathunusable :: (String, String, String)
2706 cvEnodefilestoragepathunusable =
2708 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
2709 "File storage path unusable")
2711 cvEnodehooks :: (String, String, String)
2714 Types.cVErrorCodeToRaw CvENODEHOOKS,
2715 "Communication failure in hooks execution")
2717 cvEnodehv :: (String, String, String)
2720 Types.cVErrorCodeToRaw CvENODEHV,
2721 "Hypervisor parameters verification failure")
2723 cvEnodelvm :: (String, String, String)
2726 Types.cVErrorCodeToRaw CvENODELVM,
2727 "LVM-related node error")
2729 cvEnoden1 :: (String, String, String)
2732 Types.cVErrorCodeToRaw CvENODEN1,
2733 "Not enough memory to accommodate instance failovers")
2735 cvEnodenet :: (String, String, String)
2738 Types.cVErrorCodeToRaw CvENODENET,
2739 "Network-related node error")
2741 cvEnodeoobpath :: (String, String, String)
2744 Types.cVErrorCodeToRaw CvENODEOOBPATH,
2745 "Invalid Out Of Band path")
2747 cvEnodeorphaninstance :: (String, String, String)
2748 cvEnodeorphaninstance =
2750 Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
2751 "Unknown intance running on a node")
2753 cvEnodeorphanlv :: (String, String, String)
2756 Types.cVErrorCodeToRaw CvENODEORPHANLV,
2757 "Unknown LVM logical volume")
2759 cvEnodeos :: (String, String, String)
2762 Types.cVErrorCodeToRaw CvENODEOS,
2763 "OS-related node error")
2765 cvEnoderpc :: (String, String, String)
2768 Types.cVErrorCodeToRaw CvENODERPC,
2769 "Error during connection to the primary node of an instance")
2771 cvEnodesetup :: (String, String, String)
2774 Types.cVErrorCodeToRaw CvENODESETUP,
2777 cvEnodesharedfilestoragepathunusable :: (String, String, String)
2778 cvEnodesharedfilestoragepathunusable =
2780 Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
2781 "Shared file storage path unusable")
2783 cvEnodessh :: (String, String, String)
2786 Types.cVErrorCodeToRaw CvENODESSH,
2787 "SSH-related node error")
2789 cvEnodetime :: (String, String, String)
2792 Types.cVErrorCodeToRaw CvENODETIME,
2793 "Node returned invalid time")
2795 cvEnodeuserscripts :: (String, String, String)
2796 cvEnodeuserscripts =
2798 Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
2799 "User scripts not present or not executable")
2801 cvEnodeversion :: (String, String, String)
2804 Types.cVErrorCodeToRaw CvENODEVERSION,
2805 "Protocol version mismatch or Ganeti version mismatch")
2807 cvAllEcodes :: FrozenSet (String, String, String)
2812 cvEclusterdanglinginst,
2813 cvEclusterdanglingnodes,
2814 cvEclusterfilecheck,
2815 cvEgroupdifferentpvsize,
2818 cvEinstancefaultydisk,
2820 cvEinstancemissingcfgparameter,
2821 cvEinstancemissingdisk,
2823 cvEinstancesplitgroups,
2824 cvEinstanceunsuitablenode,
2825 cvEinstancewrongnode,
2830 cvEnodefilestoragepaths,
2831 cvEnodefilestoragepathunusable,
2838 cvEnodeorphaninstance,
2843 cvEnodesharedfilestoragepathunusable,
2849 cvAllEcodesStrings :: FrozenSet String
2850 cvAllEcodesStrings =
2851 ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
2853 -- * Node verify constants
2856 nvBridges = "bridges"
2858 nvDrbdhelper :: String
2859 nvDrbdhelper = "drbd-helper"
2861 nvDrbdversion :: String
2862 nvDrbdversion = "drbd-version"
2864 nvDrbdlist :: String
2865 nvDrbdlist = "drbd-list"
2867 nvExclusivepvs :: String
2868 nvExclusivepvs = "exclusive-pvs"
2870 nvFilelist :: String
2871 nvFilelist = "filelist"
2873 nvAcceptedStoragePaths :: String
2874 nvAcceptedStoragePaths = "allowed-file-storage-paths"
2876 nvFileStoragePath :: String
2877 nvFileStoragePath = "file-storage-path"
2879 nvSharedFileStoragePath :: String
2880 nvSharedFileStoragePath = "shared-file-storage-path"
2885 nvHvparams :: String
2886 nvHvparams = "hvparms"
2888 nvHypervisor :: String
2889 nvHypervisor = "hypervisor"
2891 nvInstancelist :: String
2892 nvInstancelist = "instancelist"
2897 nvMasterip :: String
2898 nvMasterip = "master-ip"
2900 nvNodelist :: String
2901 nvNodelist = "nodelist"
2903 nvNodenettest :: String
2904 nvNodenettest = "node-net-test"
2906 nvNodesetup :: String
2907 nvNodesetup = "nodesetup"
2909 nvOobPaths :: String
2910 nvOobPaths = "oob-paths"
2921 nvUserscripts :: String
2922 nvUserscripts = "user-scripts"
2925 nvVersion = "version"
2931 nvVmnodes = "vmnodes"
2933 -- * Instance status
2935 inststAdmindown :: String
2936 inststAdmindown = Types.instanceStatusToRaw StatusDown
2938 inststAdminoffline :: String
2939 inststAdminoffline = Types.instanceStatusToRaw StatusOffline
2941 inststErrordown :: String
2942 inststErrordown = Types.instanceStatusToRaw ErrorDown
2944 inststErrorup :: String
2945 inststErrorup = Types.instanceStatusToRaw ErrorUp
2947 inststNodedown :: String
2948 inststNodedown = Types.instanceStatusToRaw NodeDown
2950 inststNodeoffline :: String
2951 inststNodeoffline = Types.instanceStatusToRaw NodeOffline
2953 inststRunning :: String
2954 inststRunning = Types.instanceStatusToRaw Running
2956 inststWrongnode :: String
2957 inststWrongnode = Types.instanceStatusToRaw WrongNode
2959 inststAll :: FrozenSet String
2960 inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
2964 adminstDown :: String
2965 adminstDown = Types.adminStateToRaw AdminDown
2967 adminstOffline :: String
2968 adminstOffline = Types.adminStateToRaw AdminOffline
2971 adminstUp = Types.adminStateToRaw AdminUp
2973 adminstAll :: FrozenSet String
2974 adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
2979 nrDrained = Types.nodeRoleToRaw NRDrained
2982 nrMaster = Types.nodeRoleToRaw NRMaster
2984 nrMcandidate :: String
2985 nrMcandidate = Types.nodeRoleToRaw NRCandidate
2988 nrOffline = Types.nodeRoleToRaw NROffline
2991 nrRegular = Types.nodeRoleToRaw NRRegular
2993 nrAll :: FrozenSet String
2994 nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
2996 -- * SSL certificate check constants (in days)
2998 sslCertExpirationError :: Int
2999 sslCertExpirationError = 7
3001 sslCertExpirationWarn :: Int
3002 sslCertExpirationWarn = 30
3004 -- * Allocator framework constants
3006 iallocatorVersion :: Int
3007 iallocatorVersion = 2
3009 iallocatorDirIn :: String
3010 iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
3012 iallocatorDirOut :: String
3013 iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
3015 validIallocatorDirections :: FrozenSet String
3016 validIallocatorDirections =
3017 ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
3019 iallocatorModeAlloc :: String
3020 iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
3022 iallocatorModeChgGroup :: String
3023 iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
3025 iallocatorModeMultiAlloc :: String
3026 iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
3028 iallocatorModeNodeEvac :: String
3029 iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
3031 iallocatorModeReloc :: String
3032 iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
3034 validIallocatorModes :: FrozenSet String
3035 validIallocatorModes =
3036 ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
3038 iallocatorSearchPath :: [String]
3039 iallocatorSearchPath = AutoConf.iallocatorSearchPath
3041 defaultIallocatorShortcut :: String
3042 defaultIallocatorShortcut = "."
3044 -- * Node evacuation
3046 nodeEvacPri :: String
3047 nodeEvacPri = Types.evacModeToRaw ChangePrimary
3049 nodeEvacSec :: String
3050 nodeEvacSec = Types.evacModeToRaw ChangeSecondary
3052 nodeEvacAll :: String
3053 nodeEvacAll = Types.evacModeToRaw ChangeAll
3055 nodeEvacModes :: FrozenSet String
3056 nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..]
3060 jobQueueVersion :: Int
3063 jobQueueSizeHardLimit :: Int
3064 jobQueueSizeHardLimit = 5000
3066 jobQueueFilesPerms :: Int
3067 jobQueueFilesPerms = 0o640
3069 -- * Unchanged job return
3071 jobNotchanged :: String
3072 jobNotchanged = "nochange"
3076 jobStatusQueued :: String
3077 jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
3079 jobStatusWaiting :: String
3080 jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
3082 jobStatusCanceling :: String
3083 jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
3085 jobStatusRunning :: String
3086 jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
3088 jobStatusCanceled :: String
3089 jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
3091 jobStatusSuccess :: String
3092 jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
3094 jobStatusError :: String
3095 jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
3097 jobsPending :: FrozenSet String
3099 ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
3101 jobsFinalized :: FrozenSet String
3103 ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
3105 jobStatusAll :: FrozenSet String
3106 jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
3110 -- ** Not yet finalized opcodes
3112 opStatusCanceling :: String
3113 opStatusCanceling = "canceling"
3115 opStatusQueued :: String
3116 opStatusQueued = "queued"
3118 opStatusRunning :: String
3119 opStatusRunning = "running"
3121 opStatusWaiting :: String
3122 opStatusWaiting = "waiting"
3124 -- ** Finalized opcodes
3126 opStatusCanceled :: String
3127 opStatusCanceled = "canceled"
3129 opStatusError :: String
3130 opStatusError = "error"
3132 opStatusSuccess :: String
3133 opStatusSuccess = "success"
3135 opsFinalized :: FrozenSet String
3137 ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
3139 -- * OpCode priority
3144 opPrioHighest :: Int
3148 opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
3151 opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
3154 opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
3156 opPrioSubmitValid :: FrozenSet Int
3157 opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
3159 opPrioDefault :: Int
3160 opPrioDefault = opPrioNormal
3162 -- * Lock recalculate mode
3164 locksAppend :: String
3165 locksAppend = "append"
3167 locksReplace :: String
3168 locksReplace = "replace"
3172 -- The lock timeout (sum) before we transition into blocking acquire
3173 -- (this can still be reset by priority change). Computed as max time
3174 -- (10 hours) before we should actually go into blocking acquire,
3175 -- given that we start from the default priority level.
3177 lockAttemptsMaxwait :: Double
3178 lockAttemptsMaxwait = 15.0
3180 lockAttemptsMinwait :: Double
3181 lockAttemptsMinwait = 1.0
3183 lockAttemptsTimeout :: Int
3184 lockAttemptsTimeout = (10 * 3600) `div` (opPrioDefault - opPrioHighest)
3186 -- * Execution log types
3188 elogMessage :: String
3189 elogMessage = Types.eLogTypeToRaw ELogMessage
3191 elogRemoteImport :: String
3192 elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
3194 elogJqueueTest :: String
3195 elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
3197 -- * /etc/hosts modification
3199 etcHostsAdd :: String
3202 etcHostsRemove :: String
3203 etcHostsRemove = "remove"
3207 jqtMsgprefix :: String
3208 jqtMsgprefix = "TESTMSG="
3213 jqtExpandnames :: String
3214 jqtExpandnames = "expandnames"
3217 jqtLogmsg = "logmsg"
3219 jqtStartmsg :: String
3220 jqtStartmsg = "startmsg"
3222 jqtAll :: FrozenSet String
3223 jqtAll = ConstantUtils.mkSet [jqtExec, jqtExpandnames, jqtLogmsg, jqtStartmsg]
3225 -- * Query resources
3228 qrCluster = "cluster"
3233 qrExtstorage :: String
3234 qrExtstorage = "extstorage"
3239 qrInstance :: String
3240 qrInstance = "instance"
3249 qrNetwork = "network"
3257 -- | List of resources which can be queried using 'Ganeti.OpCodes.OpQuery'
3258 qrViaOp :: FrozenSet String
3260 ConstantUtils.mkSet [qrCluster,
3269 -- | List of resources which can be queried using Local UniX Interface
3270 qrViaLuxi :: FrozenSet String
3271 qrViaLuxi = ConstantUtils.mkSet [qrLock, qrJob]
3273 -- | List of resources which can be queried using RAPI
3274 qrViaRapi :: FrozenSet String
3275 qrViaRapi = qrViaLuxi
3277 -- * Query field types
3283 qftNumber = "number"
3291 qftTimestamp :: String
3292 qftTimestamp = "timestamp"
3297 qftUnknown :: String
3298 qftUnknown = "unknown"
3300 qftAll :: FrozenSet String
3302 ConstantUtils.mkSet [qftBool,
3310 -- * Query result field status
3312 -- Don't change or reuse values as they're used by clients.
3314 -- FIXME: link with 'Ganeti.Query.Language.ResultStatus'
3316 -- | No data (e.g. RPC error), can be used instead of 'rsOffline'
3323 -- | Resource marked offline
3327 -- | Value unavailable/unsupported for item; if this field is
3328 -- supported but we cannot get the data for the moment, 'rsNodata' or
3329 -- 'rsOffline' should be used
3336 rsAll :: FrozenSet Int
3338 ConstantUtils.mkSet [rsNodata,
3344 -- | Special field cases and their verbose/terse formatting
3345 rssDescription :: Map Int (String, String)
3347 Map.fromList [(rsUnknown, ("(unknown)", "??")),
3348 (rsNodata, ("(nodata)", "?")),
3349 (rsOffline, ("(offline)", "*")),
3350 (rsUnavail, ("(unavail)", "-"))]
3352 -- * Max dynamic devices
3355 maxDisks = Types.maxDisks
3358 maxNics = Types.maxNics
3360 -- | SSCONF file prefix
3361 ssconfFileprefix :: String
3362 ssconfFileprefix = "ssconf_"
3366 ssClusterName :: String
3367 ssClusterName = "cluster_name"
3369 ssClusterTags :: String
3370 ssClusterTags = "cluster_tags"
3372 ssFileStorageDir :: String
3373 ssFileStorageDir = "file_storage_dir"
3375 ssSharedFileStorageDir :: String
3376 ssSharedFileStorageDir = "shared_file_storage_dir"
3378 ssMasterCandidates :: String
3379 ssMasterCandidates = "master_candidates"
3381 ssMasterCandidatesIps :: String
3382 ssMasterCandidatesIps = "master_candidates_ips"
3384 ssMasterIp :: String
3385 ssMasterIp = "master_ip"
3387 ssMasterNetdev :: String
3388 ssMasterNetdev = "master_netdev"
3390 ssMasterNetmask :: String
3391 ssMasterNetmask = "master_netmask"
3393 ssMasterNode :: String
3394 ssMasterNode = "master_node"
3396 ssNodeList :: String
3397 ssNodeList = "node_list"
3399 ssNodePrimaryIps :: String
3400 ssNodePrimaryIps = "node_primary_ips"
3402 ssNodeSecondaryIps :: String
3403 ssNodeSecondaryIps = "node_secondary_ips"
3405 ssOfflineNodes :: String
3406 ssOfflineNodes = "offline_nodes"
3408 ssOnlineNodes :: String
3409 ssOnlineNodes = "online_nodes"
3411 ssPrimaryIpFamily :: String
3412 ssPrimaryIpFamily = "primary_ip_family"
3414 ssInstanceList :: String
3415 ssInstanceList = "instance_list"
3417 ssReleaseVersion :: String
3418 ssReleaseVersion = "release_version"
3420 ssHypervisorList :: String
3421 ssHypervisorList = "hypervisor_list"
3423 ssMaintainNodeHealth :: String
3424 ssMaintainNodeHealth = "maintain_node_health"
3427 ssUidPool = "uid_pool"
3429 ssNodegroups :: String
3430 ssNodegroups = "nodegroups"
3432 ssNetworks :: String
3433 ssNetworks = "networks"
3435 -- | This is not a complete SSCONF key, but the prefix for the
3437 ssHvparamsPref :: String
3438 ssHvparamsPref = "hvparams_"
3442 ssHvparamsXenChroot :: String
3443 ssHvparamsXenChroot = ssHvparamsPref ++ htChroot
3445 ssHvparamsXenFake :: String
3446 ssHvparamsXenFake = ssHvparamsPref ++ htFake
3448 ssHvparamsXenHvm :: String
3449 ssHvparamsXenHvm = ssHvparamsPref ++ htXenHvm
3451 ssHvparamsXenKvm :: String
3452 ssHvparamsXenKvm = ssHvparamsPref ++ htKvm
3454 ssHvparamsXenLxc :: String
3455 ssHvparamsXenLxc = ssHvparamsPref ++ htLxc
3457 ssHvparamsXenPvm :: String
3458 ssHvparamsXenPvm = ssHvparamsPref ++ htXenPvm
3460 validSsHvparamsKeys :: FrozenSet String
3461 validSsHvparamsKeys =
3462 ConstantUtils.mkSet [ssHvparamsXenChroot,
3472 -- | Cluster wide default parameters
3473 defaultEnabledHypervisor :: String
3474 defaultEnabledHypervisor = htXenPvm
3476 hvcGlobals :: FrozenSet String
3478 ConstantUtils.mkSet [hvMigrationBandwidth,
3483 becDefaults :: Map String PyValueEx
3486 [ (beMinmem, PyValueEx (128 :: Int))
3487 , (beMaxmem, PyValueEx (128 :: Int))
3488 , (beVcpus, PyValueEx (1 :: Int))
3489 , (beAutoBalance, PyValueEx True)
3490 , (beAlwaysFailover, PyValueEx False)
3491 , (beSpindleUse, PyValueEx (1 :: Int))
3494 ndcDefaults :: Map String PyValueEx
3497 [ (ndOobProgram, PyValueEx "")
3498 , (ndSpindleCount, PyValueEx (1 :: Int))
3499 , (ndExclusiveStorage, PyValueEx False)
3500 , (ndOvs, PyValueEx False)
3501 , (ndOvsName, PyValueEx defaultOvs)
3502 , (ndOvsLink, PyValueEx "")
3505 ndcGlobals :: FrozenSet String
3506 ndcGlobals = ConstantUtils.mkSet [ndExclusiveStorage]
3508 diskLdDefaults :: Map DiskTemplate (Map String PyValueEx)
3511 [ (DTDrbd8, Map.fromList
3512 [ (ldpBarriers, PyValueEx drbdBarriers)
3513 , (ldpDefaultMetavg, PyValueEx defaultVg)
3514 , (ldpDelayTarget, PyValueEx (1 :: Int)) -- ds
3515 , (ldpDiskCustom, PyValueEx "")
3516 , (ldpDynamicResync, PyValueEx False)
3517 , (ldpFillTarget, PyValueEx (0 :: Int)) -- sectors
3518 , (ldpMaxRate, PyValueEx (classicDrbdSyncSpeed :: Int)) -- KiB/s
3519 , (ldpMinRate, PyValueEx (4 * 1024 :: Int)) -- KiB/s
3520 , (ldpNetCustom, PyValueEx "")
3521 , (ldpNoMetaFlush, PyValueEx drbdNoMetaFlush)
3522 -- The default values for the DRBD dynamic resync
3523 -- speed algorithm are taken from the drbsetup 8.3.11
3524 -- man page, except for c-plan-ahead (that we don't
3525 -- need to set to 0, because we have a separate option
3526 -- to enable it) and for c-max-rate, that we cap to
3527 -- the default value for the static resync rate.
3528 , (ldpPlanAhead, PyValueEx (20 :: Int)) -- ds
3529 , (ldpProtocol, PyValueEx drbdDefaultNetProtocol)
3530 , (ldpResyncRate, PyValueEx classicDrbdSyncSpeed)
3532 , (DTPlain, Map.fromList [(ldpStripes, PyValueEx lvmStripecount)])
3533 , (DTFile, Map.empty)
3534 , (DTSharedFile, Map.empty)
3535 , (DTBlock, Map.empty)
3536 , (DTRbd, Map.fromList
3537 [ (ldpPool, PyValueEx "rbd")
3538 , (ldpAccess, PyValueEx diskKernelspace)
3540 , (DTExt, Map.empty)
3543 niccDefaults :: Map String PyValueEx
3546 [ (nicMode, PyValueEx nicModeBridged)
3547 , (nicLink, PyValueEx defaultBridge)
3548 , (nicVlan, PyValueEx valueHsNothing)
3551 -- | All of the following values are quite arbitrary - there are no
3552 -- "good" defaults, these must be customised per-site
3553 ispecsMinmaxDefaults :: Map String (Map String Int)
3554 ispecsMinmaxDefaults =
3558 [(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMinISpec),
3559 (ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMinISpec),
3560 (ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMinISpec),
3561 (ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMinISpec),
3562 (ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMinISpec),
3563 (ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMinISpec)]),
3566 [(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMaxISpec),
3567 (ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMaxISpec),
3568 (ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMaxISpec),
3569 (ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMaxISpec),
3570 (ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMaxISpec),
3571 (ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMaxISpec)])]
3573 ipolicyDefaults :: Map String PyValueEx
3576 [ (ispecsMinmax, PyValueEx [ispecsMinmaxDefaults])
3577 , (ispecsStd, PyValueEx (Map.fromList
3578 [ (ispecMemSize, 128)
3579 , (ispecCpuCount, 1)
3580 , (ispecDiskCount, 1)
3581 , (ispecDiskSize, 1024)
3582 , (ispecNicCount, 1)
3583 , (ispecSpindleUse, 1)
3584 ] :: Map String Int))
3585 , (ipolicyDts, PyValueEx (ConstantUtils.toList diskTemplates))
3586 , (ipolicyVcpuRatio, PyValueEx (4.0 :: Double))
3587 , (ipolicySpindleRatio, PyValueEx (32.0 :: Double))
3590 masterPoolSizeDefault :: Int
3591 masterPoolSizeDefault = 10
3593 -- * Exclusive storage
3595 -- | Error margin used to compare physical disks
3596 partMargin :: Double
3599 -- | Space reserved when creating instance disks
3600 partReserved :: Double
3605 confdProtocolVersion :: Int
3606 confdProtocolVersion = ConstantUtils.confdProtocolVersion
3608 -- Confd request type
3611 confdReqPing = Types.confdRequestTypeToRaw ReqPing
3613 confdReqNodeRoleByname :: Int
3614 confdReqNodeRoleByname = Types.confdRequestTypeToRaw ReqNodeRoleByName
3616 confdReqNodePipByInstanceIp :: Int
3617 confdReqNodePipByInstanceIp = Types.confdRequestTypeToRaw ReqNodePipByInstPip
3619 confdReqClusterMaster :: Int
3620 confdReqClusterMaster = Types.confdRequestTypeToRaw ReqClusterMaster
3622 confdReqNodePipList :: Int
3623 confdReqNodePipList = Types.confdRequestTypeToRaw ReqNodePipList
3625 confdReqMcPipList :: Int
3626 confdReqMcPipList = Types.confdRequestTypeToRaw ReqMcPipList
3628 confdReqInstancesIpsList :: Int
3629 confdReqInstancesIpsList = Types.confdRequestTypeToRaw ReqInstIpsList
3631 confdReqNodeDrbd :: Int
3632 confdReqNodeDrbd = Types.confdRequestTypeToRaw ReqNodeDrbd
3634 confdReqNodeInstances :: Int
3635 confdReqNodeInstances = Types.confdRequestTypeToRaw ReqNodeInstances
3637 confdReqs :: FrozenSet Int
3639 ConstantUtils.mkSet .
3640 map Types.confdRequestTypeToRaw $
3641 [minBound..] \\ [ReqNodeInstances]
3643 -- * Confd request type
3645 confdReqfieldName :: Int
3646 confdReqfieldName = Types.confdReqFieldToRaw ReqFieldName
3648 confdReqfieldIp :: Int
3649 confdReqfieldIp = Types.confdReqFieldToRaw ReqFieldIp
3651 confdReqfieldMnodePip :: Int
3652 confdReqfieldMnodePip = Types.confdReqFieldToRaw ReqFieldMNodePip
3654 -- * Confd repl status
3656 confdReplStatusOk :: Int
3657 confdReplStatusOk = Types.confdReplyStatusToRaw ReplyStatusOk
3659 confdReplStatusError :: Int
3660 confdReplStatusError = Types.confdReplyStatusToRaw ReplyStatusError
3662 confdReplStatusNotimplemented :: Int
3663 confdReplStatusNotimplemented = Types.confdReplyStatusToRaw ReplyStatusNotImpl
3665 confdReplStatuses :: FrozenSet Int
3667 ConstantUtils.mkSet $ map Types.confdReplyStatusToRaw [minBound..]
3669 -- * Confd node role
3671 confdNodeRoleMaster :: Int
3672 confdNodeRoleMaster = Types.confdNodeRoleToRaw NodeRoleMaster
3674 confdNodeRoleCandidate :: Int
3675 confdNodeRoleCandidate = Types.confdNodeRoleToRaw NodeRoleCandidate
3677 confdNodeRoleOffline :: Int
3678 confdNodeRoleOffline = Types.confdNodeRoleToRaw NodeRoleOffline
3680 confdNodeRoleDrained :: Int
3681 confdNodeRoleDrained = Types.confdNodeRoleToRaw NodeRoleDrained
3683 confdNodeRoleRegular :: Int
3684 confdNodeRoleRegular = Types.confdNodeRoleToRaw NodeRoleRegular
3686 -- * A few common errors for confd
3688 confdErrorUnknownEntry :: Int
3689 confdErrorUnknownEntry = Types.confdErrorTypeToRaw ConfdErrorUnknownEntry
3691 confdErrorInternal :: Int
3692 confdErrorInternal = Types.confdErrorTypeToRaw ConfdErrorInternal
3694 confdErrorArgument :: Int
3695 confdErrorArgument = Types.confdErrorTypeToRaw ConfdErrorArgument
3697 -- * Confd request query fields
3699 confdReqqLink :: String
3700 confdReqqLink = ConstantUtils.confdReqqLink
3702 confdReqqIp :: String
3703 confdReqqIp = ConstantUtils.confdReqqIp
3705 confdReqqIplist :: String
3706 confdReqqIplist = ConstantUtils.confdReqqIplist
3708 confdReqqFields :: String
3709 confdReqqFields = ConstantUtils.confdReqqFields
3711 -- | Each request is "salted" by the current timestamp.
3713 -- This constant decides how many seconds of skew to accept.
3715 -- TODO: make this a default and allow the value to be more
3717 confdMaxClockSkew :: Int
3718 confdMaxClockSkew = 2 * nodeMaxClockSkew
3720 -- | When we haven't reloaded the config for more than this amount of
3721 -- seconds, we force a test to see if inotify is betraying us. Using a
3722 -- prime number to ensure we get less chance of 'same wakeup' with
3724 confdConfigReloadTimeout :: Int
3725 confdConfigReloadTimeout = 17
3727 -- | If we receive more than one update in this amount of
3728 -- microseconds, we move to polling every RATELIMIT seconds, rather
3729 -- than relying on inotify, to be able to serve more requests.
3730 confdConfigReloadRatelimit :: Int
3731 confdConfigReloadRatelimit = 250000
3733 -- | Magic number prepended to all confd queries.
3735 -- This allows us to distinguish different types of confd protocols
3736 -- and handle them. For example by changing this we can move the whole
3737 -- payload to be compressed, or move away from json.
3738 confdMagicFourcc :: String
3739 confdMagicFourcc = "plj0"
3741 -- | By default a confd request is sent to the minimum between this
3742 -- number and all MCs. 6 was chosen because even in the case of a
3743 -- disastrous 50% response rate, we should have enough answers to be
3744 -- able to compare more than one.
3745 confdDefaultReqCoverage :: Int
3746 confdDefaultReqCoverage = 6
3748 -- | Timeout in seconds to expire pending query request in the confd
3749 -- client library. We don't actually expect any answer more than 10
3750 -- seconds after we sent a request.
3751 confdClientExpireTimeout :: Int
3752 confdClientExpireTimeout = 10
3754 -- | Maximum UDP datagram size.
3756 -- On IPv4: 64K - 20 (ip header size) - 8 (udp header size) = 65507
3757 -- On IPv6: 64K - 40 (ip6 header size) - 8 (udp header size) = 65487
3758 -- (assuming we can't use jumbo frames)
3759 -- We just set this to 60K, which should be enough
3760 maxUdpDataSize :: Int
3761 maxUdpDataSize = 61440
3763 -- * User-id pool minimum/maximum acceptable user-ids
3765 uidpoolUidMin :: Int
3768 -- | Assuming 32 bit user-ids
3769 uidpoolUidMax :: Integer
3770 uidpoolUidMax = 2 ^ 32 - 1
3772 -- | Name or path of the pgrep command
3776 -- | Name of the node group that gets created at cluster init or
3778 initialNodeGroupName :: String
3779 initialNodeGroupName = "default"
3781 -- * Possible values for NodeGroup.alloc_policy
3783 allocPolicyLastResort :: String
3784 allocPolicyLastResort = Types.allocPolicyToRaw AllocLastResort
3786 allocPolicyPreferred :: String
3787 allocPolicyPreferred = Types.allocPolicyToRaw AllocPreferred
3789 allocPolicyUnallocable :: String
3790 allocPolicyUnallocable = Types.allocPolicyToRaw AllocUnallocable
3792 validAllocPolicies :: [String]
3793 validAllocPolicies = map Types.allocPolicyToRaw [minBound..]
3795 -- | Temporary external/shared storage parameters
3796 blockdevDriverManual :: String
3797 blockdevDriverManual = Types.blockDriverToRaw BlockDrvManual
3799 -- | 'qemu-img' path, required for 'ovfconverter'
3800 qemuimgPath :: String
3801 qemuimgPath = AutoConf.qemuimgPath
3803 -- | Whether htools was enabled at compilation time
3805 -- FIXME: this should be moved next to the other enable constants,
3806 -- such as, 'enableConfd', and renamed to 'enableHtools'.
3808 htools = AutoConf.htools
3810 -- | The hail iallocator
3811 iallocHail :: String
3814 -- * Fake opcodes for functions that have hooks attached to them via
3815 -- backend.RunLocalHooks
3817 fakeOpMasterTurndown :: String
3818 fakeOpMasterTurndown = "OP_CLUSTER_IP_TURNDOWN"
3820 fakeOpMasterTurnup :: String
3821 fakeOpMasterTurnup = "OP_CLUSTER_IP_TURNUP"
3831 sshkAll :: FrozenSet String
3832 sshkAll = ConstantUtils.mkSet [sshkRsa, sshkDsa]
3834 -- * SSH authorized key types
3837 sshakDss = "ssh-dss"
3840 sshakRsa = "ssh-rsa"
3842 sshakAll :: FrozenSet String
3843 sshakAll = ConstantUtils.mkSet [sshakDss, sshakRsa]
3847 sshsClusterName :: String
3848 sshsClusterName = "cluster_name"
3850 sshsSshHostKey :: String
3851 sshsSshHostKey = "ssh_host_key"
3853 sshsSshRootKey :: String
3854 sshsSshRootKey = "ssh_root_key"
3856 sshsNodeDaemonCertificate :: String
3857 sshsNodeDaemonCertificate = "node_daemon_certificate"
3859 -- * Key files for SSH daemon
3861 sshHostDsaPriv :: String
3862 sshHostDsaPriv = sshConfigDir ++ "/ssh_host_dsa_key"
3864 sshHostDsaPub :: String
3865 sshHostDsaPub = sshHostDsaPriv ++ ".pub"
3867 sshHostRsaPriv :: String
3868 sshHostRsaPriv = sshConfigDir ++ "/ssh_host_rsa_key"
3870 sshHostRsaPub :: String
3871 sshHostRsaPub = sshHostRsaPriv ++ ".pub"
3873 sshDaemonKeyfiles :: Map String (String, String)
3875 Map.fromList [ (sshkRsa, (sshHostRsaPriv, sshHostRsaPub))
3876 , (sshkDsa, (sshHostDsaPriv, sshHostDsaPub))
3879 -- * Node daemon setup
3881 ndsClusterName :: String
3882 ndsClusterName = "cluster_name"
3884 ndsNodeDaemonCertificate :: String
3885 ndsNodeDaemonCertificate = "node_daemon_certificate"
3888 ndsSsconf = "ssconf"
3890 ndsStartNodeDaemon :: String
3891 ndsStartNodeDaemon = "start_node_daemon"
3893 -- * The source reasons for the execution of an OpCode
3895 opcodeReasonSrcClient :: String
3896 opcodeReasonSrcClient = "gnt:client"
3898 opcodeReasonSrcNoded :: String
3899 opcodeReasonSrcNoded = "gnt:daemon:noded"
3901 opcodeReasonSrcOpcode :: String
3902 opcodeReasonSrcOpcode = "gnt:opcode"
3904 opcodeReasonSrcRlib2 :: String
3905 opcodeReasonSrcRlib2 = "gnt:library:rlib2"
3907 opcodeReasonSrcUser :: String
3908 opcodeReasonSrcUser = "gnt:user"
3910 opcodeReasonSources :: FrozenSet String
3911 opcodeReasonSources =
3912 ConstantUtils.mkSet [opcodeReasonSrcClient,
3913 opcodeReasonSrcNoded,
3914 opcodeReasonSrcOpcode,
3915 opcodeReasonSrcRlib2,
3916 opcodeReasonSrcUser]
3918 -- | Path generating random UUID
3919 randomUuidFile :: String
3920 randomUuidFile = ConstantUtils.randomUuidFile
3922 -- * Auto-repair tag prefixes
3924 autoRepairTagPrefix :: String
3925 autoRepairTagPrefix = "ganeti:watcher:autorepair:"
3927 autoRepairTagEnabled :: String
3928 autoRepairTagEnabled = autoRepairTagPrefix
3930 autoRepairTagPending :: String
3931 autoRepairTagPending = autoRepairTagPrefix ++ "pending:"
3933 autoRepairTagResult :: String
3934 autoRepairTagResult = autoRepairTagPrefix ++ "result:"
3936 autoRepairTagSuspended :: String
3937 autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:"
3939 -- * Auto-repair levels
3941 autoRepairFailover :: String
3942 autoRepairFailover = Types.autoRepairTypeToRaw ArFailover
3944 autoRepairFixStorage :: String
3945 autoRepairFixStorage = Types.autoRepairTypeToRaw ArFixStorage
3947 autoRepairMigrate :: String
3948 autoRepairMigrate = Types.autoRepairTypeToRaw ArMigrate
3950 autoRepairReinstall :: String
3951 autoRepairReinstall = Types.autoRepairTypeToRaw ArReinstall
3953 autoRepairAllTypes :: FrozenSet String
3954 autoRepairAllTypes =
3955 ConstantUtils.mkSet [autoRepairFailover,
3956 autoRepairFixStorage,
3958 autoRepairReinstall]
3960 -- * Auto-repair results
3962 autoRepairEnoperm :: String
3963 autoRepairEnoperm = Types.autoRepairResultToRaw ArEnoperm
3965 autoRepairFailure :: String
3966 autoRepairFailure = Types.autoRepairResultToRaw ArFailure
3968 autoRepairSuccess :: String
3969 autoRepairSuccess = Types.autoRepairResultToRaw ArSuccess
3971 autoRepairAllResults :: FrozenSet String
3972 autoRepairAllResults =
3973 ConstantUtils.mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess]
3975 -- | The version identifier for builtin data collectors
3976 builtinDataCollectorVersion :: String
3977 builtinDataCollectorVersion = "B"
3979 -- | The reason trail opcode parameter name
3980 opcodeReason :: String
3981 opcodeReason = "reason"
3983 diskstatsFile :: String
3984 diskstatsFile = "/proc/diskstats"
3986 -- * CPU load collector
3989 statFile = "/proc/stat"
3991 cpuavgloadBufferSize :: Int
3992 cpuavgloadBufferSize = 150
3994 cpuavgloadWindowSize :: Int
3995 cpuavgloadWindowSize = 600
3997 -- * Monitoring daemon
3999 -- | Mond's variable for periodical data collection
4000 mondTimeInterval :: Int
4001 mondTimeInterval = 5
4003 -- | Mond's latest API version
4004 mondLatestApiVersion :: Int
4005 mondLatestApiVersion = 1
4007 -- * Disk access modes
4009 diskUserspace :: String
4010 diskUserspace = Types.diskAccessModeToRaw DiskUserspace
4012 diskKernelspace :: String
4013 diskKernelspace = Types.diskAccessModeToRaw DiskKernelspace
4015 diskValidAccessModes :: FrozenSet String
4016 diskValidAccessModes =
4017 ConstantUtils.mkSet $ map Types.diskAccessModeToRaw [minBound..]
4019 -- | Timeout for queue draining in upgrades
4020 upgradeQueueDrainTimeout :: Int
4021 upgradeQueueDrainTimeout = 36 * 60 * 60 -- 1.5 days
4023 -- | Intervall at which the queue is polled during upgrades
4024 upgradeQueuePollInterval :: Int
4025 upgradeQueuePollInterval = 10
4027 -- * Hotplug Actions
4029 hotplugActionAdd :: String
4030 hotplugActionAdd = Types.hotplugActionToRaw HAAdd
4032 hotplugActionRemove :: String
4033 hotplugActionRemove = Types.hotplugActionToRaw HARemove
4035 hotplugActionModify :: String
4036 hotplugActionModify = Types.hotplugActionToRaw HAMod
4038 hotplugAllActions :: FrozenSet String
4040 ConstantUtils.mkSet $ map Types.hotplugActionToRaw [minBound..]
4042 -- * Hotplug Device Targets
4044 hotplugTargetNic :: String
4045 hotplugTargetNic = Types.hotplugTargetToRaw HTNic
4047 hotplugTargetDisk :: String
4048 hotplugTargetDisk = Types.hotplugTargetToRaw HTDisk
4050 hotplugAllTargets :: FrozenSet String
4052 ConstantUtils.mkSet $ map Types.hotplugTargetToRaw [minBound..]