Statistics
| Branch: | Tag: | Revision:

root / src / Ganeti / HsConstants.hs @ 8c44d5b3

History | View | Annotate | Download (34.4 kB)

1
{-| HsConstants contains the Haskell constants
2

    
3
This is a transitional module complementary to 'Ganeti.Constants'.  It
4
is intended to contain the Haskell constants that are meant to be
5
generated in 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 Google Inc.
20

    
21
This program is free software; you can redistribute it and/or modify
22
it under the terms of the GNU General Public License as published by
23
the Free Software Foundation; either version 2 of the License, or
24
(at your option) any later version.
25

    
26
This program is distributed in the hope that it will be useful, but
27
WITHOUT ANY WARRANTY; without even the implied warranty of
28
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
29
General Public License for more details.
30

    
31
You should have received a copy of the GNU General Public License
32
along with this program; if not, write to the Free Software
33
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
34
02110-1301, USA.
35

    
36
-}
37
module Ganeti.HsConstants where
38

    
39
import Data.Map (Map)
40
import qualified Data.Map as Map (fromList)
41

    
42
import AutoConf
43
import Ganeti.ConstantUtils (FrozenSet, Protocol(..), buildVersion)
44
import qualified Ganeti.ConstantUtils as ConstantUtils
45
import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..),
46
                       ExtraLogReason(..))
47
import Ganeti.Logging (SyslogUsage(..))
48
import qualified Ganeti.Logging as Logging (syslogUsageToRaw)
49
import qualified Ganeti.Runtime as Runtime
50
import Ganeti.Types
51
import qualified Ganeti.Types as Types
52

    
53
-- * 'autoconf' constants for Python only ('autotools/build-bash-completion')
54

    
55
htoolsProgs :: [String]
56
htoolsProgs = AutoConf.htoolsProgs
57

    
58
-- * 'autoconf' constants for Python only ('lib/constants.py')
59

    
60
drbdBarriers :: String
61
drbdBarriers = AutoConf.drbdBarriers
62

    
63
drbdNoMetaFlush :: Bool
64
drbdNoMetaFlush = AutoConf.drbdNoMetaFlush
65

    
66
lvmStripecount :: Int
67
lvmStripecount = AutoConf.lvmStripecount
68

    
69
-- * 'autoconf' constants for Python only ('lib/pathutils.py')
70

    
71
-- ** Build-time constants
72

    
73
exportDir :: String
74
exportDir = AutoConf.exportDir
75

    
76
osSearchPath :: [String]
77
osSearchPath = AutoConf.osSearchPath
78

    
79
esSearchPath :: [String]
80
esSearchPath = AutoConf.esSearchPath
81

    
82
sshConfigDir :: String
83
sshConfigDir = AutoConf.sshConfigDir
84

    
85
xenConfigDir :: String
86
xenConfigDir = AutoConf.xenConfigDir
87

    
88
sysconfdir :: String
89
sysconfdir = AutoConf.sysconfdir
90

    
91
toolsdir :: String
92
toolsdir = AutoConf.toolsdir
93

    
94
localstatedir :: String
95
localstatedir = AutoConf.localstatedir
96

    
97
-- ** Paths which don't change for a virtual cluster
98

    
99
pkglibdir :: String
100
pkglibdir = AutoConf.pkglibdir
101

    
102
-- * 'autoconf' constants for Python only ('lib/build/sphinx_ext.py')
103

    
104
manPages :: Map String Int
105
manPages = Map.fromList AutoConf.manPages
106

    
107
-- * 'autoconf' constants for QA cluster only ('qa/qa_cluster.py')
108

    
109
versionedsharedir :: String
110
versionedsharedir = AutoConf.versionedsharedir
111

    
112
-- * 'autoconf' constants for Python only ('tests/py/docs_unittest.py')
113

    
114
gntScripts :: [String]
115
gntScripts = AutoConf.gntScripts
116

    
117
-- * Various versions
118

    
119
releaseVersion :: String
120
releaseVersion = AutoConf.packageVersion
121

    
122
versionMajor :: Int
123
versionMajor = AutoConf.versionMajor
124

    
125
versionMinor :: Int
126
versionMinor = AutoConf.versionMinor
127

    
128
versionRevision :: Int
129
versionRevision = AutoConf.versionRevision
130

    
131
configMajor :: Int
132
configMajor = AutoConf.versionMajor
133

    
134
configMinor :: Int
135
configMinor = AutoConf.versionMinor
136

    
137
-- | The configuration is supposed to remain stable across
138
-- revisions. Therefore, the revision number is cleared to '0'.
139
configRevision :: Int
140
configRevision = 0
141

    
142
configVersion :: Int
143
configVersion = buildVersion configMajor configMinor configRevision
144

    
145
-- | Similarly to the configuration (see 'configRevision'), the
146
-- protocols are supposed to remain stable across revisions.
147
protocolVersion :: Int
148
protocolVersion = buildVersion configMajor configMinor configRevision
149

    
150
-- * User separation
151
daemonsGroup :: String
152
daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
153

    
154
adminGroup :: String
155
adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
156

    
157
masterdUser :: String
158
masterdUser = Runtime.daemonUser GanetiMasterd
159

    
160
masterdGroup :: String
161
masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
162

    
163
rapiUser :: String
164
rapiUser = Runtime.daemonUser GanetiRapi
165

    
166
rapiGroup :: String
167
rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
168

    
169
confdUser :: String
170
confdUser = Runtime.daemonUser GanetiConfd
171

    
172
confdGroup :: String
173
confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
174

    
175
luxidUser :: String
176
luxidUser = Runtime.daemonUser GanetiLuxid
177

    
178
luxidGroup :: String
179
luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
180

    
181
nodedUser :: String
182
nodedUser = Runtime.daemonUser GanetiNoded
183

    
184
nodedGroup :: String
185
nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
186

    
187
mondUser :: String
188
mondUser = Runtime.daemonUser GanetiMond
189

    
190
mondGroup :: String
191
mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
192

    
193
sshLoginUser :: String
194
sshLoginUser = AutoConf.sshLoginUser
195

    
196
sshConsoleUser :: String
197
sshConsoleUser = AutoConf.sshConsoleUser
198

    
199
-- * 'autoconf' enable/disable
200

    
201
enableConfd :: Bool
202
enableConfd = AutoConf.enableConfd
203

    
204
enableMond :: Bool
205
enableMond = AutoConf.enableMond
206

    
207
enableRestrictedCommands :: Bool
208
enableRestrictedCommands = AutoConf.enableRestrictedCommands
209

    
210
enableSplitQuery :: Bool
211
enableSplitQuery = AutoConf.enableSplitQuery
212

    
213
-- * SSH constants
214

    
215
ssh :: String
216
ssh = "ssh"
217

    
218
scp :: String
219
scp = "scp"
220

    
221
-- * Daemons
222

    
223
confd :: String
224
confd = Runtime.daemonName GanetiConfd
225

    
226
masterd :: String
227
masterd = Runtime.daemonName GanetiMasterd
228

    
229
mond :: String
230
mond = Runtime.daemonName GanetiMond
231

    
232
noded :: String
233
noded = Runtime.daemonName GanetiNoded
234

    
235
luxid :: String
236
luxid = Runtime.daemonName GanetiLuxid
237

    
238
rapi :: String
239
rapi = Runtime.daemonName GanetiRapi
240

    
241
daemons :: FrozenSet String
242
daemons =
243
  ConstantUtils.mkSet [confd,
244
                       luxid,
245
                       masterd,
246
                       mond,
247
                       noded,
248
                       rapi]
