557bc1c831ba19686ef2f79937db95b47db58f5a
[ganeti-github.git] / src / Ganeti / Constants.hs
1 {-# OPTIONS -fno-warn-type-defaults #-}
2 {-| Constants contains the Haskell constants
3
4 The constants in this module are used in Haskell and are also
5 converted to Python.
6
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
13 imported.
14
15 -}
16
17 {-
18
19 Copyright (C) 2013, 2014 Google Inc.
20 All rights reserved.
21
22 Redistribution and use in source and binary forms, with or without
23 modification, are permitted provided that the following conditions are
24 met:
25
26 1. Redistributions of source code must retain the above copyright notice,
27 this list of conditions and the following disclaimer.
28
29 2. Redistributions in binary form must reproduce the above copyright
30 notice, this list of conditions and the following disclaimer in the
31 documentation and/or other materials provided with the distribution.
32
33 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
34 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
35 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
36 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
37 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
38 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
39 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
40 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
41 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
42 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
43 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44
45 -}
46 module Ganeti.Constants where
47
48 import Control.Arrow ((***))
49 import Data.List ((\\))
50 import Data.Map (Map)
51 import qualified Data.Map as Map (empty, fromList, keys, insert)
52
53 import qualified AutoConf
54 import Ganeti.ConstantUtils (PythonChar(..), FrozenSet, Protocol(..),
55 buildVersion)
56 import qualified Ganeti.ConstantUtils as ConstantUtils
57 import Ganeti.HTools.Types (AutoRepairResult(..), AutoRepairType(..))
58 import qualified Ganeti.HTools.Types as Types
59 import Ganeti.Logging (SyslogUsage(..))
60 import qualified Ganeti.Logging as Logging (syslogUsageToRaw)
61 import qualified Ganeti.Runtime as Runtime
62 import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..),
63 ExtraLogReason(..))
64 import Ganeti.THH (PyValueEx(..))
65 import Ganeti.Types
66 import qualified Ganeti.Types as Types
67 import Ganeti.Confd.Types (ConfdRequestType(..), ConfdReqField(..),
68 ConfdReplyStatus(..), ConfdNodeRole(..),
69 ConfdErrorType(..))
70 import qualified Ganeti.Confd.Types as Types
71
72 {-# ANN module "HLint: ignore Use camelCase" #-}
73
74 -- * 'autoconf' constants for Python only ('autotools/build-bash-completion')
75
76 htoolsProgs :: [String]
77 htoolsProgs = AutoConf.htoolsProgs
78
79 -- * 'autoconf' constants for Python only ('lib/constants.py')
80
81 drbdBarriers :: String
82 drbdBarriers = AutoConf.drbdBarriers
83
84 drbdNoMetaFlush :: Bool
85 drbdNoMetaFlush = AutoConf.drbdNoMetaFlush
86
87 lvmStripecount :: Int
88 lvmStripecount = AutoConf.lvmStripecount
89
90 hasGnuLn :: Bool
91 hasGnuLn = AutoConf.hasGnuLn
92
93 -- * 'autoconf' constants for Python only ('lib/pathutils.py')
94
95 -- ** Build-time constants
96
97 exportDir :: String
98 exportDir = AutoConf.exportDir
99
100 backupDir :: String
101 backupDir = AutoConf.backupDir
102
103 osSearchPath :: [String]
104 osSearchPath = AutoConf.osSearchPath
105
106 esSearchPath :: [String]
107 esSearchPath = AutoConf.esSearchPath
108
109 sshConfigDir :: String
110 sshConfigDir = AutoConf.sshConfigDir
111
112 xenConfigDir :: String
113 xenConfigDir = AutoConf.xenConfigDir
114
115 sysconfdir :: String
116 sysconfdir = AutoConf.sysconfdir
117
118 toolsdir :: String
119 toolsdir = AutoConf.toolsdir
120
121 localstatedir :: String
122 localstatedir = AutoConf.localstatedir
123
124 -- ** Paths which don't change for a virtual cluster
125
126 pkglibdir :: String
127 pkglibdir = AutoConf.pkglibdir
128
129 sharedir :: String
130 sharedir = AutoConf.sharedir
131
132 -- * 'autoconf' constants for Python only ('lib/build/sphinx_ext.py')
133
134 manPages :: Map String Int
135 manPages = Map.fromList AutoConf.manPages
136
137 -- * 'autoconf' constants for QA cluster only ('qa/qa_cluster.py')
138
139 versionedsharedir :: String
140 versionedsharedir = AutoConf.versionedsharedir
141
142 -- * 'autoconf' constants for Python only ('tests/py/docs_unittest.py')
143
144 gntScripts :: [String]
145 gntScripts = AutoConf.gntScripts
146
147 -- * Various versions
148
149 releaseVersion :: String
150 releaseVersion = AutoConf.packageVersion
151
152 versionMajor :: Int
153 versionMajor = AutoConf.versionMajor
154
155 versionMinor :: Int
156 versionMinor = AutoConf.versionMinor
157
158 versionRevision :: Int
159 versionRevision = AutoConf.versionRevision
160
161 dirVersion :: String
162 dirVersion = AutoConf.dirVersion
163
164 osApiV10 :: Int
165 osApiV10 = 10
166
167 osApiV15 :: Int
168 osApiV15 = 15
169
170 osApiV20 :: Int
171 osApiV20 = 20
172
173 osApiVersions :: FrozenSet Int
174 osApiVersions = ConstantUtils.mkSet [osApiV10, osApiV15, osApiV20]
175
176 exportVersion :: Int
177 exportVersion = 0
178
179 rapiVersion :: Int
180 rapiVersion = 2
181
182 configMajor :: Int
183 configMajor = AutoConf.versionMajor
184
185 configMinor :: Int
186 configMinor = AutoConf.versionMinor
187
188 -- | The configuration is supposed to remain stable across
189 -- revisions. Therefore, the revision number is cleared to '0'.
190 configRevision :: Int
191 configRevision = 0
192
193 configVersion :: Int
194 configVersion = buildVersion configMajor configMinor configRevision
195
196 -- | Similarly to the configuration (see 'configRevision'), the
197 -- protocols are supposed to remain stable across revisions.
198 protocolVersion :: Int
199 protocolVersion = buildVersion configMajor configMinor configRevision
200
201 -- * User separation
202
203 daemonsGroup :: String
204 daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
205
206 adminGroup :: String
207 adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
208
209 masterdUser :: String
210 masterdUser = Runtime.daemonUser GanetiMasterd
211
212 masterdGroup :: String
213 masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
214
215 metadUser :: String
216 metadUser = Runtime.daemonUser GanetiMetad
217
218 metadGroup :: String
219 metadGroup = Runtime.daemonGroup (DaemonGroup GanetiMetad)
220
221 rapiUser :: String
222 rapiUser = Runtime.daemonUser GanetiRapi
223
224 rapiGroup :: String
225 rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
226
227 confdUser :: String
228 confdUser = Runtime.daemonUser GanetiConfd
229
230 confdGroup :: String
231 confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
232
233 wconfdUser :: String
234 wconfdUser = Runtime.daemonUser GanetiWConfd
235
236 wconfdGroup :: String
237 wconfdGroup = Runtime.daemonGroup (DaemonGroup GanetiWConfd)
238
239 kvmdUser :: String
240 kvmdUser = Runtime.daemonUser GanetiKvmd
241
242 kvmdGroup :: String
243 kvmdGroup = Runtime.daemonGroup (DaemonGroup GanetiKvmd)
244
245 luxidUser :: String
246 luxidUser = Runtime.daemonUser GanetiLuxid
247
248 luxidGroup :: String
249 luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
250
251 nodedUser :: String
252 nodedUser = Runtime.daemonUser GanetiNoded
253
254 nodedGroup :: String
255 nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
256
257 mondUser :: String
258 mondUser = Runtime.daemonUser GanetiMond
259
260 mondGroup :: String
261 mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
262
263 sshLoginUser :: String
264 sshLoginUser = AutoConf.sshLoginUser
265
266 sshConsoleUser :: String
267 sshConsoleUser = AutoConf.sshConsoleUser
268
269 -- * Cpu pinning separators and constants
270
271 cpuPinningSep :: String
272 cpuPinningSep = ":"
273
274 cpuPinningAll :: String
275 cpuPinningAll = "all"
276
277 -- | Internal representation of "all"
278 cpuPinningAllVal :: Int
279 cpuPinningAllVal = -1
280
281 -- | One "all" entry in a CPU list means CPU pinning is off
282 cpuPinningOff :: [Int]
283 cpuPinningOff = [cpuPinningAllVal]
284
285 -- | A Xen-specific implementation detail is that there is no way to
286 -- actually say "use any cpu for pinning" in a Xen configuration file,
287 -- as opposed to the command line, where you can say
288 -- @
289 -- xm vcpu-pin <domain> <vcpu> all
290 -- @
291 --
292 -- The workaround used in Xen is "0-63" (see source code function
293 -- "xm_vcpu_pin" in @<xen-source>/tools/python/xen/xm/main.py@).
294 --
295 -- To support future changes, the following constant is treated as a
296 -- blackbox string that simply means "use any cpu for pinning under
297 -- xen".
298 cpuPinningAllXen :: String
299 cpuPinningAllXen = "0-63"
300
301 -- * Image and wipe
302
303 ddCmd :: String
304 ddCmd = "dd"
305
306 -- | 1GB
307 maxWipeChunk :: Int
308 maxWipeChunk = 1024
309
310 minWipeChunkPercent :: Int
311 minWipeChunkPercent = 10
312
313 -- * Directories
314
315 runDirsMode :: Int
316 runDirsMode = 0o775
317
318 secureDirMode :: Int
319 secureDirMode = 0o700
320
321 secureFileMode :: Int
322 secureFileMode = 0o600
323
324 adoptableBlockdevRoot :: String
325 adoptableBlockdevRoot = "/dev/disk/"
326
327 -- * 'autoconf' enable/disable
328
329 enableConfd :: Bool
330 enableConfd = AutoConf.enableConfd
331
332 enableMond :: Bool
333 enableMond = AutoConf.enableMond
334
335 enableMetad :: Bool
336 enableMetad = AutoConf.enableMetad
337
338 enableRestrictedCommands :: Bool
339 enableRestrictedCommands = AutoConf.enableRestrictedCommands
340
341 -- * SSH constants
342
343 ssh :: String
344 ssh = "ssh"
345
346 scp :: String
347 scp = "scp"
348
349 -- * Daemons
350
351 confd :: String
352 confd = Runtime.daemonName GanetiConfd
353
354 masterd :: String
355 masterd = Runtime.daemonName GanetiMasterd
356
357 metad :: String
358 metad = Runtime.daemonName GanetiMetad
359
360 mond :: String
361 mond = Runtime.daemonName GanetiMond
362
363 noded :: String
364 noded = Runtime.daemonName GanetiNoded
365
366 wconfd :: String
367 wconfd = Runtime.daemonName GanetiWConfd
368
369 luxid :: String
370 luxid = Runtime.daemonName GanetiLuxid
371
372 rapi :: String
373 rapi = Runtime.daemonName GanetiRapi
374
375 kvmd :: String
376 kvmd = Runtime.daemonName GanetiKvmd
377
378 -- Set of daemons which only run on the master.
379 -- Keep in sync with the 'daemon-util' script.
380 daemonsMaster :: FrozenSet String
381 daemonsMaster = ConstantUtils.mkSet [wconfd, luxid, rapi]
382
383 daemons :: FrozenSet String
384 daemons =
385 ConstantUtils.mkSet
386 $ map Runtime.daemonName [minBound .. maxBound]
387
388 defaultConfdPort :: Int
389 defaultConfdPort = 1814
390
391 defaultMondPort :: Int
392 defaultMondPort = 1815
393
394 defaultMetadPort :: Int
395 defaultMetadPort = 80
396
397 defaultNodedPort :: Int
398 defaultNodedPort = 1811
399
400 defaultRapiPort :: Int
401 defaultRapiPort = 5080
402
403 daemonsPorts :: Map String (Protocol, Int)
404 daemonsPorts =
405 Map.fromList
406 [ (confd, (Udp, defaultConfdPort))
407 , (metad, (Tcp, defaultMetadPort))
408 , (mond, (Tcp, defaultMondPort))
409 , (noded, (Tcp, defaultNodedPort))
410 , (rapi, (Tcp, defaultRapiPort))
411 , (ssh, (Tcp, 22))
412 ]
413
414 firstDrbdPort :: Int
415 firstDrbdPort = 11000
416
417 lastDrbdPort :: Int
418 lastDrbdPort = 14999
419
420 daemonsLogbase :: Map String String
421 daemonsLogbase =
422 Map.fromList
423 [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
424
425 daemonsExtraLogbase :: Map String (Map String String)
426 daemonsExtraLogbase =
427 Map.fromList $
428 map (Runtime.daemonName *** id)
429 [ (GanetiMond, Map.fromList
430 [ ("access", Runtime.daemonsExtraLogbase GanetiMond AccessLog)
431 , ("error", Runtime.daemonsExtraLogbase GanetiMond ErrorLog)
432 ])
433 ]
434
435 extraLogreasonAccess :: String
436 extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
437
438 extraLogreasonError :: String
439 extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
440
441 devConsole :: String
442 devConsole = ConstantUtils.devConsole
443
444 procMounts :: String
445 procMounts = "/proc/mounts"
446
447 -- * Luxi (Local UniX Interface) related constants
448
449 luxiEom :: PythonChar
450 luxiEom = PythonChar '\x03'
451
452 -- | Environment variable for the luxi override socket
453 luxiOverride :: String
454 luxiOverride = "FORCE_LUXI_SOCKET"
455
456 luxiOverrideMaster :: String
457 luxiOverrideMaster = "master"
458
459 luxiOverrideQuery :: String
460 luxiOverrideQuery = "query"
461
462 luxiVersion :: Int
463 luxiVersion = configVersion
464
465 -- * Syslog
466
467 syslogUsage :: String
468 syslogUsage = AutoConf.syslogUsage
469
470 syslogNo :: String
471 syslogNo = Logging.syslogUsageToRaw SyslogNo
472
473 syslogYes :: String
474 syslogYes = Logging.syslogUsageToRaw SyslogYes
475
476 syslogOnly :: String
477 syslogOnly = Logging.syslogUsageToRaw SyslogOnly
478
479 syslogSocket :: String
480 syslogSocket = "/dev/log"
481
482 exportConfFile :: String
483 exportConfFile = "config.ini"
484
485 -- * Xen
486
487 xenBootloader :: String
488 xenBootloader = AutoConf.xenBootloader
489
490 xenCmdXl :: String
491 xenCmdXl = "xl"
492
493 xenCmdXm :: String
494 xenCmdXm = "xm"
495
496 xenInitrd :: String
497 xenInitrd = AutoConf.xenInitrd
498
499 xenKernel :: String
500 xenKernel = AutoConf.xenKernel
501
502 -- FIXME: perhaps rename to 'validXenCommands' for consistency with
503 -- other constants
504 knownXenCommands :: FrozenSet String
505 knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
506
507 -- * KVM and socat
508
509 kvmPath :: String
510 kvmPath = AutoConf.kvmPath
511
512 kvmKernel :: String
513 kvmKernel = AutoConf.kvmKernel
514
515 socatEscapeCode :: String
516 socatEscapeCode = "0x1d"
517
518 socatPath :: String
519 socatPath = AutoConf.socatPath
520
521 socatUseCompress :: Bool
522 socatUseCompress = AutoConf.socatUseCompress
523
524 socatUseEscape :: Bool
525 socatUseEscape = AutoConf.socatUseEscape
526
527 -- * Console types
528
529 -- | Display a message for console access
530 consMessage :: String
531 consMessage = "msg"
532
533 -- | Console as SPICE server
534 consSpice :: String
535 consSpice = "spice"
536
537 -- | Console as SSH command
538 consSsh :: String
539 consSsh = "ssh"
540
541 -- | Console as VNC server
542 consVnc :: String
543 consVnc = "vnc"
544
545 consAll :: FrozenSet String
546 consAll = ConstantUtils.mkSet [consMessage, consSpice, consSsh, consVnc]
547
548 -- | RSA key bit length
549 --
550 -- For RSA keys more bits are better, but they also make operations
551 -- more expensive. NIST SP 800-131 recommends a minimum of 2048 bits
552 -- from the year 2010 on.
553 rsaKeyBits :: Int
554 rsaKeyBits = 2048
555
556 -- | Ciphers allowed for SSL connections.
557 --
558 -- For the format, see ciphers(1). A better way to disable ciphers
559 -- would be to use the exclamation mark (!), but socat versions below
560 -- 1.5 can't parse exclamation marks in options properly. When
561 -- modifying the ciphers, ensure not to accidentially add something
562 -- after it's been removed. Use the "openssl" utility to check the
563 -- allowed ciphers, e.g. "openssl ciphers -v HIGH:-DES".
564 opensslCiphers :: String
565 opensslCiphers = "HIGH:-DES:-3DES:-EXPORT:-ADH"
566
567 -- * X509
568
569 -- | commonName (CN) used in certificates
570 x509CertCn :: String
571 x509CertCn = "ganeti.example.com"
572
573 -- | Default validity of certificates in days
574 x509CertDefaultValidity :: Int
575 x509CertDefaultValidity = 365 * 5
576
577 x509CertSignatureHeader :: String
578 x509CertSignatureHeader = "X-Ganeti-Signature"
579
580 -- | Digest used to sign certificates ("openssl x509" uses SHA1 by default)
581 x509CertSignDigest :: String
582 x509CertSignDigest = "SHA1"
583
584 -- * Import/export daemon mode
585
586 iemExport :: String
587 iemExport = "export"
588
589 iemImport :: String
590 iemImport = "import"
591
592 -- * Import/export transport compression
593
594 iecGzip :: String
595 iecGzip = "gzip"
596
597 iecGzipFast :: String
598 iecGzipFast = "gzip-fast"
599
600 iecGzipSlow :: String
601 iecGzipSlow = "gzip-slow"
602
603 iecLzop :: String
604 iecLzop = "lzop"
605
606 iecNone :: String
607 iecNone = "none"
608
609 iecAll :: [String]
610 iecAll = [iecGzip, iecGzipFast, iecGzipSlow, iecLzop, iecNone]
611
612 iecDefaultTools :: [String]
613 iecDefaultTools = [iecGzip, iecGzipFast, iecGzipSlow]
614
615 iecCompressionUtilities :: Map String String
616 iecCompressionUtilities =
617 Map.fromList
618 [ (iecGzipFast, iecGzip)
619 , (iecGzipSlow, iecGzip)
620 ]
621
622 ieCustomSize :: String
623 ieCustomSize = "fd"
624
625 -- * Import/export I/O
626
627 -- | Direct file I/O, equivalent to a shell's I/O redirection using
628 -- '<' or '>'
629 ieioFile :: String
630 ieioFile = "file"
631
632 -- | Raw block device I/O using "dd"
633 ieioRawDisk :: String
634 ieioRawDisk = "raw"
635
636 -- | OS definition import/export script
637 ieioScript :: String
638 ieioScript = "script"
639
640 -- * Values
641
642 valueDefault :: String
643 valueDefault = "default"
644
645 valueAuto :: String
646 valueAuto = "auto"
647
648 valueGenerate :: String
649 valueGenerate = "generate"
650
651 valueNone :: String
652 valueNone = "none"
653
654 valueTrue :: String
655 valueTrue = "true"
656
657 valueFalse :: String
658 valueFalse = "false"
659
660 -- * Hooks
661
662 hooksNameCfgupdate :: String
663 hooksNameCfgupdate = "config-update"
664
665 hooksNameWatcher :: String
666 hooksNameWatcher = "watcher"
667
668 hooksPath :: String
669 hooksPath = "/sbin:/bin:/usr/sbin:/usr/bin"
670
671 hooksPhasePost :: String
672 hooksPhasePost = "post"
673
674 hooksPhasePre :: String
675 hooksPhasePre = "pre"
676
677 hooksVersion :: Int
678 hooksVersion = 2
679
680 -- * Hooks subject type (what object type does the LU deal with)
681
682 htypeCluster :: String
683 htypeCluster = "CLUSTER"
684
685 htypeGroup :: String
686 htypeGroup = "GROUP"
687
688 htypeInstance :: String
689 htypeInstance = "INSTANCE"
690
691 htypeNetwork :: String
692 htypeNetwork = "NETWORK"
693
694 htypeNode :: String
695 htypeNode = "NODE"
696
697 -- * Hkr
698
699 hkrSkip :: Int
700 hkrSkip = 0
701
702 hkrFail :: Int
703 hkrFail = 1
704
705 hkrSuccess :: Int
706 hkrSuccess = 2
707
708 -- * Storage types
709
710 stBlock :: String
711 stBlock = Types.storageTypeToRaw StorageBlock
712
713 stDiskless :: String
714 stDiskless = Types.storageTypeToRaw StorageDiskless
715
716 stExt :: String
717 stExt = Types.storageTypeToRaw StorageExt
718
719 stFile :: String
720 stFile = Types.storageTypeToRaw StorageFile
721
722 stSharedFile :: String
723 stSharedFile = Types.storageTypeToRaw StorageSharedFile
724
725 stGluster :: String
726 stGluster = Types.storageTypeToRaw StorageGluster
727
728 stLvmPv :: String
729 stLvmPv = Types.storageTypeToRaw StorageLvmPv
730
731 stLvmVg :: String
732 stLvmVg = Types.storageTypeToRaw StorageLvmVg
733
734 stRados :: String
735 stRados = Types.storageTypeToRaw StorageRados
736
737 storageTypes :: FrozenSet String
738 storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
739
740 -- | The set of storage types for which full storage reporting is available
741 stsReport :: FrozenSet String
742 stsReport = ConstantUtils.mkSet [stFile, stLvmPv, stLvmVg]
743
744 -- | The set of storage types for which node storage reporting is available
745 -- | (as used by LUQueryNodeStorage)
746 stsReportNodeStorage :: FrozenSet String
747 stsReportNodeStorage = ConstantUtils.union stsReport $
748 ConstantUtils.mkSet [ stSharedFile
749 , stGluster
750 ]
751
752 -- * Storage fields
753 -- ** First two are valid in LU context only, not passed to backend
754
755 sfNode :: String
756 sfNode = "node"
757
758 sfType :: String
759 sfType = "type"
760
761 -- ** and the rest are valid in backend
762
763 sfAllocatable :: String
764 sfAllocatable = Types.storageFieldToRaw SFAllocatable
765
766 sfFree :: String
767 sfFree = Types.storageFieldToRaw SFFree
768
769 sfName :: String
770 sfName = Types.storageFieldToRaw SFName
771
772 sfSize :: String
773 sfSize = Types.storageFieldToRaw SFSize
774
775 sfUsed :: String
776 sfUsed = Types.storageFieldToRaw SFUsed
777
778 validStorageFields :: FrozenSet String
779 validStorageFields =
780 ConstantUtils.mkSet $ map Types.storageFieldToRaw [minBound..] ++
781 [sfNode, sfType]
782
783 modifiableStorageFields :: Map String (FrozenSet String)
784 modifiableStorageFields =
785 Map.fromList [(Types.storageTypeToRaw StorageLvmPv,
786 ConstantUtils.mkSet [sfAllocatable])]
787
788 -- * Storage operations
789
790 soFixConsistency :: String
791 soFixConsistency = "fix-consistency"
792
793 validStorageOperations :: Map String (FrozenSet String)
794 validStorageOperations =
795 Map.fromList [(Types.storageTypeToRaw StorageLvmVg,
796 ConstantUtils.mkSet [soFixConsistency])]
797
798 -- * Volume fields
799
800 vfDev :: String
801 vfDev = "dev"
802
803 vfInstance :: String
804 vfInstance = "instance"
805
806 vfName :: String
807 vfName = "name"
808
809 vfNode :: String
810 vfNode = "node"
811
812 vfPhys :: String
813 vfPhys = "phys"
814
815 vfSize :: String
816 vfSize = "size"
817
818 vfVg :: String
819 vfVg = "vg"
820
821 -- * Local disk status
822
823 ldsFaulty :: Int
824 ldsFaulty = Types.localDiskStatusToRaw DiskStatusFaulty
825
826 ldsOkay :: Int
827 ldsOkay = Types.localDiskStatusToRaw DiskStatusOk
828
829 ldsUnknown :: Int
830 ldsUnknown = Types.localDiskStatusToRaw DiskStatusUnknown
831
832 ldsNames :: Map Int String
833 ldsNames =
834 Map.fromList [ (Types.localDiskStatusToRaw ds,
835 localDiskStatusName ds) | ds <- [minBound..] ]
836
837 -- * Disk template types
838
839 dtDiskless :: String
840 dtDiskless = Types.diskTemplateToRaw DTDiskless
841
842 dtFile :: String
843 dtFile = Types.diskTemplateToRaw DTFile
844
845 dtSharedFile :: String
846 dtSharedFile = Types.diskTemplateToRaw DTSharedFile
847
848 dtPlain :: String
849 dtPlain = Types.diskTemplateToRaw DTPlain
850
851 dtBlock :: String
852 dtBlock = Types.diskTemplateToRaw DTBlock
853
854 dtDrbd8 :: String
855 dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
856
857 dtRbd :: String
858 dtRbd = Types.diskTemplateToRaw DTRbd
859
860 dtExt :: String
861 dtExt = Types.diskTemplateToRaw DTExt
862
863 dtGluster :: String
864 dtGluster = Types.diskTemplateToRaw DTGluster
865
866 -- | This is used to order determine the default disk template when
867 -- the list of enabled disk templates is inferred from the current
868 -- state of the cluster. This only happens on an upgrade from a
869 -- version of Ganeti that did not support the 'enabled_disk_templates'
870 -- so far.
871 diskTemplatePreference :: [String]
872 diskTemplatePreference =
873 map Types.diskTemplateToRaw
874 [DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile,
875 DTPlain, DTRbd, DTSharedFile, DTGluster]
876
877 diskTemplates :: FrozenSet String
878 diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
879
880 -- | Disk templates that are enabled by default
881 defaultEnabledDiskTemplates :: [String]
882 defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
883
884 -- | Mapping of disk templates to storage types
885 mapDiskTemplateStorageType :: Map String String
886 mapDiskTemplateStorageType =
887 Map.fromList $
888 map (Types.diskTemplateToRaw *** Types.storageTypeToRaw)
889 [(DTBlock, StorageBlock),
890 (DTDrbd8, StorageLvmVg),
891 (DTExt, StorageExt),
892 (DTSharedFile, StorageSharedFile),
893 (DTFile, StorageFile),
894 (DTDiskless, StorageDiskless),
895 (DTPlain, StorageLvmVg),
896 (DTRbd, StorageRados),
897 (DTGluster, StorageGluster)]
898
899 -- | The set of network-mirrored disk templates
900 dtsIntMirror :: FrozenSet String
901 dtsIntMirror = ConstantUtils.mkSet [dtDrbd8]
902
903 -- | 'DTDiskless' is 'trivially' externally mirrored
904 dtsExtMirror :: FrozenSet String
905 dtsExtMirror =
906 ConstantUtils.mkSet $
907 map Types.diskTemplateToRaw
908 [DTDiskless, DTBlock, DTExt, DTSharedFile, DTRbd, DTGluster]
909
910 -- | The set of non-lvm-based disk templates
911 dtsNotLvm :: FrozenSet String
912 dtsNotLvm =
913 ConstantUtils.mkSet $
914 map Types.diskTemplateToRaw
915 [DTSharedFile, DTDiskless, DTBlock, DTExt, DTFile, DTRbd, DTGluster]
916
917 -- | The set of disk templates which can be grown
918 dtsGrowable :: FrozenSet String
919 dtsGrowable =
920 ConstantUtils.mkSet $
921 map Types.diskTemplateToRaw
922 [DTSharedFile, DTDrbd8, DTPlain, DTExt, DTFile, DTRbd, DTGluster]
923
924 -- | The set of disk templates that allow adoption
925 dtsMayAdopt :: FrozenSet String
926 dtsMayAdopt =
927 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTBlock, DTPlain]
928
929 -- | The set of disk templates that *must* use adoption
930 dtsMustAdopt :: FrozenSet String
931 dtsMustAdopt = ConstantUtils.mkSet [Types.diskTemplateToRaw DTBlock]
932
933 -- | The set of disk templates that allow migrations
934 dtsMirrored :: FrozenSet String
935 dtsMirrored = dtsIntMirror `ConstantUtils.union` dtsExtMirror
936
937 -- | The set of file based disk templates
938 dtsFilebased :: FrozenSet String
939 dtsFilebased =
940 ConstantUtils.mkSet $ map Types.diskTemplateToRaw
941 [DTSharedFile, DTFile, DTGluster]
942
943 -- | The set of disk templates that can be moved by copying
944 --
945 -- Note: a requirement is that they're not accessed externally or
946 -- shared between nodes; in particular, sharedfile is not suitable.
947 dtsCopyable :: FrozenSet String
948 dtsCopyable =
949 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain, DTFile]
950
951 -- | The set of disk templates that are supported by exclusive_storage
952 dtsExclStorage :: FrozenSet String
953 dtsExclStorage = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain]
954
955 -- | Templates for which we don't perform checks on free space
956 dtsNoFreeSpaceCheck :: FrozenSet String
957 dtsNoFreeSpaceCheck =
958 ConstantUtils.mkSet $
959 map Types.diskTemplateToRaw [DTExt, DTSharedFile, DTFile, DTRbd, DTGluster]
960
961 dtsBlock :: FrozenSet String
962 dtsBlock =
963 ConstantUtils.mkSet $
964 map Types.diskTemplateToRaw [DTPlain, DTDrbd8, DTBlock, DTRbd, DTExt]
965
966 -- | The set of lvm-based disk templates
967 dtsLvm :: FrozenSet String
968 dtsLvm = diskTemplates `ConstantUtils.difference` dtsNotLvm
969
970 -- | The set of lvm-based disk templates
971 dtsHaveAccess :: FrozenSet String
972 dtsHaveAccess = ConstantUtils.mkSet $
973 map Types.diskTemplateToRaw [DTRbd, DTGluster]
974
975 -- * Drbd
976
977 drbdHmacAlg :: String
978 drbdHmacAlg = "md5"
979
980 drbdDefaultNetProtocol :: String
981 drbdDefaultNetProtocol = "C"
982
983 drbdMigrationNetProtocol :: String
984 drbdMigrationNetProtocol = "C"
985
986 drbdStatusFile :: String
987 drbdStatusFile = "/proc/drbd"
988
989 -- | The length of generated DRBD secrets (see also TempRes module).
990 drbdSecretLength :: Int
991 drbdSecretLength = 20
992
993 -- | Size of DRBD meta block device
994 drbdMetaSize :: Int
995 drbdMetaSize = 128
996
997 -- * Drbd barrier types
998
999 drbdBDiskBarriers :: String
1000 drbdBDiskBarriers = "b"
1001
1002 drbdBDiskDrain :: String
1003 drbdBDiskDrain = "d"
1004
1005 drbdBDiskFlush :: String
1006 drbdBDiskFlush = "f"
1007
1008 drbdBNone :: String
1009 drbdBNone = "n"
1010
1011 -- | Valid barrier combinations: "n" or any non-null subset of "bfd"
1012 drbdValidBarrierOpt :: FrozenSet (FrozenSet String)
1013 drbdValidBarrierOpt =
1014 ConstantUtils.mkSet
1015 [ ConstantUtils.mkSet [drbdBNone]
1016 , ConstantUtils.mkSet [drbdBDiskBarriers]
1017 , ConstantUtils.mkSet [drbdBDiskDrain]
1018 , ConstantUtils.mkSet [drbdBDiskFlush]
1019 , ConstantUtils.mkSet [drbdBDiskDrain, drbdBDiskFlush]
1020 , ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskDrain]
1021 , ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskFlush]
1022 , ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskFlush, drbdBDiskDrain]
1023 ]
1024
1025 -- | Rbd tool command
1026 rbdCmd :: String
1027 rbdCmd = "rbd"
1028
1029 -- * File backend driver
1030
1031 fdBlktap :: String
1032 fdBlktap = Types.fileDriverToRaw FileBlktap
1033
1034 fdBlktap2 :: String
1035 fdBlktap2 = Types.fileDriverToRaw FileBlktap2
1036
1037 fdLoop :: String
1038 fdLoop = Types.fileDriverToRaw FileLoop
1039
1040 fdDefault :: String
1041 fdDefault = fdLoop
1042
1043 fileDriver :: FrozenSet String
1044 fileDriver =
1045 ConstantUtils.mkSet $
1046 map Types.fileDriverToRaw [minBound..]
1047
1048 -- | The set of drbd-like disk types
1049 dtsDrbd :: FrozenSet String
1050 dtsDrbd = ConstantUtils.mkSet [Types.diskTemplateToRaw DTDrbd8]
1051
1052 -- * Disk access mode
1053
1054 diskRdonly :: String
1055 diskRdonly = Types.diskModeToRaw DiskRdOnly
1056
1057 diskRdwr :: String
1058 diskRdwr = Types.diskModeToRaw DiskRdWr
1059
1060 diskAccessSet :: FrozenSet String
1061 diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..]
1062
1063 -- * Disk replacement mode
1064
1065 replaceDiskAuto :: String
1066 replaceDiskAuto = Types.replaceDisksModeToRaw ReplaceAuto
1067
1068 replaceDiskChg :: String
1069 replaceDiskChg = Types.replaceDisksModeToRaw ReplaceNewSecondary
1070
1071 replaceDiskPri :: String
1072 replaceDiskPri = Types.replaceDisksModeToRaw ReplaceOnPrimary
1073
1074 replaceDiskSec :: String
1075 replaceDiskSec = Types.replaceDisksModeToRaw ReplaceOnSecondary
1076
1077 replaceModes :: FrozenSet String
1078 replaceModes =
1079 ConstantUtils.mkSet $ map Types.replaceDisksModeToRaw [minBound..]
1080
1081 -- * Instance export mode
1082
1083 exportModeLocal :: String
1084 exportModeLocal = Types.exportModeToRaw ExportModeLocal
1085
1086 exportModeRemote :: String
1087 exportModeRemote = Types.exportModeToRaw ExportModeRemote
1088
1089 exportModes :: FrozenSet String
1090 exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
1091
1092 -- * Instance creation modes
1093
1094 instanceCreate :: String
1095 instanceCreate = Types.instCreateModeToRaw InstCreate
1096
1097 instanceImport :: String
1098 instanceImport = Types.instCreateModeToRaw InstImport
1099
1100 instanceRemoteImport :: String
1101 instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
1102
1103 instanceCreateModes :: FrozenSet String
1104 instanceCreateModes =
1105 ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
1106
1107 -- * Remote import/export handshake message and version
1108
1109 rieHandshake :: String
1110 rieHandshake = "Hi, I'm Ganeti"
1111
1112 rieVersion :: Int
1113 rieVersion = 0
1114
1115 -- | Remote import/export certificate validity (seconds)
1116 rieCertValidity :: Int
1117 rieCertValidity = 24 * 60 * 60
1118
1119 -- | Export only: how long to wait per connection attempt (seconds)
1120 rieConnectAttemptTimeout :: Int
1121 rieConnectAttemptTimeout = 20
1122
1123 -- | Export only: number of attempts to connect
1124 rieConnectRetries :: Int
1125 rieConnectRetries = 10
1126
1127 -- | Overall timeout for establishing connection
1128 rieConnectTimeout :: Int
1129 rieConnectTimeout = 180
1130
1131 -- | Give child process up to 5 seconds to exit after sending a signal
1132 childLingerTimeout :: Double
1133 childLingerTimeout = 5.0
1134
1135 -- * Import/export config options
1136
1137 inisectBep :: String
1138 inisectBep = "backend"
1139
1140 inisectExp :: String
1141 inisectExp = "export"
1142
1143 inisectHyp :: String
1144 inisectHyp = "hypervisor"
1145
1146 inisectIns :: String
1147 inisectIns = "instance"
1148
1149 inisectOsp :: String
1150 inisectOsp = "os"
1151
1152 inisectOspPrivate :: String
1153 inisectOspPrivate = "os_private"
1154
1155 -- * Dynamic device modification
1156
1157 ddmAdd :: String
1158 ddmAdd = Types.ddmFullToRaw DdmFullAdd
1159
1160 ddmModify :: String
1161 ddmModify = Types.ddmFullToRaw DdmFullModify
1162
1163 ddmRemove :: String
1164 ddmRemove = Types.ddmFullToRaw DdmFullRemove
1165
1166 ddmsValues :: FrozenSet String
1167 ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
1168
1169 ddmsValuesWithModify :: FrozenSet String
1170 ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
1171
1172 -- * Common exit codes
1173
1174 exitSuccess :: Int
1175 exitSuccess = 0
1176
1177 exitFailure :: Int
1178 exitFailure = ConstantUtils.exitFailure
1179
1180 exitNotcluster :: Int
1181 exitNotcluster = 5
1182
1183 exitNotmaster :: Int
1184 exitNotmaster = 11
1185
1186 exitNodesetupError :: Int
1187 exitNodesetupError = 12
1188
1189 -- | Need user confirmation
1190 exitConfirmation :: Int
1191 exitConfirmation = 13
1192
1193 -- | Exit code for query operations with unknown fields
1194 exitUnknownField :: Int
1195 exitUnknownField = 14
1196
1197 -- * Tags
1198
1199 tagCluster :: String
1200 tagCluster = Types.tagKindToRaw TagKindCluster
1201
1202 tagInstance :: String
1203 tagInstance = Types.tagKindToRaw TagKindInstance
1204
1205 tagNetwork :: String
1206 tagNetwork = Types.tagKindToRaw TagKindNetwork
1207
1208 tagNode :: String
1209 tagNode = Types.tagKindToRaw TagKindNode
1210
1211 tagNodegroup :: String
1212 tagNodegroup = Types.tagKindToRaw TagKindGroup
1213
1214 validTagTypes :: FrozenSet String
1215 validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
1216
1217 maxTagLen :: Int
1218 maxTagLen = 128
1219
1220 maxTagsPerObj :: Int
1221 maxTagsPerObj = 4096
1222
1223 -- * Others
1224
1225 defaultBridge :: String
1226 defaultBridge = "xen-br0"
1227
1228 defaultOvs :: String
1229 defaultOvs = "switch1"
1230
1231 -- | 60 MiB/s, expressed in KiB/s
1232 classicDrbdSyncSpeed :: Int
1233 classicDrbdSyncSpeed = 60 * 1024
1234
1235 ip4AddressAny :: String
1236 ip4AddressAny = "0.0.0.0"
1237
1238 ip4AddressLocalhost :: String
1239 ip4AddressLocalhost = "127.0.0.1"
1240
1241 ip6AddressAny :: String
1242 ip6AddressAny = "::"
1243
1244 ip6AddressLocalhost :: String
1245 ip6AddressLocalhost = "::1"
1246
1247 ip4Version :: Int
1248 ip4Version = 4
1249
1250 ip6Version :: Int
1251 ip6Version = 6
1252
1253 validIpVersions :: FrozenSet Int
1254 validIpVersions = ConstantUtils.mkSet [ip4Version, ip6Version]
1255
1256 tcpPingTimeout :: Int
1257 tcpPingTimeout = 10
1258
1259 defaultVg :: String
1260 defaultVg = "xenvg"
1261
1262 defaultDrbdHelper :: String
1263 defaultDrbdHelper = "/bin/true"
1264
1265 minVgSize :: Int
1266 minVgSize = 20480
1267
1268 defaultMacPrefix :: String
1269 defaultMacPrefix = "aa:00:00"
1270
1271 -- | Default maximum instance wait time (seconds)
1272 defaultShutdownTimeout :: Int
1273 defaultShutdownTimeout = 120
1274
1275 -- | Node clock skew (seconds)
1276 nodeMaxClockSkew :: Int
1277 nodeMaxClockSkew = 150
1278
1279 -- | Time for an intra-cluster disk transfer to wait for a connection
1280 diskTransferConnectTimeout :: Int
1281 diskTransferConnectTimeout = 60
1282
1283 -- | Disk index separator
1284 diskSeparator :: String
1285 diskSeparator = AutoConf.diskSeparator
1286
1287 ipCommandPath :: String
1288 ipCommandPath = AutoConf.ipPath
1289
1290 -- | Key for job IDs in opcode result
1291 jobIdsKey :: String
1292 jobIdsKey = "jobs"
1293
1294 -- * Runparts results
1295
1296 runpartsErr :: Int
1297 runpartsErr = 2
1298
1299 runpartsRun :: Int
1300 runpartsRun = 1
1301
1302 runpartsSkip :: Int
1303 runpartsSkip = 0
1304
1305 runpartsStatus :: [Int]
1306 runpartsStatus = [runpartsErr, runpartsRun, runpartsSkip]
1307
1308 -- * RPC
1309
1310 rpcEncodingNone :: Int
1311 rpcEncodingNone = 0
1312
1313 rpcEncodingZlibBase64 :: Int
1314 rpcEncodingZlibBase64 = 1
1315
1316 -- * Timeout table
1317 --
1318 -- Various time constants for the timeout table
1319
1320 rpcTmoUrgent :: Int
1321 rpcTmoUrgent = Types.rpcTimeoutToRaw Urgent
1322
1323 rpcTmoFast :: Int
1324 rpcTmoFast = Types.rpcTimeoutToRaw Fast
1325
1326 rpcTmoNormal :: Int
1327 rpcTmoNormal = Types.rpcTimeoutToRaw Normal
1328
1329 rpcTmoSlow :: Int
1330 rpcTmoSlow = Types.rpcTimeoutToRaw Slow
1331
1332 -- | 'rpcTmo_4hrs' contains an underscore to circumvent a limitation
1333 -- in the 'Ganeti.THH.deCamelCase' function and generate the correct
1334 -- Python name.
1335 rpcTmo_4hrs :: Int
1336 rpcTmo_4hrs = Types.rpcTimeoutToRaw FourHours
1337
1338 -- | 'rpcTmo_1day' contains an underscore to circumvent a limitation
1339 -- in the 'Ganeti.THH.deCamelCase' function and generate the correct
1340 -- Python name.
1341 rpcTmo_1day :: Int
1342 rpcTmo_1day = Types.rpcTimeoutToRaw OneDay
1343
1344 -- | Timeout for connecting to nodes (seconds)
1345 rpcConnectTimeout :: Int
1346 rpcConnectTimeout = 5
1347
1348 -- OS
1349
1350 osScriptCreate :: String
1351 osScriptCreate = "create"
1352
1353 osScriptCreateUntrusted :: String
1354 osScriptCreateUntrusted = "create_untrusted"
1355
1356 osScriptExport :: String
1357 osScriptExport = "export"
1358
1359 osScriptImport :: String
1360 osScriptImport = "import"
1361
1362 osScriptRename :: String
1363 osScriptRename = "rename"
1364
1365 osScriptVerify :: String
1366 osScriptVerify = "verify"
1367
1368 osScripts :: [String]
1369 osScripts = [osScriptCreate, osScriptCreateUntrusted, osScriptExport,
1370 osScriptImport, osScriptRename, osScriptVerify]
1371
1372 osApiFile :: String
1373 osApiFile = "ganeti_api_version"
1374
1375 osVariantsFile :: String
1376 osVariantsFile = "variants.list"
1377
1378 osParametersFile :: String
1379 osParametersFile = "parameters.list"
1380
1381 osValidateParameters :: String
1382 osValidateParameters = "parameters"
1383
1384 osValidateCalls :: FrozenSet String
1385 osValidateCalls = ConstantUtils.mkSet [osValidateParameters]
1386
1387 -- | External Storage (ES) related constants
1388
1389 esActionAttach :: String
1390 esActionAttach = "attach"
1391
1392 esActionCreate :: String
1393 esActionCreate = "create"
1394
1395 esActionDetach :: String
1396 esActionDetach = "detach"
1397
1398 esActionGrow :: String
1399 esActionGrow = "grow"
1400
1401 esActionRemove :: String
1402 esActionRemove = "remove"
1403
1404 esActionSetinfo :: String
1405 esActionSetinfo = "setinfo"
1406
1407 esActionVerify :: String
1408 esActionVerify = "verify"
1409
1410 esScriptCreate :: String
1411 esScriptCreate = esActionCreate
1412
1413 esScriptRemove :: String
1414 esScriptRemove = esActionRemove
1415
1416 esScriptGrow :: String
1417 esScriptGrow = esActionGrow
1418
1419 esScriptAttach :: String
1420 esScriptAttach = esActionAttach
1421
1422 esScriptDetach :: String
1423 esScriptDetach = esActionDetach
1424
1425 esScriptSetinfo :: String
1426 esScriptSetinfo = esActionSetinfo
1427
1428 esScriptVerify :: String
1429 esScriptVerify = esActionVerify
1430
1431 esScripts :: FrozenSet String
1432 esScripts =
1433 ConstantUtils.mkSet [esScriptAttach,
1434 esScriptCreate,
1435 esScriptDetach,
1436 esScriptGrow,
1437 esScriptRemove,
1438 esScriptSetinfo,
1439 esScriptVerify]
1440
1441 esParametersFile :: String
1442 esParametersFile = "parameters.list"
1443
1444 -- * Reboot types
1445
1446 instanceRebootSoft :: String
1447 instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
1448
1449 instanceRebootHard :: String
1450 instanceRebootHard = Types.rebootTypeToRaw RebootHard
1451
1452 instanceRebootFull :: String
1453 instanceRebootFull = Types.rebootTypeToRaw RebootFull
1454
1455 rebootTypes :: FrozenSet String
1456 rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
1457
1458 -- * Instance reboot behaviors
1459
1460 instanceRebootAllowed :: String
1461 instanceRebootAllowed = "reboot"
1462
1463 instanceRebootExit :: String
1464 instanceRebootExit = "exit"
1465
1466 rebootBehaviors :: [String]
1467 rebootBehaviors = [instanceRebootAllowed, instanceRebootExit]
1468
1469 -- * VTypes
1470
1471 vtypeBool :: VType
1472 vtypeBool = VTypeBool
1473
1474 vtypeInt :: VType
1475 vtypeInt = VTypeInt
1476
1477 vtypeFloat :: VType
1478 vtypeFloat = VTypeFloat
1479
1480 vtypeMaybeString :: VType
1481 vtypeMaybeString = VTypeMaybeString
1482
1483 -- | Size in MiBs
1484 vtypeSize :: VType
1485 vtypeSize = VTypeSize
1486
1487 vtypeString :: VType
1488 vtypeString = VTypeString
1489
1490 enforceableTypes :: FrozenSet VType
1491 enforceableTypes = ConstantUtils.mkSet [minBound..]
1492
1493 -- | Constant representing that the user does not specify any IP version
1494 ifaceNoIpVersionSpecified :: Int
1495 ifaceNoIpVersionSpecified = 0
1496
1497 validSerialSpeeds :: [Int]
1498 validSerialSpeeds =
1499 [75,
1500 110,
1501 300,
1502 600,
1503 1200,
1504 1800,
1505 2400,
1506 4800,
1507 9600,
1508 14400,
1509 19200,
1510 28800,
1511 38400,
1512 57600,
1513 115200,
1514 230400,
1515 345600,
1516 460800]
1517
1518 -- * HV parameter names (global namespace)
1519
1520 hvAcpi :: String
1521 hvAcpi = "acpi"
1522
1523 hvBlockdevPrefix :: String
1524 hvBlockdevPrefix = "blockdev_prefix"
1525
1526 hvBootloaderArgs :: String
1527 hvBootloaderArgs = "bootloader_args"
1528
1529 hvBootloaderPath :: String
1530 hvBootloaderPath = "bootloader_path"
1531
1532 hvBootOrder :: String
1533 hvBootOrder = "boot_order"
1534
1535 hvCdromImagePath :: String
1536 hvCdromImagePath = "cdrom_image_path"
1537
1538 hvCpuCap :: String
1539 hvCpuCap = "cpu_cap"
1540
1541 hvCpuCores :: String
1542 hvCpuCores = "cpu_cores"
1543
1544 hvCpuMask :: String
1545 hvCpuMask = "cpu_mask"
1546
1547 hvCpuSockets :: String
1548 hvCpuSockets = "cpu_sockets"
1549
1550 hvCpuThreads :: String
1551 hvCpuThreads = "cpu_threads"
1552
1553 hvCpuType :: String
1554 hvCpuType = "cpu_type"
1555
1556 hvCpuWeight :: String
1557 hvCpuWeight = "cpu_weight"
1558
1559 hvDeviceModel :: String
1560 hvDeviceModel = "device_model"
1561
1562 hvDiskCache :: String
1563 hvDiskCache = "disk_cache"
1564
1565 hvDiskType :: String
1566 hvDiskType = "disk_type"
1567
1568 hvInitrdPath :: String
1569 hvInitrdPath = "initrd_path"
1570
1571 hvInitScript :: String
1572 hvInitScript = "init_script"
1573
1574 hvKernelArgs :: String
1575 hvKernelArgs = "kernel_args"
1576
1577 hvKernelPath :: String
1578 hvKernelPath = "kernel_path"
1579
1580 hvKeymap :: String
1581 hvKeymap = "keymap"
1582
1583 hvKvmCdrom2ImagePath :: String
1584 hvKvmCdrom2ImagePath = "cdrom2_image_path"
1585
1586 hvKvmCdromDiskType :: String
1587 hvKvmCdromDiskType = "cdrom_disk_type"
1588
1589 hvKvmExtra :: String
1590 hvKvmExtra = "kvm_extra"
1591
1592 hvKvmFlag :: String
1593 hvKvmFlag = "kvm_flag"
1594
1595 hvKvmFloppyImagePath :: String
1596 hvKvmFloppyImagePath = "floppy_image_path"
1597
1598 hvKvmMachineVersion :: String
1599 hvKvmMachineVersion = "machine_version"
1600
1601 hvKvmMigrationCaps :: String
1602 hvKvmMigrationCaps = "migration_caps"
1603
1604 hvKvmPath :: String
1605 hvKvmPath = "kvm_path"
1606
1607 hvKvmDiskAio :: String
1608 hvKvmDiskAio = "disk_aio"
1609
1610 hvKvmSpiceAudioCompr :: String
1611 hvKvmSpiceAudioCompr = "spice_playback_compression"
1612
1613 hvKvmSpiceBind :: String
1614 hvKvmSpiceBind = "spice_bind"
1615
1616 hvKvmSpiceIpVersion :: String
1617 hvKvmSpiceIpVersion = "spice_ip_version"
1618
1619 hvKvmSpiceJpegImgCompr :: String
1620 hvKvmSpiceJpegImgCompr = "spice_jpeg_wan_compression"
1621
1622 hvKvmSpiceLosslessImgCompr :: String
1623 hvKvmSpiceLosslessImgCompr = "spice_image_compression"
1624
1625 hvKvmSpicePasswordFile :: String
1626 hvKvmSpicePasswordFile = "spice_password_file"
1627
1628 hvKvmSpiceStreamingVideoDetection :: String
1629 hvKvmSpiceStreamingVideoDetection = "spice_streaming_video"
1630
1631 hvKvmSpiceTlsCiphers :: String
1632 hvKvmSpiceTlsCiphers = "spice_tls_ciphers"
1633
1634 hvKvmSpiceUseTls :: String
1635 hvKvmSpiceUseTls = "spice_use_tls"
1636
1637 hvKvmSpiceUseVdagent :: String
1638 hvKvmSpiceUseVdagent = "spice_use_vdagent"
1639
1640 hvKvmSpiceZlibGlzImgCompr :: String
1641 hvKvmSpiceZlibGlzImgCompr = "spice_zlib_glz_wan_compression"
1642
1643 hvKvmUseChroot :: String
1644 hvKvmUseChroot = "use_chroot"
1645
1646 hvKvmUserShutdown :: String
1647 hvKvmUserShutdown = "user_shutdown"
1648
1649 hvMemPath :: String
1650 hvMemPath = "mem_path"
1651
1652 hvMigrationBandwidth :: String
1653 hvMigrationBandwidth = "migration_bandwidth"
1654
1655 hvMigrationDowntime :: String
1656 hvMigrationDowntime = "migration_downtime"
1657
1658 hvMigrationMode :: String
1659 hvMigrationMode = "migration_mode"
1660
1661 hvMigrationPort :: String
1662 hvMigrationPort = "migration_port"
1663
1664 hvNicType :: String
1665 hvNicType = "nic_type"
1666
1667 hvPae :: String
1668 hvPae = "pae"
1669
1670 hvPassthrough :: String
1671 hvPassthrough = "pci_pass"
1672
1673 hvRebootBehavior :: String
1674 hvRebootBehavior = "reboot_behavior"
1675
1676 hvRootPath :: String
1677 hvRootPath = "root_path"
1678
1679 hvSecurityDomain :: String
1680 hvSecurityDomain = "security_domain"
1681
1682 hvSecurityModel :: String
1683 hvSecurityModel = "security_model"
1684
1685 hvSerialConsole :: String
1686 hvSerialConsole = "serial_console"
1687
1688 hvSerialSpeed :: String
1689 hvSerialSpeed = "serial_speed"
1690
1691 hvSoundhw :: String
1692 hvSoundhw = "soundhw"
1693
1694 hvUsbDevices :: String
1695 hvUsbDevices = "usb_devices"
1696
1697 hvUsbMouse :: String
1698 hvUsbMouse = "usb_mouse"
1699
1700 hvUseBootloader :: String
1701 hvUseBootloader = "use_bootloader"
1702
1703 hvUseLocaltime :: String
1704 hvUseLocaltime = "use_localtime"
1705
1706 hvVga :: String
1707 hvVga = "vga"
1708
1709 hvVhostNet :: String
1710 hvVhostNet = "vhost_net"
1711
1712 hvVirtioNetQueues :: String
1713 hvVirtioNetQueues = "virtio_net_queues"
1714
1715 hvVifScript :: String
1716 hvVifScript = "vif_script"
1717
1718 hvVifType :: String
1719 hvVifType = "vif_type"
1720
1721 hvViridian :: String
1722 hvViridian = "viridian"
1723
1724 hvVncBindAddress :: String
1725 hvVncBindAddress = "vnc_bind_address"
1726
1727 hvVncPasswordFile :: String
1728 hvVncPasswordFile = "vnc_password_file"
1729
1730 hvVncTls :: String
1731 hvVncTls = "vnc_tls"
1732
1733 hvVncX509 :: String
1734 hvVncX509 = "vnc_x509_path"
1735
1736 hvVncX509Verify :: String
1737 hvVncX509Verify = "vnc_x509_verify"
1738
1739 hvVnetHdr :: String
1740 hvVnetHdr = "vnet_hdr"
1741
1742 hvXenCmd :: String
1743 hvXenCmd = "xen_cmd"
1744
1745 hvXenCpuid :: String
1746 hvXenCpuid = "cpuid"
1747
1748 hvsParameterTitles :: Map String String
1749 hvsParameterTitles =
1750 Map.fromList
1751 [(hvAcpi, "ACPI"),
1752 (hvBootOrder, "Boot_order"),
1753 (hvCdromImagePath, "CDROM_image_path"),
1754 (hvCpuType, "cpu_type"),
1755 (hvDiskType, "Disk_type"),
1756 (hvInitrdPath, "Initrd_path"),
1757 (hvKernelPath, "Kernel_path"),
1758 (hvNicType, "NIC_type"),
1759 (hvPae, "PAE"),
1760 (hvPassthrough, "pci_pass"),
1761 (hvVncBindAddress, "VNC_bind_address")]
1762
1763 hvsParameters :: FrozenSet String
1764 hvsParameters = ConstantUtils.mkSet $ Map.keys hvsParameterTypes
1765
1766 hvsParameterTypes :: Map String VType
1767 hvsParameterTypes = Map.fromList
1768 [ (hvAcpi, VTypeBool)
1769 , (hvBlockdevPrefix, VTypeString)
1770 , (hvBootloaderArgs, VTypeString)
1771 , (hvBootloaderPath, VTypeString)
1772 , (hvBootOrder, VTypeString)
1773 , (hvCdromImagePath, VTypeString)
1774 , (hvCpuCap, VTypeInt)
1775 , (hvCpuCores, VTypeInt)
1776 , (hvCpuMask, VTypeString)
1777 , (hvCpuSockets, VTypeInt)
1778 , (hvCpuThreads, VTypeInt)
1779 , (hvCpuType, VTypeString)
1780 , (hvCpuWeight, VTypeInt)
1781 , (hvDeviceModel, VTypeString)
1782 , (hvDiskCache, VTypeString)
1783 , (hvDiskType, VTypeString)
1784 , (hvInitrdPath, VTypeString)
1785 , (hvInitScript, VTypeString)
1786 , (hvKernelArgs, VTypeString)
1787 , (hvKernelPath, VTypeString)
1788 , (hvKeymap, VTypeString)
1789 , (hvKvmCdrom2ImagePath, VTypeString)
1790 , (hvKvmCdromDiskType, VTypeString)
1791 , (hvKvmExtra, VTypeString)
1792 , (hvKvmFlag, VTypeString)
1793 , (hvKvmFloppyImagePath, VTypeString)
1794 , (hvKvmMachineVersion, VTypeString)
1795 , (hvKvmMigrationCaps, VTypeString)
1796 , (hvKvmPath, VTypeString)
1797 , (hvKvmDiskAio, VTypeString)
1798 , (hvKvmSpiceAudioCompr, VTypeBool)
1799 , (hvKvmSpiceBind, VTypeString)
1800 , (hvKvmSpiceIpVersion, VTypeInt)
1801 , (hvKvmSpiceJpegImgCompr, VTypeString)
1802 , (hvKvmSpiceLosslessImgCompr, VTypeString)
1803 , (hvKvmSpicePasswordFile, VTypeString)
1804 , (hvKvmSpiceStreamingVideoDetection, VTypeString)
1805 , (hvKvmSpiceTlsCiphers, VTypeString)
1806 , (hvKvmSpiceUseTls, VTypeBool)
1807 , (hvKvmSpiceUseVdagent, VTypeBool)
1808 , (hvKvmSpiceZlibGlzImgCompr, VTypeString)
1809 , (hvKvmUseChroot, VTypeBool)
1810 , (hvKvmUserShutdown, VTypeBool)
1811 , (hvMemPath, VTypeString)
1812 , (hvMigrationBandwidth, VTypeInt)
1813 , (hvMigrationDowntime, VTypeInt)
1814 , (hvMigrationMode, VTypeString)
1815 , (hvMigrationPort, VTypeInt)
1816 , (hvNicType, VTypeString)
1817 , (hvPae, VTypeBool)
1818 , (hvPassthrough, VTypeString)
1819 , (hvRebootBehavior, VTypeString)
1820 , (hvRootPath, VTypeMaybeString)
1821 , (hvSecurityDomain, VTypeString)
1822 , (hvSecurityModel, VTypeString)
1823 , (hvSerialConsole, VTypeBool)
1824 , (hvSerialSpeed, VTypeInt)
1825 , (hvSoundhw, VTypeString)
1826 , (hvUsbDevices, VTypeString)
1827 , (hvUsbMouse, VTypeString)
1828 , (hvUseBootloader, VTypeBool)
1829 , (hvUseLocaltime, VTypeBool)
1830 , (hvVga, VTypeString)
1831 , (hvVhostNet, VTypeBool)
1832 , (hvVirtioNetQueues, VTypeInt)
1833 , (hvVifScript, VTypeString)
1834 , (hvVifType, VTypeString)
1835 , (hvViridian, VTypeBool)
1836 , (hvVncBindAddress, VTypeString)
1837 , (hvVncPasswordFile, VTypeString)
1838 , (hvVncTls, VTypeBool)
1839 , (hvVncX509, VTypeString)
1840 , (hvVncX509Verify, VTypeBool)
1841 , (hvVnetHdr, VTypeBool)
1842 , (hvXenCmd, VTypeString)
1843 , (hvXenCpuid, VTypeString)
1844 ]
1845
1846 -- * Migration statuses
1847
1848 hvMigrationActive :: String
1849 hvMigrationActive = "active"
1850
1851 hvMigrationCancelled :: String
1852 hvMigrationCancelled = "cancelled"
1853
1854 hvMigrationCompleted :: String
1855 hvMigrationCompleted = "completed"
1856
1857 hvMigrationFailed :: String
1858 hvMigrationFailed = "failed"
1859
1860 hvMigrationValidStatuses :: FrozenSet String
1861 hvMigrationValidStatuses =
1862 ConstantUtils.mkSet [hvMigrationActive,
1863 hvMigrationCancelled,
1864 hvMigrationCompleted,
1865 hvMigrationFailed]
1866
1867 hvMigrationFailedStatuses :: FrozenSet String
1868 hvMigrationFailedStatuses =
1869 ConstantUtils.mkSet [hvMigrationFailed, hvMigrationCancelled]
1870
1871 -- | KVM-specific statuses
1872 --
1873 -- FIXME: this constant seems unnecessary
1874 hvKvmMigrationValidStatuses :: FrozenSet String
1875 hvKvmMigrationValidStatuses = hvMigrationValidStatuses
1876
1877 -- | Node info keys
1878 hvNodeinfoKeyVersion :: String
1879 hvNodeinfoKeyVersion = "hv_version"
1880
1881 -- * Hypervisor state
1882
1883 hvstCpuNode :: String
1884 hvstCpuNode = "cpu_node"
1885
1886 hvstCpuTotal :: String
1887 hvstCpuTotal = "cpu_total"
1888
1889 hvstMemoryHv :: String
1890 hvstMemoryHv = "mem_hv"
1891
1892 hvstMemoryNode :: String
1893 hvstMemoryNode = "mem_node"
1894
1895 hvstMemoryTotal :: String
1896 hvstMemoryTotal = "mem_total"
1897
1898 hvstsParameters :: FrozenSet String
1899 hvstsParameters =
1900 ConstantUtils.mkSet [hvstCpuNode,
1901 hvstCpuTotal,
1902 hvstMemoryHv,
1903 hvstMemoryNode,
1904 hvstMemoryTotal]
1905
1906 hvstDefaults :: Map String Int
1907 hvstDefaults =
1908 Map.fromList
1909 [(hvstCpuNode, 1),
1910 (hvstCpuTotal, 1),
1911 (hvstMemoryHv, 0),
1912 (hvstMemoryTotal, 0),
1913 (hvstMemoryNode, 0)]
1914
1915 hvstsParameterTypes :: Map String VType
1916 hvstsParameterTypes =
1917 Map.fromList [(hvstMemoryTotal, VTypeInt),
1918 (hvstMemoryNode, VTypeInt),
1919 (hvstMemoryHv, VTypeInt),
1920 (hvstCpuTotal, VTypeInt),
1921 (hvstCpuNode, VTypeInt)]
1922
1923 -- * Disk state
1924
1925 dsDiskOverhead :: String
1926 dsDiskOverhead = "disk_overhead"
1927
1928 dsDiskReserved :: String
1929 dsDiskReserved = "disk_reserved"
1930
1931 dsDiskTotal :: String
1932 dsDiskTotal = "disk_total"
1933
1934 dsDefaults :: Map String Int
1935 dsDefaults =
1936 Map.fromList
1937 [(dsDiskTotal, 0),
1938 (dsDiskReserved, 0),
1939 (dsDiskOverhead, 0)]
1940
1941 dssParameterTypes :: Map String VType
1942 dssParameterTypes =
1943 Map.fromList [(dsDiskTotal, VTypeInt),
1944 (dsDiskReserved, VTypeInt),
1945 (dsDiskOverhead, VTypeInt)]
1946
1947 dssParameters :: FrozenSet String
1948 dssParameters =
1949 ConstantUtils.mkSet [dsDiskTotal, dsDiskReserved, dsDiskOverhead]
1950
1951 dsValidTypes :: FrozenSet String
1952 dsValidTypes = ConstantUtils.mkSet [Types.diskTemplateToRaw DTPlain]
1953
1954 -- Backend parameter names
1955
1956 beAlwaysFailover :: String
1957 beAlwaysFailover = "always_failover"
1958
1959 beAutoBalance :: String
1960 beAutoBalance = "auto_balance"
1961
1962 beMaxmem :: String
1963 beMaxmem = "maxmem"
1964
1965 -- | Deprecated and replaced by max and min mem
1966 beMemory :: String
1967 beMemory = "memory"
1968
1969 beMinmem :: String
1970 beMinmem = "minmem"
1971
1972 beSpindleUse :: String
1973 beSpindleUse = "spindle_use"
1974
1975 beVcpus :: String
1976 beVcpus = "vcpus"
1977
1978 besParameterTypes :: Map String VType
1979 besParameterTypes =
1980 Map.fromList [(beAlwaysFailover, VTypeBool),
1981 (beAutoBalance, VTypeBool),
1982 (beMaxmem, VTypeSize),
1983 (beMinmem, VTypeSize),
1984 (beSpindleUse, VTypeInt),
1985 (beVcpus, VTypeInt)]
1986
1987 besParameterTitles :: Map String String
1988 besParameterTitles =
1989 Map.fromList [(beAutoBalance, "Auto_balance"),
1990 (beMinmem, "ConfigMinMem"),
1991 (beVcpus, "ConfigVCPUs"),
1992 (beMaxmem, "ConfigMaxMem")]
1993
1994 besParameterCompat :: Map String VType
1995 besParameterCompat = Map.insert beMemory VTypeSize besParameterTypes
1996
1997 besParameters :: FrozenSet String
1998 besParameters =
1999 ConstantUtils.mkSet [beAlwaysFailover,
2000 beAutoBalance,
2001 beMaxmem,
2002 beMinmem,
2003 beSpindleUse,
2004 beVcpus]
2005
2006 -- | Instance specs
2007 --
2008 -- FIXME: these should be associated with 'Ganeti.HTools.Types.ISpec'
2009
2010 ispecMemSize :: String
2011 ispecMemSize = ConstantUtils.ispecMemSize
2012
2013 ispecCpuCount :: String
2014 ispecCpuCount = ConstantUtils.ispecCpuCount
2015
2016 ispecDiskCount :: String
2017 ispecDiskCount = ConstantUtils.ispecDiskCount
2018
2019 ispecDiskSize :: String
2020 ispecDiskSize = ConstantUtils.ispecDiskSize
2021
2022 ispecNicCount :: String
2023 ispecNicCount = ConstantUtils.ispecNicCount
2024
2025 ispecSpindleUse :: String
2026 ispecSpindleUse = ConstantUtils.ispecSpindleUse
2027
2028 ispecsParameterTypes :: Map String VType
2029 ispecsParameterTypes =
2030 Map.fromList
2031 [(ConstantUtils.ispecDiskSize, VTypeInt),
2032 (ConstantUtils.ispecCpuCount, VTypeInt),
2033 (ConstantUtils.ispecSpindleUse, VTypeInt),
2034 (ConstantUtils.ispecMemSize, VTypeInt),
2035 (ConstantUtils.ispecNicCount, VTypeInt),
2036 (ConstantUtils.ispecDiskCount, VTypeInt)]
2037
2038 ispecsParameters :: FrozenSet String
2039 ispecsParameters =
2040 ConstantUtils.mkSet [ConstantUtils.ispecCpuCount,
2041 ConstantUtils.ispecDiskCount,
2042 ConstantUtils.ispecDiskSize,
2043 ConstantUtils.ispecMemSize,
2044 ConstantUtils.ispecNicCount,
2045 ConstantUtils.ispecSpindleUse]
2046
2047 ispecsMinmax :: String
2048 ispecsMinmax = ConstantUtils.ispecsMinmax
2049
2050 ispecsMax :: String
2051 ispecsMax = "max"
2052
2053 ispecsMin :: String
2054 ispecsMin = "min"
2055
2056 ispecsStd :: String
2057 ispecsStd = ConstantUtils.ispecsStd
2058
2059 ipolicyDts :: String
2060 ipolicyDts = ConstantUtils.ipolicyDts
2061
2062 ipolicyVcpuRatio :: String
2063 ipolicyVcpuRatio = ConstantUtils.ipolicyVcpuRatio
2064
2065 ipolicySpindleRatio :: String
2066 ipolicySpindleRatio = ConstantUtils.ipolicySpindleRatio
2067
2068 ispecsMinmaxKeys :: FrozenSet String
2069 ispecsMinmaxKeys = ConstantUtils.mkSet [ispecsMax, ispecsMin]
2070
2071 ipolicyParameters :: FrozenSet String
2072 ipolicyParameters =
2073 ConstantUtils.mkSet [ConstantUtils.ipolicyVcpuRatio,
2074 ConstantUtils.ipolicySpindleRatio]
2075
2076 ipolicyAllKeys :: FrozenSet String
2077 ipolicyAllKeys =
2078 ConstantUtils.union ipolicyParameters $
2079 ConstantUtils.mkSet [ConstantUtils.ipolicyDts,
2080 ConstantUtils.ispecsMinmax,
2081 ispecsStd]
2082
2083 -- | Node parameter names
2084
2085 ndExclusiveStorage :: String
2086 ndExclusiveStorage = "exclusive_storage"
2087
2088 ndOobProgram :: String
2089 ndOobProgram = "oob_program"
2090
2091 ndSpindleCount :: String
2092 ndSpindleCount = "spindle_count"
2093
2094 ndOvs :: String
2095 ndOvs = "ovs"
2096
2097 ndOvsLink :: String
2098 ndOvsLink = "ovs_link"
2099
2100 ndOvsName :: String
2101 ndOvsName = "ovs_name"
2102
2103 ndSshPort :: String
2104 ndSshPort = "ssh_port"
2105
2106 ndCpuSpeed :: String
2107 ndCpuSpeed = "cpu_speed"
2108
2109 ndsParameterTypes :: Map String VType
2110 ndsParameterTypes =
2111 Map.fromList
2112 [(ndExclusiveStorage, VTypeBool),
2113 (ndOobProgram, VTypeString),
2114 (ndOvs, VTypeBool),
2115 (ndOvsLink, VTypeMaybeString),
2116 (ndOvsName, VTypeMaybeString),
2117 (ndSpindleCount, VTypeInt),
2118 (ndSshPort, VTypeInt),
2119 (ndCpuSpeed, VTypeFloat)]
2120
2121 ndsParameters :: FrozenSet String
2122 ndsParameters = ConstantUtils.mkSet (Map.keys ndsParameterTypes)
2123
2124 ndsParameterTitles :: Map String String
2125 ndsParameterTitles =
2126 Map.fromList
2127 [(ndExclusiveStorage, "ExclusiveStorage"),
2128 (ndOobProgram, "OutOfBandProgram"),
2129 (ndOvs, "OpenvSwitch"),
2130 (ndOvsLink, "OpenvSwitchLink"),
2131 (ndOvsName, "OpenvSwitchName"),
2132 (ndSpindleCount, "SpindleCount")]
2133
2134 -- * Logical Disks parameters
2135
2136 ldpAccess :: String
2137 ldpAccess = "access"
2138
2139 ldpBarriers :: String
2140 ldpBarriers = "disabled-barriers"
2141
2142 ldpDefaultMetavg :: String
2143 ldpDefaultMetavg = "default-metavg"
2144
2145 ldpDelayTarget :: String
2146 ldpDelayTarget = "c-delay-target"
2147
2148 ldpDiskCustom :: String
2149 ldpDiskCustom = "disk-custom"
2150
2151 ldpDynamicResync :: String
2152 ldpDynamicResync = "dynamic-resync"
2153
2154 ldpFillTarget :: String
2155 ldpFillTarget = "c-fill-target"
2156
2157 ldpMaxRate :: String
2158 ldpMaxRate = "c-max-rate"
2159
2160 ldpMinRate :: String
2161 ldpMinRate = "c-min-rate"
2162
2163 ldpNetCustom :: String
2164 ldpNetCustom = "net-custom"
2165
2166 ldpNoMetaFlush :: String
2167 ldpNoMetaFlush = "disable-meta-flush"
2168
2169 ldpPlanAhead :: String
2170 ldpPlanAhead = "c-plan-ahead"
2171
2172 ldpPool :: String
2173 ldpPool = "pool"
2174
2175 ldpProtocol :: String
2176 ldpProtocol = "protocol"
2177
2178 ldpResyncRate :: String
2179 ldpResyncRate = "resync-rate"
2180
2181 ldpStripes :: String
2182 ldpStripes = "stripes"
2183
2184 diskLdTypes :: Map String VType
2185 diskLdTypes =
2186 Map.fromList
2187 [(ldpAccess, VTypeString),
2188 (ldpResyncRate, VTypeInt),
2189 (ldpStripes, VTypeInt),
2190 (ldpBarriers, VTypeString),
2191 (ldpNoMetaFlush, VTypeBool),
2192 (ldpDefaultMetavg, VTypeString),
2193 (ldpDiskCustom, VTypeString),
2194 (ldpNetCustom, VTypeString),
2195 (ldpProtocol, VTypeString),
2196 (ldpDynamicResync, VTypeBool),
2197 (ldpPlanAhead, VTypeInt),
2198 (ldpFillTarget, VTypeInt),
2199 (ldpDelayTarget, VTypeInt),
2200 (ldpMaxRate, VTypeInt),
2201 (ldpMinRate, VTypeInt),
2202 (ldpPool, VTypeString)]
2203
2204 diskLdParameters :: FrozenSet String
2205 diskLdParameters = ConstantUtils.mkSet (Map.keys diskLdTypes)
2206
2207 -- * Disk template parameters
2208 --
2209 -- Disk template parameters can be set/changed by the user via
2210 -- gnt-cluster and gnt-group)
2211
2212 drbdResyncRate :: String
2213 drbdResyncRate = "resync-rate"
2214
2215 drbdDataStripes :: String
2216 drbdDataStripes = "data-stripes"
2217
2218 drbdMetaStripes :: String
2219 drbdMetaStripes = "meta-stripes"
2220
2221 drbdDiskBarriers :: String
2222 drbdDiskBarriers = "disk-barriers"
2223
2224 drbdMetaBarriers :: String
2225 drbdMetaBarriers = "meta-barriers"
2226
2227 drbdDefaultMetavg :: String
2228 drbdDefaultMetavg = "metavg"
2229
2230 drbdDiskCustom :: String
2231 drbdDiskCustom = "disk-custom"
2232
2233 drbdNetCustom :: String
2234 drbdNetCustom = "net-custom"
2235
2236 drbdProtocol :: String
2237 drbdProtocol = "protocol"
2238
2239 drbdDynamicResync :: String
2240 drbdDynamicResync = "dynamic-resync"
2241
2242 drbdPlanAhead :: String
2243 drbdPlanAhead = "c-plan-ahead"
2244
2245 drbdFillTarget :: String
2246 drbdFillTarget = "c-fill-target"
2247
2248 drbdDelayTarget :: String
2249 drbdDelayTarget = "c-delay-target"
2250
2251 drbdMaxRate :: String
2252 drbdMaxRate = "c-max-rate"
2253
2254 drbdMinRate :: String
2255 drbdMinRate = "c-min-rate"
2256
2257 lvStripes :: String
2258 lvStripes = "stripes"
2259
2260 rbdAccess :: String
2261 rbdAccess = "access"
2262
2263 rbdPool :: String
2264 rbdPool = "pool"
2265
2266 diskDtTypes :: Map String VType
2267 diskDtTypes =
2268 Map.fromList [(drbdResyncRate, VTypeInt),
2269 (drbdDataStripes, VTypeInt),
2270 (drbdMetaStripes, VTypeInt),
2271 (drbdDiskBarriers, VTypeString),
2272 (drbdMetaBarriers, VTypeBool),
2273 (drbdDefaultMetavg, VTypeString),
2274 (drbdDiskCustom, VTypeString),
2275 (drbdNetCustom, VTypeString),
2276 (drbdProtocol, VTypeString),
2277 (drbdDynamicResync, VTypeBool),
2278 (drbdPlanAhead, VTypeInt),
2279 (drbdFillTarget, VTypeInt),
2280 (drbdDelayTarget, VTypeInt),
2281 (drbdMaxRate, VTypeInt),
2282 (drbdMinRate, VTypeInt),
2283 (lvStripes, VTypeInt),
2284 (rbdAccess, VTypeString),
2285 (rbdPool, VTypeString),
2286 (glusterHost, VTypeString),
2287 (glusterVolume, VTypeString),
2288 (glusterPort, VTypeInt)
2289 ]
2290
2291 diskDtParameters :: FrozenSet String
2292 diskDtParameters = ConstantUtils.mkSet (Map.keys diskDtTypes)
2293
2294 -- * Dynamic disk parameters
2295
2296 ddpLocalIp :: String
2297 ddpLocalIp = "local-ip"
2298
2299 ddpRemoteIp :: String
2300 ddpRemoteIp = "remote-ip"
2301
2302 ddpPort :: String
2303 ddpPort = "port"
2304
2305 ddpLocalMinor :: String
2306 ddpLocalMinor = "local-minor"
2307
2308 ddpRemoteMinor :: String
2309 ddpRemoteMinor = "remote-minor"
2310
2311 -- * OOB supported commands
2312
2313 oobPowerOn :: String
2314 oobPowerOn = Types.oobCommandToRaw OobPowerOn
2315
2316 oobPowerOff :: String
2317 oobPowerOff = Types.oobCommandToRaw OobPowerOff
2318
2319 oobPowerCycle :: String
2320 oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
2321
2322 oobPowerStatus :: String
2323 oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
2324
2325 oobHealth :: String
2326 oobHealth = Types.oobCommandToRaw OobHealth
2327
2328 oobCommands :: FrozenSet String
2329 oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
2330
2331 oobPowerStatusPowered :: String
2332 oobPowerStatusPowered = "powered"
2333
2334 -- | 60 seconds
2335 oobTimeout :: Int
2336 oobTimeout = 60
2337
2338 -- | 2 seconds
2339 oobPowerDelay :: Double
2340 oobPowerDelay = 2.0
2341
2342 oobStatusCritical :: String
2343 oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
2344
2345 oobStatusOk :: String
2346 oobStatusOk = Types.oobStatusToRaw OobStatusOk
2347
2348 oobStatusUnknown :: String
2349 oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
2350
2351 oobStatusWarning :: String
2352 oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
2353
2354 oobStatuses :: FrozenSet String
2355 oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
2356
2357 -- | Instance Parameters Profile
2358 ppDefault :: String
2359 ppDefault = "default"
2360
2361 -- * nic* constants are used inside the ganeti config
2362
2363 nicLink :: String
2364 nicLink = "link"
2365
2366 nicMode :: String
2367 nicMode = "mode"
2368
2369 nicVlan :: String
2370 nicVlan = "vlan"
2371
2372 nicsParameterTypes :: Map String VType
2373 nicsParameterTypes =
2374 Map.fromList [(nicMode, vtypeString),
2375 (nicLink, vtypeString),
2376 (nicVlan, vtypeString)]
2377
2378 nicsParameters :: FrozenSet String
2379 nicsParameters = ConstantUtils.mkSet (Map.keys nicsParameterTypes)
2380
2381 nicModeBridged :: String
2382 nicModeBridged = Types.nICModeToRaw NMBridged
2383
2384 nicModeRouted :: String
2385 nicModeRouted = Types.nICModeToRaw NMRouted
2386
2387 nicModeOvs :: String
2388 nicModeOvs = Types.nICModeToRaw NMOvs
2389
2390 nicIpPool :: String
2391 nicIpPool = Types.nICModeToRaw NMPool
2392
2393 nicValidModes :: FrozenSet String
2394 nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
2395
2396 releaseAction :: String
2397 releaseAction = "release"
2398
2399 reserveAction :: String
2400 reserveAction = "reserve"
2401
2402 -- * idisk* constants are used in opcodes, to create/change disks
2403
2404 idiskAdopt :: String
2405 idiskAdopt = "adopt"
2406
2407 idiskMetavg :: String
2408 idiskMetavg = "metavg"
2409
2410 idiskMode :: String
2411 idiskMode = "mode"
2412
2413 idiskName :: String
2414 idiskName = "name"
2415
2416 idiskSize :: String
2417 idiskSize = "size"
2418
2419 idiskSpindles :: String
2420 idiskSpindles = "spindles"
2421
2422 idiskVg :: String
2423 idiskVg = "vg"
2424
2425 idiskProvider :: String
2426 idiskProvider = "provider"
2427
2428 idiskParamsTypes :: Map String VType
2429 idiskParamsTypes =
2430 Map.fromList [(idiskSize, VTypeSize),
2431 (idiskSpindles, VTypeInt),
2432 (idiskMode, VTypeString),
2433 (idiskAdopt, VTypeString),
2434 (idiskVg, VTypeString),
2435 (idiskMetavg, VTypeString),
2436 (idiskProvider, VTypeString),
2437 (idiskName, VTypeMaybeString)]
2438
2439 idiskParams :: FrozenSet String
2440 idiskParams = ConstantUtils.mkSet (Map.keys idiskParamsTypes)
2441
2442 modifiableIdiskParamsTypes :: Map String VType
2443 modifiableIdiskParamsTypes =
2444 Map.fromList [(idiskMode, VTypeString),
2445 (idiskName, VTypeString)]
2446
2447 modifiableIdiskParams :: FrozenSet String
2448 modifiableIdiskParams =
2449 ConstantUtils.mkSet (Map.keys modifiableIdiskParamsTypes)
2450
2451 -- * inic* constants are used in opcodes, to create/change nics
2452
2453 inicBridge :: String
2454 inicBridge = "bridge"
2455
2456 inicIp :: String
2457 inicIp = "ip"
2458
2459 inicLink :: String
2460 inicLink = "link"
2461
2462 inicMac :: String
2463 inicMac = "mac"
2464
2465 inicMode :: String
2466 inicMode = "mode"
2467
2468 inicName :: String
2469 inicName = "name"
2470
2471 inicNetwork :: String
2472 inicNetwork = "network"
2473
2474 inicVlan :: String
2475 inicVlan = "vlan"
2476
2477 inicParamsTypes :: Map String VType
2478 inicParamsTypes =
2479 Map.fromList [(inicBridge, VTypeMaybeString),
2480 (inicIp, VTypeMaybeString),
2481 (inicLink, VTypeString),
2482 (inicMac, VTypeString),
2483 (inicMode, VTypeString),
2484 (inicName, VTypeMaybeString),
2485 (inicNetwork, VTypeMaybeString),
2486 (inicVlan, VTypeMaybeString)]
2487
2488 inicParams :: FrozenSet String
2489 inicParams = ConstantUtils.mkSet (Map.keys inicParamsTypes)
2490
2491 -- * Hypervisor constants
2492
2493 htXenPvm :: String
2494 htXenPvm = Types.hypervisorToRaw XenPvm
2495
2496 htFake :: String
2497 htFake = Types.hypervisorToRaw Fake
2498
2499 htXenHvm :: String
2500 htXenHvm = Types.hypervisorToRaw XenHvm
2501
2502 htKvm :: String
2503 htKvm = Types.hypervisorToRaw Kvm
2504
2505 htChroot :: String
2506 htChroot = Types.hypervisorToRaw Chroot
2507
2508 htLxc :: String
2509 htLxc = Types.hypervisorToRaw Lxc
2510
2511 hyperTypes :: FrozenSet String
2512 hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
2513
2514 htsReqPort :: FrozenSet String
2515 htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
2516
2517 vncBasePort :: Int
2518 vncBasePort = 5900
2519
2520 vncDefaultBindAddress :: String
2521 vncDefaultBindAddress = ip4AddressAny
2522
2523 -- * NIC types
2524
2525 htNicE1000 :: String
2526 htNicE1000 = "e1000"
2527
2528 htNicI82551 :: String
2529 htNicI82551 = "i82551"
2530
2531 htNicI8259er :: String
2532 htNicI8259er = "i82559er"
2533
2534 htNicI85557b :: String
2535 htNicI85557b = "i82557b"
2536
2537 htNicNe2kIsa :: String
2538 htNicNe2kIsa = "ne2k_isa"
2539
2540 htNicNe2kPci :: String
2541 htNicNe2kPci = "ne2k_pci"
2542
2543 htNicParavirtual :: String
2544 htNicParavirtual = "paravirtual"
2545
2546 htNicPcnet :: String
2547 htNicPcnet = "pcnet"
2548
2549 htNicRtl8139 :: String
2550 htNicRtl8139 = "rtl8139"
2551
2552 htHvmValidNicTypes :: FrozenSet String
2553 htHvmValidNicTypes =
2554 ConstantUtils.mkSet [htNicE1000,
2555 htNicNe2kIsa,
2556 htNicNe2kPci,
2557 htNicParavirtual,
2558 htNicRtl8139]
2559
2560 htKvmValidNicTypes :: FrozenSet String
2561 htKvmValidNicTypes =
2562 ConstantUtils.mkSet [htNicE1000,
2563 htNicI82551,
2564 htNicI8259er,
2565 htNicI85557b,
2566 htNicNe2kIsa,
2567 htNicNe2kPci,
2568 htNicParavirtual,
2569 htNicPcnet,
2570 htNicRtl8139]
2571
2572 -- * Vif types
2573
2574 -- | Default vif type in xen-hvm
2575 htHvmVifIoemu :: String
2576 htHvmVifIoemu = "ioemu"
2577
2578 htHvmVifVif :: String
2579 htHvmVifVif = "vif"
2580
2581 htHvmValidVifTypes :: FrozenSet String
2582 htHvmValidVifTypes = ConstantUtils.mkSet [htHvmVifIoemu, htHvmVifVif]
2583
2584 -- * Disk types
2585
2586 htDiskIde :: String
2587 htDiskIde = "ide"
2588
2589 htDiskIoemu :: String
2590 htDiskIoemu = "ioemu"
2591
2592 htDiskMtd :: String
2593 htDiskMtd = "mtd"
2594
2595 htDiskParavirtual :: String
2596 htDiskParavirtual = "paravirtual"
2597
2598 htDiskPflash :: String
2599 htDiskPflash = "pflash"
2600
2601 htDiskScsi :: String
2602 htDiskScsi = "scsi"
2603
2604 htDiskSd :: String
2605 htDiskSd = "sd"
2606
2607 htHvmValidDiskTypes :: FrozenSet String
2608 htHvmValidDiskTypes = ConstantUtils.mkSet [htDiskIoemu, htDiskParavirtual]
2609
2610 htKvmValidDiskTypes :: FrozenSet String
2611 htKvmValidDiskTypes =
2612 ConstantUtils.mkSet [htDiskIde,
2613 htDiskMtd,
2614 htDiskParavirtual,
2615 htDiskPflash,
2616 htDiskScsi,
2617 htDiskSd]
2618
2619 htCacheDefault :: String
2620 htCacheDefault = "default"
2621
2622 htCacheNone :: String
2623 htCacheNone = "none"
2624
2625 htCacheWback :: String
2626 htCacheWback = "writeback"
2627
2628 htCacheWthrough :: String
2629 htCacheWthrough = "writethrough"
2630
2631 htValidCacheTypes :: FrozenSet String
2632 htValidCacheTypes =
2633 ConstantUtils.mkSet [htCacheDefault,
2634 htCacheNone,
2635 htCacheWback,
2636 htCacheWthrough]
2637
2638 htKvmAioThreads :: String
2639 htKvmAioThreads = "threads"
2640
2641 htKvmAioNative :: String
2642 htKvmAioNative = "native"
2643
2644 htKvmValidAioTypes :: FrozenSet String
2645 htKvmValidAioTypes =
2646 ConstantUtils.mkSet [htKvmAioThreads,
2647 htKvmAioNative]
2648
2649 -- * Mouse types
2650
2651 htMouseMouse :: String
2652 htMouseMouse = "mouse"
2653
2654 htMouseTablet :: String
2655 htMouseTablet = "tablet"
2656
2657 htKvmValidMouseTypes :: FrozenSet String
2658 htKvmValidMouseTypes = ConstantUtils.mkSet [htMouseMouse, htMouseTablet]
2659
2660 -- * Boot order
2661
2662 htBoCdrom :: String
2663 htBoCdrom = "cdrom"
2664
2665 htBoDisk :: String
2666 htBoDisk = "disk"
2667
2668 htBoFloppy :: String
2669 htBoFloppy = "floppy"
2670
2671 htBoNetwork :: String
2672 htBoNetwork = "network"
2673
2674 htKvmValidBoTypes :: FrozenSet String
2675 htKvmValidBoTypes =
2676 ConstantUtils.mkSet [htBoCdrom, htBoDisk, htBoFloppy, htBoNetwork]
2677
2678 -- * SPICE lossless image compression options
2679
2680 htKvmSpiceLosslessImgComprAutoGlz :: String
2681 htKvmSpiceLosslessImgComprAutoGlz = "auto_glz"
2682
2683 htKvmSpiceLosslessImgComprAutoLz :: String
2684 htKvmSpiceLosslessImgComprAutoLz = "auto_lz"
2685
2686 htKvmSpiceLosslessImgComprGlz :: String
2687 htKvmSpiceLosslessImgComprGlz = "glz"
2688
2689 htKvmSpiceLosslessImgComprLz :: String
2690 htKvmSpiceLosslessImgComprLz = "lz"
2691
2692 htKvmSpiceLosslessImgComprOff :: String
2693 htKvmSpiceLosslessImgComprOff = "off"
2694
2695 htKvmSpiceLosslessImgComprQuic :: String
2696 htKvmSpiceLosslessImgComprQuic = "quic"
2697
2698 htKvmSpiceValidLosslessImgComprOptions :: FrozenSet String
2699 htKvmSpiceValidLosslessImgComprOptions =
2700 ConstantUtils.mkSet [htKvmSpiceLosslessImgComprAutoGlz,
2701 htKvmSpiceLosslessImgComprAutoLz,
2702 htKvmSpiceLosslessImgComprGlz,
2703 htKvmSpiceLosslessImgComprLz,
2704 htKvmSpiceLosslessImgComprOff,
2705 htKvmSpiceLosslessImgComprQuic]
2706
2707 htKvmSpiceLossyImgComprAlways :: String
2708 htKvmSpiceLossyImgComprAlways = "always"
2709
2710 htKvmSpiceLossyImgComprAuto :: String
2711 htKvmSpiceLossyImgComprAuto = "auto"
2712
2713 htKvmSpiceLossyImgComprNever :: String
2714 htKvmSpiceLossyImgComprNever = "never"
2715
2716 htKvmSpiceValidLossyImgComprOptions :: FrozenSet String
2717 htKvmSpiceValidLossyImgComprOptions =
2718 ConstantUtils.mkSet [htKvmSpiceLossyImgComprAlways,
2719 htKvmSpiceLossyImgComprAuto,
2720 htKvmSpiceLossyImgComprNever]
2721
2722 -- * SPICE video stream detection
2723
2724 htKvmSpiceVideoStreamDetectionAll :: String
2725 htKvmSpiceVideoStreamDetectionAll = "all"
2726
2727 htKvmSpiceVideoStreamDetectionFilter :: String
2728 htKvmSpiceVideoStreamDetectionFilter = "filter"
2729
2730 htKvmSpiceVideoStreamDetectionOff :: String
2731 htKvmSpiceVideoStreamDetectionOff = "off"
2732
2733 htKvmSpiceValidVideoStreamDetectionOptions :: FrozenSet String
2734 htKvmSpiceValidVideoStreamDetectionOptions =
2735 ConstantUtils.mkSet [htKvmSpiceVideoStreamDetectionAll,
2736 htKvmSpiceVideoStreamDetectionFilter,
2737 htKvmSpiceVideoStreamDetectionOff]
2738
2739 -- * Security models
2740
2741 htSmNone :: String
2742 htSmNone = "none"
2743
2744 htSmPool :: String
2745 htSmPool = "pool"
2746
2747 htSmUser :: String
2748 htSmUser = "user"
2749
2750 htKvmValidSmTypes :: FrozenSet String
2751 htKvmValidSmTypes = ConstantUtils.mkSet [htSmNone, htSmPool, htSmUser]
2752
2753 -- * Kvm flag values
2754
2755 htKvmDisabled :: String
2756 htKvmDisabled = "disabled"
2757
2758 htKvmEnabled :: String
2759 htKvmEnabled = "enabled"
2760
2761 htKvmFlagValues :: FrozenSet String
2762 htKvmFlagValues = ConstantUtils.mkSet [htKvmDisabled, htKvmEnabled]
2763
2764 -- * Migration type
2765
2766 htMigrationLive :: String
2767 htMigrationLive = Types.migrationModeToRaw MigrationLive
2768
2769 htMigrationNonlive :: String
2770 htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
2771
2772 htMigrationModes :: FrozenSet String
2773 htMigrationModes =
2774 ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
2775
2776 -- * Cluster verify steps
2777
2778 verifyNplusoneMem :: String
2779 verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
2780
2781 verifyOptionalChecks :: FrozenSet String
2782 verifyOptionalChecks =
2783 ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
2784
2785 -- * Cluster Verify error classes
2786
2787 cvTcluster :: String
2788 cvTcluster = "cluster"
2789
2790 cvTgroup :: String
2791 cvTgroup = "group"
2792
2793 cvTnode :: String
2794 cvTnode = "node"
2795
2796 cvTinstance :: String
2797 cvTinstance = "instance"
2798
2799 -- * Cluster Verify error levels
2800
2801 cvWarning :: String
2802 cvWarning = "WARNING"
2803
2804 cvError :: String
2805 cvError = "ERROR"
2806
2807 -- * Cluster Verify error codes and documentation
2808
2809 cvEclustercert :: (String, String, String)
2810 cvEclustercert =
2811 ("cluster",
2812 Types.cVErrorCodeToRaw CvECLUSTERCERT,
2813 "Cluster certificate files verification failure")
2814
2815 cvEclusterclientcert :: (String, String, String)
2816 cvEclusterclientcert =
2817 ("cluster",
2818 Types.cVErrorCodeToRaw CvECLUSTERCLIENTCERT,
2819 "Cluster client certificate files verification failure")
2820
2821 cvEclustercfg :: (String, String, String)
2822 cvEclustercfg =
2823 ("cluster",
2824 Types.cVErrorCodeToRaw CvECLUSTERCFG,
2825 "Cluster configuration verification failure")
2826
2827 cvEclusterdanglinginst :: (String, String, String)
2828 cvEclusterdanglinginst =
2829 ("node",
2830 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
2831 "Some instances have a non-existing primary node")
2832
2833 cvEclusterdanglingnodes :: (String, String, String)
2834 cvEclusterdanglingnodes =
2835 ("node",
2836 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
2837 "Some nodes belong to non-existing groups")
2838
2839 cvEclusterfilecheck :: (String, String, String)
2840 cvEclusterfilecheck =
2841 ("cluster",
2842 Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
2843 "Cluster configuration verification failure")
2844
2845 cvEgroupdifferentpvsize :: (String, String, String)
2846 cvEgroupdifferentpvsize =
2847 ("group",
2848 Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
2849 "PVs in the group have different sizes")
2850
2851 cvEinstancebadnode :: (String, String, String)
2852 cvEinstancebadnode =
2853 ("instance",
2854 Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
2855 "Instance marked as running lives on an offline node")
2856
2857 cvEinstancedown :: (String, String, String)
2858 cvEinstancedown =
2859 ("instance",
2860 Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
2861 "Instance not running on its primary node")
2862
2863 cvEinstancefaultydisk :: (String, String, String)
2864 cvEinstancefaultydisk =
2865 ("instance",
2866 Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
2867 "Impossible to retrieve status for a disk")
2868
2869 cvEinstancelayout :: (String, String, String)
2870 cvEinstancelayout =
2871 ("instance",
2872 Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
2873 "Instance has multiple secondary nodes")
2874
2875 cvEinstancemissingcfgparameter :: (String, String, String)
2876 cvEinstancemissingcfgparameter =
2877 ("instance",
2878 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
2879 "A configuration parameter for an instance is missing")
2880
2881 cvEinstancemissingdisk :: (String, String, String)
2882 cvEinstancemissingdisk =
2883 ("instance",
2884 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
2885 "Missing volume on an instance")
2886
2887 cvEinstancepolicy :: (String, String, String)
2888 cvEinstancepolicy =
2889 ("instance",
2890 Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
2891 "Instance does not meet policy")
2892
2893 cvEinstancesplitgroups :: (String, String, String)
2894 cvEinstancesplitgroups =
2895 ("instance",
2896 Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
2897 "Instance with primary and secondary nodes in different groups")
2898
2899 cvEinstanceunsuitablenode :: (String, String, String)
2900 cvEinstanceunsuitablenode =
2901 ("instance",
2902 Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
2903 "Instance running on nodes that are not suitable for it")
2904
2905 cvEinstancewrongnode :: (String, String, String)
2906 cvEinstancewrongnode =
2907 ("instance",
2908 Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
2909 "Instance running on the wrong node")
2910
2911 cvEnodedrbd :: (String, String, String)
2912 cvEnodedrbd =
2913 ("node",
2914 Types.cVErrorCodeToRaw CvENODEDRBD,
2915 "Error parsing the DRBD status file")
2916
2917 cvEnodedrbdhelper :: (String, String, String)
2918 cvEnodedrbdhelper =
2919 ("node",
2920 Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
2921 "Error caused by the DRBD helper")
2922
2923 cvEnodedrbdversion :: (String, String, String)
2924 cvEnodedrbdversion =
2925 ("node",
2926 Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
2927 "DRBD version mismatch within a node group")
2928
2929 cvEnodefilecheck :: (String, String, String)
2930 cvEnodefilecheck =
2931 ("node",
2932 Types.cVErrorCodeToRaw CvENODEFILECHECK,
2933 "Error retrieving the checksum of the node files")
2934
2935 cvEnodefilestoragepaths :: (String, String, String)
2936 cvEnodefilestoragepaths =
2937 ("node",
2938 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
2939 "Detected bad file storage paths")
2940
2941 cvEnodefilestoragepathunusable :: (String, String, String)
2942 cvEnodefilestoragepathunusable =
2943 ("node",
2944 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
2945 "File storage path unusable")
2946
2947 cvEnodehooks :: (String, String, String)
2948 cvEnodehooks =
2949 ("node",
2950 Types.cVErrorCodeToRaw CvENODEHOOKS,
2951 "Communication failure in hooks execution")
2952
2953 cvEnodehv :: (String, String, String)
2954 cvEnodehv =
2955 ("node",
2956 Types.cVErrorCodeToRaw CvENODEHV,
2957 "Hypervisor parameters verification failure")
2958
2959 cvEnodelvm :: (String, String, String)
2960 cvEnodelvm =
2961 ("node",
2962 Types.cVErrorCodeToRaw CvENODELVM,
2963 "LVM-related node error")
2964
2965 cvEnoden1 :: (String, String, String)
2966 cvEnoden1 =
2967 ("node",
2968 Types.cVErrorCodeToRaw CvENODEN1,
2969 "Not enough memory to accommodate instance failovers")
2970
2971 cvEnodenet :: (String, String, String)
2972 cvEnodenet =
2973 ("node",
2974 Types.cVErrorCodeToRaw CvENODENET,
2975 "Network-related node error")
2976
2977 cvEnodeoobpath :: (String, String, String)
2978 cvEnodeoobpath =
2979 ("node",
2980 Types.cVErrorCodeToRaw CvENODEOOBPATH,
2981 "Invalid Out Of Band path")
2982
2983 cvEnodeorphaninstance :: (String, String, String)
2984 cvEnodeorphaninstance =
2985 ("node",
2986 Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
2987 "Unknown intance running on a node")
2988
2989 cvEnodeorphanlv :: (String, String, String)
2990 cvEnodeorphanlv =
2991 ("node",
2992 Types.cVErrorCodeToRaw CvENODEORPHANLV,
2993 "Unknown LVM logical volume")
2994
2995 cvEnodeos :: (String, String, String)
2996 cvEnodeos =
2997 ("node",
2998 Types.cVErrorCodeToRaw CvENODEOS,
2999 "OS-related node error")
3000
3001 cvEnoderpc :: (String, String, String)
3002 cvEnoderpc =
3003 ("node",
3004 Types.cVErrorCodeToRaw CvENODERPC,
3005 "Error during connection to the primary node of an instance")
3006
3007 cvEnodesetup :: (String, String, String)
3008 cvEnodesetup =
3009 ("node",
3010 Types.cVErrorCodeToRaw CvENODESETUP,
3011 "Node setup error")
3012
3013 cvEnodesharedfilestoragepathunusable :: (String, String, String)
3014 cvEnodesharedfilestoragepathunusable =
3015 ("node",
3016 Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
3017 "Shared file storage path unusable")
3018
3019 cvEnodeglusterstoragepathunusable :: (String, String, String)
3020 cvEnodeglusterstoragepathunusable =
3021 ("node",
3022 Types.cVErrorCodeToRaw CvENODEGLUSTERSTORAGEPATHUNUSABLE,
3023 "Gluster storage path unusable")
3024
3025 cvEnodessh :: (String, String, String)
3026 cvEnodessh =
3027 ("node",
3028 Types.cVErrorCodeToRaw CvENODESSH,
3029 "SSH-related node error")
3030
3031 cvEnodetime :: (String, String, String)
3032 cvEnodetime =
3033 ("node",
3034 Types.cVErrorCodeToRaw CvENODETIME,
3035 "Node returned invalid time")
3036
3037 cvEnodeuserscripts :: (String, String, String)
3038 cvEnodeuserscripts =
3039 ("node",
3040 Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
3041 "User scripts not present or not executable")
3042
3043 cvEnodeversion :: (String, String, String)
3044 cvEnodeversion =
3045 ("node",
3046 Types.cVErrorCodeToRaw CvENODEVERSION,
3047 "Protocol version mismatch or Ganeti version mismatch")
3048
3049 cvAllEcodes :: FrozenSet (String, String, String)
3050 cvAllEcodes =
3051 ConstantUtils.mkSet
3052 [cvEclustercert,
3053 cvEclustercfg,
3054 cvEclusterdanglinginst,
3055 cvEclusterdanglingnodes,
3056 cvEclusterfilecheck,
3057 cvEgroupdifferentpvsize,
3058 cvEinstancebadnode,
3059 cvEinstancedown,
3060 cvEinstancefaultydisk,
3061 cvEinstancelayout,
3062 cvEinstancemissingcfgparameter,
3063 cvEinstancemissingdisk,
3064 cvEinstancepolicy,
3065 cvEinstancesplitgroups,
3066 cvEinstanceunsuitablenode,
3067 cvEinstancewrongnode,
3068 cvEnodedrbd,
3069 cvEnodedrbdhelper,
3070 cvEnodedrbdversion,
3071 cvEnodefilecheck,
3072 cvEnodefilestoragepaths,
3073 cvEnodefilestoragepathunusable,
3074 cvEnodehooks,
3075 cvEnodehv,
3076 cvEnodelvm,
3077 cvEnoden1,
3078 cvEnodenet,
3079 cvEnodeoobpath,
3080 cvEnodeorphaninstance,
3081 cvEnodeorphanlv,
3082 cvEnodeos,
3083 cvEnoderpc,
3084 cvEnodesetup,
3085 cvEnodesharedfilestoragepathunusable,
3086 cvEnodeglusterstoragepathunusable,
3087 cvEnodessh,
3088 cvEnodetime,
3089 cvEnodeuserscripts,
3090 cvEnodeversion]
3091
3092 cvAllEcodesStrings :: FrozenSet String
3093 cvAllEcodesStrings =
3094 ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
3095
3096 -- * Node verify constants
3097
3098 nvBridges :: String
3099 nvBridges = "bridges"
3100
3101 nvClientCert :: String
3102 nvClientCert = "client-cert"
3103
3104 nvDrbdhelper :: String
3105 nvDrbdhelper = "drbd-helper"
3106
3107 nvDrbdversion :: String
3108 nvDrbdversion = "drbd-version"
3109
3110 nvDrbdlist :: String
3111 nvDrbdlist = "drbd-list"
3112
3113 nvExclusivepvs :: String
3114 nvExclusivepvs = "exclusive-pvs"
3115
3116 nvFilelist :: String
3117 nvFilelist = "filelist"
3118
3119 nvAcceptedStoragePaths :: String
3120 nvAcceptedStoragePaths = "allowed-file-storage-paths"
3121
3122 nvFileStoragePath :: String
3123 nvFileStoragePath = "file-storage-path"
3124
3125 nvSharedFileStoragePath :: String
3126 nvSharedFileStoragePath = "shared-file-storage-path"
3127
3128 nvGlusterStoragePath :: String
3129 nvGlusterStoragePath = "gluster-storage-path"
3130
3131 nvHvinfo :: String
3132 nvHvinfo = "hvinfo"
3133
3134 nvHvparams :: String
3135 nvHvparams = "hvparms"
3136
3137 nvHypervisor :: String
3138 nvHypervisor = "hypervisor"
3139
3140 nvInstancelist :: String
3141 nvInstancelist = "instancelist"
3142
3143 nvLvlist :: String
3144 nvLvlist = "lvlist"
3145
3146 nvMasterip :: String
3147 nvMasterip = "master-ip"
3148
3149 nvNodelist :: String
3150 nvNodelist = "nodelist"
3151
3152 nvNodenettest :: String
3153 nvNodenettest = "node-net-test"
3154
3155 nvNodesetup :: String
3156 nvNodesetup = "nodesetup"
3157
3158 nvOobPaths :: String
3159 nvOobPaths = "oob-paths"
3160
3161 nvOslist :: String
3162 nvOslist = "oslist"
3163
3164 nvPvlist :: String
3165 nvPvlist = "pvlist"
3166
3167 nvTime :: String
3168 nvTime = "time"
3169
3170 nvUserscripts :: String
3171 nvUserscripts = "user-scripts"
3172
3173 nvVersion :: String
3174 nvVersion = "version"
3175
3176 nvVglist :: String
3177 nvVglist = "vglist"
3178
3179 nvNonvmnodes :: String
3180 nvNonvmnodes = "nonvmnodes"
3181
3182 -- * Instance status
3183
3184 inststAdmindown :: String
3185 inststAdmindown = Types.instanceStatusToRaw StatusDown
3186
3187 inststAdminoffline :: String
3188 inststAdminoffline = Types.instanceStatusToRaw StatusOffline
3189
3190 inststErrordown :: String
3191 inststErrordown = Types.instanceStatusToRaw ErrorDown
3192
3193 inststErrorup :: String
3194 inststErrorup = Types.instanceStatusToRaw ErrorUp
3195
3196 inststNodedown :: String
3197 inststNodedown = Types.instanceStatusToRaw NodeDown
3198
3199 inststNodeoffline :: String
3200 inststNodeoffline = Types.instanceStatusToRaw NodeOffline
3201
3202 inststRunning :: String
3203 inststRunning = Types.instanceStatusToRaw Running
3204
3205 inststUserdown :: String
3206 inststUserdown = Types.instanceStatusToRaw UserDown
3207
3208 inststWrongnode :: String
3209 inststWrongnode = Types.instanceStatusToRaw WrongNode
3210
3211 inststAll :: FrozenSet String
3212 inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
3213
3214 -- * Admin states
3215
3216 adminstDown :: String
3217 adminstDown = Types.adminStateToRaw AdminDown
3218
3219 adminstOffline :: String
3220 adminstOffline = Types.adminStateToRaw AdminOffline
3221
3222 adminstUp :: String
3223 adminstUp = Types.adminStateToRaw AdminUp
3224
3225 adminstAll :: FrozenSet String
3226 adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
3227
3228 -- * Admin state sources
3229
3230 adminSource :: AdminStateSource
3231 adminSource = AdminSource
3232
3233 userSource :: AdminStateSource
3234 userSource = UserSource
3235
3236 adminStateSources :: FrozenSet AdminStateSource
3237 adminStateSources = ConstantUtils.mkSet [minBound..]
3238
3239 -- * Node roles
3240
3241 nrDrained :: String
3242 nrDrained = Types.nodeRoleToRaw NRDrained
3243
3244 nrMaster :: String
3245 nrMaster = Types.nodeRoleToRaw NRMaster
3246
3247 nrMcandidate :: String
3248 nrMcandidate = Types.nodeRoleToRaw NRCandidate
3249
3250 nrOffline :: String
3251 nrOffline = Types.nodeRoleToRaw NROffline
3252
3253 nrRegular :: String
3254 nrRegular = Types.nodeRoleToRaw NRRegular
3255
3256 nrAll :: FrozenSet String
3257 nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
3258
3259 -- * SSL certificate check constants (in days)
3260
3261 sslCertExpirationError :: Int
3262 sslCertExpirationError = 7
3263
3264 sslCertExpirationWarn :: Int
3265 sslCertExpirationWarn = 30
3266
3267 -- * Allocator framework constants
3268
3269 iallocatorVersion :: Int
3270 iallocatorVersion = 2
3271
3272 iallocatorDirIn :: String
3273 iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
3274
3275 iallocatorDirOut :: String
3276 iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
3277
3278 validIallocatorDirections :: FrozenSet String
3279 validIallocatorDirections =
3280 ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
3281
3282 iallocatorModeAlloc :: String
3283 iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
3284
3285 iallocatorModeChgGroup :: String
3286 iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
3287
3288 iallocatorModeMultiAlloc :: String
3289 iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
3290
3291 iallocatorModeNodeEvac :: String
3292 iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
3293
3294 iallocatorModeReloc :: String
3295 iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
3296
3297 validIallocatorModes :: FrozenSet String
3298 validIallocatorModes =
3299 ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
3300
3301 iallocatorSearchPath :: [String]
3302 iallocatorSearchPath = AutoConf.iallocatorSearchPath
3303
3304 defaultIallocatorShortcut :: String
3305 defaultIallocatorShortcut = "."
3306
3307 -- * Opportunistic allocator usage
3308
3309 -- | Time delay in seconds between repeated opportunistic instance creations.
3310 -- Rather than failing with an informative error message if the opportunistic
3311 -- creation cannot grab enough nodes, for some uses it is better to retry the
3312 -- creation with an interval between attempts. This is a reasonable default.
3313 defaultOpportunisticRetryInterval :: Int
3314 defaultOpportunisticRetryInterval = 30
3315
3316 -- * Node evacuation
3317
3318 nodeEvacPri :: String
3319 nodeEvacPri = Types.evacModeToRaw ChangePrimary
3320
3321 nodeEvacSec :: String
3322 nodeEvacSec = Types.evacModeToRaw ChangeSecondary
3323
3324 nodeEvacAll :: String
3325 nodeEvacAll = Types.evacModeToRaw ChangeAll
3326
3327 nodeEvacModes :: FrozenSet String
3328 nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..]
3329
3330 -- * Job queue
3331
3332 jobQueueVersion :: Int
3333 jobQueueVersion = 1
3334
3335 jobQueueSizeHardLimit :: Int
3336 jobQueueSizeHardLimit = 5000
3337
3338 jobQueueFilesPerms :: Int
3339 jobQueueFilesPerms = 0o640
3340
3341 -- * Unchanged job return
3342
3343 jobNotchanged :: String
3344 jobNotchanged = "nochange"
3345
3346 -- * Job status
3347
3348 jobStatusQueued :: String
3349 jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
3350
3351 jobStatusWaiting :: String
3352 jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
3353
3354 jobStatusCanceling :: String
3355 jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
3356
3357 jobStatusRunning :: String
3358 jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
3359
3360 jobStatusCanceled :: String
3361 jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
3362
3363 jobStatusSuccess :: String
3364 jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
3365
3366 jobStatusError :: String
3367 jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
3368
3369 jobsPending :: FrozenSet String
3370 jobsPending =
3371 ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
3372
3373 jobsFinalized :: FrozenSet String
3374 jobsFinalized =
3375 ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
3376
3377 jobStatusAll :: FrozenSet String
3378 jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
3379
3380 -- * OpCode status
3381
3382 -- ** Not yet finalized opcodes
3383
3384 opStatusCanceling :: String
3385 opStatusCanceling = "canceling"
3386
3387 opStatusQueued :: String
3388 opStatusQueued = "queued"
3389
3390 opStatusRunning :: String
3391 opStatusRunning = "running"
3392
3393 opStatusWaiting :: String
3394 opStatusWaiting = "waiting"
3395
3396 -- ** Finalized opcodes
3397
3398 opStatusCanceled :: String
3399 opStatusCanceled = "canceled"
3400
3401 opStatusError :: String
3402 opStatusError = "error"
3403
3404 opStatusSuccess :: String
3405 opStatusSuccess = "success"
3406
3407 opsFinalized :: FrozenSet String
3408 opsFinalized =
3409 ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
3410
3411 -- * OpCode priority
3412
3413 opPrioLowest :: Int
3414 opPrioLowest = 19
3415
3416 opPrioHighest :: Int
3417 opPrioHighest = -20
3418
3419 opPrioLow :: Int
3420 opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
3421
3422 opPrioNormal :: Int
3423 opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
3424
3425 opPrioHigh :: Int
3426 opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
3427
3428 opPrioSubmitValid :: FrozenSet Int
3429 opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
3430
3431 opPrioDefault :: Int
3432 opPrioDefault = opPrioNormal
3433
3434 -- * Lock recalculate mode
3435
3436 locksAppend :: String
3437 locksAppend = "append"
3438
3439 locksReplace :: String
3440 locksReplace = "replace"
3441
3442 -- * Lock timeout
3443 --
3444 -- The lock timeout (sum) before we transition into blocking acquire
3445 -- (this can still be reset by priority change). Computed as max time
3446 -- (10 hours) before we should actually go into blocking acquire,
3447 -- given that we start from the default priority level.
3448
3449 lockAttemptsMaxwait :: Double
3450 lockAttemptsMaxwait = 75.0
3451
3452 lockAttemptsMinwait :: Double
3453 lockAttemptsMinwait = 5.0
3454
3455 lockAttemptsTimeout :: Int
3456 lockAttemptsTimeout = (10 * 3600) `div` (opPrioDefault - opPrioHighest)
3457
3458 -- * Execution log types
3459
3460 elogMessage :: String
3461 elogMessage = Types.eLogTypeToRaw ELogMessage
3462
3463 elogRemoteImport :: String
3464 elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
3465
3466 elogJqueueTest :: String
3467 elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
3468
3469 elogDelayTest :: String
3470 elogDelayTest = Types.eLogTypeToRaw ELogDelayTest
3471
3472 -- * /etc/hosts modification
3473
3474 etcHostsAdd :: String
3475 etcHostsAdd = "add"
3476
3477 etcHostsRemove :: String
3478 etcHostsRemove = "remove"
3479
3480 -- * Job queue test
3481
3482 jqtMsgprefix :: String
3483 jqtMsgprefix = "TESTMSG="
3484
3485 jqtExec :: String
3486 jqtExec = "exec"
3487
3488 jqtExpandnames :: String
3489 jqtExpandnames = "expandnames"
3490
3491 jqtLogmsg :: String
3492 jqtLogmsg = "logmsg"
3493
3494 jqtStartmsg :: String
3495 jqtStartmsg = "startmsg"
3496
3497 jqtAll :: FrozenSet String
3498 jqtAll = ConstantUtils.mkSet [jqtExec, jqtExpandnames, jqtLogmsg, jqtStartmsg]
3499
3500 -- * Query resources
3501
3502 qrCluster :: String
3503 qrCluster = "cluster"
3504
3505 qrExport :: String
3506 qrExport = "export"
3507
3508 qrExtstorage :: String
3509 qrExtstorage = "extstorage"
3510
3511 qrGroup :: String
3512 qrGroup = "group"
3513
3514 qrInstance :: String
3515 qrInstance = "instance"
3516
3517 qrJob :: String
3518 qrJob = "job"
3519
3520 qrLock :: String
3521 qrLock = "lock"
3522
3523 qrNetwork :: String
3524 qrNetwork = "network"
3525
3526 qrNode :: String
3527 qrNode = "node"
3528
3529 qrOs :: String
3530 qrOs = "os"
3531
3532 -- | List of resources which can be queried using 'Ganeti.OpCodes.OpQuery'
3533 qrViaOp :: FrozenSet String
3534 qrViaOp =
3535 ConstantUtils.mkSet [qrCluster,
3536 qrOs,
3537 qrExtstorage]
3538
3539 -- | List of resources which can be queried using Local UniX Interface
3540 qrViaLuxi :: FrozenSet String
3541 qrViaLuxi = ConstantUtils.mkSet [qrGroup,
3542 qrExport,
3543 qrInstance,
3544 qrJob,
3545 qrLock,
3546 qrNetwork,
3547 qrNode]
3548
3549 -- | List of resources which can be queried using RAPI
3550 qrViaRapi :: FrozenSet String
3551 qrViaRapi = qrViaLuxi
3552
3553 -- | List of resources which can be queried via RAPI including PUT requests
3554 qrViaRapiPut :: FrozenSet String
3555 qrViaRapiPut = ConstantUtils.mkSet [qrLock, qrJob]
3556
3557 -- * Query field types
3558
3559 qftBool :: String
3560 qftBool = "bool"
3561
3562 qftNumber :: String
3563 qftNumber = "number"
3564
3565 qftNumberFloat :: String
3566 qftNumberFloat = "float"
3567
3568 qftOther :: String
3569 qftOther = "other"
3570
3571 qftText :: String
3572 qftText = "text"
3573
3574 qftTimestamp :: String
3575 qftTimestamp = "timestamp"
3576
3577 qftUnit :: String
3578 qftUnit = "unit"
3579
3580 qftUnknown :: String
3581 qftUnknown = "unknown"
3582
3583 qftAll :: FrozenSet String
3584 qftAll =
3585 ConstantUtils.mkSet [qftBool,
3586 qftNumber,
3587 qftNumberFloat,
3588 qftOther,
3589 qftText,
3590 qftTimestamp,
3591 qftUnit,
3592 qftUnknown]
3593
3594 -- * Query result field status
3595 --
3596 -- Don't change or reuse values as they're used by clients.
3597 --
3598 -- FIXME: link with 'Ganeti.Query.Language.ResultStatus'
3599
3600 -- | No data (e.g. RPC error), can be used instead of 'rsOffline'
3601 rsNodata :: Int
3602 rsNodata = 2
3603
3604 rsNormal :: Int
3605 rsNormal = 0
3606
3607 -- | Resource marked offline
3608 rsOffline :: Int
3609 rsOffline = 4
3610
3611 -- | Value unavailable/unsupported for item; if this field is
3612 -- supported but we cannot get the data for the moment, 'rsNodata' or
3613 -- 'rsOffline' should be used
3614 rsUnavail :: Int
3615 rsUnavail = 3
3616
3617 rsUnknown :: Int
3618 rsUnknown = 1
3619
3620 rsAll :: FrozenSet Int
3621 rsAll =
3622 ConstantUtils.mkSet [rsNodata,
3623 rsNormal,
3624 rsOffline,
3625 rsUnavail,
3626 rsUnknown]
3627
3628 -- | Special field cases and their verbose/terse formatting
3629 rssDescription :: Map Int (String, String)
3630 rssDescription =
3631 Map.fromList [(rsUnknown, ("(unknown)", "??")),
3632 (rsNodata, ("(nodata)", "?")),
3633 (rsOffline, ("(offline)", "*")),
3634 (rsUnavail, ("(unavail)", "-"))]
3635
3636 -- * Max dynamic devices
3637
3638 maxDisks :: Int
3639 maxDisks = Types.maxDisks
3640
3641 maxNics :: Int
3642 maxNics = Types.maxNics
3643
3644 -- | SSCONF file prefix
3645 ssconfFileprefix :: String
3646 ssconfFileprefix = "ssconf_"
3647
3648 -- * SSCONF keys
3649
3650 ssClusterName :: String
3651 ssClusterName = "cluster_name"
3652
3653 ssClusterTags :: String
3654 ssClusterTags = "cluster_tags"
3655
3656 ssFileStorageDir :: String
3657 ssFileStorageDir = "file_storage_dir"
3658
3659 ssSharedFileStorageDir :: String
3660 ssSharedFileStorageDir = "shared_file_storage_dir"
3661
3662 ssGlusterStorageDir :: String
3663 ssGlusterStorageDir = "gluster_storage_dir"
3664
3665 ssMasterCandidates :: String
3666 ssMasterCandidates = "master_candidates"
3667
3668 ssMasterCandidatesIps :: String
3669 ssMasterCandidatesIps = "master_candidates_ips"
3670
3671 ssMasterCandidatesCerts :: String
3672 ssMasterCandidatesCerts = "master_candidates_certs"
3673
3674 ssMasterIp :: String
3675 ssMasterIp = "master_ip"
3676
3677 ssMasterNetdev :: String
3678 ssMasterNetdev = "master_netdev"
3679
3680 ssMasterNetmask :: String
3681 ssMasterNetmask = "master_netmask"
3682
3683 ssMasterNode :: String
3684 ssMasterNode = "master_node"
3685
3686 ssNodeList :: String
3687 ssNodeList = "node_list"
3688
3689 ssNodePrimaryIps :: String
3690 ssNodePrimaryIps = "node_primary_ips"
3691
3692 ssNodeSecondaryIps :: String
3693 ssNodeSecondaryIps = "node_secondary_ips"
3694
3695 ssNodeVmCapable :: String
3696 ssNodeVmCapable = "node_vm_capable"
3697
3698 ssOfflineNodes :: String
3699 ssOfflineNodes = "offline_nodes"
3700
3701 ssOnlineNodes :: String
3702 ssOnlineNodes = "online_nodes"
3703
3704 ssPrimaryIpFamily :: String
3705 ssPrimaryIpFamily = "primary_ip_family"
3706
3707 ssInstanceList :: String
3708 ssInstanceList = "instance_list"
3709
3710 ssReleaseVersion :: String
3711 ssReleaseVersion = "release_version"
3712
3713 ssHypervisorList :: String
3714 ssHypervisorList = "hypervisor_list"
3715
3716 ssMaintainNodeHealth :: String
3717 ssMaintainNodeHealth = "maintain_node_health"
3718
3719 ssUidPool :: String
3720 ssUidPool = "uid_pool"
3721
3722 ssNodegroups :: String
3723 ssNodegroups = "nodegroups"
3724
3725 ssNetworks :: String
3726 ssNetworks = "networks"
3727
3728 -- | This is not a complete SSCONF key, but the prefix for the
3729 -- hypervisor keys
3730 ssHvparamsPref :: String
3731 ssHvparamsPref = "hvparams_"
3732
3733 -- * Hvparams keys
3734
3735 ssHvparamsXenChroot :: String
3736 ssHvparamsXenChroot = ssHvparamsPref ++ htChroot
3737
3738 ssHvparamsXenFake :: String
3739 ssHvparamsXenFake = ssHvparamsPref ++ htFake
3740
3741 ssHvparamsXenHvm :: String
3742 ssHvparamsXenHvm = ssHvparamsPref ++ htXenHvm
3743
3744 ssHvparamsXenKvm :: String
3745 ssHvparamsXenKvm = ssHvparamsPref ++ htKvm
3746
3747 ssHvparamsXenLxc :: String
3748 ssHvparamsXenLxc = ssHvparamsPref ++ htLxc
3749
3750 ssHvparamsXenPvm :: String
3751 ssHvparamsXenPvm = ssHvparamsPref ++ htXenPvm
3752
3753 validSsHvparamsKeys :: FrozenSet String
3754 validSsHvparamsKeys =
3755 ConstantUtils.mkSet [ssHvparamsXenChroot,
3756 ssHvparamsXenLxc,
3757 ssHvparamsXenFake,
3758 ssHvparamsXenHvm,
3759 ssHvparamsXenKvm,
3760 ssHvparamsXenPvm]
3761
3762 ssFilePerms :: Int
3763 ssFilePerms = 0o444
3764
3765 ssEnabledUserShutdown :: String
3766 ssEnabledUserShutdown = "enabled_user_shutdown"
3767
3768 ssSshPorts :: String
3769 ssSshPorts = "ssh_ports"
3770
3771 -- | Cluster wide default parameters
3772 defaultEnabledHypervisor :: String
3773 defaultEnabledHypervisor = htXenPvm
3774
3775 hvcDefaults :: Map Hypervisor (Map String PyValueEx)
3776 hvcDefaults =
3777 Map.fromList
3778 [ (XenPvm, Map.fromList
3779 [ (hvUseBootloader, PyValueEx False)
3780 , (hvBootloaderPath, PyValueEx xenBootloader)
3781 , (hvBootloaderArgs, PyValueEx "")
3782 , (hvKernelPath, PyValueEx xenKernel)
3783 , (hvInitrdPath, PyValueEx "")
3784 , (hvRootPath, PyValueEx "/dev/xvda1")
3785 , (hvKernelArgs, PyValueEx "ro")
3786 , (hvMigrationPort, PyValueEx (8002 :: Int))
3787 , (hvMigrationMode, PyValueEx htMigrationLive)
3788 , (hvBlockdevPrefix, PyValueEx "sd")
3789 , (hvRebootBehavior, PyValueEx instanceRebootAllowed)
3790 , (hvCpuMask, PyValueEx cpuPinningAll)
3791 , (hvCpuCap, PyValueEx (0 :: Int))
3792 , (hvCpuWeight, PyValueEx (256 :: Int))
3793 , (hvVifScript, PyValueEx "")
3794 , (hvXenCmd, PyValueEx xenCmdXm)
3795 , (hvXenCpuid, PyValueEx "")
3796 , (hvSoundhw, PyValueEx "")
3797 ])
3798 , (XenHvm, Map.fromList
3799 [ (hvBootOrder, PyValueEx "cd")
3800 , (hvCdromImagePath, PyValueEx "")
3801 , (hvNicType, PyValueEx htNicRtl8139)
3802 , (hvDiskType, PyValueEx htDiskParavirtual)
3803 , (hvVncBindAddress, PyValueEx ip4AddressAny)
3804 , (hvAcpi, PyValueEx True)
3805 , (hvPae, PyValueEx True)
3806 , (hvKernelPath, PyValueEx "/usr/lib/xen/boot/hvmloader")
3807 , (hvDeviceModel, PyValueEx "/usr/lib/xen/bin/qemu-dm")
3808 , (hvMigrationPort, PyValueEx (8002 :: Int))
3809 , (hvMigrationMode, PyValueEx htMigrationNonlive)
3810 , (hvUseLocaltime, PyValueEx False)
3811 , (hvBlockdevPrefix, PyValueEx "hd")
3812 , (hvPassthrough, PyValueEx "")
3813 , (hvRebootBehavior, PyValueEx instanceRebootAllowed)
3814 , (hvCpuMask, PyValueEx cpuPinningAll)
3815 , (hvCpuCap, PyValueEx (0 :: Int))
3816 , (hvCpuWeight, PyValueEx (256 :: Int))
3817 , (hvVifType, PyValueEx htHvmVifIoemu)
3818 , (hvVifScript, PyValueEx "")
3819 , (hvViridian, PyValueEx False)
3820 , (hvXenCmd, PyValueEx xenCmdXm)
3821 , (hvXenCpuid, PyValueEx "")
3822 , (hvSoundhw, PyValueEx "")
3823 ])
3824 , (Kvm, Map.fromList
3825 [ (hvKvmPath, PyValueEx kvmPath)
3826 , (hvKernelPath, PyValueEx kvmKernel)
3827 , (hvInitrdPath, PyValueEx "")
3828 , (hvKernelArgs, PyValueEx "ro")
3829 , (hvRootPath, PyValueEx "/dev/vda1")
3830 , (hvAcpi, PyValueEx True)
3831 , (hvSerialConsole, PyValueEx True)
3832 , (hvSerialSpeed, PyValueEx (38400 :: Int))
3833 , (hvVncBindAddress, PyValueEx "")
3834 , (hvVncTls, PyValueEx False)
3835 , (hvVncX509, PyValueEx "")
3836 , (hvVncX509Verify, PyValueEx False)
3837 , (hvVncPasswordFile, PyValueEx "")
3838 , (hvKvmSpiceBind, PyValueEx "")
3839 , (hvKvmSpiceIpVersion, PyValueEx ifaceNoIpVersionSpecified)
3840 , (hvKvmSpicePasswordFile, PyValueEx "")
3841 , (hvKvmSpiceLosslessImgCompr, PyValueEx "")
3842 , (hvKvmSpiceJpegImgCompr, PyValueEx "")
3843 , (hvKvmSpiceZlibGlzImgCompr, PyValueEx "")
3844 , (hvKvmSpiceStreamingVideoDetection, PyValueEx "")
3845 , (hvKvmSpiceAudioCompr, PyValueEx True)
3846 , (hvKvmSpiceUseTls, PyValueEx False)
3847 , (hvKvmSpiceTlsCiphers, PyValueEx opensslCiphers)
3848 , (hvKvmSpiceUseVdagent, PyValueEx True)
3849 , (hvKvmFloppyImagePath, PyValueEx "")
3850 , (hvCdromImagePath, PyValueEx "")
3851 , (hvKvmCdrom2ImagePath, PyValueEx "")
3852 , (hvBootOrder, PyValueEx htBoDisk)
3853 , (hvNicType, PyValueEx htNicParavirtual)
3854 , (hvDiskType, PyValueEx htDiskParavirtual)
3855 , (hvKvmCdromDiskType, PyValueEx "")
3856 , (hvKvmDiskAio, PyValueEx htKvmAioThreads)
3857 , (hvUsbMouse, PyValueEx "")
3858 , (hvKeymap, PyValueEx "")
3859 , (hvMigrationPort, PyValueEx (8102 :: Int))
3860 , (hvMigrationBandwidth, PyValueEx (32 :: Int))
3861 , (hvMigrationDowntime, PyValueEx (30 :: Int))
3862 , (hvMigrationMode, PyValueEx htMigrationLive)
3863 , (hvUseLocaltime, PyValueEx False)
3864 , (hvDiskCache, PyValueEx htCacheDefault)
3865 , (hvSecurityModel, PyValueEx htSmNone)
3866 , (hvSecurityDomain, PyValueEx "")
3867 , (hvKvmFlag, PyValueEx "")
3868 , (hvVhostNet, PyValueEx False)
3869 , (hvVirtioNetQueues, PyValueEx (1 :: Int))
3870 , (hvKvmUseChroot, PyValueEx False)
3871 , (hvKvmUserShutdown, PyValueEx False)
3872 , (hvMemPath, PyValueEx "")
3873 , (hvRebootBehavior, PyValueEx instanceRebootAllowed)
3874 , (hvCpuMask, PyValueEx cpuPinningAll)
3875 , (hvCpuType, PyValueEx "")
3876 , (hvCpuCores, PyValueEx (0 :: Int))
3877 , (hvCpuThreads, PyValueEx (0 :: Int))
3878 , (hvCpuSockets, PyValueEx (0 :: Int))
3879 , (hvSoundhw, PyValueEx "")
3880 , (hvUsbDevices, PyValueEx "")
3881 , (hvVga, PyValueEx "")
3882 , (hvKvmExtra, PyValueEx "")
3883 , (hvKvmMachineVersion, PyValueEx "")
3884 , (hvKvmMigrationCaps, PyValueEx "")
3885 , (hvVnetHdr, PyValueEx True)])
3886 , (Fake, Map.fromList [(hvMigrationMode, PyValueEx htMigrationLive)])
3887 , (Chroot, Map.fromList [(hvInitScript, PyValueEx "/ganeti-chroot")])
3888 , (Lxc, Map.fromList [(hvCpuMask, PyValueEx "")])
3889 ]
3890
3891 hvcGlobals :: FrozenSet String
3892 hvcGlobals =
3893 ConstantUtils.mkSet [hvMigrationBandwidth,
3894 hvMigrationMode,
3895 hvMigrationPort,
3896 hvXenCmd]
3897
3898 becDefaults :: Map String PyValueEx
3899 becDefaults =
3900 Map.fromList
3901 [ (beMinmem, PyValueEx (128 :: Int))
3902 , (beMaxmem, PyValueEx (128 :: Int))
3903 , (beVcpus, PyValueEx (1 :: Int))
3904 , (beAutoBalance, PyValueEx True)
3905 , (beAlwaysFailover, PyValueEx False)
3906 , (beSpindleUse, PyValueEx (1 :: Int))
3907 ]
3908
3909 ndcDefaults :: Map String PyValueEx
3910 ndcDefaults =
3911 Map.fromList
3912 [ (ndOobProgram, PyValueEx "")
3913 , (ndSpindleCount, PyValueEx (1 :: Int))
3914 , (ndExclusiveStorage, PyValueEx False)
3915 , (ndOvs, PyValueEx False)
3916 , (ndOvsName, PyValueEx defaultOvs)
3917 , (ndOvsLink, PyValueEx "")
3918 , (ndSshPort, PyValueEx (22 :: Int))
3919 , (ndCpuSpeed, PyValueEx (1 :: Double))
3920 ]
3921
3922 ndcGlobals :: FrozenSet String
3923 ndcGlobals = ConstantUtils.mkSet [ndExclusiveStorage]
3924
3925 -- | Default delay target measured in sectors
3926 defaultDelayTarget :: Int
3927 defaultDelayTarget = 1
3928
3929 defaultDiskCustom :: String
3930 defaultDiskCustom = ""
3931
3932 defaultDiskResync :: Bool
3933 defaultDiskResync = False
3934
3935 -- | Default fill target measured in sectors
3936 defaultFillTarget :: Int
3937 defaultFillTarget = 0
3938
3939 -- | Default mininum rate measured in KiB/s
3940 defaultMinRate :: Int
3941 defaultMinRate = 4 * 1024
3942
3943 defaultNetCustom :: String
3944 defaultNetCustom = ""
3945
3946 -- | Default plan ahead measured in sectors
3947 --
3948 -- The default values for the DRBD dynamic resync speed algorithm are
3949 -- taken from the drbsetup 8.3.11 man page, except for c-plan-ahead
3950 -- (that we don't need to set to 0, because we have a separate option
3951 -- to enable it) and for c-max-rate, that we cap to the default value
3952 -- for the static resync rate.
3953 defaultPlanAhead :: Int
3954 defaultPlanAhead = 20
3955
3956 defaultRbdPool :: String
3957 defaultRbdPool = "rbd"
3958
3959 diskLdDefaults :: Map DiskTemplate (Map String PyValueEx)
3960 diskLdDefaults =
3961 Map.fromList
3962 [ (DTBlock, Map.empty)
3963 , (DTDrbd8, Map.fromList
3964 [ (ldpBarriers, PyValueEx drbdBarriers)
3965 , (ldpDefaultMetavg, PyValueEx defaultVg)
3966 , (ldpDelayTarget, PyValueEx defaultDelayTarget)
3967 , (ldpDiskCustom, PyValueEx defaultDiskCustom)
3968 , (ldpDynamicResync, PyValueEx defaultDiskResync)
3969 , (ldpFillTarget, PyValueEx defaultFillTarget)
3970 , (ldpMaxRate, PyValueEx classicDrbdSyncSpeed)
3971 , (ldpMinRate, PyValueEx defaultMinRate)
3972 , (ldpNetCustom, PyValueEx defaultNetCustom)
3973 , (ldpNoMetaFlush, PyValueEx drbdNoMetaFlush)
3974 , (ldpPlanAhead, PyValueEx defaultPlanAhead)
3975 , (ldpProtocol, PyValueEx drbdDefaultNetProtocol)
3976 , (ldpResyncRate, PyValueEx classicDrbdSyncSpeed)
3977 ])
3978 , (DTExt, Map.empty)
3979 , (DTFile, Map.empty)
3980 , (DTPlain, Map.fromList [(ldpStripes, PyValueEx lvmStripecount)])
3981 , (DTRbd, Map.fromList
3982 [ (ldpPool, PyValueEx defaultRbdPool)
3983 , (ldpAccess, PyValueEx diskKernelspace)
3984 ])
3985 , (DTSharedFile, Map.empty)
3986 , (DTGluster, Map.fromList
3987 [ (rbdAccess, PyValueEx diskKernelspace)
3988 , (glusterHost, PyValueEx glusterHostDefault)
3989 , (glusterVolume, PyValueEx glusterVolumeDefault)
3990 , (glusterPort, PyValueEx glusterPortDefault)
3991 ])
3992 ]
3993
3994 diskDtDefaults :: Map DiskTemplate (Map String PyValueEx)
3995 diskDtDefaults =
3996 Map.fromList
3997 [ (DTBlock, Map.empty)
3998 , (DTDiskless, Map.empty)
3999 , (DTDrbd8, Map.fromList
4000 [ (drbdDataStripes, PyValueEx lvmStripecount)
4001 , (drbdDefaultMetavg, PyValueEx defaultVg)
4002 , (drbdDelayTarget, PyValueEx defaultDelayTarget)
4003 , (drbdDiskBarriers, PyValueEx drbdBarriers)
4004 , (drbdDiskCustom, PyValueEx defaultDiskCustom)
4005 , (drbdDynamicResync, PyValueEx defaultDiskResync)
4006 , (drbdFillTarget, PyValueEx defaultFillTarget)
4007 , (drbdMaxRate, PyValueEx classicDrbdSyncSpeed)
4008 , (drbdMetaBarriers, PyValueEx drbdNoMetaFlush)
4009 , (drbdMetaStripes, PyValueEx lvmStripecount)
4010 , (drbdMinRate, PyValueEx defaultMinRate)
4011 , (drbdNetCustom, PyValueEx defaultNetCustom)
4012 , (drbdPlanAhead, PyValueEx defaultPlanAhead)
4013 , (drbdProtocol, PyValueEx drbdDefaultNetProtocol)
4014 , (drbdResyncRate, PyValueEx classicDrbdSyncSpeed)
4015 ])
4016 , (DTExt, Map.empty)
4017 , (DTFile, Map.empty)
4018 , (DTPlain, Map.fromList [(lvStripes, PyValueEx lvmStripecount)])
4019 , (DTRbd, Map.fromList
4020 [ (rbdPool, PyValueEx defaultRbdPool)
4021 , (rbdAccess, PyValueEx diskKernelspace)
4022 ])
4023 , (DTSharedFile, Map.empty)
4024 , (DTGluster, Map.fromList
4025 [ (rbdAccess, PyValueEx diskKernelspace)
4026 , (glusterHost, PyValueEx glusterHostDefault)
4027 , (glusterVolume, PyValueEx glusterVolumeDefault)
4028 , (glusterPort, PyValueEx glusterPortDefault)
4029 ])
4030 ]
4031
4032 niccDefaults :: Map String PyValueEx
4033 niccDefaults =
4034 Map.fromList
4035 [ (nicMode, PyValueEx nicModeBridged)
4036 , (nicLink, PyValueEx defaultBridge)
4037 , (nicVlan, PyValueEx "")
4038 ]
4039
4040 -- | All of the following values are quite arbitrary - there are no
4041 -- "good" defaults, these must be customised per-site
4042 ispecsMinmaxDefaults :: Map String (Map String Int)
4043 ispecsMinmaxDefaults =
4044 Map.fromList
4045 [(ispecsMin,
4046 Map.fromList
4047 [(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMinISpec),
4048 (ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMinISpec),
4049 (ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMinISpec),
4050 (ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMinISpec),
4051 (ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMinISpec),
4052 (ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMinISpec)]),
4053 (ispecsMax,
4054 Map.fromList
4055 [(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMaxISpec),
4056 (ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMaxISpec),
4057 (ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMaxISpec),
4058 (ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMaxISpec),
4059 (ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMaxISpec),
4060 (ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMaxISpec)])]
4061
4062 ipolicyDefaults :: Map String PyValueEx
4063 ipolicyDefaults =
4064 Map.fromList
4065 [ (ispecsMinmax, PyValueEx [ispecsMinmaxDefaults])
4066 , (ispecsStd, PyValueEx (Map.fromList
4067 [ (ispecMemSize, 128)
4068 , (ispecCpuCount, 1)
4069 , (ispecDiskCount, 1)
4070 , (ispecDiskSize, 1024)
4071 , (ispecNicCount, 1)
4072 , (ispecSpindleUse, 1)
4073 ] :: Map String Int))
4074 , (ipolicyDts, PyValueEx (ConstantUtils.toList diskTemplates))
4075 , (ipolicyVcpuRatio, PyValueEx (4.0 :: Double))
4076 , (ipolicySpindleRatio, PyValueEx (32.0 :: Double))
4077 ]
4078
4079 masterPoolSizeDefault :: Int
4080 masterPoolSizeDefault = 10
4081
4082 -- * Exclusive storage
4083
4084 -- | Error margin used to compare physical disks
4085 partMargin :: Double
4086 partMargin = 0.01
4087
4088 -- | Space reserved when creating instance disks
4089 partReserved :: Double
4090 partReserved = 0.02
4091
4092 -- * Luxid job scheduling
4093
4094 -- | Time intervall in seconds for polling updates on the job queue. This
4095 -- intervall is only relevant if the number of running jobs reaches the maximal
4096 -- allowed number, as otherwise new jobs will be started immediately anyway.
4097 -- Also, as jobs are watched via inotify, scheduling usually works independent
4098 -- of polling. Therefore we chose a sufficiently large interval, in the order of
4099 -- 5 minutes. As with the interval for reloading the configuration, we chose a
4100 -- prime number to avoid accidental 'same wakeup' with other processes.
4101 luxidJobqueuePollInterval :: Int
4102 luxidJobqueuePollInterval = 307
4103
4104 -- | The default value for the maximal number of jobs to be running at the same
4105 -- time. Once the maximal number is reached, new jobs will just be queued and
4106 -- only started, once some of the other jobs have finished.
4107 luxidMaximalRunningJobsDefault :: Int
4108 luxidMaximalRunningJobsDefault = 20
4109
4110 -- | The default value for the maximal number of jobs that luxid tracks via
4111 -- inotify. If the number of running jobs exceeds this limit (which only happens
4112 -- if the user increases the default value of maximal running jobs), new forked
4113 -- jobs are no longer tracked by inotify; progress will still be noticed on the
4114 -- regular polls.
4115 luxidMaximalTrackedJobsDefault :: Int
4116 luxidMaximalTrackedJobsDefault = 25
4117
4118 -- | The number of retries when trying to @fork@ a new job.
4119 -- Due to a bug in GHC, this can fail even though we synchronize all forks
4120 -- and restrain from other @IO@ operations in the thread.
4121 luxidRetryForkCount :: Int
4122 luxidRetryForkCount = 5
4123
4124 -- | The average time period (in /us/) to wait between two @fork@ attempts.
4125 -- The forking thread wait a random time period between @0@ and twice the
4126 -- number, and with each attempt it doubles the step.
4127 -- See 'luxidRetryForkCount'.
4128 luxidRetryForkStepUS :: Int
4129 luxidRetryForkStepUS = 500000
4130
4131 -- * WConfD
4132
4133 -- | Time itnervall in seconds between checks that all lock owners are still
4134 -- alive, and cleaning up the resources for the dead ones. As jobs dying without
4135 -- releasing resources is the exception, not the rule, we don't want this task
4136 -- to take up too many cycles itself. Hence we choose a sufficiently large
4137 -- intervall, in the order of 5 minutes. To avoid accidental 'same wakeup'
4138 -- with other tasks, we choose the next unused prime number.
4139 wconfdDeathdetectionIntervall :: Int
4140 wconfdDeathdetectionIntervall = 311
4141
4142 wconfdDefCtmo :: Int
4143 wconfdDefCtmo = 10
4144
4145 wconfdDefRwto :: Int
4146 wconfdDefRwto = 60
4147
4148 -- | The prefix of the WConfD livelock file name
4149 wconfdLivelockPrefix :: String
4150 wconfdLivelockPrefix = "wconf-daemon"
4151
4152 -- * Confd
4153
4154 confdProtocolVersion :: Int
4155 confdProtocolVersion = ConstantUtils.confdProtocolVersion
4156
4157 -- Confd request type
4158
4159 confdReqPing :: Int
4160 confdReqPing = Types.confdRequestTypeToRaw ReqPing
4161
4162 confdReqNodeRoleByname :: Int
4163 confdReqNodeRoleByname = Types.confdRequestTypeToRaw ReqNodeRoleByName
4164
4165 confdReqNodePipByInstanceIp :: Int
4166 confdReqNodePipByInstanceIp = Types.confdRequestTypeToRaw ReqNodePipByInstPip
4167
4168 confdReqClusterMaster :: Int
4169 confdReqClusterMaster = Types.confdRequestTypeToRaw ReqClusterMaster
4170
4171 confdReqNodePipList :: Int
4172 confdReqNodePipList = Types.confdRequestTypeToRaw ReqNodePipList
4173
4174 confdReqMcPipList :: Int
4175 confdReqMcPipList = Types.confdRequestTypeToRaw ReqMcPipList
4176
4177 confdReqInstancesIpsList :: Int
4178 confdReqInstancesIpsList = Types.confdRequestTypeToRaw ReqInstIpsList
4179
4180 confdReqNodeDrbd :: Int
4181 confdReqNodeDrbd = Types.confdRequestTypeToRaw ReqNodeDrbd
4182
4183 confdReqNodeInstances :: Int
4184 confdReqNodeInstances = Types.confdRequestTypeToRaw ReqNodeInstances
4185
4186 confdReqInstanceDisks :: Int
4187 confdReqInstanceDisks = Types.confdRequestTypeToRaw ReqInstanceDisks
4188
4189 confdReqs :: FrozenSet Int
4190 confdReqs =
4191 ConstantUtils.mkSet .
4192 map Types.confdRequestTypeToRaw $
4193 [minBound..] \\ [ReqNodeInstances]
4194
4195 -- * Confd request type
4196
4197 confdReqfieldName :: Int
4198 confdReqfieldName = Types.confdReqFieldToRaw ReqFieldName
4199
4200 confdReqfieldIp :: Int
4201 confdReqfieldIp = Types.confdReqFieldToRaw ReqFieldIp
4202
4203 confdReqfieldMnodePip :: Int
4204 confdReqfieldMnodePip = Types.confdReqFieldToRaw ReqFieldMNodePip
4205
4206 -- * Confd repl status
4207
4208 confdReplStatusOk :: Int
4209 confdReplStatusOk = Types.confdReplyStatusToRaw ReplyStatusOk
4210
4211 confdReplStatusError :: Int
4212 confdReplStatusError = Types.confdReplyStatusToRaw ReplyStatusError
4213
4214 confdReplStatusNotimplemented :: Int
4215 confdReplStatusNotimplemented = Types.confdReplyStatusToRaw ReplyStatusNotImpl
4216
4217 confdReplStatuses :: FrozenSet Int
4218 confdReplStatuses =
4219 ConstantUtils.mkSet $ map Types.confdReplyStatusToRaw [minBound..]
4220
4221 -- * Confd node role
4222
4223 confdNodeRoleMaster :: Int
4224 confdNodeRoleMaster = Types.confdNodeRoleToRaw NodeRoleMaster
4225
4226 confdNodeRoleCandidate :: Int
4227 confdNodeRoleCandidate = Types.confdNodeRoleToRaw NodeRoleCandidate
4228
4229 confdNodeRoleOffline :: Int
4230 confdNodeRoleOffline = Types.confdNodeRoleToRaw NodeRoleOffline
4231
4232 confdNodeRoleDrained :: Int
4233 confdNodeRoleDrained = Types.confdNodeRoleToRaw NodeRoleDrained
4234
4235 confdNodeRoleRegular :: Int
4236 confdNodeRoleRegular = Types.confdNodeRoleToRaw NodeRoleRegular
4237
4238 -- * A few common errors for confd
4239
4240 confdErrorUnknownEntry :: Int
4241 confdErrorUnknownEntry = Types.confdErrorTypeToRaw ConfdErrorUnknownEntry
4242
4243 confdErrorInternal :: Int
4244 confdErrorInternal = Types.confdErrorTypeToRaw ConfdErrorInternal
4245
4246 confdErrorArgument :: Int
4247 confdErrorArgument = Types.confdErrorTypeToRaw ConfdErrorArgument
4248