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