249

    
250
defaultConfdPort :: Int
251
defaultConfdPort = 1814
252

    
253
defaultMondPort :: Int
254
defaultMondPort = 1815
255

    
256
defaultNodedPort :: Int
257
defaultNodedPort = 1811
258

    
259
defaultRapiPort :: Int
260
defaultRapiPort = 5080
261

    
262
daemonsPorts :: Map String (Protocol, Int)
263
daemonsPorts =
264
  Map.fromList [(confd, (Udp, defaultConfdPort)),
265
                (mond, (Tcp, defaultMondPort)),
266
                (noded, (Tcp, defaultNodedPort)),
267
                (rapi, (Tcp, defaultRapiPort)),
268
                (ssh, (Tcp, 22))]
269

    
270
daemonsLogbase :: Map String String
271
daemonsLogbase =
272
  Map.fromList
273
  [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
274

    
275
extraLogreasonAccess :: String
276
extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
277

    
278
extraLogreasonError :: String
279
extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
280

    
281
devConsole :: String
282
devConsole = ConstantUtils.devConsole
283

    
284
-- * Syslog
285

    
286
syslogUsage :: String
287
syslogUsage = AutoConf.syslogUsage
288

    
289
syslogNo :: String
290
syslogNo = Logging.syslogUsageToRaw SyslogNo
291

    
292
syslogYes :: String
293
syslogYes = Logging.syslogUsageToRaw SyslogYes
294

    
295
syslogOnly :: String
296
syslogOnly = Logging.syslogUsageToRaw SyslogOnly
297

    
298
syslogSocket :: String
299
syslogSocket = "/dev/log"
300

    
301
-- * Xen
302

    
303
xenBootloader :: String
304
xenBootloader = AutoConf.xenBootloader
305

    
306
xenCmdXl :: String
307
xenCmdXl = "xl"
308

    
309
xenCmdXm :: String
310
xenCmdXm = "xm"
311

    
312
xenInitrd :: String
313
xenInitrd = AutoConf.xenInitrd
314

    
315
xenKernel :: String
316
xenKernel = AutoConf.xenKernel
317

    
318
-- FIXME: perhaps rename to 'validXenCommands' for consistency with
319
-- other constants
320
knownXenCommands :: FrozenSet String
321
knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
322

    
323
-- * KVM and socat
324

    
325
kvmPath :: String
326
kvmPath = AutoConf.kvmPath
327

    
328
kvmKernel :: String
329
kvmKernel = AutoConf.kvmKernel
330

    
331
socatEscapeCode :: String
332
socatEscapeCode = "0x1d"
333

    
334
socatPath :: String
335
socatPath = AutoConf.socatPath
336

    
337
socatUseCompress :: Bool
338
socatUseCompress = AutoConf.socatUseCompress
339

    
340
socatUseEscape :: Bool
341
socatUseEscape = AutoConf.socatUseEscape
342

    
343
-- * Storage types
344

    
345
stBlock :: String
346
stBlock = Types.storageTypeToRaw StorageBlock
347

    
348
stDiskless :: String
349
stDiskless = Types.storageTypeToRaw StorageDiskless
350

    
351
stExt :: String
352
stExt = Types.storageTypeToRaw StorageExt
353

    
354
stFile :: String
355
stFile = Types.storageTypeToRaw StorageFile
356

    
357
stLvmPv :: String
358
stLvmPv = Types.storageTypeToRaw StorageLvmPv
359

    
360
stLvmVg :: String
361
stLvmVg = Types.storageTypeToRaw StorageLvmVg
362

    
363
stRados :: String
364
stRados = Types.storageTypeToRaw StorageRados
365

    
366
storageTypes :: FrozenSet String
367
storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
368

    
369
-- * Storage fields
370
-- ** First two are valid in LU context only, not passed to backend
371

    
372
sfNode :: String
373
sfNode = "node"
374

    
375
sfType :: String
376
sfType = "type"
377

    
378
-- ** and the rest are valid in backend
379

    
380
sfAllocatable :: String
381
sfAllocatable = Types.storageFieldToRaw SFAllocatable
382

    
383
sfFree :: String
384
sfFree = Types.storageFieldToRaw SFFree
385

    
386
sfName :: String
387
sfName = Types.storageFieldToRaw SFName
388

    
389
sfSize :: String
390
sfSize = Types.storageFieldToRaw SFSize
391

    
392
sfUsed :: String
393
sfUsed = Types.storageFieldToRaw SFUsed
394

    
395
-- * Disk template types
396

    
397
dtDiskless :: String
398
dtDiskless = Types.diskTemplateToRaw DTDiskless
399

    
400
dtFile :: String
401
dtFile = Types.diskTemplateToRaw DTFile
402

    
403
dtSharedFile :: String
404
dtSharedFile = Types.diskTemplateToRaw DTSharedFile
405

    
406
dtPlain :: String
407
dtPlain = Types.diskTemplateToRaw DTPlain
408

    
409
dtBlock :: String
410
dtBlock = Types.diskTemplateToRaw DTBlock
411

    
412
dtDrbd8 :: String
413
dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
414

    
415
dtRbd :: String
416
dtRbd = Types.diskTemplateToRaw DTRbd
417

    
418
dtExt :: String
419
dtExt = Types.diskTemplateToRaw DTExt
420

    
421
-- | This is used to order determine the default disk template when
422
-- the list of enabled disk templates is inferred from the current
423
-- state of the cluster.  This only happens on an upgrade from a
424
-- version of Ganeti that did not support the 'enabled_disk_templates'
425
-- so far.
426
diskTemplatePreference :: [String]
427
diskTemplatePreference =
428
  map Types.diskTemplateToRaw
429
  [DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile]
430

    
431
diskTemplates :: FrozenSet String
432
diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
433

    
434
-- | Disk templates that are enabled by default
435
defaultEnabledDiskTemplates :: [String]
436
defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
437

    
438
-- * File backend driver
439

    
440
fdBlktap :: String
441
fdBlktap = Types.fileDriverToRaw FileBlktap
442

    
443
fdLoop :: String
444
fdLoop = Types.fileDriverToRaw FileLoop
445

    
446
-- * Disk access mode
447

    
448
diskRdonly :: String
449
diskRdonly = Types.diskModeToRaw DiskRdOnly
450

    
451
diskRdwr :: String
452
diskRdwr = Types.diskModeToRaw DiskRdWr
453

    
454
diskAccessSet :: FrozenSet String
455
diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..]
456

    
457
-- * Instance export mode
458

    
459
exportModeLocal :: String
460
exportModeLocal = Types.exportModeToRaw ExportModeLocal
461

    
462
exportModeRemote :: String
463
exportModeRemote = Types.exportModeToRaw ExportModeRemote
464

    
465
exportModes :: FrozenSet String
466
exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
467

    
468
-- * Instance creation modes
469

    
470
instanceCreate :: String
471
instanceCreate = Types.instCreateModeToRaw InstCreate
472

    
473
instanceImport :: String
474
instanceImport = Types.instCreateModeToRaw InstImport
475

    
476
instanceRemoteImport :: String
477
instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
478

    
479
instanceCreateModes :: FrozenSet String
480
instanceCreateModes =
481
  ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
