Do not add a new Inotify watchers on timer
[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 qualified Ganeti.HTools.Types as Types
58 import Ganeti.HTools.Types (AutoRepairResult(..), AutoRepairType(..))
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 -- | The version of the backup/export instance description file format we are
177 -- producing when exporting and accepting when importing. The two are currently
178 -- tightly intertwined.
179 exportVersion :: Int
180 exportVersion = 0
181
182 rapiVersion :: Int
183 rapiVersion = 2
184
185 configMajor :: Int
186 configMajor = AutoConf.versionMajor
187
188 configMinor :: Int
189 configMinor = AutoConf.versionMinor
190
191 -- | The configuration is supposed to remain stable across
192 -- revisions. Therefore, the revision number is cleared to '0'.
193 configRevision :: Int
194 configRevision = 0
195
196 configVersion :: Int
197 configVersion = buildVersion configMajor configMinor configRevision
198
199 -- | Similarly to the configuration (see 'configRevision'), the
200 -- protocols are supposed to remain stable across revisions.
201 protocolVersion :: Int
202 protocolVersion = buildVersion configMajor configMinor configRevision
203
204 -- * User separation
205
206 daemonsGroup :: String
207 daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
208
209 adminGroup :: String
210 adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
211
212 masterdUser :: String
213 masterdUser = Runtime.daemonUser GanetiMasterd
214
215 masterdGroup :: String
216 masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
217
218 metadUser :: String
219 metadUser = Runtime.daemonUser GanetiMetad
220
221 metadGroup :: String
222 metadGroup = Runtime.daemonGroup (DaemonGroup GanetiMetad)
223
224 rapiUser :: String
225 rapiUser = Runtime.daemonUser GanetiRapi
226
227 rapiGroup :: String
228 rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
229
230 confdUser :: String
231 confdUser = Runtime.daemonUser GanetiConfd
232
233 confdGroup :: String
234 confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
235
236 wconfdUser :: String
237 wconfdUser = Runtime.daemonUser GanetiWConfd
238
239 wconfdGroup :: String
240 wconfdGroup = Runtime.daemonGroup (DaemonGroup GanetiWConfd)
241
242 kvmdUser :: String
243 kvmdUser = Runtime.daemonUser GanetiKvmd
244
245 kvmdGroup :: String
246 kvmdGroup = Runtime.daemonGroup (DaemonGroup GanetiKvmd)
247
248 luxidUser :: String
249 luxidUser = Runtime.daemonUser GanetiLuxid
250
251 luxidGroup :: String
252 luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
253
254 nodedUser :: String
255 nodedUser = Runtime.daemonUser GanetiNoded
256
257 nodedGroup :: String
258 nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
259
260 mondUser :: String
261 mondUser = Runtime.daemonUser GanetiMond
262
263 mondGroup :: String
264 mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
265
266 sshLoginUser :: String
267 sshLoginUser = AutoConf.sshLoginUser
268
269 sshConsoleUser :: String
270 sshConsoleUser = AutoConf.sshConsoleUser
271
272 -- * Cpu pinning separators and constants
273
274 cpuPinningSep :: String
275 cpuPinningSep = ":"
276
277 cpuPinningAll :: String
278 cpuPinningAll = "all"
279
280 -- | Internal representation of "all"
281 cpuPinningAllVal :: Int
282 cpuPinningAllVal = -1
283
284 -- | One "all" entry in a CPU list means CPU pinning is off
285 cpuPinningOff :: [Int]
286 cpuPinningOff = [cpuPinningAllVal]
287
288 -- | A Xen-specific implementation detail is that there is no way to
289 -- actually say "use any cpu for pinning" in a Xen configuration file,
290 -- as opposed to the command line, where you can say
291 -- @
292 -- xm vcpu-pin <domain> <vcpu> all
293 -- @
294 --
295 -- The workaround used in Xen is "0-63" (see source code function
296 -- "xm_vcpu_pin" in @<xen-source>/tools/python/xen/xm/main.py@).
297 --
298 -- To support future changes, the following constant is treated as a
299 -- blackbox string that simply means "use any cpu for pinning under
300 -- xen".
301 cpuPinningAllXen :: String
302 cpuPinningAllXen = "0-63"
303
304 -- * Image and wipe
305
306 ddCmd :: String
307 ddCmd = "dd"
308
309 -- | 1 MiB
310 -- The default block size for the 'dd' command
311 ddBlockSize :: Int
312 ddBlockSize = 1024^2
313
314 -- | 1GB
315 maxWipeChunk :: Int
316 maxWipeChunk = 1024
317
318 minWipeChunkPercent :: Int
319 minWipeChunkPercent = 10
320
321 -- * Directories
322
323 runDirsMode :: Int
324 runDirsMode = 0o775
325
326 secureDirMode :: Int
327 secureDirMode = 0o700
328
329 secureFileMode :: Int
330 secureFileMode = 0o600
331
332 adoptableBlockdevRoot :: String
333 adoptableBlockdevRoot = "/dev/disk/"
334
335 -- * 'autoconf' enable/disable
336
337 enableMond :: Bool
338 enableMond = AutoConf.enableMond
339
340 enableMetad :: Bool
341 enableMetad = AutoConf.enableMetad
342
343 enableRestrictedCommands :: Bool
344 enableRestrictedCommands = AutoConf.enableRestrictedCommands
345
346 -- * SSH constants
347
348 ssh :: String
349 ssh = "ssh"
350
351 scp :: String
352 scp = "scp"
353
354 -- * Daemons
355
356 confd :: String
357 confd = Runtime.daemonName GanetiConfd
358
359 masterd :: String
360 masterd = Runtime.daemonName GanetiMasterd
361
362 metad :: String
363 metad = Runtime.daemonName GanetiMetad
364
365 mond :: String
366 mond = Runtime.daemonName GanetiMond
367
368 noded :: String
369 noded = Runtime.daemonName GanetiNoded
370
371 wconfd :: String
372 wconfd = Runtime.daemonName GanetiWConfd
373
374 luxid :: String
375 luxid = Runtime.daemonName GanetiLuxid
376
377 rapi :: String
378 rapi = Runtime.daemonName GanetiRapi
379
380 kvmd :: String
381 kvmd = Runtime.daemonName GanetiKvmd
382
383 -- Set of daemons which only run on the master.
384 -- Keep in sync with the 'daemon-util' script.
385 daemonsMaster :: FrozenSet String
386 daemonsMaster = ConstantUtils.mkSet [wconfd, luxid, rapi]
387
388 daemons :: FrozenSet String
389 daemons =
390 ConstantUtils.mkSet
391 $ map Runtime.daemonName [minBound .. maxBound]
392
393 defaultConfdPort :: Int
394 defaultConfdPort = 1814
395
396 defaultMondPort :: Int
397 defaultMondPort = 1815
398
399 defaultMetadPort :: Int
400 defaultMetadPort = 80
401
402 defaultNodedPort :: Int
403 defaultNodedPort = 1811
404
405 defaultRapiPort :: Int
406 defaultRapiPort = 5080
407
408 daemonsPorts :: Map String (Protocol, Int)
409 daemonsPorts =
410 Map.fromList
411 [ (confd, (Udp, defaultConfdPort))
412 , (metad, (Tcp, defaultMetadPort))
413 , (mond, (Tcp, defaultMondPort))
414 , (noded, (Tcp, defaultNodedPort))
415 , (rapi, (Tcp, defaultRapiPort))
416 , (ssh, (Tcp, 22))
417 ]
418
419 firstDrbdPort :: Int
420 firstDrbdPort = 11000
421
422 lastDrbdPort :: Int
423 lastDrbdPort = 14999
424
425 daemonsLogbase :: Map String String
426 daemonsLogbase =
427 Map.fromList
428 [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
429
430 daemonsExtraLogbase :: Map String (Map String String)
431 daemonsExtraLogbase =
432 Map.fromList $
433 map (Runtime.daemonName *** id)
434 [ (GanetiMond, Map.fromList
435 [ ("access", Runtime.daemonsExtraLogbase GanetiMond AccessLog)
436 , ("error", Runtime.daemonsExtraLogbase GanetiMond ErrorLog)
437 ])
438 ]
439
440 extraLogreasonAccess :: String
441 extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
442
443 extraLogreasonError :: String
444 extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
445
446 devConsole :: String
447 devConsole = ConstantUtils.devConsole
448
449 procMounts :: String
450 procMounts = "/proc/mounts"
451
452 -- * Luxi (Local UniX Interface) related constants
453
454 luxiEom :: PythonChar
455 luxiEom = PythonChar '\x03'
456
457 -- | Environment variable for the luxi override socket
458 luxiOverride :: String
459 luxiOverride = "FORCE_LUXI_SOCKET"
460
461 luxiOverrideMaster :: String
462 luxiOverrideMaster = "master"
463
464 luxiOverrideQuery :: String
465 luxiOverrideQuery = "query"
466
467 luxiVersion :: Int
468 luxiVersion = configVersion
469
470 -- * Syslog
471
472 syslogUsage :: String
473 syslogUsage = AutoConf.syslogUsage
474
475 syslogNo :: String
476 syslogNo = Logging.syslogUsageToRaw SyslogNo
477
478 syslogYes :: String
479 syslogYes = Logging.syslogUsageToRaw SyslogYes
480
481 syslogOnly :: String
482 syslogOnly = Logging.syslogUsageToRaw SyslogOnly
483
484 syslogSocket :: String
485 syslogSocket = "/dev/log"
486
487 exportConfFile :: String
488 exportConfFile = "config.ini"
489
490 -- * Xen
491
492 xenBootloader :: String
493 xenBootloader = AutoConf.xenBootloader
494
495 xenCmdXl :: String
496 xenCmdXl = "xl"
497
498 xenCmdXm :: String
499 xenCmdXm = "xm"
500
501 xenInitrd :: String
502 xenInitrd = AutoConf.xenInitrd
503
504 xenKernel :: String
505 xenKernel = AutoConf.xenKernel
506
507 xlSocatCmd :: String
508 xlSocatCmd = "socat -b524288 - TCP:%s:%d #"
509
510 xlMigrationPidfile :: String
511 xlMigrationPidfile = "socat.pid"
512
513 -- FIXME: perhaps rename to 'validXenCommands' for consistency with
514 -- other constants
515 knownXenCommands :: FrozenSet String
516 knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
517
518 -- * KVM and socat
519
520 kvmPath :: String
521 kvmPath = AutoConf.kvmPath
522
523 kvmKernel :: String
524 kvmKernel = AutoConf.kvmKernel
525
526 socatEscapeCode :: String
527 socatEscapeCode = "0x1d"
528
529 socatPath :: String
530 socatPath = AutoConf.socatPath
531
532 socatUseCompress :: Bool
533 socatUseCompress = AutoConf.socatUseCompress
534
535 socatUseEscape :: Bool
536 socatUseEscape = AutoConf.socatUseEscape
537
538 -- * LXC
539 -- If you are trying to change the value of these default constants, you also
540 -- need to edit the default value declaration in man/gnt-instance.rst.
541 lxcDevicesDefault :: String
542 lxcDevicesDefault =
543 "c 1:3 rw" -- /dev/null
544 ++ ",c 1:5 rw" -- /dev/zero
545 ++ ",c 1:7 rw" -- /dev/full
546 ++ ",c 1:8 rw" -- /dev/random
547 ++ ",c 1:9 rw" -- /dev/urandom
548 ++ ",c 1:10 rw" -- /dev/aio
549 ++ ",c 5:0 rw" -- /dev/tty
550 ++ ",c 5:1 rw" -- /dev/console
551 ++ ",c 5:2 rw" -- /dev/ptmx
552 ++ ",c 136:* rw" -- first block of Unix98 PTY slaves
553
554 lxcDropCapabilitiesDefault :: String
555 lxcDropCapabilitiesDefault =
556 "mac_override" -- Allow MAC configuration or state changes
557 ++ ",sys_boot" -- Use reboot(2) and kexec_load(2)
558 ++ ",sys_module" -- Load and unload kernel modules
559 ++ ",sys_time" -- Set system clock, set real-time (hardware) clock
560 ++ ",sys_admin" -- Various system administration operations
561
562 lxcStateRunning :: String
563 lxcStateRunning = "RUNNING"
564
565 -- * Console types
566
567 -- | Display a message for console access
568 consMessage :: String
569 consMessage = "msg"
570
571 -- | Console as SPICE server
572 consSpice :: String
573 consSpice = "spice"
574
575 -- | Console as SSH command
576 consSsh :: String
577 consSsh = "ssh"
578
579 -- | Console as VNC server
580 consVnc :: String
581 consVnc = "vnc"
582
583 consAll :: FrozenSet String
584 consAll = ConstantUtils.mkSet [consMessage, consSpice, consSsh, consVnc]
585
586 -- | RSA key bit length
587 --
588 -- For RSA keys more bits are better, but they also make operations
589 -- more expensive. NIST SP 800-131 recommends a minimum of 2048 bits
590 -- from the year 2010 on.
591 rsaKeyBits :: Int
592 rsaKeyBits = 2048
593
594 -- | Ciphers allowed for SSL connections.
595 --
596 -- For the format, see ciphers(1). A better way to disable ciphers
597 -- would be to use the exclamation mark (!), but socat versions below
598 -- 1.5 can't parse exclamation marks in options properly. When
599 -- modifying the ciphers, ensure not to accidentially add something
600 -- after it's been removed. Use the "openssl" utility to check the
601 -- allowed ciphers, e.g. "openssl ciphers -v HIGH:-DES".
602 opensslCiphers :: String
603 opensslCiphers = "HIGH:-DES:-3DES:-EXPORT:-DH"
604
605 -- * X509
606
607 -- | commonName (CN) used in certificates
608 x509CertCn :: String
609 x509CertCn = "ganeti.example.com"
610
611 -- | Default validity of certificates in days
612 x509CertDefaultValidity :: Int
613 x509CertDefaultValidity = 365 * 5
614
615 x509CertSignatureHeader :: String
616 x509CertSignatureHeader = "X-Ganeti-Signature"
617
618 -- | Digest used to sign certificates ("openssl x509" uses SHA1 by default)
619 x509CertSignDigest :: String
620 x509CertSignDigest = "SHA1"
621
622 -- * Import/export daemon mode
623
624 iemExport :: String
625 iemExport = "export"
626
627 iemImport :: String
628 iemImport = "import"
629
630 -- * Import/export transport compression
631
632 iecGzip :: String
633 iecGzip = "gzip"
634
635 iecGzipFast :: String
636 iecGzipFast = "gzip-fast"
637
638 iecGzipSlow :: String
639 iecGzipSlow = "gzip-slow"
640
641 iecLzop :: String
642 iecLzop = "lzop"
643
644 iecNone :: String
645 iecNone = "none"
646
647 iecAll :: [String]
648 iecAll = [iecGzip, iecGzipFast, iecGzipSlow, iecLzop, iecNone]
649
650 iecDefaultTools :: [String]
651 iecDefaultTools = [iecGzip, iecGzipFast, iecGzipSlow]
652
653 iecCompressionUtilities :: Map String String
654 iecCompressionUtilities =
655 Map.fromList
656 [ (iecGzipFast, iecGzip)
657 , (iecGzipSlow, iecGzip)
658 ]
659
660 ieCustomSize :: String
661 ieCustomSize = "fd"
662
663 -- * Import/export I/O
664
665 -- | Direct file I/O, equivalent to a shell's I/O redirection using
666 -- '<' or '>'
667 ieioFile :: String
668 ieioFile = "file"
669
670 -- | Raw block device I/O using "dd"
671 ieioRawDisk :: String
672 ieioRawDisk = "raw"
673
674 -- | OS definition import/export script
675 ieioScript :: String
676 ieioScript = "script"
677
678 -- * Values
679
680 valueDefault :: String
681 valueDefault = "default"
682
683 valueAuto :: String
684 valueAuto = "auto"
685
686 valueGenerate :: String
687 valueGenerate = "generate"
688
689 valueNone :: String
690 valueNone = "none"
691
692 valueTrue :: String
693 valueTrue = "true"
694
695 valueFalse :: String
696 valueFalse = "false"
697
698 -- * Hooks
699
700 hooksNameCfgupdate :: String
701 hooksNameCfgupdate = "config-update"
702
703 hooksNameWatcher :: String
704 hooksNameWatcher = "watcher"
705
706 hooksPath :: String
707 hooksPath = "/sbin:/bin:/usr/sbin:/usr/bin"
708
709 hooksPhasePost :: String
710 hooksPhasePost = "post"
711
712 hooksPhasePre :: String
713 hooksPhasePre = "pre"
714
715 hooksVersion :: Int
716 hooksVersion = 2
717
718 -- * Hooks subject type (what object type does the LU deal with)
719
720 htypeCluster :: String
721 htypeCluster = "CLUSTER"
722
723 htypeGroup :: String
724 htypeGroup = "GROUP"
725
726 htypeInstance :: String
727 htypeInstance = "INSTANCE"
728
729 htypeNetwork :: String
730 htypeNetwork = "NETWORK"
731
732 htypeNode :: String
733 htypeNode = "NODE"
734
735 -- * Hkr
736
737 hkrSkip :: Int
738 hkrSkip = 0
739
740 hkrFail :: Int
741 hkrFail = 1
742
743 hkrSuccess :: Int
744 hkrSuccess = 2
745
746 -- * Storage types
747
748 stBlock :: String
749 stBlock = Types.storageTypeToRaw StorageBlock
750
751 stDiskless :: String
752 stDiskless = Types.storageTypeToRaw StorageDiskless
753
754 stExt :: String
755 stExt = Types.storageTypeToRaw StorageExt
756
757 stFile :: String
758 stFile = Types.storageTypeToRaw StorageFile
759
760 stSharedFile :: String
761 stSharedFile = Types.storageTypeToRaw StorageSharedFile
762
763 stGluster :: String
764 stGluster = Types.storageTypeToRaw StorageGluster
765
766 stLvmPv :: String
767 stLvmPv = Types.storageTypeToRaw StorageLvmPv
768
769 stLvmVg :: String
770 stLvmVg = Types.storageTypeToRaw StorageLvmVg
771
772 stRados :: String
773 stRados = Types.storageTypeToRaw StorageRados
774
775 storageTypes :: FrozenSet String
776 storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
777
778 -- | The set of storage types for which full storage reporting is available
779 stsReport :: FrozenSet String
780 stsReport = ConstantUtils.mkSet [stFile, stLvmPv, stLvmVg]
781
782 -- | The set of storage types for which node storage reporting is available
783 -- | (as used by LUQueryNodeStorage)
784 stsReportNodeStorage :: FrozenSet String
785 stsReportNodeStorage = ConstantUtils.union stsReport $
786 ConstantUtils.mkSet [ stSharedFile
787 , stGluster
788 ]
789
790 -- * Storage fields
791 -- ** First two are valid in LU context only, not passed to backend
792
793 sfNode :: String
794 sfNode = "node"
795
796 sfType :: String
797 sfType = "type"
798
799 -- ** and the rest are valid in backend
800
801 sfAllocatable :: String
802 sfAllocatable = Types.storageFieldToRaw SFAllocatable
803
804 sfFree :: String
805 sfFree = Types.storageFieldToRaw SFFree
806
807 sfName :: String
808 sfName = Types.storageFieldToRaw SFName
809
810 sfSize :: String
811 sfSize = Types.storageFieldToRaw SFSize
812
813 sfUsed :: String
814 sfUsed = Types.storageFieldToRaw SFUsed
815
816 validStorageFields :: FrozenSet String
817 validStorageFields =
818 ConstantUtils.mkSet $ map Types.storageFieldToRaw [minBound..] ++
819 [sfNode, sfType]
820
821 modifiableStorageFields :: Map String (FrozenSet String)
822 modifiableStorageFields =
823 Map.fromList [(Types.storageTypeToRaw StorageLvmPv,
824 ConstantUtils.mkSet [sfAllocatable])]
825
826 -- * Storage operations
827
828 soFixConsistency :: String
829 soFixConsistency = "fix-consistency"
830
831 validStorageOperations :: Map String (FrozenSet String)
832 validStorageOperations =
833 Map.fromList [(Types.storageTypeToRaw StorageLvmVg,
834 ConstantUtils.mkSet [soFixConsistency])]
835
836 -- * Volume fields
837
838 vfDev :: String
839 vfDev = "dev"
840
841 vfInstance :: String
842 vfInstance = "instance"
843
844 vfName :: String
845 vfName = "name"
846
847 vfNode :: String
848 vfNode = "node"
849
850 vfPhys :: String
851 vfPhys = "phys"
852
853 vfSize :: String
854 vfSize = "size"
855
856 vfVg :: String
857 vfVg = "vg"
858
859 -- * Local disk status
860
861 ldsFaulty :: Int
862 ldsFaulty = Types.localDiskStatusToRaw DiskStatusFaulty
863
864 ldsOkay :: Int
865 ldsOkay = Types.localDiskStatusToRaw DiskStatusOk
866
867 ldsUnknown :: Int
868 ldsUnknown = Types.localDiskStatusToRaw DiskStatusUnknown
869
870 ldsSync :: Int
871 ldsSync = Types.localDiskStatusToRaw DiskStatusSync
872
873 ldsNames :: Map Int String
874 ldsNames =
875 Map.fromList [ (Types.localDiskStatusToRaw ds,
876 localDiskStatusName ds) | ds <- [minBound..] ]
877
878 -- * Disk template types
879
880 dtDiskless :: String
881 dtDiskless = Types.diskTemplateToRaw DTDiskless
882
883 dtFile :: String
884 dtFile = Types.diskTemplateToRaw DTFile
885
886 dtSharedFile :: String
887 dtSharedFile = Types.diskTemplateToRaw DTSharedFile
888
889 dtPlain :: String
890 dtPlain = Types.diskTemplateToRaw DTPlain
891
892 dtBlock :: String
893 dtBlock = Types.diskTemplateToRaw DTBlock
894
895 dtDrbd8 :: String
896 dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
897
898 dtRbd :: String
899 dtRbd = Types.diskTemplateToRaw DTRbd
900
901 dtExt :: String
902 dtExt = Types.diskTemplateToRaw DTExt
903
904 dtGluster :: String
905 dtGluster = Types.diskTemplateToRaw DTGluster
906
907 dtMixed :: String
908 dtMixed = "mixed"
909
910 -- | This is used to order determine the default disk template when
911 -- the list of enabled disk templates is inferred from the current
912 -- state of the cluster. This only happens on an upgrade from a
913 -- version of Ganeti that did not support the 'enabled_disk_templates'
914 -- so far.
915 diskTemplatePreference :: [String]
916 diskTemplatePreference =
917 map Types.diskTemplateToRaw
918 [DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile,
919 DTPlain, DTRbd, DTSharedFile, DTGluster]
920
921 diskTemplates :: FrozenSet String
922 diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
923
924 -- | Disk templates that are enabled by default
925 defaultEnabledDiskTemplates :: [String]
926 defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
927
928 -- | Mapping of disk templates to storage types
929 mapDiskTemplateStorageType :: Map String String
930 mapDiskTemplateStorageType =
931 Map.fromList $
932 map ( Types.diskTemplateToRaw
933 &&& Types.storageTypeToRaw . diskTemplateToStorageType)
934 [minBound..maxBound]
935
936 -- | The set of network-mirrored disk templates
937 dtsIntMirror :: FrozenSet String
938 dtsIntMirror = ConstantUtils.mkSet [dtDrbd8]
939
940 -- | 'DTDiskless' is 'trivially' externally mirrored
941 dtsExtMirror :: FrozenSet String
942 dtsExtMirror =
943 ConstantUtils.mkSet $
944 map Types.diskTemplateToRaw
945 [DTDiskless, DTBlock, DTExt, DTSharedFile, DTRbd, DTGluster]
946
947 -- | The set of non-lvm-based disk templates
948 dtsNotLvm :: FrozenSet String
949 dtsNotLvm =
950 ConstantUtils.mkSet $
951 map Types.diskTemplateToRaw
952 [DTSharedFile, DTDiskless, DTBlock, DTExt, DTFile, DTRbd, DTGluster]
953
954 -- | The set of disk templates which can be grown
955 dtsGrowable :: FrozenSet String
956 dtsGrowable =
957 ConstantUtils.mkSet $
958 map Types.diskTemplateToRaw
959 [DTSharedFile, DTDrbd8, DTPlain, DTExt, DTFile, DTRbd, DTGluster]
960
961 -- | The set of disk templates that allow adoption
962 dtsMayAdopt :: FrozenSet String
963 dtsMayAdopt =
964 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTBlock, DTPlain]
965
966 -- | The set of disk templates that *must* use adoption
967 dtsMustAdopt :: FrozenSet String
968 dtsMustAdopt = ConstantUtils.mkSet [Types.diskTemplateToRaw DTBlock]
969
970 -- | The set of disk templates that allow migrations
971 dtsMirrored :: FrozenSet String
972 dtsMirrored = dtsIntMirror `ConstantUtils.union` dtsExtMirror
973
974 -- | The set of file based disk templates
975 dtsFilebased :: FrozenSet String
976 dtsFilebased =
977 ConstantUtils.mkSet $ map Types.diskTemplateToRaw
978 [DTSharedFile, DTFile, DTGluster]
979
980 -- | The set of file based disk templates whose path is tied to the instance
981 -- name
982 dtsInstanceDependentPath :: FrozenSet String
983 dtsInstanceDependentPath =
984 ConstantUtils.mkSet $ map Types.diskTemplateToRaw
985 [DTSharedFile, DTFile]
986
987 -- | The set of disk templates that can be moved by copying
988 --
989 -- Note: a requirement is that they're not accessed externally or
990 -- shared between nodes; in particular, sharedfile is not suitable.
991 dtsCopyable :: FrozenSet String
992 dtsCopyable =
993 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain, DTFile]
994
995 -- | The set of disk templates which can be snapshot.
996 dtsSnapshotCapable :: FrozenSet String
997 dtsSnapshotCapable =
998 ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain, DTDrbd8, DTExt]
999
1000 -- | The set of disk templates that are supported by exclusive_storage
1001 dtsExclStorage :: FrozenSet String
1002 dtsExclStorage = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain]
1003
1004 -- | Templates for which we don't perform checks on free space
1005 dtsNoFreeSpaceCheck :: FrozenSet String
1006 dtsNoFreeSpaceCheck =
1007 ConstantUtils.mkSet $
1008 map Types.diskTemplateToRaw [DTExt, DTSharedFile, DTFile, DTRbd, DTGluster]
1009
1010 dtsBlock :: FrozenSet String
1011 dtsBlock =
1012 ConstantUtils.mkSet $
1013 map Types.diskTemplateToRaw [DTPlain, DTDrbd8, DTBlock, DTRbd, DTExt]
1014
1015 -- | The set of lvm-based disk templates
1016 dtsLvm :: FrozenSet String
1017 dtsLvm = diskTemplates `ConstantUtils.difference` dtsNotLvm
1018
1019 -- | The set of lvm-based disk templates
1020 dtsHaveAccess :: FrozenSet String
1021 dtsHaveAccess = ConstantUtils.mkSet $
1022 map Types.diskTemplateToRaw [DTRbd, DTGluster, DTExt]
1023
1024 -- | The set of disk templates that cannot convert from
1025 dtsNotConvertibleFrom :: FrozenSet String
1026 dtsNotConvertibleFrom =
1027 ConstantUtils.mkSet $
1028 map Types.diskTemplateToRaw [DTDiskless]
1029
1030 -- | The set of disk templates that cannot convert to
1031 dtsNotConvertibleTo :: FrozenSet String
1032 dtsNotConvertibleTo =
1033 ConstantUtils.mkSet $
1034 map Types.diskTemplateToRaw [DTDiskless, DTBlock]
1035
1036 -- * Drbd
1037
1038 drbdHmacAlg :: String
1039 drbdHmacAlg = "md5"
1040
1041 drbdDefaultNetProtocol :: String
1042 drbdDefaultNetProtocol = "C"
1043
1044 drbdMigrationNetProtocol :: String
1045 drbdMigrationNetProtocol = "C"
1046
1047 drbdStatusFile :: String
1048 drbdStatusFile = "/proc/drbd"
1049
1050 -- | The length of generated DRBD secrets (see also TempRes module).
1051 drbdSecretLength :: Int
1052 drbdSecretLength = 20
1053
1054 -- | Size of DRBD meta block device
1055 drbdMetaSize :: Int
1056 drbdMetaSize = 128
1057
1058 -- * Drbd barrier types
1059
1060 drbdBDiskBarriers :: String
1061 drbdBDiskBarriers = "b"
1062
1063 drbdBDiskDrain :: String
1064 drbdBDiskDrain = "d"
1065
1066 drbdBDiskFlush :: String
1067 drbdBDiskFlush = "f"
1068
1069 drbdBNone :: String
1070 drbdBNone = "n"
1071
1072 -- | Valid barrier combinations: "n" or any non-null subset of "bfd"
1073 drbdValidBarrierOpt :: FrozenSet (FrozenSet String)
1074 drbdValidBarrierOpt =
1075 ConstantUtils.mkSet
1076 [ ConstantUtils.mkSet [drbdBNone]
1077 , ConstantUtils.mkSet [drbdBDiskBarriers]
1078 , ConstantUtils.mkSet [drbdBDiskDrain]
1079 , ConstantUtils.mkSet [drbdBDiskFlush]
1080 , ConstantUtils.mkSet [drbdBDiskDrain, drbdBDiskFlush]
1081 , ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskDrain]
1082 , ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskFlush]
1083 , ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskFlush, drbdBDiskDrain]
1084 ]
1085
1086 -- | Rbd tool command
1087 rbdCmd :: String
1088 rbdCmd = "rbd"
1089
1090 -- * File backend driver
1091
1092 fdBlktap :: String
1093 fdBlktap = Types.fileDriverToRaw FileBlktap
1094
1095 fdBlktap2 :: String
1096 fdBlktap2 = Types.fileDriverToRaw FileBlktap2
1097
1098 fdLoop :: String
1099 fdLoop = Types.fileDriverToRaw FileLoop
1100
1101 fdDefault :: String
1102 fdDefault = fdLoop
1103
1104 fileDriver :: FrozenSet String
1105 fileDriver =
1106 ConstantUtils.mkSet $
1107 map Types.fileDriverToRaw [minBound..]
1108
1109 -- | The set of drbd-like disk types
1110 dtsDrbd :: FrozenSet String
1111 dtsDrbd = ConstantUtils.mkSet [Types.diskTemplateToRaw DTDrbd8]
1112
1113 -- * Disk access mode
1114
1115 diskRdonly :: String
1116 diskRdonly = Types.diskModeToRaw DiskRdOnly
1117
1118 diskRdwr :: String
1119 diskRdwr = Types.diskModeToRaw DiskRdWr
1120
1121 diskAccessSet :: FrozenSet String
1122 diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..]
1123
1124 -- * Disk replacement mode
1125
1126 replaceDiskAuto :: String
1127 replaceDiskAuto = Types.replaceDisksModeToRaw ReplaceAuto
1128
1129 replaceDiskChg :: String
1130 replaceDiskChg = Types.replaceDisksModeToRaw ReplaceNewSecondary
1131
1132 replaceDiskPri :: String
1133 replaceDiskPri = Types.replaceDisksModeToRaw ReplaceOnPrimary
1134
1135 replaceDiskSec :: String
1136 replaceDiskSec = Types.replaceDisksModeToRaw ReplaceOnSecondary
1137
1138 replaceModes :: FrozenSet String
1139 replaceModes =
1140 ConstantUtils.mkSet $ map Types.replaceDisksModeToRaw [minBound..]
1141
1142 -- * Instance export mode
1143
1144 exportModeLocal :: String
1145 exportModeLocal = Types.exportModeToRaw ExportModeLocal
1146
1147 exportModeRemote :: String
1148 exportModeRemote = Types.exportModeToRaw ExportModeRemote
1149
1150 exportModes :: FrozenSet String
1151 exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
1152
1153 -- * Instance creation modes
1154
1155 instanceCreate :: String
1156 instanceCreate = Types.instCreateModeToRaw InstCreate
1157
1158 instanceImport :: String
1159 instanceImport = Types.instCreateModeToRaw InstImport
1160
1161 instanceRemoteImport :: String
1162 instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
1163
1164 instanceCreateModes :: FrozenSet String
1165 instanceCreateModes =
1166 ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
1167
1168 -- * Remote import/export handshake message and version
1169
1170 rieHandshake :: String
1171 rieHandshake = "Hi, I'm Ganeti"
1172
1173 rieVersion :: Int
1174 rieVersion = 0
1175
1176 -- | Remote import/export certificate validity (seconds)
1177 rieCertValidity :: Int
1178 rieCertValidity = 24 * 60 * 60
1179
1180 -- | Export only: how long to wait per connection attempt (seconds)
1181 rieConnectAttemptTimeout :: Int
1182 rieConnectAttemptTimeout = 20
1183
1184 -- | Export only: number of attempts to connect
1185 rieConnectRetries :: Int
1186 rieConnectRetries = 10
1187
1188 -- | Overall timeout for establishing connection
1189 rieConnectTimeout :: Int
1190 rieConnectTimeout = 180
1191
1192 -- | Give child process up to 5 seconds to exit after sending a signal
1193 childLingerTimeout :: Double
1194 childLingerTimeout = 5.0
1195
1196 -- * Import/export config options
1197
1198 inisectBep :: String
1199 inisectBep = "backend"
1200
1201 inisectExp :: String
1202 inisectExp = "export"
1203
1204 inisectHyp :: String
1205 inisectHyp = "hypervisor"
1206
1207 inisectIns :: String
1208 inisectIns = "instance"
1209
1210 inisectOsp :: String
1211 inisectOsp = "os"
1212
1213 inisectOspPrivate :: String
1214 inisectOspPrivate = "os_private"
1215
1216 -- * Dynamic device modification
1217
1218 ddmAdd :: String
1219 ddmAdd = Types.ddmFullToRaw DdmFullAdd
1220
1221 ddmAttach :: String
1222 ddmAttach = Types.ddmFullToRaw DdmFullAttach
1223
1224 ddmModify :: String
1225 ddmModify = Types.ddmFullToRaw DdmFullModify
1226
1227 ddmRemove :: String
1228 ddmRemove = Types.ddmFullToRaw DdmFullRemove
1229
1230 ddmDetach :: String
1231 ddmDetach = Types.ddmFullToRaw DdmFullDetach
1232
1233 ddmsValues :: FrozenSet String
1234 ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmAttach, ddmRemove, ddmDetach]
1235
1236 ddmsValuesWithModify :: FrozenSet String
1237 ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
1238
1239 -- * Common exit codes
1240
1241 exitSuccess :: Int
1242 exitSuccess = 0
1243
1244 exitFailure :: Int
1245 exitFailure = ConstantUtils.exitFailure
1246
1247 exitNotcluster :: Int
1248 exitNotcluster = 5
1249
1250 exitNotmaster :: Int
1251 exitNotmaster = 11
1252
1253 exitNodesetupError :: Int
1254 exitNodesetupError = 12
1255
1256 -- | Need user confirmation
1257 exitConfirmation :: Int
1258 exitConfirmation = 13
1259
1260 -- | Exit code for query operations with unknown fields
1261 exitUnknownField :: Int
1262 exitUnknownField = 14
1263
1264 -- * Tags
1265
1266 tagCluster :: String
1267 tagCluster = Types.tagKindToRaw TagKindCluster
1268
1269 tagInstance :: String
1270 tagInstance = Types.tagKindToRaw TagKindInstance
1271
1272 tagNetwork :: String
1273 tagNetwork = Types.tagKindToRaw TagKindNetwork
1274
1275 tagNode :: String
1276 tagNode = Types.tagKindToRaw TagKindNode
1277
1278 tagNodegroup :: String
1279 tagNodegroup = Types.tagKindToRaw TagKindGroup
1280
1281 validTagTypes :: FrozenSet String
1282 validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
1283
1284 maxTagLen :: Int
1285 maxTagLen = 128
1286
1287 maxTagsPerObj :: Int
1288 maxTagsPerObj = 4096
1289
1290 -- * Others
1291
1292 defaultBridge :: String
1293 defaultBridge = AutoConf.defaultBridge
1294
1295 defaultOvs :: String
1296 defaultOvs = "switch1"
1297
1298 -- | 60 MiB/s, expressed in KiB/s
1299 classicDrbdSyncSpeed :: Int
1300 classicDrbdSyncSpeed = 60 * 1024
1301
1302 ip4AddressAny :: String
1303 ip4AddressAny = "0.0.0.0"
1304
1305 ip4AddressLocalhost :: String
1306 ip4AddressLocalhost = "127.0.0.1"
1307
1308 ip6AddressAny :: String
1309 ip6AddressAny = "::"
1310
1311 ip6AddressLocalhost :: String
1312 ip6AddressLocalhost = "::1"
1313
1314 ip4Version :: Int
1315 ip4Version = 4
1316
1317 ip6Version :: Int
1318 ip6Version = 6
1319
1320 validIpVersions :: FrozenSet Int
1321 validIpVersions = ConstantUtils.mkSet [ip4Version, ip6Version]
1322
1323 tcpPingTimeout :: Int
1324 tcpPingTimeout = 10
1325
1326 defaultVg :: String
1327 defaultVg = AutoConf.defaultVg
1328
1329 defaultDrbdHelper :: String
1330 defaultDrbdHelper = "/bin/true"
1331
1332 minVgSize :: Int
1333 minVgSize = 20480
1334
1335 defaultMacPrefix :: String
1336 defaultMacPrefix = "aa:00:00"
1337
1338 -- | Default maximum instance wait time (seconds)
1339 defaultShutdownTimeout :: Int
1340 defaultShutdownTimeout = 120
1341
1342 -- | Node clock skew (seconds)
1343 nodeMaxClockSkew :: Int
1344 nodeMaxClockSkew = 150
1345
1346 -- | Time for an intra-cluster disk transfer to wait for a connection
1347 diskTransferConnectTimeout :: Int
1348 diskTransferConnectTimeout = 60
1349
1350 -- | Disk index separator
1351 diskSeparator :: String
1352 diskSeparator = AutoConf.diskSeparator
1353
1354 ipCommandPath :: String
1355 ipCommandPath = AutoConf.ipPath
1356
1357 -- | Key for job IDs in opcode result
1358 jobIdsKey :: String
1359 jobIdsKey = "jobs"
1360
1361 -- * Runparts results
1362
1363 runpartsErr :: Int
1364 runpartsErr = 2
1365
1366 runpartsRun :: Int
1367 runpartsRun = 1
1368
1369 runpartsSkip :: Int
1370 runpartsSkip = 0
1371
1372 runpartsStatus :: [Int]
1373 runpartsStatus = [runpartsErr, runpartsRun, runpartsSkip]
1374
1375 -- * RPC
1376
1377 rpcEncodingNone :: Int
1378 rpcEncodingNone = 0
1379
1380 rpcEncodingZlibBase64 :: Int
1381 rpcEncodingZlibBase64 = 1
1382
1383 -- * Timeout table
1384 --
1385 -- Various time constants for the timeout table
1386
1387 rpcTmoUrgent :: Int
1388 rpcTmoUrgent = Types.rpcTimeoutToRaw Urgent
1389
1390 rpcTmoFast :: Int
1391 rpcTmoFast = Types.rpcTimeoutToRaw Fast
1392
1393 rpcTmoNormal :: Int
1394 rpcTmoNormal = Types.rpcTimeoutToRaw Normal
1395
1396 rpcTmoSlow :: Int
1397 rpcTmoSlow = Types.rpcTimeoutToRaw Slow
1398
1399 -- | 'rpcTmo_4hrs' contains an underscore to circumvent a limitation
1400 -- in the 'Ganeti.THH.deCamelCase' function and generate the correct
1401 -- Python name.
1402 rpcTmo_4hrs :: Int
1403 rpcTmo_4hrs = Types.rpcTimeoutToRaw FourHours
1404
1405 -- | 'rpcTmo_1day' contains an underscore to circumvent a limitation
1406 -- in the 'Ganeti.THH.deCamelCase' function and generate the correct
1407 -- Python name.
1408 rpcTmo_1day :: Int
1409 rpcTmo_1day = Types.rpcTimeoutToRaw OneDay
1410
1411 -- | Timeout for connecting to nodes (seconds)
1412 rpcConnectTimeout :: Int
1413 rpcConnectTimeout = 5
1414
1415 -- OS
1416
1417 osScriptCreate :: String
1418 osScriptCreate = "create"
1419
1420 osScriptCreateUntrusted :: String
1421 osScriptCreateUntrusted = "create_untrusted"
1422
1423 osScriptExport :: String
1424 osScriptExport = "export"
1425
1426 osScriptImport :: String
1427 osScriptImport = "import"
1428
1429 osScriptRename :: String
1430 osScriptRename = "rename"
1431
1432 osScriptVerify :: String
1433 osScriptVerify = "verify"
1434
1435 osScripts :: [String]
1436 osScripts = [osScriptCreate, osScriptCreateUntrusted, osScriptExport,
1437 osScriptImport, osScriptRename, osScriptVerify]
1438
1439 osApiFile :: String
1440 osApiFile = "ganeti_api_version"
1441
1442 osVariantsFile :: String
1443 osVariantsFile = "variants.list"
1444
1445 osParametersFile :: String
1446 osParametersFile = "parameters.list"
1447
1448 osValidateParameters :: String
1449 osValidateParameters = "parameters"
1450
1451 osValidateCalls :: FrozenSet String
1452 osValidateCalls = ConstantUtils.mkSet [osValidateParameters]
1453
1454 -- | External Storage (ES) related constants
1455
1456 esActionAttach :: String
1457 esActionAttach = "attach"
1458
1459 esActionCreate :: String
1460 esActionCreate = "create"
1461
1462 esActionDetach :: String
1463 esActionDetach = "detach"
1464
1465 esActionGrow :: String
1466 esActionGrow = "grow"
1467
1468 esActionRemove :: String
1469 esActionRemove = "remove"
1470
1471 esActionSetinfo :: String
1472 esActionSetinfo = "setinfo"
1473
1474 esActionVerify :: String
1475 esActionVerify = "verify"
1476
1477 esActionSnapshot :: String
1478 esActionSnapshot = "snapshot"
1479
1480 esActionOpen :: String
1481 esActionOpen = "open"
1482
1483 esActionClose :: String
1484 esActionClose = "close"
1485
1486 esScriptCreate :: String
1487 esScriptCreate = esActionCreate
1488
1489 esScriptRemove :: String
1490 esScriptRemove = esActionRemove
1491
1492 esScriptGrow :: String
1493 esScriptGrow = esActionGrow
1494
1495 esScriptAttach :: String
1496 esScriptAttach = esActionAttach
1497
1498 esScriptDetach :: String
1499 esScriptDetach = esActionDetach
1500
1501 esScriptSetinfo :: String
1502 esScriptSetinfo = esActionSetinfo
1503
1504 esScriptVerify :: String
1505 esScriptVerify = esActionVerify
1506
1507 esScriptSnapshot :: String
1508 esScriptSnapshot = esActionSnapshot
1509
1510 esScriptOpen :: String
1511 esScriptOpen = esActionOpen
1512
1513 esScriptClose :: String
1514 esScriptClose = esActionClose
1515
1516 esScripts :: FrozenSet String
1517 esScripts =
1518 ConstantUtils.mkSet [esScriptAttach,
1519 esScriptCreate,
1520 esScriptDetach,
1521 esScriptGrow,
1522 esScriptRemove,
1523 esScriptSetinfo,
1524 esScriptVerify,
1525 esScriptSnapshot,
1526 esScriptOpen,
1527 esScriptClose]
1528
1529 esParametersFile :: String
1530 esParametersFile = "parameters.list"
1531
1532 -- * Reboot types
1533
1534 instanceRebootSoft :: String
1535 instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
1536
1537 instanceRebootHard :: String
1538 instanceRebootHard = Types.rebootTypeToRaw RebootHard
1539
1540 instanceRebootFull :: String
1541 instanceRebootFull = Types.rebootTypeToRaw RebootFull
1542
1543 rebootTypes :: FrozenSet String
1544 rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
1545
1546 -- * Instance reboot behaviors
1547
1548 instanceRebootAllowed :: String
1549 instanceRebootAllowed = "reboot"
1550
1551 instanceRebootExit :: String
1552 instanceRebootExit = "exit"
1553
1554 rebootBehaviors :: [String]
1555 rebootBehaviors = [instanceRebootAllowed, instanceRebootExit]
1556
1557 -- * VTypes
1558
1559 vtypeBool :: VType
1560 vtypeBool = VTypeBool
1561
1562 vtypeInt :: VType
1563 vtypeInt = VTypeInt
1564
1565 vtypeFloat :: VType
1566 vtypeFloat = VTypeFloat
1567
1568 vtypeMaybeString :: VType
1569 vtypeMaybeString = VTypeMaybeString
1570
1571 -- | Size in MiBs
1572 vtypeSize :: VType
1573 vtypeSize = VTypeSize
1574
1575 vtypeString :: VType
1576 vtypeString = VTypeString
1577
1578 enforceableTypes :: FrozenSet VType
1579 enforceableTypes = ConstantUtils.mkSet [minBound..]
1580
1581 -- | Constant representing that the user does not specify any IP version
1582 ifaceNoIpVersionSpecified :: Int
1583 ifaceNoIpVersionSpecified = 0
1584
1585 validSerialSpeeds :: [Int]
1586 validSerialSpeeds =
1587 [75,
1588 110,
1589 300,
1590 600,
1591 1200,
1592 1800,
1593 2400,
1594 4800,
1595 9600,
1596 14400,
1597 19200,
1598 28800,
1599 38400,
1600 57600,
1601 115200,
1602 230400,
1603 345600,
1604 460800]
1605
1606 -- * HV parameter names (global namespace)
1607
1608 hvAcpi :: String
1609 hvAcpi = "acpi"
1610
1611 hvBlockdevPrefix :: String
1612 hvBlockdevPrefix = "blockdev_prefix"
1613
1614 hvBootloaderArgs :: String
1615 hvBootloaderArgs = "bootloader_args"
1616
1617 hvBootloaderPath :: String
1618 hvBootloaderPath = "bootloader_path"
1619
1620 hvBootOrder :: String
1621 hvBootOrder = "boot_order"
1622
1623 hvCdromImagePath :: String
1624 hvCdromImagePath = "cdrom_image_path"
1625
1626 hvCpuCap :: String
1627 hvCpuCap = "cpu_cap"
1628
1629 hvCpuCores :: String
1630 hvCpuCores = "cpu_cores"
1631
1632 hvCpuMask :: String
1633 hvCpuMask = "cpu_mask"
1634
1635 hvCpuSockets :: String
1636 hvCpuSockets = "cpu_sockets"
1637
1638 hvCpuThreads :: String
1639 hvCpuThreads = "cpu_threads"
1640
1641 hvCpuType :: String
1642 hvCpuType = "cpu_type"
1643
1644 hvCpuWeight :: String
1645 hvCpuWeight = "cpu_weight"
1646
1647 hvDeviceModel :: String
1648 hvDeviceModel = "device_model"
1649
1650 hvDiskCache :: String
1651 hvDiskCache = "disk_cache"
1652
1653 hvDiskType :: String
1654 hvDiskType = "disk_type"
1655
1656 hvInitrdPath :: String
1657 hvInitrdPath = "initrd_path"
1658
1659 hvInitScript :: String
1660 hvInitScript = "init_script"
1661
1662 hvKernelArgs :: String
1663 hvKernelArgs = "kernel_args"
1664
1665 hvKernelPath :: String
1666 hvKernelPath = "kernel_path"
1667
1668 hvKeymap :: String
1669 hvKeymap = "keymap"
1670
1671 hvKvmCdrom2ImagePath :: String
1672 hvKvmCdrom2ImagePath = "cdrom2_image_path"
1673
1674 hvKvmCdromDiskType :: String
1675 hvKvmCdromDiskType = "cdrom_disk_type"
1676
1677 hvKvmExtra :: String
1678 hvKvmExtra = "kvm_extra"
1679
1680 hvKvmFlag :: String
1681 hvKvmFlag = "kvm_flag"
1682
1683 hvKvmFloppyImagePath :: String
1684 hvKvmFloppyImagePath = "floppy_image_path"
1685
1686 hvKvmMachineVersion :: String
1687 hvKvmMachineVersion = "machine_version"
1688
1689 hvKvmMigrationCaps :: String
1690 hvKvmMigrationCaps = "migration_caps"
1691
1692 hvKvmPath :: String
1693 hvKvmPath = "kvm_path"
1694
1695 hvKvmDiskAio :: String
1696 hvKvmDiskAio = "disk_aio"
1697
1698 hvKvmSpiceAudioCompr :: String
1699 hvKvmSpiceAudioCompr = "spice_playback_compression"
1700
1701 hvKvmSpiceBind :: String
1702 hvKvmSpiceBind = "spice_bind"
1703
1704 hvKvmSpiceIpVersion :: String
1705 hvKvmSpiceIpVersion = "spice_ip_version"
1706
1707 hvKvmSpiceJpegImgCompr :: String
1708 hvKvmSpiceJpegImgCompr = "spice_jpeg_wan_compression"
1709
1710 hvKvmSpiceLosslessImgCompr :: String
1711 hvKvmSpiceLosslessImgCompr = "spice_image_compression"
1712
1713 hvKvmSpicePasswordFile :: String
1714 hvKvmSpicePasswordFile = "spice_password_file"
1715
1716 hvKvmSpiceStreamingVideoDetection :: String
1717 hvKvmSpiceStreamingVideoDetection = "spice_streaming_video"
1718
1719 hvKvmSpiceTlsCiphers :: String
1720 hvKvmSpiceTlsCiphers = "spice_tls_ciphers"
1721
1722 hvKvmSpiceUseTls :: String
1723 hvKvmSpiceUseTls = "spice_use_tls"
1724
1725 hvKvmSpiceUseVdagent :: String
1726 hvKvmSpiceUseVdagent = "spice_use_vdagent"
1727
1728 hvKvmSpiceZlibGlzImgCompr :: String
1729 hvKvmSpiceZlibGlzImgCompr = "spice_zlib_glz_wan_compression"
1730
1731 hvKvmUseChroot :: String
1732 hvKvmUseChroot = "use_chroot"
1733
1734 hvKvmUserShutdown :: String
1735 hvKvmUserShutdown = "user_shutdown"
1736
1737 hvLxcStartupTimeout :: String
1738 hvLxcStartupTimeout = "startup_timeout"
1739
1740 hvLxcExtraCgroups :: String
1741 hvLxcExtraCgroups = "extra_cgroups"
1742
1743 hvLxcDevices :: String
1744 hvLxcDevices = "devices"
1745
1746 hvLxcDropCapabilities :: String
1747 hvLxcDropCapabilities = "drop_capabilities"
1748
1749 hvLxcExtraConfig :: String
1750 hvLxcExtraConfig = "extra_config"
1751
1752 hvLxcNumTtys :: String
1753 hvLxcNumTtys = "num_ttys"
1754
1755 hvMemPath :: String
1756 hvMemPath = "mem_path"
1757
1758 hvMigrationBandwidth :: String
1759 hvMigrationBandwidth = "migration_bandwidth"
1760
1761 hvMigrationDowntime :: String
1762 hvMigrationDowntime = "migration_downtime"
1763
1764 hvMigrationMode :: String
1765 hvMigrationMode = "migration_mode"
1766
1767 hvMigrationPort :: String
1768 hvMigrationPort = "migration_port"
1769
1770 hvNicType :: String
1771 hvNicType = "nic_type"
1772
1773 hvPae :: String
1774 hvPae = "pae"
1775
1776 hvPassthrough :: String
1777 hvPassthrough = "pci_pass"
1778
1779 hvRebootBehavior :: String
1780 hvRebootBehavior = "reboot_behavior"
1781
1782 hvRootPath :: String
1783 hvRootPath = "root_path"
1784
1785 hvSecurityDomain :: String
1786 hvSecurityDomain = "security_domain"
1787
1788 hvSecurityModel :: String
1789 hvSecurityModel = "security_model"
1790
1791 hvSerialConsole :: String
1792 hvSerialConsole = "serial_console"
1793
1794 hvSerialSpeed :: String
1795 hvSerialSpeed = "serial_speed"
1796
1797 hvSoundhw :: String
1798 hvSoundhw = "soundhw"
1799
1800 hvUsbDevices :: String
1801 hvUsbDevices = "usb_devices"
1802
1803 hvUsbMouse :: String
1804 hvUsbMouse = "usb_mouse"
1805
1806 hvUseBootloader :: String
1807 hvUseBootloader = "use_bootloader"
1808
1809 hvUseLocaltime :: String
1810 hvUseLocaltime = "use_localtime"
1811
1812 hvVga :: String
1813 hvVga = "vga"
1814
1815 hvVhostNet :: String
1816 hvVhostNet = "vhost_net"
1817
1818 hvVirtioNetQueues :: String
1819 hvVirtioNetQueues = "virtio_net_queues"
1820
1821 hvVifScript :: String
1822 hvVifScript = "vif_script"
1823
1824 hvVifType :: String
1825 hvVifType = "vif_type"
1826
1827 hvViridian :: String
1828 hvViridian = "viridian"
1829
1830 hvVncBindAddress :: String
1831 hvVncBindAddress = "vnc_bind_address"
1832
1833 hvVncPasswordFile :: String
1834 hvVncPasswordFile = "vnc_password_file"
1835
1836 hvVncTls :: String
1837 hvVncTls = "vnc_tls"
1838
1839 hvVncX509 :: String
1840 hvVncX509 = "vnc_x509_path"
1841
1842 hvVncX509Verify :: String
1843 hvVncX509Verify = "vnc_x509_verify"
1844
1845 hvVnetHdr :: String
1846 hvVnetHdr = "vnet_hdr"
1847
1848 hvXenCmd :: String
1849 hvXenCmd = "xen_cmd"
1850
1851 hvXenCpuid :: String
1852 hvXenCpuid = "cpuid"
1853
1854 hvsParameterTitles :: Map String String
1855 hvsParameterTitles =
1856 Map.fromList
1857 [(hvAcpi, "ACPI"),
1858 (hvBootOrder, "Boot_order"),
1859 (hvCdromImagePath, "CDROM_image_path"),
1860 (hvCpuType, "cpu_type"),
1861 (hvDiskType, "Disk_type"),
1862 (hvInitrdPath, "Initrd_path"),
1863 (hvKernelPath, "Kernel_path"),
1864 (hvNicType, "NIC_type"),
1865 (hvPae, "PAE"),
1866 (hvPassthrough, "pci_pass"),
1867 (hvVncBindAddress, "VNC_bind_address")]
1868
1869 hvsParameters :: FrozenSet String
1870 hvsParameters = ConstantUtils.mkSet $ Map.keys hvsParameterTypes
1871
1872 hvsParameterTypes :: Map String VType
1873 hvsParameterTypes = Map.fromList
1874 [ (hvAcpi, VTypeBool)
1875 , (hvBlockdevPrefix, VTypeString)
1876 , (hvBootloaderArgs, VTypeString)
1877 , (hvBootloaderPath, VTypeString)
1878 , (hvBootOrder, VTypeString)
1879 , (hvCdromImagePath, VTypeString)
1880 , (hvCpuCap, VTypeInt)
1881 , (hvCpuCores, VTypeInt)
1882 , (hvCpuMask, VTypeString)
1883 , (hvCpuSockets, VTypeInt)
1884 , (hvCpuThreads, VTypeInt)
1885 , (hvCpuType, VTypeString)
1886 , (hvCpuWeight, VTypeInt)
1887 , (hvDeviceModel, VTypeString)
1888 , (hvDiskCache, VTypeString)
1889 , (hvDiskType, VTypeString)
1890 , (hvInitrdPath, VTypeString)
1891 , (hvInitScript, VTypeString)
1892 , (hvKernelArgs, VTypeString)
1893 , (hvKernelPath, VTypeString)
1894 , (hvKeymap, VTypeString)
1895 , (hvKvmCdrom2ImagePath, VTypeString)
1896 , (hvKvmCdromDiskType, VTypeString)
1897 , (hvKvmExtra, VTypeString)
1898 , (hvKvmFlag, VTypeString)
1899 , (hvKvmFloppyImagePath, VTypeString)
1900 , (hvKvmMachineVersion, VTypeString)
1901 , (hvKvmMigrationCaps, VTypeString)
1902 , (hvKvmPath, VTypeString)
1903 , (hvKvmDiskAio, VTypeString)
1904 , (hvKvmSpiceAudioCompr, VTypeBool)
1905 , (hvKvmSpiceBind, VTypeString)
1906 , (hvKvmSpiceIpVersion, VTypeInt)
1907 , (hvKvmSpiceJpegImgCompr, VTypeString)
1908 , (hvKvmSpiceLosslessImgCompr, VTypeString)
1909 , (hvKvmSpicePasswordFile, VTypeString)
1910 , (hvKvmSpiceStreamingVideoDetection, VTypeString)
1911 , (hvKvmSpiceTlsCiphers, VTypeString)
1912 , (hvKvmSpiceUseTls, VTypeBool)
1913 , (hvKvmSpiceUseVdagent, VTypeBool)
1914 , (hvKvmSpiceZlibGlzImgCompr, VTypeString)
1915 , (hvKvmUseChroot, VTypeBool)
1916 , (hvKvmUserShutdown, VTypeBool)
1917 , (hvLxcDevices, VTypeString)
1918 , (hvLxcDropCapabilities, VTypeString)
1919 , (hvLxcExtraCgroups, VTypeString)
1920 , (hvLxcExtraConfig, VTypeString)
1921 , (hvLxcNumTtys, VTypeInt)
1922 , (hvLxcStartupTimeout, VTypeInt)
1923 , (hvMemPath, VTypeString)
1924 , (hvMigrationBandwidth, VTypeInt)
1925 , (hvMigrationDowntime, VTypeInt)
1926 , (hvMigrationMode, VTypeString)
1927 , (hvMigrationPort, VTypeInt)
1928 , (hvNicType, VTypeString)
1929 , (hvPae, VTypeBool)
1930 , (hvPassthrough, VTypeString)
1931 , (hvRebootBehavior, VTypeString)
1932 , (hvRootPath, VTypeMaybeString)
1933 , (hvSecurityDomain, VTypeString)
1934 , (hvSecurityModel, VTypeString)
1935 , (hvSerialConsole, VTypeBool)
1936 , (hvSerialSpeed, VTypeInt)
1937 , (hvSoundhw, VTypeString)
1938 , (hvUsbDevices, VTypeString)
1939 , (hvUsbMouse, VTypeString)
1940 , (hvUseBootloader, VTypeBool)
1941 , (hvUseLocaltime, VTypeBool)
1942 , (hvVga, VTypeString)
1943 , (hvVhostNet, VTypeBool)
1944 , (hvVirtioNetQueues, VTypeInt)
1945 , (hvVifScript, VTypeString)
1946 , (hvVifType, VTypeString)
1947 , (hvViridian, VTypeBool)
1948 , (hvVncBindAddress, VTypeString)
1949 , (hvVncPasswordFile, VTypeString)
1950 , (hvVncTls, VTypeBool)
1951 , (hvVncX509, VTypeString)
1952 , (hvVncX509Verify, VTypeBool)
1953 , (hvVnetHdr, VTypeBool)
1954 , (hvXenCmd, VTypeString)
1955 , (hvXenCpuid, VTypeString)
1956 ]
1957
1958 -- * Migration statuses
1959
1960 hvMigrationActive :: String
1961 hvMigrationActive = "active"
1962
1963 hvMigrationCancelled :: String
1964 hvMigrationCancelled = "cancelled"
1965
1966 hvMigrationCompleted :: String
1967 hvMigrationCompleted = "completed"
1968
1969 hvMigrationFailed :: String
1970 hvMigrationFailed = "failed"
1971
1972 hvMigrationValidStatuses :: FrozenSet String
1973 hvMigrationValidStatuses =
1974 ConstantUtils.mkSet [hvMigrationActive,
1975 hvMigrationCancelled,
1976 hvMigrationCompleted,
1977 hvMigrationFailed]
1978
1979 hvMigrationFailedStatuses :: FrozenSet String
1980 hvMigrationFailedStatuses =
1981 ConstantUtils.mkSet [hvMigrationFailed, hvMigrationCancelled]
1982
1983 -- | KVM-specific statuses
1984 --
1985 -- FIXME: this constant seems unnecessary
1986 hvKvmMigrationValidStatuses :: FrozenSet String
1987 hvKvmMigrationValidStatuses = hvMigrationValidStatuses
1988
1989 -- | Node info keys
1990 hvNodeinfoKeyVersion :: String
1991 hvNodeinfoKeyVersion = "hv_version"
1992
1993 -- * Hypervisor state
1994
1995 hvstCpuNode :: String
1996 hvstCpuNode = "cpu_node"
1997
1998 hvstCpuTotal :: String
1999 hvstCpuTotal = "cpu_total"
2000
2001 hvstMemoryHv :: String
2002 hvstMemoryHv = "mem_hv"
2003
2004 hvstMemoryNode :: String
2005 hvstMemoryNode = "mem_node"
2006
2007 hvstMemoryTotal :: String
2008 hvstMemoryTotal = "mem_total"
2009
2010 hvstsParameters :: FrozenSet String
2011 hvstsParameters =
2012 ConstantUtils.mkSet [hvstCpuNode,
2013 hvstCpuTotal,
2014 hvstMemoryHv,
2015 hvstMemoryNode,
2016 hvstMemoryTotal]
2017
2018 hvstDefaults :: Map String Int
2019 hvstDefaults =
2020 Map.fromList
2021 [(hvstCpuNode, 1),
2022 (hvstCpuTotal, 1),
2023 (hvstMemoryHv, 0),
2024 (hvstMemoryTotal, 0),
2025 (hvstMemoryNode, 0)]
2026
2027 hvstsParameterTypes :: Map String VType
2028 hvstsParameterTypes =
2029 Map.fromList [(hvstMemoryTotal, VTypeInt),
2030 (hvstMemoryNode, VTypeInt),
2031 (hvstMemoryHv, VTypeInt),
2032 (hvstCpuTotal, VTypeInt),
2033 (hvstCpuNode, VTypeInt)]
2034
2035 -- * Disk state
2036
2037 dsDiskOverhead :: String
2038 dsDiskOverhead = "disk_overhead"
2039
2040 dsDiskReserved :: String
2041 dsDiskReserved = "disk_reserved"
2042
2043 dsDiskTotal :: String
2044 dsDiskTotal = "disk_total"
2045
2046 dsDefaults :: Map String Int
2047 dsDefaults =
2048 Map.fromList
2049 [(dsDiskTotal, 0),
2050 (dsDiskReserved, 0),
2051 (dsDiskOverhead, 0)]
2052
2053 dssParameterTypes :: Map String VType
2054 dssParameterTypes =
2055 Map.fromList [(dsDiskTotal, VTypeInt),
2056 (dsDiskReserved, VTypeInt),
2057 (dsDiskOverhead, VTypeInt)]
2058
2059 dssParameters :: FrozenSet String
2060 dssParameters =
2061 ConstantUtils.mkSet [dsDiskTotal, dsDiskReserved, dsDiskOverhead]
2062
2063 dsValidTypes :: FrozenSet String
2064 dsValidTypes = ConstantUtils.mkSet [Types.diskTemplateToRaw DTPlain]
2065
2066 -- Backend parameter names
2067
2068 beAlwaysFailover :: String
2069 beAlwaysFailover = "always_failover"
2070
2071 beAutoBalance :: String
2072 beAutoBalance = "auto_balance"
2073
2074 beMaxmem :: String
2075 beMaxmem = "maxmem"
2076
2077 -- | Deprecated and replaced by max and min mem
2078 beMemory :: String
2079 beMemory = "memory"
2080
2081 beMinmem :: String
2082 beMinmem = "minmem"
2083
2084 beSpindleUse :: String
2085 beSpindleUse = "spindle_use"
2086
2087 beVcpus :: String
2088 beVcpus = "vcpus"
2089
2090 besParameterTypes :: Map String VType
2091 besParameterTypes =
2092 Map.fromList [(beAlwaysFailover, VTypeBool),
2093 (beAutoBalance, VTypeBool),
2094 (beMaxmem, VTypeSize),
2095 (beMinmem, VTypeSize),
2096 (beSpindleUse, VTypeInt),
2097 (beVcpus, VTypeInt)]
2098
2099 besParameterTitles :: Map String String
2100 besParameterTitles =
2101 Map.fromList [(beAutoBalance, "Auto_balance"),
2102 (beMinmem, "ConfigMinMem"),
2103 (beVcpus, "ConfigVCPUs"),
2104 (beMaxmem, "ConfigMaxMem")]
2105
2106 besParameterCompat :: Map String VType
2107 besParameterCompat = Map.insert beMemory VTypeSize besParameterTypes
2108
2109 besParameters :: FrozenSet String
2110 besParameters =
2111 ConstantUtils.mkSet [beAlwaysFailover,
2112 beAutoBalance,
2113 beMaxmem,
2114 beMinmem,
2115 beSpindleUse,
2116 beVcpus]
2117
2118 -- | Instance specs
2119 --
2120 -- FIXME: these should be associated with 'Ganeti.HTools.Types.ISpec'
2121
2122 ispecMemSize :: String
2123 ispecMemSize = ConstantUtils.ispecMemSize
2124
2125 ispecCpuCount :: String
2126 ispecCpuCount = ConstantUtils.ispecCpuCount
2127
2128 ispecDiskCount :: String
2129 ispecDiskCount = ConstantUtils.ispecDiskCount
2130
2131 ispecDiskSize :: String
2132 ispecDiskSize = ConstantUtils.ispecDiskSize
2133
2134 ispecNicCount :: String
2135 ispecNicCount = ConstantUtils.ispecNicCount
2136
2137 ispecSpindleUse :: String
2138 ispecSpindleUse = ConstantUtils.ispecSpindleUse
2139
2140 ispecsParameterTypes :: Map String VType
2141 ispecsParameterTypes =
2142 Map.fromList
2143 [(ConstantUtils.ispecDiskSize, VTypeInt),
2144 (ConstantUtils.ispecCpuCount, VTypeInt),
2145 (ConstantUtils.ispecSpindleUse, VTypeInt),
2146 (ConstantUtils.ispecMemSize, VTypeInt),
2147 (ConstantUtils.ispecNicCount, VTypeInt),
2148 (ConstantUtils.ispecDiskCount, VTypeInt)]
2149
2150 ispecsParameters :: FrozenSet String
2151 ispecsParameters =
2152 ConstantUtils.mkSet [ConstantUtils.ispecCpuCount,
2153 ConstantUtils.ispecDiskCount,
2154 ConstantUtils.ispecDiskSize,
2155 ConstantUtils.ispecMemSize,
2156 ConstantUtils.ispecNicCount,
2157 ConstantUtils.ispecSpindleUse]
2158
2159 ispecsMinmax :: String
2160 ispecsMinmax = ConstantUtils.ispecsMinmax
2161
2162 ispecsMax :: String
2163 ispecsMax = "max"
2164
2165 ispecsMin :: String
2166 ispecsMin = "min"
2167
2168 ispecsStd :: String
2169 ispecsStd = ConstantUtils.ispecsStd
2170
2171 ipolicyDts :: String
2172 ipolicyDts = ConstantUtils.ipolicyDts
2173
2174 ipolicyVcpuRatio :: String
2175 ipolicyVcpuRatio = ConstantUtils.ipolicyVcpuRatio
2176
2177 ipolicySpindleRatio :: String
2178 ipolicySpindleRatio = ConstantUtils.ipolicySpindleRatio
2179
2180 ispecsMinmaxKeys :: FrozenSet String
2181 ispecsMinmaxKeys = ConstantUtils.mkSet [ispecsMax, ispecsMin]
2182
2183 ipolicyParameters :: FrozenSet String
2184 ipolicyParameters =
2185 ConstantUtils.mkSet [ConstantUtils.ipolicyVcpuRatio,
2186 ConstantUtils.ipolicySpindleRatio]
2187
2188 ipolicyAllKeys :: FrozenSet String
2189 ipolicyAllKeys =
2190 ConstantUtils.union ipolicyParameters $
2191 ConstantUtils.mkSet [ConstantUtils.ipolicyDts,
2192 ConstantUtils.ispecsMinmax,
2193 ispecsStd]
2194
2195 -- | Node parameter names
2196
2197 ndExclusiveStorage :: String
2198 ndExclusiveStorage = "exclusive_storage"
2199
2200 ndOobProgram :: String
2201 ndOobProgram = "oob_program"
2202
2203 ndSpindleCount :: String
2204 ndSpindleCount = "spindle_count"
2205
2206 ndOvs :: String
2207 ndOvs = "ovs"
2208
2209 ndOvsLink :: String
2210 ndOvsLink = "ovs_link"
2211
2212 ndOvsName :: String
2213 ndOvsName = "ovs_name"
2214
2215 ndSshPort :: String
2216 ndSshPort = "ssh_port"
2217
2218 ndCpuSpeed :: String
2219 ndCpuSpeed = "cpu_speed"
2220
2221 ndsParameterTypes :: Map String VType
2222 ndsParameterTypes =
2223 Map.fromList
2224 [(ndExclusiveStorage, VTypeBool),
2225 (ndOobProgram, VTypeString),
2226 (ndOvs, VTypeBool),
2227 (ndOvsLink, VTypeMaybeString),
2228 (ndOvsName, VTypeMaybeString),
2229 (ndSpindleCount, VTypeInt),
2230 (ndSshPort, VTypeInt),
2231 (ndCpuSpeed, VTypeFloat)]
2232
2233 ndsParameters :: FrozenSet String
2234 ndsParameters = ConstantUtils.mkSet (Map.keys ndsParameterTypes)
2235
2236 ndsParameterTitles :: Map String String
2237 ndsParameterTitles =
2238 Map.fromList
2239 [(ndExclusiveStorage, "ExclusiveStorage"),
2240 (ndOobProgram, "OutOfBandProgram"),
2241 (ndOvs, "OpenvSwitch"),
2242 (ndOvsLink, "OpenvSwitchLink"),
2243 (ndOvsName, "OpenvSwitchName"),
2244 (ndSpindleCount, "SpindleCount")]
2245
2246 -- * Logical Disks parameters
2247
2248 ldpAccess :: String
2249 ldpAccess = "access"
2250
2251 ldpBarriers :: String
2252 ldpBarriers = "disabled-barriers"
2253
2254 ldpDefaultMetavg :: String
2255 ldpDefaultMetavg = "default-metavg"
2256
2257 ldpDelayTarget :: String
2258 ldpDelayTarget = "c-delay-target"
2259
2260 ldpDiskCustom :: String
2261 ldpDiskCustom = "disk-custom"
2262
2263 ldpDynamicResync :: String
2264 ldpDynamicResync = "dynamic-resync"
2265
2266 ldpFillTarget :: String
2267 ldpFillTarget = "c-fill-target"
2268
2269 ldpMaxRate :: String
2270 ldpMaxRate = "c-max-rate"
2271
2272 ldpMinRate :: String
2273 ldpMinRate = "c-min-rate"
2274
2275 ldpNetCustom :: String
2276 ldpNetCustom = "net-custom"
2277
2278 ldpNoMetaFlush :: String
2279 ldpNoMetaFlush = "disable-meta-flush"
2280
2281 ldpPlanAhead :: String
2282 ldpPlanAhead = "c-plan-ahead"
2283
2284 ldpPool :: String
2285 ldpPool = "pool"
2286
2287 ldpProtocol :: String
2288 ldpProtocol = "protocol"
2289
2290 ldpResyncRate :: String
2291 ldpResyncRate = "resync-rate"
2292
2293 ldpStripes :: String
2294 ldpStripes = "stripes"
2295
2296 diskLdTypes :: Map String VType
2297 diskLdTypes =
2298 Map.fromList
2299 [(ldpAccess, VTypeString),
2300 (ldpResyncRate, VTypeInt),
2301 (ldpStripes, VTypeInt),
2302 (ldpBarriers, VTypeString),
2303 (ldpNoMetaFlush, VTypeBool),
2304 (ldpDefaultMetavg, VTypeString),
2305 (ldpDiskCustom, VTypeString),
2306 (ldpNetCustom, VTypeString),
2307 (ldpProtocol, VTypeString),
2308 (ldpDynamicResync, VTypeBool),
2309 (ldpPlanAhead, VTypeInt),
2310 (ldpFillTarget, VTypeInt),
2311 (ldpDelayTarget, VTypeInt),
2312 (ldpMaxRate, VTypeInt),
2313 (ldpMinRate, VTypeInt),
2314 (ldpPool, VTypeString)]
2315
2316 diskLdParameters :: FrozenSet String
2317 diskLdParameters = ConstantUtils.mkSet (Map.keys diskLdTypes)
2318
2319 -- * Disk template parameters
2320 --
2321 -- Disk template parameters can be set/changed by the user via
2322 -- gnt-cluster and gnt-group)
2323
2324 drbdResyncRate :: String
2325 drbdResyncRate = "resync-rate"
2326
2327 drbdDataStripes :: String
2328 drbdDataStripes = "data-stripes"
2329
2330 drbdMetaStripes :: String
2331 drbdMetaStripes = "meta-stripes"
2332
2333 drbdDiskBarriers :: String
2334 drbdDiskBarriers = "disk-barriers"
2335
2336 drbdMetaBarriers :: String
2337 drbdMetaBarriers = "meta-barriers"
2338
2339 drbdDefaultMetavg :: String
2340 drbdDefaultMetavg = "metavg"
2341
2342 drbdDiskCustom :: String
2343 drbdDiskCustom = "disk-custom"
2344
2345 drbdNetCustom :: String
2346 drbdNetCustom = "net-custom"
2347
2348 drbdProtocol :: String
2349 drbdProtocol = "protocol"
2350
2351 drbdDynamicResync :: String
2352 drbdDynamicResync = "dynamic-resync"
2353
2354 drbdPlanAhead :: String
2355 drbdPlanAhead = "c-plan-ahead"
2356
2357 drbdFillTarget :: String
2358 drbdFillTarget = "c-fill-target"
2359
2360 drbdDelayTarget :: String
2361 drbdDelayTarget = "c-delay-target"
2362
2363 drbdMaxRate :: String
2364 drbdMaxRate = "c-max-rate"
2365
2366 drbdMinRate :: String
2367 drbdMinRate = "c-min-rate"
2368
2369 lvStripes :: String
2370 lvStripes = "stripes"
2371
2372 rbdAccess :: String
2373 rbdAccess = "access"
2374
2375 rbdPool :: String
2376 rbdPool = "pool"
2377
2378 diskDtTypes :: Map String VType
2379 diskDtTypes =
2380 Map.fromList [(drbdResyncRate, VTypeInt),
2381 (drbdDataStripes, VTypeInt),
2382 (drbdMetaStripes, VTypeInt),
2383 (drbdDiskBarriers, VTypeString),
2384 (drbdMetaBarriers, VTypeBool),
2385 (drbdDefaultMetavg, VTypeString),
2386 (drbdDiskCustom, VTypeString),
2387 (drbdNetCustom, VTypeString),
2388 (drbdProtocol, VTypeString),
2389 (drbdDynamicResync, VTypeBool),
2390 (drbdPlanAhead, VTypeInt),
2391 (drbdFillTarget, VTypeInt),
2392 (drbdDelayTarget, VTypeInt),
2393 (drbdMaxRate, VTypeInt),
2394 (drbdMinRate, VTypeInt),
2395 (lvStripes, VTypeInt),
2396 (rbdAccess, VTypeString),
2397 (rbdPool, VTypeString),
2398 (glusterHost, VTypeString),
2399 (glusterVolume, VTypeString),
2400 (glusterPort, VTypeInt)
2401 ]
2402
2403 diskDtParameters :: FrozenSet String
2404 diskDtParameters = ConstantUtils.mkSet (Map.keys diskDtTypes)
2405
2406 -- * Dynamic disk parameters
2407
2408 ddpLocalIp :: String
2409 ddpLocalIp = "local-ip"
2410
2411 ddpRemoteIp :: String
2412 ddpRemoteIp = "remote-ip"
2413
2414 ddpPort :: String
2415 ddpPort = "port"
2416
2417 ddpLocalMinor :: String
2418 ddpLocalMinor = "local-minor"
2419
2420 ddpRemoteMinor :: String
2421 ddpRemoteMinor = "remote-minor"
2422
2423 -- * OOB supported commands
2424
2425 oobPowerOn :: String
2426 oobPowerOn = Types.oobCommandToRaw OobPowerOn
2427
2428 oobPowerOff :: String
2429 oobPowerOff = Types.oobCommandToRaw OobPowerOff
2430
2431 oobPowerCycle :: String
2432 oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
2433
2434 oobPowerStatus :: String
2435 oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
2436
2437 oobHealth :: String
2438 oobHealth = Types.oobCommandToRaw OobHealth
2439
2440 oobCommands :: FrozenSet String
2441 oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
2442
2443 oobPowerStatusPowered :: String
2444 oobPowerStatusPowered = "powered"
2445
2446 -- | 60 seconds
2447 oobTimeout :: Int
2448 oobTimeout = 60
2449
2450 -- | 2 seconds
2451 oobPowerDelay :: Double
2452 oobPowerDelay = 2.0
2453
2454 oobStatusCritical :: String
2455 oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
2456
2457 oobStatusOk :: String
2458 oobStatusOk = Types.oobStatusToRaw OobStatusOk
2459
2460 oobStatusUnknown :: String
2461 oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
2462
2463 oobStatusWarning :: String
2464 oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
2465
2466 oobStatuses :: FrozenSet String
2467 oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
2468
2469 -- | Instance Parameters Profile
2470 ppDefault :: String
2471 ppDefault = "default"
2472
2473 -- * nic* constants are used inside the ganeti config
2474
2475 nicLink :: String
2476 nicLink = "link"
2477
2478 nicMode :: String
2479 nicMode = "mode"
2480
2481 nicVlan :: String
2482 nicVlan = "vlan"
2483
2484 nicsParameterTypes :: Map String VType
2485 nicsParameterTypes =
2486 Map.fromList [(nicMode, vtypeString),
2487 (nicLink, vtypeString),
2488 (nicVlan, vtypeString)]
2489
2490 nicsParameters :: FrozenSet String
2491 nicsParameters = ConstantUtils.mkSet (Map.keys nicsParameterTypes)
2492
2493 nicModeBridged :: String
2494 nicModeBridged = Types.nICModeToRaw NMBridged
2495
2496 nicModeRouted :: String
2497 nicModeRouted = Types.nICModeToRaw NMRouted
2498
2499 nicModeOvs :: String
2500 nicModeOvs = Types.nICModeToRaw NMOvs
2501
2502 nicIpPool :: String
2503 nicIpPool = Types.nICModeToRaw NMPool
2504
2505 nicValidModes :: FrozenSet String
2506 nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
2507
2508 releaseAction :: String
2509 releaseAction = "release"
2510
2511 reserveAction :: String
2512 reserveAction = "reserve"
2513
2514 -- * idisk* constants are used in opcodes, to create/change disks
2515
2516 idiskAdopt :: String
2517 idiskAdopt = "adopt"
2518
2519 idiskMetavg :: String
2520 idiskMetavg = "metavg"
2521
2522 idiskMode :: String
2523 idiskMode = "mode"
2524
2525 idiskName :: String
2526 idiskName = "name"
2527
2528 idiskSize :: String
2529 idiskSize = "size"
2530
2531 idiskSpindles :: String
2532 idiskSpindles = "spindles"
2533
2534 idiskVg :: String
2535 idiskVg = "vg"
2536
2537 idiskProvider :: String
2538 idiskProvider = "provider"
2539
2540 idiskAccess :: String
2541 idiskAccess = "access"
2542
2543 idiskType :: String
2544 idiskType = "dev_type"
2545
2546 idiskParamsTypes :: Map String VType
2547 idiskParamsTypes =
2548 Map.fromList [ (idiskSize, VTypeSize)
2549 , (idiskSpindles, VTypeInt)
2550 , (idiskMode, VTypeString)
2551 , (idiskAdopt, VTypeString)
2552 , (idiskVg, VTypeString)
2553 , (idiskMetavg, VTypeString)
2554 , (idiskProvider, VTypeString)
2555 , (idiskAccess, VTypeString)
2556 , (idiskName, VTypeMaybeString)
2557 , (idiskType, VTypeString)
2558 ]
2559
2560 idiskParams :: FrozenSet String
2561 idiskParams = ConstantUtils.mkSet (Map.keys idiskParamsTypes)
2562
2563 modifiableIdiskParamsTypes :: Map String VType
2564 modifiableIdiskParamsTypes =
2565 Map.fromList [(idiskMode, VTypeString),
2566 (idiskName, VTypeString)]
2567
2568 modifiableIdiskParams :: FrozenSet String
2569 modifiableIdiskParams =
2570 ConstantUtils.mkSet (Map.keys modifiableIdiskParamsTypes)
2571
2572 -- * inic* constants are used in opcodes, to create/change nics
2573
2574 inicBridge :: String
2575 inicBridge = "bridge"
2576
2577 inicIp :: String
2578 inicIp = "ip"
2579
2580 inicLink :: String
2581 inicLink = "link"
2582
2583 inicMac :: String
2584 inicMac = "mac"
2585
2586 inicMode :: String
2587 inicMode = "mode"
2588
2589 inicName :: String
2590 inicName = "name"
2591
2592 inicNetwork :: String
2593 inicNetwork = "network"
2594
2595 inicVlan :: String
2596 inicVlan = "vlan"
2597
2598 inicParamsTypes :: Map String VType
2599 inicParamsTypes =
2600 Map.fromList [(inicBridge, VTypeMaybeString),
2601 (inicIp, VTypeMaybeString),
2602 (inicLink, VTypeString),
2603 (inicMac, VTypeString),
2604 (inicMode, VTypeString),
2605 (inicName, VTypeMaybeString),
2606 (inicNetwork, VTypeMaybeString),
2607 (inicVlan, VTypeMaybeString)]
2608
2609 inicParams :: FrozenSet String
2610 inicParams = ConstantUtils.mkSet (Map.keys inicParamsTypes)
2611
2612 -- * Hypervisor constants
2613
2614 htXenPvm :: String
2615 htXenPvm = Types.hypervisorToRaw XenPvm
2616
2617 htFake :: String
2618 htFake = Types.hypervisorToRaw Fake
2619
2620 htXenHvm :: String
2621 htXenHvm = Types.hypervisorToRaw XenHvm
2622
2623 htKvm :: String
2624 htKvm = Types.hypervisorToRaw Kvm
2625
2626 htChroot :: String
2627 htChroot = Types.hypervisorToRaw Chroot
2628
2629 htLxc :: String
2630 htLxc = Types.hypervisorToRaw Lxc
2631
2632 hyperTypes :: FrozenSet String
2633 hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
2634
2635 htsReqPort :: FrozenSet String
2636 htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
2637
2638 vncBasePort :: Int
2639 vncBasePort = 5900
2640
2641 vncDefaultBindAddress :: String
2642 vncDefaultBindAddress = ip4AddressAny
2643
2644 -- * NIC types
2645
2646 htNicE1000 :: String
2647 htNicE1000 = "e1000"
2648
2649 htNicI82551 :: String
2650 htNicI82551 = "i82551"
2651
2652 htNicI8259er :: String
2653 htNicI8259er = "i82559er"
2654
2655 htNicI85557b :: String
2656 htNicI85557b = "i82557b"
2657
2658 htNicNe2kIsa :: String
2659 htNicNe2kIsa = "ne2k_isa"
2660
2661 htNicNe2kPci :: String
2662 htNicNe2kPci = "ne2k_pci"
2663
2664 htNicParavirtual :: String
2665 htNicParavirtual = "paravirtual"
2666
2667 htNicPcnet :: String
2668 htNicPcnet = "pcnet"
2669
2670 htNicRtl8139 :: String
2671 htNicRtl8139 = "rtl8139"
2672
2673 htHvmValidNicTypes :: FrozenSet String
2674 htHvmValidNicTypes =
2675 ConstantUtils.mkSet [htNicE1000,
2676 htNicNe2kIsa,
2677 htNicNe2kPci,
2678 htNicParavirtual,
2679 htNicRtl8139]
2680
2681 htKvmValidNicTypes :: FrozenSet String
2682 htKvmValidNicTypes =
2683 ConstantUtils.mkSet [htNicE1000,
2684 htNicI82551,
2685 htNicI8259er,
2686 htNicI85557b,
2687 htNicNe2kIsa,
2688 htNicNe2kPci,
2689 htNicParavirtual,
2690 htNicPcnet,
2691 htNicRtl8139]
2692
2693 -- * Vif types
2694
2695 -- | Default vif type in xen-hvm
2696 htHvmVifIoemu :: String
2697 htHvmVifIoemu = "ioemu"
2698
2699 htHvmVifVif :: String
2700 htHvmVifVif = "vif"
2701
2702 htHvmValidVifTypes :: FrozenSet String
2703 htHvmValidVifTypes = ConstantUtils.mkSet [htHvmVifIoemu, htHvmVifVif]
2704
2705 -- * Disk types
2706
2707 htDiskIde :: String
2708 htDiskIde = "ide"
2709
2710 htDiskIoemu :: String
2711 htDiskIoemu = "ioemu"
2712
2713 htDiskMtd :: String
2714 htDiskMtd = "mtd"
2715
2716 htDiskParavirtual :: String
2717 htDiskParavirtual = "paravirtual"
2718
2719 htDiskPflash :: String
2720 htDiskPflash = "pflash"
2721
2722 htDiskScsi :: String
2723 htDiskScsi = "scsi"
2724
2725 htDiskSd :: String
2726 htDiskSd = "sd"
2727
2728 htHvmValidDiskTypes :: FrozenSet String
2729 htHvmValidDiskTypes = ConstantUtils.mkSet [htDiskIoemu, htDiskParavirtual]
2730
2731 htKvmValidDiskTypes :: FrozenSet String
2732 htKvmValidDiskTypes =
2733 ConstantUtils.mkSet [htDiskIde,
2734 htDiskMtd,
2735 htDiskParavirtual,
2736 htDiskPflash,
2737 htDiskScsi,
2738 htDiskSd]
2739
2740 htCacheDefault :: String
2741 htCacheDefault = "default"
2742
2743 htCacheNone :: String
2744 htCacheNone = "none"
2745
2746 htCacheWback :: String
2747 htCacheWback = "writeback"
2748
2749 htCacheWthrough :: String
2750 htCacheWthrough = "writethrough"
2751
2752 htValidCacheTypes :: FrozenSet String
2753 htValidCacheTypes =
2754 ConstantUtils.mkSet [htCacheDefault,
2755 htCacheNone,
2756 htCacheWback,
2757 htCacheWthrough]
2758
2759 htKvmAioThreads :: String
2760 htKvmAioThreads = "threads"
2761
2762 htKvmAioNative :: String
2763 htKvmAioNative = "native"
2764
2765 htKvmValidAioTypes :: FrozenSet String
2766 htKvmValidAioTypes =
2767 ConstantUtils.mkSet [htKvmAioThreads,
2768 htKvmAioNative]
2769
2770 -- * Mouse types
2771
2772 htMouseMouse :: String
2773 htMouseMouse = "mouse"
2774
2775 htMouseTablet :: String
2776 htMouseTablet = "tablet"
2777
2778 htKvmValidMouseTypes :: FrozenSet String
2779 htKvmValidMouseTypes = ConstantUtils.mkSet [htMouseMouse, htMouseTablet]
2780
2781 -- * Boot order
2782
2783 htBoCdrom :: String
2784 htBoCdrom = "cdrom"
2785
2786 htBoDisk :: String
2787 htBoDisk = "disk"
2788
2789 htBoFloppy :: String
2790 htBoFloppy = "floppy"
2791
2792 htBoNetwork :: String
2793 htBoNetwork = "network"
2794
2795 htKvmValidBoTypes :: FrozenSet String
2796 htKvmValidBoTypes =
2797 ConstantUtils.mkSet [htBoCdrom, htBoDisk, htBoFloppy, htBoNetwork]
2798
2799 -- * SPICE lossless image compression options
2800
2801 htKvmSpiceLosslessImgComprAutoGlz :: String
2802 htKvmSpiceLosslessImgComprAutoGlz = "auto_glz"
2803
2804 htKvmSpiceLosslessImgComprAutoLz :: String
2805 htKvmSpiceLosslessImgComprAutoLz = "auto_lz"
2806
2807 htKvmSpiceLosslessImgComprGlz :: String
2808 htKvmSpiceLosslessImgComprGlz = "glz"
2809
2810 htKvmSpiceLosslessImgComprLz :: String
2811 htKvmSpiceLosslessImgComprLz = "lz"
2812
2813 htKvmSpiceLosslessImgComprOff :: String
2814 htKvmSpiceLosslessImgComprOff = "off"
2815
2816 htKvmSpiceLosslessImgComprQuic :: String
2817 htKvmSpiceLosslessImgComprQuic = "quic"
2818
2819 htKvmSpiceValidLosslessImgComprOptions :: FrozenSet String
2820 htKvmSpiceValidLosslessImgComprOptions =
2821 ConstantUtils.mkSet [htKvmSpiceLosslessImgComprAutoGlz,
2822 htKvmSpiceLosslessImgComprAutoLz,
2823 htKvmSpiceLosslessImgComprGlz,
2824 htKvmSpiceLosslessImgComprLz,
2825 htKvmSpiceLosslessImgComprOff,
2826 htKvmSpiceLosslessImgComprQuic]
2827
2828 htKvmSpiceLossyImgComprAlways :: String
2829 htKvmSpiceLossyImgComprAlways = "always"
2830
2831 htKvmSpiceLossyImgComprAuto :: String
2832 htKvmSpiceLossyImgComprAuto = "auto"
2833
2834 htKvmSpiceLossyImgComprNever :: String
2835 htKvmSpiceLossyImgComprNever = "never"
2836
2837 htKvmSpiceValidLossyImgComprOptions :: FrozenSet String
2838 htKvmSpiceValidLossyImgComprOptions =
2839 ConstantUtils.mkSet [htKvmSpiceLossyImgComprAlways,
2840 htKvmSpiceLossyImgComprAuto,
2841 htKvmSpiceLossyImgComprNever]
2842
2843 -- * SPICE video stream detection
2844
2845 htKvmSpiceVideoStreamDetectionAll :: String
2846 htKvmSpiceVideoStreamDetectionAll = "all"
2847
2848 htKvmSpiceVideoStreamDetectionFilter :: String
2849 htKvmSpiceVideoStreamDetectionFilter = "filter"
2850
2851 htKvmSpiceVideoStreamDetectionOff :: String
2852 htKvmSpiceVideoStreamDetectionOff = "off"
2853
2854 htKvmSpiceValidVideoStreamDetectionOptions :: FrozenSet String
2855 htKvmSpiceValidVideoStreamDetectionOptions =
2856 ConstantUtils.mkSet [htKvmSpiceVideoStreamDetectionAll,
2857 htKvmSpiceVideoStreamDetectionFilter,
2858 htKvmSpiceVideoStreamDetectionOff]
2859
2860 -- * Security models
2861
2862 htSmNone :: String
2863 htSmNone = "none"
2864
2865 htSmPool :: String
2866 htSmPool = "pool"
2867
2868 htSmUser :: String
2869 htSmUser = "user"
2870
2871 htKvmValidSmTypes :: FrozenSet String
2872 htKvmValidSmTypes = ConstantUtils.mkSet [htSmNone, htSmPool, htSmUser]
2873
2874 -- * Kvm flag values
2875
2876 htKvmDisabled :: String
2877 htKvmDisabled = "disabled"
2878
2879 htKvmEnabled :: String
2880 htKvmEnabled = "enabled"
2881
2882 htKvmFlagValues :: FrozenSet String
2883 htKvmFlagValues = ConstantUtils.mkSet [htKvmDisabled, htKvmEnabled]
2884
2885 -- * Migration type
2886
2887 htMigrationLive :: String
2888 htMigrationLive = Types.migrationModeToRaw MigrationLive
2889
2890 htMigrationNonlive :: String
2891 htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
2892
2893 htMigrationModes :: FrozenSet String
2894 htMigrationModes =
2895 ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
2896
2897 -- * Cluster verify steps
2898
2899 verifyNplusoneMem :: String
2900 verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
2901
2902 verifyOptionalChecks :: FrozenSet String
2903 verifyOptionalChecks =
2904 ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
2905
2906 -- * Cluster Verify error classes
2907
2908 cvTcluster :: String
2909 cvTcluster = "cluster"
2910
2911 cvTgroup :: String
2912 cvTgroup = "group"
2913
2914 cvTnode :: String
2915 cvTnode = "node"
2916
2917 cvTinstance :: String
2918 cvTinstance = "instance"
2919
2920 -- * Cluster Verify error levels
2921
2922 cvWarning :: String
2923 cvWarning = "WARNING"
2924
2925 cvError :: String
2926 cvError = "ERROR"
2927
2928 -- * Cluster Verify error codes and documentation
2929
2930 cvEclustercert :: (String, String, String)
2931 cvEclustercert =
2932 ("cluster",
2933 Types.cVErrorCodeToRaw CvECLUSTERCERT,
2934 "Cluster certificate files verification failure")
2935
2936 cvEclusterclientcert :: (String, String, String)
2937 cvEclusterclientcert =
2938 ("cluster",
2939 Types.cVErrorCodeToRaw CvECLUSTERCLIENTCERT,
2940 "Cluster client certificate files verification failure")
2941
2942 cvEclustercfg :: (String, String, String)
2943 cvEclustercfg =
2944 ("cluster",
2945 Types.cVErrorCodeToRaw CvECLUSTERCFG,
2946 "Cluster configuration verification failure")
2947
2948 cvEclusterdanglinginst :: (String, String, String)
2949 cvEclusterdanglinginst =
2950 ("node",
2951 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
2952 "Some instances have a non-existing primary node")
2953
2954 cvEclusterdanglingnodes :: (String, String, String)
2955 cvEclusterdanglingnodes =
2956 ("node",
2957 Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
2958 "Some nodes belong to non-existing groups")
2959
2960 cvEclusterfilecheck :: (String, String, String)
2961 cvEclusterfilecheck =
2962 ("cluster",
2963 Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
2964 "Cluster configuration verification failure")
2965
2966 cvEgroupdifferentpvsize :: (String, String, String)
2967 cvEgroupdifferentpvsize =
2968 ("group",
2969 Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
2970 "PVs in the group have different sizes")
2971
2972 cvEinstancebadnode :: (String, String, String)
2973 cvEinstancebadnode =
2974 ("instance",
2975 Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
2976 "Instance marked as running lives on an offline node")
2977
2978 cvEinstancedown :: (String, String, String)
2979 cvEinstancedown =
2980 ("instance",
2981 Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
2982 "Instance not running on its primary node")
2983
2984 cvEinstancefaultydisk :: (String, String, String)
2985 cvEinstancefaultydisk =
2986 ("instance",
2987 Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
2988 "Impossible to retrieve status for a disk")
2989
2990 cvEinstancelayout :: (String, String, String)
2991 cvEinstancelayout =
2992 ("instance",
2993 Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
2994 "Instance has multiple secondary nodes")
2995
2996 cvEinstancemissingcfgparameter :: (String, String, String)
2997 cvEinstancemissingcfgparameter =
2998 ("instance",
2999 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
3000 "A configuration parameter for an instance is missing")
3001
3002 cvEinstancemissingdisk :: (String, String, String)
3003 cvEinstancemissingdisk =
3004 ("instance",
3005 Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
3006 "Missing volume on an instance")
3007
3008 cvEinstancepolicy :: (String, String, String)
3009 cvEinstancepolicy =
3010 ("instance",
3011 Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
3012 "Instance does not meet policy")
3013
3014 cvEinstancesplitgroups :: (String, String, String)
3015 cvEinstancesplitgroups =
3016 ("instance",
3017 Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
3018 "Instance with primary and secondary nodes in different groups")
3019
3020 cvEinstanceunsuitablenode :: (String, String, String)
3021 cvEinstanceunsuitablenode =
3022 ("instance",
3023 Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
3024 "Instance running on nodes that are not suitable for it")
3025
3026 cvEinstancewrongnode :: (String, String, String)
3027 cvEinstancewrongnode =
3028 ("instance",
3029 Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
3030 "Instance running on the wrong node")
3031
3032 cvEnodedrbd :: (String, String, String)
3033 cvEnodedrbd =
3034 ("node",
3035 Types.cVErrorCodeToRaw CvENODEDRBD,
3036 "Error parsing the DRBD status file")
3037
3038 cvEnodedrbdhelper :: (String, String, String)
3039 cvEnodedrbdhelper =
3040 ("node",
3041 Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
3042 "Error caused by the DRBD helper")
3043
3044 cvEnodedrbdversion :: (String, String, String)
3045 cvEnodedrbdversion =
3046 ("node",
3047 Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
3048 "DRBD version mismatch within a node group")
3049
3050 cvEnodefilecheck :: (String, String, String)
3051 cvEnodefilecheck =
3052 ("node",
3053 Types.cVErrorCodeToRaw CvENODEFILECHECK,
3054 "Error retrieving the checksum of the node files")
3055
3056 cvEnodefilestoragepaths :: (String, String, String)
3057 cvEnodefilestoragepaths =
3058 ("node",
3059 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
3060 "Detected bad file storage paths")
3061
3062 cvEnodefilestoragepathunusable :: (String, String, String)
3063 cvEnodefilestoragepathunusable =
3064 ("node",
3065 Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
3066 "File storage path unusable")
3067
3068 cvEnodehooks :: (String, String, String)
3069 cvEnodehooks =
3070 ("node",
3071 Types.cVErrorCodeToRaw CvENODEHOOKS,
3072 "Communication failure in hooks execution")
3073
3074 cvEnodehv :: (String, String, String)
3075 cvEnodehv =
3076 ("node",
3077 Types.cVErrorCodeToRaw CvENODEHV,
3078 "Hypervisor parameters verification failure")
3079
3080 cvEnodelvm :: (String, String, String)
3081 cvEnodelvm =
3082 ("node",
3083 Types.cVErrorCodeToRaw CvENODELVM,
3084 "LVM-related node error")
3085
3086 cvEnoden1 :: (String, String, String)
3087 cvEnoden1 =
3088 ("node",
3089 Types.cVErrorCodeToRaw CvENODEN1,
3090 "Not enough memory to accommodate instance failovers")
3091
3092 cvEnodenet :: (String, String, String)
3093 cvEnodenet =
3094 ("node",
3095 Types.cVErrorCodeToRaw CvENODENET,
3096 "Network-related node error")
3097
3098 cvEnodeoobpath :: (String, String, String)
3099 cvEnodeoobpath =
3100 ("node",
3101 Types.cVErrorCodeToRaw CvENODEOOBPATH,
3102 "Invalid Out Of Band path")
3103
3104 cvEnodeorphaninstance :: (String, String, String)
3105 cvEnodeorphaninstance =
3106 ("node",
3107 Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
3108 "Unknown intance running on a node")
3109
3110 cvEnodeorphanlv :: (String, String, String)
3111 cvEnodeorphanlv =
3112 ("node",
3113 Types.cVErrorCodeToRaw CvENODEORPHANLV,
3114 "Unknown LVM logical volume")
3115
3116 cvEnodeos :: (String, String, String)
3117 cvEnodeos =
3118 ("node",
3119 Types.cVErrorCodeToRaw CvENODEOS,
3120 "OS-related node error")
3121
3122 cvEnoderpc :: (String, String, String)
3123 cvEnoderpc =
3124 ("node",
3125 Types.cVErrorCodeToRaw CvENODERPC,
3126 "Error during connection to the primary node of an instance")
3127
3128 cvEnodesetup :: (String, String, String)
3129 cvEnodesetup =
3130 ("node",
3131 Types.cVErrorCodeToRaw CvENODESETUP,
3132 "Node setup error")
3133
3134 cvEnodesharedfilestoragepathunusable :: (String, String, String)
3135 cvEnodesharedfilestoragepathunusable =
3136 ("node",
3137 Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
3138 "Shared file storage path unusable")
3139
3140 cvEnodeglusterstoragepathunusable :: (String, String, String)
3141 cvEnodeglusterstoragepathunusable =
3142 ("node",
3143 Types.cVErrorCodeToRaw CvENODEGLUSTERSTORAGEPATHUNUSABLE,
3144 "Gluster storage path unusable")
3145
3146 cvEnodessh :: (String, String, String)
3147 cvEnodessh =
3148 ("node",
3149 Types.cVErrorCodeToRaw CvENODESSH,
3150 "SSH-related node error")
3151
3152 cvEnodetime :: (String, String, String)
3153 cvEnodetime =
3154 ("node",
3155 Types.cVErrorCodeToRaw CvENODETIME,
3156 "Node returned invalid time")
3157
3158 cvEnodeuserscripts :: (String, String, String)
3159 cvEnodeuserscripts =
3160 ("node",
3161 Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
3162 "User scripts not present or not executable")
3163
3164 cvEnodeversion :: (String, String, String)
3165 cvEnodeversion =
3166 ("node",
3167 Types.cVErrorCodeToRaw CvENODEVERSION,
3168 "Protocol version mismatch or Ganeti version mismatch")
3169
3170 cvAllEcodes :: FrozenSet (String, String, String)
3171 cvAllEcodes =
3172 ConstantUtils.mkSet
3173 [cvEclustercert,
3174 cvEclustercfg,
3175 cvEclusterdanglinginst,
3176 cvEclusterdanglingnodes,
3177 cvEclusterfilecheck,
3178 cvEgroupdifferentpvsize,
3179 cvEinstancebadnode,
3180 cvEinstancedown,
3181 cvEinstancefaultydisk,
3182 cvEinstancelayout,
3183 cvEinstancemissingcfgparameter,
3184 cvEinstancemissingdisk,
3185 cvEinstancepolicy,
3186 cvEinstancesplitgroups,
3187 cvEinstanceunsuitablenode,
3188 cvEinstancewrongnode,
3189 cvEnodedrbd,
3190 cvEnodedrbdhelper,
3191 cvEnodedrbdversion,
3192 cvEnodefilecheck,
3193 cvEnodefilestoragepaths,
3194 cvEnodefilestoragepathunusable,
3195 cvEnodehooks,
3196 cvEnodehv,
3197 cvEnodelvm,
3198 cvEnoden1,
3199 cvEnodenet,
3200 cvEnodeoobpath,
3201 cvEnodeorphaninstance,
3202 cvEnodeorphanlv,
3203 cvEnodeos,
3204 cvEnoderpc,
3205 cvEnodesetup,
3206 cvEnodesharedfilestoragepathunusable,
3207 cvEnodeglusterstoragepathunusable,
3208 cvEnodessh,
3209 cvEnodetime,
3210 cvEnodeuserscripts,
3211 cvEnodeversion]
3212
3213 cvAllEcodesStrings :: FrozenSet String
3214 cvAllEcodesStrings =
3215 ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
3216
3217 -- * Node verify constants
3218
3219 nvBridges :: String
3220 nvBridges = "bridges"
3221
3222 nvClientCert :: String
3223 nvClientCert = "client-cert"
3224
3225 nvDrbdhelper :: String
3226 nvDrbdhelper = "drbd-helper"
3227
3228 nvDrbdversion :: String
3229 nvDrbdversion = "drbd-version"
3230
3231 nvDrbdlist :: String
3232 nvDrbdlist = "drbd-list"
3233
3234 nvExclusivepvs :: String
3235 nvExclusivepvs = "exclusive-pvs"
3236
3237 nvFilelist :: String
3238 nvFilelist = "filelist"
3239
3240 nvAcceptedStoragePaths :: String
3241 nvAcceptedStoragePaths = "allowed-file-storage-paths"
3242
3243 nvFileStoragePath :: String
3244 nvFileStoragePath = "file-storage-path"
3245
3246 nvSharedFileStoragePath :: String
3247 nvSharedFileStoragePath = "shared-file-storage-path"
3248
3249 nvGlusterStoragePath :: String
3250 nvGlusterStoragePath = "gluster-storage-path"
3251
3252 nvHvinfo :: String
3253 nvHvinfo = "hvinfo"
3254
3255 nvHvparams :: String
3256 nvHvparams = "hvparms"
3257
3258 nvHypervisor :: String
3259 nvHypervisor = "hypervisor"
3260
3261 nvInstancelist :: String
3262 nvInstancelist = "instancelist"
3263
3264 nvLvlist :: String
3265 nvLvlist = "lvlist"
3266
3267 nvMasterip :: String
3268 nvMasterip = "master-ip"
3269
3270 nvNodelist :: String
3271 nvNodelist = "nodelist"
3272
3273 nvNodenettest :: String
3274 nvNodenettest = "node-net-test"
3275
3276 nvNodesetup :: String
3277 nvNodesetup = "nodesetup"
3278
3279 nvOobPaths :: String
3280 nvOobPaths = "oob-paths"
3281
3282 nvOslist :: String
3283 nvOslist = "oslist"
3284
3285 nvPvlist :: String
3286 nvPvlist = "pvlist"
3287
3288 nvTime :: String
3289 nvTime = "time"
3290
3291 nvUserscripts :: String
3292 nvUserscripts = "user-scripts"
3293
3294 nvVersion :: String
3295 nvVersion = "version"
3296
3297 nvVglist :: String
3298 nvVglist = "vglist"
3299
3300 nvNonvmnodes :: String
3301 nvNonvmnodes = "nonvmnodes"
3302
3303 nvSshSetup :: String
3304 nvSshSetup = "ssh-setup"
3305
3306 nvSshClutter :: String
3307 nvSshClutter = "ssh-clutter"
3308
3309 -- * Instance status
3310
3311 inststAdmindown :: String
3312 inststAdmindown = Types.instanceStatusToRaw StatusDown
3313
3314 inststAdminoffline :: String
3315 inststAdminoffline = Types.instanceStatusToRaw StatusOffline
3316
3317 inststErrordown :: String
3318 inststErrordown = Types.instanceStatusToRaw ErrorDown
3319
3320 inststErrorup :: String
3321 inststErrorup = Types.instanceStatusToRaw ErrorUp
3322
3323 inststNodedown :: String
3324 inststNodedown = Types.instanceStatusToRaw NodeDown
3325
3326 inststNodeoffline :: String
3327 inststNodeoffline = Types.instanceStatusToRaw NodeOffline
3328
3329 inststRunning :: String
3330 inststRunning = Types.instanceStatusToRaw Running
3331
3332 inststUserdown :: String
3333 inststUserdown = Types.instanceStatusToRaw UserDown
3334
3335 inststWrongnode :: String
3336 inststWrongnode = Types.instanceStatusToRaw WrongNode
3337
3338 inststAll :: FrozenSet String
3339 inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
3340
3341 -- * Admin states
3342
3343 adminstDown :: String
3344 adminstDown = Types.adminStateToRaw AdminDown
3345
3346 adminstOffline :: String
3347 adminstOffline = Types.adminStateToRaw AdminOffline
3348
3349 adminstUp :: String
3350 adminstUp = Types.adminStateToRaw AdminUp
3351
3352 adminstAll :: FrozenSet String
3353 adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
3354
3355 -- * Admin state sources
3356
3357 adminSource :: AdminStateSource
3358 adminSource = AdminSource
3359
3360 userSource :: AdminStateSource
3361 userSource = UserSource
3362
3363 adminStateSources :: FrozenSet AdminStateSource
3364 adminStateSources = ConstantUtils.mkSet [minBound..]
3365
3366 -- * Node roles
3367
3368 nrDrained :: String
3369 nrDrained = Types.nodeRoleToRaw NRDrained
3370
3371 nrMaster :: String
3372 nrMaster = Types.nodeRoleToRaw NRMaster
3373
3374 nrMcandidate :: String
3375 nrMcandidate = Types.nodeRoleToRaw NRCandidate
3376
3377 nrOffline :: String
3378 nrOffline = Types.nodeRoleToRaw NROffline
3379
3380 nrRegular :: String
3381 nrRegular = Types.nodeRoleToRaw NRRegular
3382
3383 nrAll :: FrozenSet String
3384 nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
3385
3386 -- * SSL certificate check constants (in days)
3387
3388 sslCertExpirationError :: Int
3389 sslCertExpirationError = 7
3390
3391 sslCertExpirationWarn :: Int
3392 sslCertExpirationWarn = 30
3393
3394 -- * Allocator framework constants
3395
3396 iallocatorVersion :: Int
3397 iallocatorVersion = 2
3398
3399 iallocatorDirIn :: String
3400 iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
3401
3402 iallocatorDirOut :: String
3403 iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
3404
3405 validIallocatorDirections :: FrozenSet String
3406 validIallocatorDirections =
3407 ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
3408
3409 iallocatorModeAlloc :: String
3410 iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
3411
3412 iallocatorModeChgGroup :: String
3413 iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
3414
3415 iallocatorModeMultiAlloc :: String
3416 iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
3417
3418 iallocatorModeNodeEvac :: String
3419 iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
3420
3421 iallocatorModeReloc :: String
3422 iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
3423
3424 validIallocatorModes :: FrozenSet String
3425 validIallocatorModes =
3426 ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
3427
3428 iallocatorSearchPath :: [String]
3429 iallocatorSearchPath = AutoConf.iallocatorSearchPath
3430
3431 defaultIallocatorShortcut :: String
3432 defaultIallocatorShortcut = "."
3433
3434 -- * Opportunistic allocator usage
3435
3436 -- | Time delay in seconds between repeated opportunistic instance creations.
3437 -- Rather than failing with an informative error message if the opportunistic
3438 -- creation cannot grab enough nodes, for some uses it is better to retry the
3439 -- creation with an interval between attempts. This is a reasonable default.
3440 defaultOpportunisticRetryInterval :: Int
3441 defaultOpportunisticRetryInterval = 30
3442
3443 -- * Node evacuation
3444
3445 nodeEvacPri :: String
3446 nodeEvacPri = Types.evacModeToRaw ChangePrimary
3447
3448 nodeEvacSec :: String
3449 nodeEvacSec = Types.evacModeToRaw ChangeSecondary
3450
3451 nodeEvacAll :: String
3452 nodeEvacAll = Types.evacModeToRaw ChangeAll
3453
3454 nodeEvacModes :: FrozenSet String
3455 nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..]
3456
3457 -- * Job queue
3458
3459 jobQueueVersion :: Int
3460 jobQueueVersion = 1
3461
3462 jobQueueSizeHardLimit :: Int
3463 jobQueueSizeHardLimit = 5000
3464
3465 jobQueueFilesPerms :: Int
3466 jobQueueFilesPerms = 0o640
3467
3468 -- * Unchanged job return
3469
3470 jobNotchanged :: String
3471 jobNotchanged = "nochange"
3472
3473 -- * Job status
3474
3475 jobStatusQueued :: String
3476 jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
3477
3478 jobStatusWaiting :: String
3479 jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
3480
3481 jobStatusCanceling :: String
3482 jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
3483
3484 jobStatusRunning :: String
3485 jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
3486
3487 jobStatusCanceled :: String
3488 jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
3489
3490 jobStatusSuccess :: String
3491 jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
3492
3493 jobStatusError :: String
3494 jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
3495
3496 jobsPending :: FrozenSet String
3497 jobsPending =
3498 ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
3499
3500 jobsFinalized :: FrozenSet String
3501 jobsFinalized =
3502 ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
3503
3504 jobStatusAll :: FrozenSet String
3505 jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
3506
3507 -- * OpCode status
3508
3509 -- ** Not yet finalized opcodes
3510
3511 opStatusCanceling :: String
3512 opStatusCanceling = "canceling"
3513
3514 opStatusQueued :: String
3515 opStatusQueued = "queued"
3516
3517 opStatusRunning :: String
3518 opStatusRunning = "running"
3519
3520 opStatusWaiting :: String
3521 opStatusWaiting = "waiting"
3522
3523 -- ** Finalized opcodes
3524
3525 opStatusCanceled :: String
3526 opStatusCanceled = "canceled"
3527
3528 opStatusError :: String
3529 opStatusError = "error"
3530
3531 opStatusSuccess :: String
3532 opStatusSuccess = "success"
3533
3534 opsFinalized :: FrozenSet String
3535 opsFinalized =
3536 ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
3537
3538 -- * OpCode priority
3539
3540 opPrioLowest :: Int
3541 opPrioLowest = 19
3542
3543 opPrioHighest :: Int
3544 opPrioHighest = -20
3545
3546 opPrioLow :: Int
3547 opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
3548
3549 opPrioNormal :: Int
3550 opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
3551
3552 opPrioHigh :: Int
3553 opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
3554
3555 opPrioSubmitValid :: FrozenSet Int
3556 opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
3557
3558 opPrioDefault :: Int
3559 opPrioDefault = opPrioNormal
3560
3561 -- * Lock recalculate mode
3562
3563 locksAppend :: String
3564 locksAppend = "append"
3565
3566 locksReplace :: String
3567 locksReplace = "replace"
3568
3569 -- * Lock timeout
3570 --
3571 -- The lock timeout (sum) before we transition into blocking acquire
3572 -- (this can still be reset by priority change). Computed as max time
3573 -- (10 hours) before we should actually go into blocking acquire,
3574 -- given that we start from the default priority level.
3575
3576 lockAttemptsMaxwait :: Double
3577 lockAttemptsMaxwait = 75.0
3578
3579 lockAttemptsMinwait :: Double
3580 lockAttemptsMinwait = 5.0
3581
3582 lockAttemptsTimeout :: Int
3583 lockAttemptsTimeout = (10 * 3600) `div` (opPrioDefault - opPrioHighest)
3584
3585 -- * Execution log types
3586
3587 elogMessage :: String
3588 elogMessage = Types.eLogTypeToRaw ELogMessage
3589
3590 elogRemoteImport :: String
3591 elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
3592
3593 elogJqueueTest :: String
3594 elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
3595
3596 elogDelayTest :: String
3597 elogDelayTest = Types.eLogTypeToRaw ELogDelayTest
3598
3599 -- * /etc/hosts modification
3600
3601 etcHostsAdd :: String
3602 etcHostsAdd = "add"
3603
3604 etcHostsRemove :: String
3605 etcHostsRemove = "remove"
3606
3607 -- * Job queue test
3608
3609 jqtMsgprefix :: String
3610 jqtMsgprefix = "TESTMSG="
3611
3612 jqtExec :: String
3613 jqtExec = "exec"
3614
3615 jqtExpandnames :: String
3616 jqtExpandnames = "expandnames"
3617
3618 jqtLogmsg :: String
3619 jqtLogmsg = "logmsg"
3620
3621 jqtStartmsg :: String
3622 jqtStartmsg = "startmsg"
3623
3624 jqtAll :: FrozenSet String
3625 jqtAll = ConstantUtils.mkSet [jqtExec, jqtExpandnames, jqtLogmsg, jqtStartmsg]
3626
3627 -- * Query resources
3628
3629 qrCluster :: String
3630 qrCluster = "cluster"
3631
3632 qrExport :: String
3633 qrExport = "export"
3634
3635 qrExtstorage :: String
3636 qrExtstorage = "extstorage"
3637
3638 qrGroup :: String
3639 qrGroup = "group"
3640
3641 qrInstance :: String
3642 qrInstance = "instance"
3643
3644 qrJob :: String
3645 qrJob = "job"
3646
3647 qrLock :: String
3648 qrLock = "lock"
3649
3650 qrNetwork :: String
3651 qrNetwork = "network"
3652
3653 qrFilter :: String
3654 qrFilter = "filter"