1 {-| HsConstants contains the Haskell constants
3 This is a transitional module complementary to 'Ganeti.Constants'. It
4 is intended to contain the Haskell constants that are meant to be
7 Do not write any definitions in this file other than constants. Do
8 not even write helper functions. The definitions in this module are
9 automatically stripped to build the Makefile.am target
10 'ListConstants.hs'. If there are helper functions in this module,
11 they will also be dragged and it will cause compilation to fail.
12 Therefore, all helper functions should go to a separate module and
19 Copyright (C) 2013 Google Inc.
21 This program is free software; you can redistribute it and/or modify
22 it under the terms of the GNU General Public License as published by
23 the Free Software Foundation; either version 2 of the License, or
24 (at your option) any later version.
26 This program is distributed in the hope that it will be useful, but
27 WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 General Public License for more details.
31 You should have received a copy of the GNU General Public License
32 along with this program; if not, write to the Free Software
33 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
37 module Ganeti.HsConstants where
40 import qualified Data.Map as Map (fromList)
43 import Ganeti.ConstantUtils (FrozenSet, Protocol(..))
44 import qualified Ganeti.ConstantUtils as ConstantUtils
45 import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..),
47 import Ganeti.Logging (SyslogUsage(..))
48 import qualified Ganeti.Logging as Logging (syslogUsageToRaw)
49 import qualified Ganeti.Runtime as Runtime
51 import qualified Ganeti.Types as Types
53 -- * Constants for 'lib/pathutils.py'
55 osSearchPath :: [String]
56 osSearchPath = AutoConf.osSearchPath
58 esSearchPath :: [String]
59 esSearchPath = AutoConf.esSearchPath
61 -- * OOB supported commands
64 oobPowerOn = Types.oobCommandToRaw OobPowerOn
67 oobPowerOff = Types.oobCommandToRaw OobPowerOff
69 oobPowerCycle :: String
70 oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
72 oobPowerStatus :: String
73 oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
76 oobHealth = Types.oobCommandToRaw OobHealth
78 oobCommands :: FrozenSet String
79 oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
81 oobPowerStatusPowered :: String
82 oobPowerStatusPowered = "powered"
89 oobPowerDelay :: Double
92 oobStatusCritical :: String
93 oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
96 oobStatusOk = Types.oobStatusToRaw OobStatusOk
98 oobStatusUnknown :: String
99 oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
101 oobStatusWarning :: String
102 oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
104 oobStatuses :: FrozenSet String
105 oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
107 -- * NIC_* constants are used inside the ganeti config
118 nicModeBridged :: String
119 nicModeBridged = Types.nICModeToRaw NMBridged
121 nicModeRouted :: String
122 nicModeRouted = Types.nICModeToRaw NMRouted
125 nicModeOvs = Types.nICModeToRaw NMOvs
128 nicIpPool = Types.nICModeToRaw NMPool
130 nicValidModes :: FrozenSet String
131 nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
133 -- * Hypervisor constants
136 htXenPvm = Types.hypervisorToRaw XenPvm
139 htFake = Types.hypervisorToRaw Fake
142 htXenHvm = Types.hypervisorToRaw XenHvm
145 htKvm = Types.hypervisorToRaw Kvm
148 htChroot = Types.hypervisorToRaw Chroot
151 htLxc = Types.hypervisorToRaw Lxc
153 hyperTypes :: FrozenSet String
154 hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
156 htsReqPort :: FrozenSet String
157 htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
161 htMigrationLive :: String
162 htMigrationLive = Types.migrationModeToRaw MigrationLive
164 htMigrationNonlive :: String
165 htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
167 htMigrationModes :: FrozenSet String
169 ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
171 -- * Cluster verify steps
173 verifyNplusoneMem :: String
174 verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
176 verifyOptionalChecks :: FrozenSet String
177 verifyOptionalChecks =
178 ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
180 -- * Cluster Verify error classes
183 cvTcluster = "cluster"
191 cvTinstance :: String
192 cvTinstance = "instance"
194 -- * Cluster Verify error codes and documentation
196 cvEclustercert :: (String, String, String)
199 Types.cVErrorCodeToRaw CvECLUSTERCERT,
200 "Cluster certificate files verification failure")
202 cvEclustercfg :: (String, String, String)
205 Types.cVErrorCodeToRaw CvECLUSTERCFG,
206 "Cluster configuration verification failure")
208 cvEclusterdanglinginst :: (String, String, String)
209 cvEclusterdanglinginst =
211 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
212 "Some instances have a non-existing primary node")
214 cvEclusterdanglingnodes :: (String, String, String)
215 cvEclusterdanglingnodes =
217 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
218 "Some nodes belong to non-existing groups")
220 cvEclusterfilecheck :: (String, String, String)
221 cvEclusterfilecheck =
223 Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
224 "Cluster configuration verification failure")
226 cvEgroupdifferentpvsize :: (String, String, String)
227 cvEgroupdifferentpvsize =
229 Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
230 "PVs in the group have different sizes")
232 cvEinstancebadnode :: (String, String, String)
235 Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
236 "Instance marked as running lives on an offline node")
238 cvEinstancedown :: (String, String, String)
241 Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
242 "Instance not running on its primary node")
244 cvEinstancefaultydisk :: (String, String, String)
245 cvEinstancefaultydisk =
247 Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
248 "Impossible to retrieve status for a disk")
250 cvEinstancelayout :: (String, String, String)
253 Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
254 "Instance has multiple secondary nodes")
256 cvEinstancemissingcfgparameter :: (String, String, String)
257 cvEinstancemissingcfgparameter =
259 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
260 "A configuration parameter for an instance is missing")
262 cvEinstancemissingdisk :: (String, String, String)
263 cvEinstancemissingdisk =
265 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
266 "Missing volume on an instance")
268 cvEinstancepolicy :: (String, String, String)
271 Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
272 "Instance does not meet policy")
274 cvEinstancesplitgroups :: (String, String, String)
275 cvEinstancesplitgroups =
277 Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
278 "Instance with primary and secondary nodes in different groups")
280 cvEinstanceunsuitablenode :: (String, String, String)
281 cvEinstanceunsuitablenode =
283 Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
284 "Instance running on nodes that are not suitable for it")
286 cvEinstancewrongnode :: (String, String, String)
287 cvEinstancewrongnode =
289 Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
290 "Instance running on the wrong node")
292 cvEnodedrbd :: (String, String, String)
295 Types.cVErrorCodeToRaw CvENODEDRBD,
296 "Error parsing the DRBD status file")
298 cvEnodedrbdhelper :: (String, String, String)
301 Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
302 "Error caused by the DRBD helper")
304 cvEnodedrbdversion :: (String, String, String)
307 Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
308 "DRBD version mismatch within a node group")
310 cvEnodefilecheck :: (String, String, String)
313 Types.cVErrorCodeToRaw CvENODEFILECHECK,
314 "Error retrieving the checksum of the node files")
316 cvEnodefilestoragepaths :: (String, String, String)
317 cvEnodefilestoragepaths =
319 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
320 "Detected bad file storage paths")
322 cvEnodefilestoragepathunusable :: (String, String, String)
323 cvEnodefilestoragepathunusable =
325 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
326 "File storage path unusable")
328 cvEnodehooks :: (String, String, String)
331 Types.cVErrorCodeToRaw CvENODEHOOKS,
332 "Communication failure in hooks execution")
334 cvEnodehv :: (String, String, String)
337 Types.cVErrorCodeToRaw CvENODEHV,
338 "Hypervisor parameters verification failure")
340 cvEnodelvm :: (String, String, String)
343 Types.cVErrorCodeToRaw CvENODELVM,
344 "LVM-related node error")
346 cvEnoden1 :: (String, String, String)
349 Types.cVErrorCodeToRaw CvENODEN1,
350 "Not enough memory to accommodate instance failovers")
352 cvEnodenet :: (String, String, String)
355 Types.cVErrorCodeToRaw CvENODENET,
356 "Network-related node error")
358 cvEnodeoobpath :: (String, String, String)
361 Types.cVErrorCodeToRaw CvENODEOOBPATH,
362 "Invalid Out Of Band path")
364 cvEnodeorphaninstance :: (String, String, String)
365 cvEnodeorphaninstance =
367 Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
368 "Unknown intance running on a node")
370 cvEnodeorphanlv :: (String, String, String)
373 Types.cVErrorCodeToRaw CvENODEORPHANLV,
374 "Unknown LVM logical volume")
376 cvEnodeos :: (String, String, String)
379 Types.cVErrorCodeToRaw CvENODEOS,
380 "OS-related node error")
382 cvEnoderpc :: (String, String, String)
385 Types.cVErrorCodeToRaw CvENODERPC,
386 "Error during connection to the primary node of an instance")
388 cvEnodesetup :: (String, String, String)
391 Types.cVErrorCodeToRaw CvENODESETUP,
394 cvEnodesharedfilestoragepathunusable :: (String, String, String)
395 cvEnodesharedfilestoragepathunusable =
397 Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
398 "Shared file storage path unusable")
400 cvEnodessh :: (String, String, String)
403 Types.cVErrorCodeToRaw CvENODESSH,
404 "SSH-related node error")
406 cvEnodetime :: (String, String, String)
409 Types.cVErrorCodeToRaw CvENODETIME,
410 "Node returned invalid time")
412 cvEnodeuserscripts :: (String, String, String)
415 Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
416 "User scripts not present or not executable")
418 cvEnodeversion :: (String, String, String)
421 Types.cVErrorCodeToRaw CvENODEVERSION,
422 "Protocol version mismatch or Ganeti version mismatch")
424 cvAllEcodes :: FrozenSet (String, String, String)
429 cvEclusterdanglinginst,
430 cvEclusterdanglingnodes,
432 cvEgroupdifferentpvsize,
435 cvEinstancefaultydisk,
437 cvEinstancemissingcfgparameter,
438 cvEinstancemissingdisk,
440 cvEinstancesplitgroups,
441 cvEinstanceunsuitablenode,
442 cvEinstancewrongnode,
447 cvEnodefilestoragepaths,
448 cvEnodefilestoragepathunusable,
455 cvEnodeorphaninstance,
460 cvEnodesharedfilestoragepathunusable,
466 cvAllEcodesStrings :: FrozenSet String
468 ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
472 inststAdmindown :: String
473 inststAdmindown = Types.instanceStatusToRaw StatusDown
475 inststAdminoffline :: String
476 inststAdminoffline = Types.instanceStatusToRaw StatusOffline
478 inststErrordown :: String
479 inststErrordown = Types.instanceStatusToRaw ErrorDown
481 inststErrorup :: String
482 inststErrorup = Types.instanceStatusToRaw ErrorUp
484 inststNodedown :: String
485 inststNodedown = Types.instanceStatusToRaw NodeDown
487 inststNodeoffline :: String
488 inststNodeoffline = Types.instanceStatusToRaw NodeOffline
490 inststRunning :: String
491 inststRunning = Types.instanceStatusToRaw Running
493 inststWrongnode :: String
494 inststWrongnode = Types.instanceStatusToRaw WrongNode
496 inststAll :: FrozenSet String
497 inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
501 adminstDown :: String
504 adminstOffline :: String
505 adminstOffline = "offline"
510 adminstAll :: FrozenSet String
511 adminstAll = ConstantUtils.mkSet [adminstDown, adminstOffline, adminstUp]
513 -- * Allocator framework constants
515 iallocatorVersion :: Int
516 iallocatorVersion = 2
518 iallocatorDirIn :: String
519 iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
521 iallocatorDirOut :: String
522 iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
524 validIallocatorDirections :: FrozenSet String
525 validIallocatorDirections =
526 ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
528 iallocatorModeAlloc :: String
529 iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
531 iallocatorModeChgGroup :: String
532 iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
534 iallocatorModeMultiAlloc :: String
535 iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
537 iallocatorModeNodeEvac :: String
538 iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
540 iallocatorModeReloc :: String
541 iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
543 validIallocatorModes :: FrozenSet String
544 validIallocatorModes =
545 ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
547 iallocatorSearchPath :: [String]
548 iallocatorSearchPath = AutoConf.iallocatorSearchPath
550 defaultIallocatorShortcut :: String
551 defaultIallocatorShortcut = "."
553 iallocatorNevacPri :: String
554 iallocatorNevacPri = Types.nodeEvacModeToRaw NEvacPrimary
556 iallocatorNevacSec :: String
557 iallocatorNevacSec = Types.nodeEvacModeToRaw NEvacSecondary
559 iallocatorNevacAll :: String
560 iallocatorNevacAll = Types.nodeEvacModeToRaw NEvacAll
562 iallocatorNevacModes :: FrozenSet String
563 iallocatorNevacModes =
564 ConstantUtils.mkSet $ map Types.nodeEvacModeToRaw [minBound..]
568 nodeEvacPri :: String
569 nodeEvacPri = Types.nodeEvacModeToRaw NEvacPrimary
571 nodeEvacSec :: String
572 nodeEvacSec = Types.nodeEvacModeToRaw NEvacSecondary
574 nodeEvacAll :: String
575 nodeEvacAll = Types.nodeEvacModeToRaw NEvacAll
577 nodeEvacModes :: FrozenSet String
578 nodeEvacModes = ConstantUtils.mkSet $ map Types.nodeEvacModeToRaw [minBound..]
582 jobStatusQueued :: String
583 jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
585 jobStatusWaiting :: String
586 jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
588 jobStatusCanceling :: String
589 jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
591 jobStatusRunning :: String
592 jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
594 jobStatusCanceled :: String
595 jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
597 jobStatusSuccess :: String
598 jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
600 jobStatusError :: String
601 jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
603 jobsPending :: FrozenSet String
605 ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
607 jobsFinalized :: FrozenSet String
609 ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
611 jobStatusAll :: FrozenSet String
612 jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
616 -- ** Not yet finalized opcodes
618 opStatusCanceling :: String
619 opStatusCanceling = "canceling"
621 opStatusQueued :: String
622 opStatusQueued = "queued"
624 opStatusRunning :: String
625 opStatusRunning = "running"
627 opStatusWaiting :: String
628 opStatusWaiting = "waiting"
630 -- ** Finalized opcodes
632 opStatusCanceled :: String
633 opStatusCanceled = "canceled"
635 opStatusError :: String
636 opStatusError = "error"
638 opStatusSuccess :: String
639 opStatusSuccess = "success"
641 opsFinalized :: FrozenSet String
643 ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
654 opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
657 opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
660 opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
662 opPrioSubmitValid :: FrozenSet Int
663 opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
666 opPrioDefault = opPrioNormal
668 -- * Execution log types
670 elogMessage :: String
671 elogMessage = Types.eLogTypeToRaw ELogMessage
673 elogRemoteImport :: String
674 elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
676 elogJqueueTest :: String
677 elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
681 daemonsGroup :: String
682 daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
685 adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
687 masterdUser :: String
688 masterdUser = Runtime.daemonUser GanetiMasterd
690 masterdGroup :: String
691 masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
694 rapiUser = Runtime.daemonUser GanetiRapi
697 rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
700 confdUser = Runtime.daemonUser GanetiConfd
703 confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
706 luxidUser = Runtime.daemonUser GanetiLuxid
709 luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
712 nodedUser = Runtime.daemonUser GanetiNoded
715 nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
718 mondUser = Runtime.daemonUser GanetiMond
721 mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
723 sshLoginUser :: String
724 sshLoginUser = AutoConf.sshLoginUser
726 sshConsoleUser :: String
727 sshConsoleUser = AutoConf.sshConsoleUser
740 confd = Runtime.daemonName GanetiConfd
743 masterd = Runtime.daemonName GanetiMasterd
746 mond = Runtime.daemonName GanetiMond
749 noded = Runtime.daemonName GanetiNoded
752 luxid = Runtime.daemonName GanetiLuxid
755 rapi = Runtime.daemonName GanetiRapi
757 daemons :: FrozenSet String
759 ConstantUtils.mkSet [confd,
766 defaultConfdPort :: Int
767 defaultConfdPort = 1814
769 defaultMondPort :: Int
770 defaultMondPort = 1815
772 defaultNodedPort :: Int
773 defaultNodedPort = 1811
775 defaultRapiPort :: Int
776 defaultRapiPort = 5080
778 daemonsPorts :: Map String (Protocol, Int)
780 Map.fromList [(confd, (Udp, defaultConfdPort)),
781 (mond, (Tcp, defaultMondPort)),
782 (noded, (Tcp, defaultNodedPort)),
783 (rapi, (Tcp, defaultRapiPort)),
786 daemonsLogbase :: Map String String
789 [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
791 extraLogreasonAccess :: String
792 extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
794 extraLogreasonError :: String
795 extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
798 devConsole = ConstantUtils.devConsole
802 syslogUsage :: String
803 syslogUsage = AutoConf.syslogUsage
806 syslogNo = Logging.syslogUsageToRaw SyslogNo
809 syslogYes = Logging.syslogUsageToRaw SyslogYes
812 syslogOnly = Logging.syslogUsageToRaw SyslogOnly
814 syslogSocket :: String
815 syslogSocket = "/dev/log"
819 xenBootloader :: String
820 xenBootloader = AutoConf.xenBootloader
829 xenInitrd = AutoConf.xenInitrd
832 xenKernel = AutoConf.xenKernel
834 -- FIXME: perhaps rename to 'validXenCommands' for consistency with
836 knownXenCommands :: FrozenSet String
837 knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
842 stBlock = Types.storageTypeToRaw StorageBlock
845 stDiskless = Types.storageTypeToRaw StorageDiskless
848 stExt = Types.storageTypeToRaw StorageExt
851 stFile = Types.storageTypeToRaw StorageFile
854 stLvmPv = Types.storageTypeToRaw StorageLvmPv
857 stLvmVg = Types.storageTypeToRaw StorageLvmVg
860 stRados = Types.storageTypeToRaw StorageRados
862 storageTypes :: FrozenSet String
863 storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
865 -- * Disk template types
868 dtDiskless = Types.diskTemplateToRaw DTDiskless
871 dtFile = Types.diskTemplateToRaw DTFile
873 dtSharedFile :: String
874 dtSharedFile = Types.diskTemplateToRaw DTSharedFile
877 dtPlain = Types.diskTemplateToRaw DTPlain
880 dtBlock = Types.diskTemplateToRaw DTBlock
883 dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
886 dtRbd = Types.diskTemplateToRaw DTRbd
889 dtExt = Types.diskTemplateToRaw DTExt
891 -- | This is used to order determine the default disk template when
892 -- the list of enabled disk templates is inferred from the current
893 -- state of the cluster. This only happens on an upgrade from a
894 -- version of Ganeti that did not support the 'enabled_disk_templates'
896 diskTemplatePreference :: [String]
897 diskTemplatePreference =
898 map Types.diskTemplateToRaw
899 [DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile]
901 diskTemplates :: FrozenSet String
902 diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
904 -- | Disk templates that are enabled by default
905 defaultEnabledDiskTemplates :: [String]
906 defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
908 -- * File backend driver
911 fdBlktap = Types.fileDriverToRaw FileBlktap
914 fdLoop = Types.fileDriverToRaw FileLoop
916 -- * Instance export mode
918 exportModeLocal :: String
919 exportModeLocal = Types.exportModeToRaw ExportModeLocal
921 exportModeRemote :: String
922 exportModeRemote = Types.exportModeToRaw ExportModeRemote
924 exportModes :: FrozenSet String
925 exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
927 -- * Instance creation modes
929 instanceCreate :: String
930 instanceCreate = Types.instCreateModeToRaw InstCreate
932 instanceImport :: String
933 instanceImport = Types.instCreateModeToRaw InstImport
935 instanceRemoteImport :: String
936 instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
938 instanceCreateModes :: FrozenSet String
939 instanceCreateModes =
940 ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
942 -- * Dynamic device modification
945 ddmAdd = Types.ddmFullToRaw DdmFullAdd
948 ddmModify = Types.ddmFullToRaw DdmFullModify
951 ddmRemove = Types.ddmFullToRaw DdmFullRemove
953 ddmsValues :: FrozenSet String
954 ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
956 ddmsValuesWithModify :: FrozenSet String
957 ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
959 -- * Common exit codes
965 exitFailure = ConstantUtils.exitFailure
967 exitNotcluster :: Int
973 exitNodesetupError :: Int
974 exitNodesetupError = 12
976 -- | Need user confirmation
977 exitConfirmation :: Int
978 exitConfirmation = 13
980 -- | Exit code for query operations with unknown fields
981 exitUnknownField :: Int
982 exitUnknownField = 14
987 tagCluster = Types.tagKindToRaw TagKindCluster
989 tagInstance :: String
990 tagInstance = Types.tagKindToRaw TagKindInstance
993 tagNetwork = Types.tagKindToRaw TagKindNetwork
996 tagNode = Types.tagKindToRaw TagKindNode
998 tagNodegroup :: String
999 tagNodegroup = Types.tagKindToRaw TagKindGroup
1001 validTagTypes :: FrozenSet String
1002 validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
1007 maxTagsPerObj :: Int
1008 maxTagsPerObj = 4096
1012 instanceRebootSoft :: String
1013 instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
1015 instanceRebootHard :: String
1016 instanceRebootHard = Types.rebootTypeToRaw RebootHard
1018 instanceRebootFull :: String
1019 instanceRebootFull = Types.rebootTypeToRaw RebootFull
1021 rebootTypes :: FrozenSet String
1022 rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
1024 -- * Possible values for NodeGroup.alloc_policy
1026 allocPolicyLastResort :: String
1027 allocPolicyLastResort = Types.allocPolicyToRaw AllocLastResort
1029 allocPolicyPreferred :: String
1030 allocPolicyPreferred = Types.allocPolicyToRaw AllocPreferred
1032 allocPolicyUnallocable :: String
1033 allocPolicyUnallocable = Types.allocPolicyToRaw AllocUnallocable
1035 validAllocPolicies :: [String]
1036 validAllocPolicies = map Types.allocPolicyToRaw [minBound..]
1038 -- | Temporary external/shared storage parameters
1039 blockdevDriverManual :: String
1040 blockdevDriverManual = "manual"
1042 -- | Path generating random UUID
1043 randomUuidFile :: String
1044 randomUuidFile = ConstantUtils.randomUuidFile
1046 -- * Auto-repair tag prefixes
1048 autoRepairTagPrefix :: String
1049 autoRepairTagPrefix = "ganeti:watcher:autorepair:"
1051 autoRepairTagEnabled :: String
1052 autoRepairTagEnabled = autoRepairTagPrefix
1054 autoRepairTagPending :: String
1055 autoRepairTagPending = autoRepairTagPrefix ++ "pending:"
1057 autoRepairTagResult :: String
1058 autoRepairTagResult = autoRepairTagPrefix ++ "result:"
1060 autoRepairTagSuspended :: String
1061 autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:"
1063 -- * Auto-repair levels
1065 autoRepairFailover :: String
1066 autoRepairFailover = "failover"
1068 autoRepairFixStorage :: String
1069 autoRepairFixStorage = "fix-storage"
1071 autoRepairMigrate :: String
1072 autoRepairMigrate = "migrate"
1074 autoRepairReinstall :: String
1075 autoRepairReinstall = "reinstall"
1077 autoRepairAllTypes :: FrozenSet String
1078 autoRepairAllTypes =
1079 ConstantUtils.mkSet [autoRepairFailover,
1080 autoRepairFixStorage,
1082 autoRepairReinstall]
1084 -- * Auto-repair results
1086 autoRepairEnoperm :: String
1087 autoRepairEnoperm = "enoperm"
1089 autoRepairFailure :: String
1090 autoRepairFailure = "failure"
1092 autoRepairSuccess :: String
1093 autoRepairSuccess = "success"
1095 autoRepairAllResults :: FrozenSet String
1096 autoRepairAllResults =
1097 ConstantUtils.mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess]
1099 -- | The version identifier for builtin data collectors
1100 builtinDataCollectorVersion :: String
1101 builtinDataCollectorVersion = "B"