482

    
483
-- * Dynamic device modification
484

    
485
ddmAdd :: String
486
ddmAdd = Types.ddmFullToRaw DdmFullAdd
487

    
488
ddmModify :: String
489
ddmModify = Types.ddmFullToRaw DdmFullModify
490

    
491
ddmRemove :: String
492
ddmRemove = Types.ddmFullToRaw DdmFullRemove
493

    
494
ddmsValues :: FrozenSet String
495
ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
496

    
497
ddmsValuesWithModify :: FrozenSet String
498
ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
499

    
500
-- * Common exit codes
501

    
502
exitSuccess :: Int
503
exitSuccess = 0
504

    
505
exitFailure :: Int
506
exitFailure = ConstantUtils.exitFailure
507

    
508
exitNotcluster :: Int
509
exitNotcluster = 5
510

    
511
exitNotmaster :: Int
512
exitNotmaster = 11
513

    
514
exitNodesetupError :: Int
515
exitNodesetupError = 12
516

    
517
-- | Need user confirmation
518
exitConfirmation :: Int
519
exitConfirmation = 13
520

    
521
-- | Exit code for query operations with unknown fields
522
exitUnknownField :: Int
523
exitUnknownField = 14
524

    
525
-- * Tags
526

    
527
tagCluster :: String
528
tagCluster = Types.tagKindToRaw TagKindCluster
529

    
530
tagInstance :: String
531
tagInstance = Types.tagKindToRaw TagKindInstance
532

    
533
tagNetwork :: String
534
tagNetwork = Types.tagKindToRaw TagKindNetwork
535

    
536
tagNode :: String
537
tagNode = Types.tagKindToRaw TagKindNode
538

    
539
tagNodegroup :: String
540
tagNodegroup = Types.tagKindToRaw TagKindGroup
541

    
542
validTagTypes :: FrozenSet String
543
validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
544

    
545
maxTagLen :: Int
546
maxTagLen = 128
547

    
548
maxTagsPerObj :: Int
549
maxTagsPerObj = 4096
550

    
551
-- | Node clock skew in seconds
552
nodeMaxClockSkew :: Int
553
nodeMaxClockSkew = 150
554

    
555
-- | Disk index separator
556
diskSeparator :: String
557
diskSeparator = AutoConf.diskSeparator
558

    
559
ipCommandPath :: String
560
ipCommandPath = AutoConf.ipPath
561

    
562
-- * Reboot types
563

    
564
instanceRebootSoft :: String
565
instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
566

    
567
instanceRebootHard :: String
568
instanceRebootHard = Types.rebootTypeToRaw RebootHard
569

    
570
instanceRebootFull :: String
571
instanceRebootFull = Types.rebootTypeToRaw RebootFull
572

    
573
rebootTypes :: FrozenSet String
574
rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
575

    
576
-- * VTypes
577

    
578
vtypeBool :: String
579
vtypeBool = Types.vTypeToRaw VTypeBool
580

    
581
vtypeInt :: String
582
vtypeInt = Types.vTypeToRaw VTypeInt
583

    
584
vtypeMaybeString :: String
585
vtypeMaybeString = Types.vTypeToRaw VTypeMaybeString
586

    
587
-- | Size in MiBs
588
vtypeSize :: String
589
vtypeSize = Types.vTypeToRaw VTypeSize
590

    
591
vtypeString :: String
592
vtypeString = Types.vTypeToRaw VTypeString
593

    
594
enforceableTypes :: FrozenSet String
595
enforceableTypes = ConstantUtils.mkSet $ map Types.vTypeToRaw [minBound..]
596

    
597
-- * OOB supported commands
598

    
599
oobPowerOn :: String
600
oobPowerOn = Types.oobCommandToRaw OobPowerOn
601

    
602
oobPowerOff :: String
603
oobPowerOff = Types.oobCommandToRaw OobPowerOff
604

    
605
oobPowerCycle :: String
606
oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
607

    
608
oobPowerStatus :: String
609
oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
610

    
611
oobHealth :: String
612
oobHealth = Types.oobCommandToRaw OobHealth
613

    
614
oobCommands :: FrozenSet String
615
oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
616

    
617
oobPowerStatusPowered :: String
618
oobPowerStatusPowered = "powered"
619

    
620
-- | 60 seconds
621
oobTimeout :: Int
622
oobTimeout = 60
623

    
624
-- | 2 seconds
625
oobPowerDelay :: Double
626
oobPowerDelay = 2.0
627

    
628
oobStatusCritical :: String
629
oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
630

    
631
oobStatusOk :: String
632
oobStatusOk = Types.oobStatusToRaw OobStatusOk
633

    
634
oobStatusUnknown :: String
635
oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
636

    
637
oobStatusWarning :: String
638
oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
639

    
640
oobStatuses :: FrozenSet String
641
oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
642

    
643
-- * NIC_* constants are used inside the ganeti config
644

    
645
nicLink :: String
646
nicLink = "link"
647

    
648
nicMode :: String
649
nicMode = "mode"
650

    
651
nicVlan :: String
652
nicVlan = "vlan"
653

    
654
nicModeBridged :: String
655
nicModeBridged = Types.nICModeToRaw NMBridged
656

    
657
nicModeRouted :: String
658
nicModeRouted = Types.nICModeToRaw NMRouted
659

    
660
nicModeOvs :: String
661
nicModeOvs = Types.nICModeToRaw NMOvs
662

    
663
nicIpPool :: String
664
nicIpPool = Types.nICModeToRaw NMPool
665

    
666
nicValidModes :: FrozenSet String
667
nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
668

    
669
-- * Hypervisor constants
670

    
671
htXenPvm :: String
672
htXenPvm = Types.hypervisorToRaw XenPvm
673

    
674
htFake :: String
675
htFake = Types.hypervisorToRaw Fake
676

    
677
htXenHvm :: String
678
htXenHvm = Types.hypervisorToRaw XenHvm
679

    
680
htKvm :: String
681
htKvm = Types.hypervisorToRaw Kvm
682

    
683
htChroot :: String
684
htChroot = Types.hypervisorToRaw Chroot
685

    
686
htLxc :: String
687
htLxc = Types.hypervisorToRaw Lxc
688

    
689
hyperTypes :: FrozenSet String
690
hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
691

    
692
htsReqPort :: FrozenSet String
693
htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
694

    
695
-- * Migration type
696

    
697
htMigrationLive :: String
698
htMigrationLive = Types.migrationModeToRaw MigrationLive
699

    
700
htMigrationNonlive :: String
701
htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
702

    
703
htMigrationModes :: FrozenSet String
704
htMigrationModes =
705
  ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
706

    
707
-- * Cluster verify steps
708

    
709
verifyNplusoneMem :: String
710
verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
711

    
712
verifyOptionalChecks :: FrozenSet String
713
verifyOptionalChecks =
714
  ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
715

    
716
-- * Cluster Verify error classes
717

    
718
cvTcluster :: String
719
cvTcluster = "cluster"
720

    
721
cvTgroup :: String
722
cvTgroup = "group"
723

    
724
cvTnode :: String
725
cvTnode = "node"
726

    
727
cvTinstance :: String
728
cvTinstance = "instance"
729

    
730
-- * Cluster Verify error codes and documentation
731

    
732
cvEclustercert :: (String, String, String)
733
cvEclustercert =
734
  ("cluster",
735
   Types.cVErrorCodeToRaw CvECLUSTERCERT,
736
   "Cluster certificate files verification failure")
737

    
738
cvEclustercfg :: (String, String, String)
739
cvEclustercfg =
740
  ("cluster",
741
   Types.cVErrorCodeToRaw CvECLUSTERCFG,
742
   "Cluster configuration verification failure")
743

    
744
cvEclusterdanglinginst :: (String, String, String)
745
cvEclusterdanglinginst =
746
  ("node",
747
   Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
748
   "Some instances have a non-existing primary node")
749

    
750
cvEclusterdanglingnodes :: (String, String, String)
751
cvEclusterdanglingnodes =
752
  ("node",
753
   Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
754
   "Some nodes belong to non-existing groups")
755

    
756
cvEclusterfilecheck :: (String, String, String)
757
cvEclusterfilecheck =
758
  ("cluster",
759
   Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
760
   "Cluster configuration verification failure")
761

    
762
cvEgroupdifferentpvsize :: (String, String, String)
763
cvEgroupdifferentpvsize =
764
  ("group",
765
   Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
766
   "PVs in the group have different sizes")
767

    
768
cvEinstancebadnode :: (String, String, String)
769
cvEinstancebadnode =
770
  ("instance",
771
   Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
772
   "Instance marked as running lives on an offline node")
773

    
774
cvEinstancedown :: (String, String, String)
775
cvEinstancedown =
776
  ("instance",
777
   Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
778
   "Instance not running on its primary node")
779

    
780
cvEinstancefaultydisk :: (String, String, String)
781
cvEinstancefaultydisk =
782
  ("instance",
783
   Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
784
   "Impossible to retrieve status for a disk")
785

    
786
cvEinstancelayout :: (String, String, String)
787
cvEinstancelayout =
788
  ("instance",
789
   Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
790
   "Instance has multiple secondary nodes")
791

    
792
cvEinstancemissingcfgparameter :: (String, String, String)
793
cvEinstancemissingcfgparameter =
794
  ("instance",
795
   Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
796
   "A configuration parameter for an instance is missing")
797

    
798
cvEinstancemissingdisk :: (String, String, String)
799
cvEinstancemissingdisk =
800
  ("instance",
801
   Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
802
   "Missing volume on an instance")
803

    
804
cvEinstancepolicy :: (String, String, String)
805
cvEinstancepolicy =
806
  ("instance",
807
   Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
808
   "Instance does not meet policy")
809

    
810
cvEinstancesplitgroups :: (String, String, String)
811
cvEinstancesplitgroups =
812
  ("instance",
813
   Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
814
   "Instance with primary and secondary nodes in different groups")
815

    
816
cvEinstanceunsuitablenode :: (String, String, String)
817
cvEinstanceunsuitablenode =
818
  ("instance",
819
   Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
820
   "Instance running on nodes that are not suitable for it")
821

    
822
cvEinstancewrongnode :: (String, String, String)
823
cvEinstancewrongnode =
824
  ("instance",
825
   Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
826
   "Instance running on the wrong node")
827

    
828
cvEnodedrbd :: (String, String, String)
829
cvEnodedrbd =
830
  ("node",
831
   Types.cVErrorCodeToRaw CvENODEDRBD,
832
   "Error parsing the DRBD status file")
833

    
834
cvEnodedrbdhelper :: (String, String, String)
835
cvEnodedrbdhelper =
836
  ("node",
837
   Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
838
   "Error caused by the DRBD helper")
839

    
840
cvEnodedrbdversion :: (String, String, String)
841
cvEnodedrbdversion =
842
  ("node",
843
   Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
844
   "DRBD version mismatch within a node group")
845

    
846
cvEnodefilecheck :: (String, String, String)
847
cvEnodefilecheck =
848
  ("node",
849
   Types.cVErrorCodeToRaw CvENODEFILECHECK,
850
   "Error retrieving the checksum of the node files")
851

    
852
cvEnodefilestoragepaths :: (String, String, String)
853
cvEnodefilestoragepaths =
854
  ("node",
855
   Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
856
   "Detected bad file storage paths")
857

    
858
cvEnodefilestoragepathunusable :: (String, String, String)
859
cvEnodefilestoragepathunusable =
860
  ("node",
861
   Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
862
   "File storage path unusable")
863

    
864
cvEnodehooks :: (String, String, String)
865
cvEnodehooks =
866
  ("node",
867
   Types.cVErrorCodeToRaw CvENODEHOOKS,
868
   "Communication failure in hooks execution")
869

    
870
cvEnodehv :: (String, String, String)
871
cvEnodehv =
872
  ("node",
873
   Types.cVErrorCodeToRaw CvENODEHV,
874
   "Hypervisor parameters verification failure")
875

    
876
cvEnodelvm :: (String, String, String)
877
cvEnodelvm =
878
  ("node",
879
   Types.cVErrorCodeToRaw CvENODELVM,
880
   "LVM-related node error")
881

    
882
cvEnoden1 :: (String, String, String)
883
cvEnoden1 =
884
  ("node",
885
   Types.cVErrorCodeToRaw CvENODEN1,
886
   "Not enough memory to accommodate instance failovers")
887

    
888
cvEnodenet :: (String, String, String)
889
cvEnodenet =
890
  ("node",
891
   Types.cVErrorCodeToRaw CvENODENET,
892
   "Network-related node error")
893

    
894
cvEnodeoobpath :: (String, String, String)
895
cvEnodeoobpath =
896
  ("node",
897
   Types.cVErrorCodeToRaw CvENODEOOBPATH,
898
   "Invalid Out Of Band path")
899

    
900
cvEnodeorphaninstance :: (String, String, String)
901
cvEnodeorphaninstance =
902
  ("node",
903
   Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
904
   "Unknown intance running on a node")
905

    
906
cvEnodeorphanlv :: (String, String, String)
907
cvEnodeorphanlv =
908
  ("node",
909
   Types.cVErrorCodeToRaw CvENODEORPHANLV,
910
   "Unknown LVM logical volume")
911

    
912
cvEnodeos :: (String, String, String)
913
cvEnodeos =
914
  ("node",
915
   Types.cVErrorCodeToRaw CvENODEOS,
916
   "OS-related node error")
917

    
918
cvEnoderpc :: (String, String, String)
919
cvEnoderpc =
920
  ("node",
921
   Types.cVErrorCodeToRaw CvENODERPC,
922
   "Error during connection to the primary node of an instance")
923

    
924
cvEnodesetup :: (String, String, String)
925
cvEnodesetup =
926
  ("node",
927
   Types.cVErrorCodeToRaw CvENODESETUP,
928
   "Node setup error")
929

    
930
cvEnodesharedfilestoragepathunusable :: (String, String, String)
931
cvEnodesharedfilestoragepathunusable =
932
  ("node",
933
   Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
934
   "Shared file storage path unusable")
935

    
936
cvEnodessh :: (String, String, String)
937
cvEnodessh =
938
  ("node",
939
   Types.cVErrorCodeToRaw CvENODESSH,
940
   "SSH-related node error")
941

    
942
cvEnodetime :: (String, String, String)
943
cvEnodetime =
944
  ("node",
945
   Types.cVErrorCodeToRaw CvENODETIME,
946
   "Node returned invalid time")
947

    
948
cvEnodeuserscripts :: (String, String, String)
949
cvEnodeuserscripts =
950
  ("node",
951
   Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
952
   "User scripts not present or not executable")
953

    
954
cvEnodeversion :: (String, String, String)
955
cvEnodeversion =
956
  ("node",
957
   Types.cVErrorCodeToRaw CvENODEVERSION,
958
   "Protocol version mismatch or Ganeti version mismatch")
959

    
960
cvAllEcodes :: FrozenSet (String, String, String)
961
cvAllEcodes =
962
  ConstantUtils.mkSet
963
  [cvEclustercert,
964
   cvEclustercfg,
965
   cvEclusterdanglinginst,
966
   cvEclusterdanglingnodes,
967
   cvEclusterfilecheck,
968
   cvEgroupdifferentpvsize,
969
   cvEinstancebadnode,
970
   cvEinstancedown,
971
   cvEinstancefaultydisk,
972
   cvEinstancelayout,
973
   cvEinstancemissingcfgparameter,
974
   cvEinstancemissingdisk,
975
   cvEinstancepolicy,
976
   cvEinstancesplitgroups,
977
   cvEinstanceunsuitablenode,
978
   cvEinstancewrongnode,
979
   cvEnodedrbd,
980
   cvEnodedrbdhelper,
981
   cvEnodedrbdversion,
982
   cvEnodefilecheck,
983
   cvEnodefilestoragepaths,
984
   cvEnodefilestoragepathunusable,
985
   cvEnodehooks,
986
   cvEnodehv,
987
   cvEnodelvm,
988
   cvEnoden1,
989
   cvEnodenet,
990
   cvEnodeoobpath,
991
   cvEnodeorphaninstance,
992
   cvEnodeorphanlv,
993
   cvEnodeos,
994
   cvEnoderpc,
995
   cvEnodesetup,
996
   cvEnodesharedfilestoragepathunusable,
997
   cvEnodessh,
998
   cvEnodetime,
999
   cvEnodeuserscripts,
1000
   cvEnodeversion]
1001

    
1002
cvAllEcodesStrings :: FrozenSet String
1003
cvAllEcodesStrings =
1004
  ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
1005

    
1006
-- * Instance status
1007

    
1008
inststAdmindown :: String
1009
inststAdmindown = Types.instanceStatusToRaw StatusDown
1010

    
1011
inststAdminoffline :: String
1012
inststAdminoffline = Types.instanceStatusToRaw StatusOffline
1013

    
1014
inststErrordown :: String
1015
inststErrordown = Types.instanceStatusToRaw ErrorDown
1016

    
1017
inststErrorup :: String
1018
inststErrorup = Types.instanceStatusToRaw ErrorUp
1019

    
1020
inststNodedown :: String
1021
inststNodedown = Types.instanceStatusToRaw NodeDown
1022

    
1023
inststNodeoffline :: String
1024
inststNodeoffline = Types.instanceStatusToRaw NodeOffline
1025

    
1026
inststRunning :: String
1027
inststRunning = Types.instanceStatusToRaw Running
1028

    
1029
inststWrongnode :: String
1030
inststWrongnode = Types.instanceStatusToRaw WrongNode
1031

    
1032
inststAll :: FrozenSet String
1033
inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
1034

    
1035
-- * Admin states
1036

    
1037
adminstDown :: String
1038
adminstDown = Types.adminStateToRaw AdminDown
1039

    
1040
adminstOffline :: String
1041
adminstOffline = Types.adminStateToRaw AdminOffline
1042

    
1043
adminstUp :: String
1044
adminstUp = Types.adminStateToRaw AdminUp
1045

    
1046
adminstAll :: FrozenSet String
1047
adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
1048

    
1049
-- * Node roles
1050

    
1051
nrDrained :: String
1052
nrDrained = Types.nodeRoleToRaw NRDrained
1053

    
1054
nrMaster :: String
1055
nrMaster = Types.nodeRoleToRaw NRMaster
1056

    
1057
nrMcandidate :: String
1058
nrMcandidate = Types.nodeRoleToRaw NRCandidate
1059

    
1060
nrOffline :: String
1061
nrOffline = Types.nodeRoleToRaw NROffline
1062

    
1063
nrRegular :: String
1064
nrRegular = Types.nodeRoleToRaw NRRegular
1065

    
1066
nrAll :: FrozenSet String
1067
nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
1068

    
1069
-- * Allocator framework constants
1070

    
1071
iallocatorVersion :: Int
1072
iallocatorVersion = 2
1073

    
1074
iallocatorDirIn :: String
1075
iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
1076

    
1077
iallocatorDirOut :: String
1078
iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
1079

    
1080
validIallocatorDirections :: FrozenSet String
1081
validIallocatorDirections =
1082
  ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
1083

    
1084
iallocatorModeAlloc :: String
1085
iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
1086

    
1087
iallocatorModeChgGroup :: String
1088
iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
1089

    
1090
iallocatorModeMultiAlloc :: String
1091
iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
1092

    
1093
iallocatorModeNodeEvac :: String
1094
iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
1095

    
1096
iallocatorModeReloc :: String
1097
iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
1098

    
1099
validIallocatorModes :: FrozenSet String
1100
validIallocatorModes =
1101
  ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
1102

    
1103
iallocatorSearchPath :: [String]
1104
iallocatorSearchPath = AutoConf.iallocatorSearchPath
1105

    
1106
defaultIallocatorShortcut :: String
1107
defaultIallocatorShortcut = "."
1108

    
1109
-- * Node evacuation
1110

    
1111
nodeEvacPri :: String
1112
nodeEvacPri = Types.evacModeToRaw ChangePrimary
1113

    
1114
nodeEvacSec :: String
1115
nodeEvacSec = Types.evacModeToRaw ChangeSecondary
1116

    
1117
nodeEvacAll :: String
1118
nodeEvacAll = Types.evacModeToRaw ChangeAll
1119

    
1120
nodeEvacModes :: FrozenSet String
1121
nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..]
1122

    
1123
-- * Job status
1124

    
1125
jobStatusQueued :: String
1126
jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
1127

    
1128
jobStatusWaiting :: String
1129
jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
1130

    
1131
jobStatusCanceling :: String
1132
jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
1133

    
1134
jobStatusRunning :: String
1135
jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
1136

    
1137
jobStatusCanceled :: String
1138
jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
1139

    
1140
jobStatusSuccess :: String
1141
jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
1142

    
1143
jobStatusError :: String
1144
jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
1145

    
1146
jobsPending :: FrozenSet String
1147
jobsPending =
1148
  ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
1149

    
1150
jobsFinalized :: FrozenSet String
1151
jobsFinalized =
1152
  ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
1153

    
1154
jobStatusAll :: FrozenSet String
1155
jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
1156

    
1157
-- * OpCode status
1158

    
1159
-- ** Not yet finalized opcodes
1160

    
1161
opStatusCanceling :: String
1162
opStatusCanceling = "canceling"
1163

    
1164
opStatusQueued :: String
1165
opStatusQueued = "queued"
1166

    
1167
opStatusRunning :: String
1168
opStatusRunning = "running"
1169

    
1170
opStatusWaiting :: String
1171
opStatusWaiting = "waiting"
1172

    
1173
-- ** Finalized opcodes
1174

    
1175
opStatusCanceled :: String
1176
opStatusCanceled = "canceled"
1177

    
1178
opStatusError :: String
1179
opStatusError = "error"
1180

    
1181
opStatusSuccess :: String
1182
opStatusSuccess = "success"
1183

    
1184
opsFinalized :: FrozenSet String
1185
opsFinalized =
1186
  ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
1187

    
1188
-- * OpCode priority
1189

    
1190
opPrioLowest :: Int
1191
opPrioLowest = 19
1192

    
1193
opPrioHighest :: Int
1194
opPrioHighest = -20
1195

    
1196
opPrioLow :: Int
1197
opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
1198

    
1199
opPrioNormal :: Int
1200
opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
1201

    
1202
opPrioHigh :: Int
1203
opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
1204

    
1205
opPrioSubmitValid :: FrozenSet Int
1206
opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
1207

    
1208
opPrioDefault :: Int
1209
opPrioDefault = opPrioNormal
1210

    
1211
-- * Execution log types
1212

    
1213
elogMessage :: String
1214
elogMessage = Types.eLogTypeToRaw ELogMessage
1215

    
1216
elogRemoteImport :: String
1217
elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
1218

    
1219
elogJqueueTest :: String
1220
elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
1221

    
1222
-- * A few common errors for confd
1223

    
1224
confdErrorArgument :: Int
1225
confdErrorArgument = 3
1226

    
1227
confdErrorInternal :: Int
1228
confdErrorInternal = 2
1229

    
1230
confdErrorUnknownEntry :: Int
1231
confdErrorUnknownEntry = 1
1232

    
1233
-- | Each request is "salted" by the current timestamp.
1234
--
1235
-- This constant decides how many seconds of skew to accept.
1236
--
1237
-- TODO: make this a default and allow the value to be more
1238
-- configurable
1239
confdMaxClockSkew :: Int
1240
confdMaxClockSkew = 2 * nodeMaxClockSkew
1241

    
1242
-- | When we haven't reloaded the config for more than this amount of
1243
-- seconds, we force a test to see if inotify is betraying us. Using a
1244
-- prime number to ensure we get less chance of 'same wakeup' with
1245
-- other processes.
1246
confdConfigReloadTimeout :: Int
1247
confdConfigReloadTimeout = 17
1248

    
1249
-- | If we receive more than one update in this amount of
1250
-- microseconds, we move to polling every RATELIMIT seconds, rather
1251
-- than relying on inotify, to be able to serve more requests.
1252
confdConfigReloadRatelimit :: Int
1253
confdConfigReloadRatelimit = 250000
1254

    
1255
-- | Magic number prepended to all confd queries.
1256
--
1257
-- This allows us to distinguish different types of confd protocols
1258
-- and handle them. For example by changing this we can move the whole
1259
-- payload to be compressed, or move away from json.
1260
confdMagicFourcc :: String
1261
confdMagicFourcc = "plj0"
1262

    
1263
-- | By default a confd request is sent to the minimum between this
1264
-- number and all MCs. 6 was chosen because even in the case of a
1265
-- disastrous 50% response rate, we should have enough answers to be
1266
-- able to compare more than one.
1267
confdDefaultReqCoverage :: Int
1268
confdDefaultReqCoverage = 6
1269

    
1270
-- | Timeout in seconds to expire pending query request in the confd
1271
-- client library. We don't actually expect any answer more than 10
1272
-- seconds after we sent a request.
1273
confdClientExpireTimeout :: Int
1274
confdClientExpireTimeout = 10
1275

    
1276
-- * Possible values for NodeGroup.alloc_policy
1277

    
1278
allocPolicyLastResort :: String
1279
allocPolicyLastResort = Types.allocPolicyToRaw AllocLastResort
1280

    
1281
allocPolicyPreferred :: String
1282
allocPolicyPreferred = Types.allocPolicyToRaw AllocPreferred
1283

    
1284
allocPolicyUnallocable :: String
1285
allocPolicyUnallocable = Types.allocPolicyToRaw AllocUnallocable
1286

    
1287
validAllocPolicies :: [String]
1288
validAllocPolicies = map Types.allocPolicyToRaw [minBound..]
1289

    
1290
-- | Temporary external/shared storage parameters
1291
blockdevDriverManual :: String
1292
blockdevDriverManual = Types.blockDriverToRaw BlockDrvManual
1293

    
1294
-- | 'qemu-img' path, required for 'ovfconverter'
1295
qemuimgPath :: String
1296
qemuimgPath = AutoConf.qemuimgPath
1297

    
1298
-- | Whether htools was enabled at compilation time
1299
--
1300
-- FIXME: this should be moved next to the other enable constants,
1301
-- such as, 'enableConfd', and renamed to 'enableHtools'.
1302
htools :: Bool
1303
htools = AutoConf.htools
1304

    
1305
-- | Path generating random UUID
1306
randomUuidFile :: String
1307
randomUuidFile = ConstantUtils.randomUuidFile
1308

    
1309
-- * Auto-repair tag prefixes
1310

    
1311
autoRepairTagPrefix :: String
1312
autoRepairTagPrefix = "ganeti:watcher:autorepair:"
1313

    
1314
autoRepairTagEnabled :: String
1315
autoRepairTagEnabled = autoRepairTagPrefix
1316

    
1317
autoRepairTagPending :: String
1318
autoRepairTagPending = autoRepairTagPrefix ++ "pending:"
1319

    
1320
autoRepairTagResult :: String
1321
autoRepairTagResult = autoRepairTagPrefix ++ "result:"
1322

    
1323
autoRepairTagSuspended :: String
1324
autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:"
1325

    
1326
-- * Auto-repair levels
1327

    
1328
autoRepairFailover :: String
1329
autoRepairFailover = "failover"
1330

    
1331
autoRepairFixStorage :: String
1332
autoRepairFixStorage = "fix-storage"
1333

    
1334
autoRepairMigrate :: String
1335
autoRepairMigrate = "migrate"
1336

    
1337
autoRepairReinstall :: String
1338
autoRepairReinstall = "reinstall"
1339

    
1340
autoRepairAllTypes :: FrozenSet String
1341
autoRepairAllTypes =
1342
  ConstantUtils.mkSet [autoRepairFailover,
1343
                       autoRepairFixStorage,
1344
                       autoRepairMigrate,
1345
                       autoRepairReinstall]
1346

    
1347
-- * Auto-repair results
1348

    
1349
autoRepairEnoperm :: String
1350
autoRepairEnoperm = "enoperm"
1351

    
1352
autoRepairFailure :: String
1353
autoRepairFailure = "failure"
1354

    
1355
autoRepairSuccess :: String
1356
autoRepairSuccess = "success"
1357

    
1358
autoRepairAllResults :: FrozenSet String
1359
autoRepairAllResults =
1360
  ConstantUtils.mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess]
1361

    
1362
-- | The version identifier for builtin data collectors
1363
builtinDataCollectorVersion :: String
1364
builtinDataCollectorVersion = "B"
1365

    
1366
-- | The reason trail opcode parameter name
1367
opcodeReason :: String
1368
opcodeReason = "reason"
1369

    
1370
diskstatsFile :: String
1371
diskstatsFile = "/proc/diskstats"
1372

    
1373
-- | CPU load collector
1374
statFile :: String
1375
statFile = "/proc/stat"
1376

    
1377
-- | Mond's variable for periodical data collection
1378
mondTimeInterval :: Int
1379
mondTimeInterval = 5
1380

    
1381
-- * Disk access modes
1382

    
1383
diskUserspace :: String
1384
diskUserspace = Types.diskAccessModeToRaw DiskUserspace
1385

    
1386
diskKernelspace :: String
1387
diskKernelspace = Types.diskAccessModeToRaw DiskKernelspace
1388

    
1389
diskValidAccessModes :: FrozenSet String
1390
diskValidAccessModes =
1391
  ConstantUtils.mkSet $ map Types.diskAccessModeToRaw [minBound..]