Statistics
| Branch: | Tag: | Revision:

root / src / Ganeti / HsConstants.hs @ 55f0626b

History | View | Annotate | Download (34.7 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
sharedir :: String
103
sharedir = AutoConf.sharedir
104

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

    
107
manPages :: Map String Int
108
manPages = Map.fromList AutoConf.manPages
109

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

    
112
versionedsharedir :: String
113
versionedsharedir = AutoConf.versionedsharedir
114

    
115
-- * 'autoconf' constants for Python only ('tests/py/docs_unittest.py')
116

    
117
gntScripts :: [String]
118
gntScripts = AutoConf.gntScripts
119

    
120
-- * Various versions
121

    
122
releaseVersion :: String
123
releaseVersion = AutoConf.packageVersion
124

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

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

    
131
versionRevision :: Int
132
versionRevision = AutoConf.versionRevision
133

    
134
configMajor :: Int
135
configMajor = AutoConf.versionMajor
136

    
137
configMinor :: Int
138
configMinor = AutoConf.versionMinor
139

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

    
145
configVersion :: Int
146
configVersion = buildVersion configMajor configMinor configRevision
147

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

    
153
-- * User separation
154
daemonsGroup :: String
155
daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
156

    
157
adminGroup :: String
158
adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
159

    
160
masterdUser :: String
161
masterdUser = Runtime.daemonUser GanetiMasterd
162

    
163
masterdGroup :: String
164
masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
165

    
166
rapiUser :: String
167
rapiUser = Runtime.daemonUser GanetiRapi
168

    
169
rapiGroup :: String
170
rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
171

    
172
confdUser :: String
173
confdUser = Runtime.daemonUser GanetiConfd
174

    
175
confdGroup :: String
176
confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
177

    
178
luxidUser :: String
179
luxidUser = Runtime.daemonUser GanetiLuxid
180

    
181
luxidGroup :: String
182
luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
183

    
184
nodedUser :: String
185
nodedUser = Runtime.daemonUser GanetiNoded
186

    
187
nodedGroup :: String
188
nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
189

    
190
mondUser :: String
191
mondUser = Runtime.daemonUser GanetiMond
192

    
193
mondGroup :: String
194
mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
195

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

    
199
sshConsoleUser :: String
200
sshConsoleUser = AutoConf.sshConsoleUser
201

    
202
-- * 'autoconf' enable/disable
203

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

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

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

    
213
enableSplitQuery :: Bool
214
enableSplitQuery = AutoConf.enableSplitQuery
215

    
216
-- * SSH constants
217

    
218
ssh :: String
219
ssh = "ssh"
220

    
221
scp :: String
222
scp = "scp"
223

    
224
-- * Daemons
225

    
226
confd :: String
227
confd = Runtime.daemonName GanetiConfd
228

    
229
masterd :: String
230
masterd = Runtime.daemonName GanetiMasterd
231

    
232
mond :: String
233
mond = Runtime.daemonName GanetiMond
234

    
235
noded :: String
236
noded = Runtime.daemonName GanetiNoded
237

    
238
luxid :: String
239
luxid = Runtime.daemonName GanetiLuxid
240

    
241
rapi :: String
242
rapi = Runtime.daemonName GanetiRapi
243

    
244
daemons :: FrozenSet String
245
daemons =
246
  ConstantUtils.mkSet [confd,
247
                       luxid,
248
                       masterd,
249
                       mond,
250
                       noded,
251
                       rapi]
252

    
253
defaultConfdPort :: Int
254
defaultConfdPort = 1814
255

    
256
defaultMondPort :: Int
257
defaultMondPort = 1815
258

    
259
defaultNodedPort :: Int
260
defaultNodedPort = 1811
261

    
262
defaultRapiPort :: Int
263
defaultRapiPort = 5080
264

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

    
273
daemonsLogbase :: Map String String
274
daemonsLogbase =
275
  Map.fromList
276
  [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
277

    
278
extraLogreasonAccess :: String
279
extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
280

    
281
extraLogreasonError :: String
282
extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
283

    
284
devConsole :: String
285
devConsole = ConstantUtils.devConsole
286

    
287
-- * Syslog
288

    
289
syslogUsage :: String
290
syslogUsage = AutoConf.syslogUsage
291

    
292
syslogNo :: String
293
syslogNo = Logging.syslogUsageToRaw SyslogNo
294

    
295
syslogYes :: String
296
syslogYes = Logging.syslogUsageToRaw SyslogYes
297

    
298
syslogOnly :: String
299
syslogOnly = Logging.syslogUsageToRaw SyslogOnly
300

    
301
syslogSocket :: String
302
syslogSocket = "/dev/log"
303

    
304
-- * Xen
305

    
306
xenBootloader :: String
307
xenBootloader = AutoConf.xenBootloader
308

    
309
xenCmdXl :: String
310
xenCmdXl = "xl"
311

    
312
xenCmdXm :: String
313
xenCmdXm = "xm"
314

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

    
318
xenKernel :: String
319
xenKernel = AutoConf.xenKernel
320

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

    
326
-- * KVM and socat
327

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

    
331
kvmKernel :: String
332
kvmKernel = AutoConf.kvmKernel
333

    
334
socatEscapeCode :: String
335
socatEscapeCode = "0x1d"
336

    
337
socatPath :: String
338
socatPath = AutoConf.socatPath
339

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

    
343
socatUseEscape :: Bool
344
socatUseEscape = AutoConf.socatUseEscape
345

    
346
-- * Storage types
347

    
348
stBlock :: String
349
stBlock = Types.storageTypeToRaw StorageBlock
350

    
351
stDiskless :: String
352
stDiskless = Types.storageTypeToRaw StorageDiskless
353

    
354
stExt :: String
355
stExt = Types.storageTypeToRaw StorageExt
356

    
357
stFile :: String
358
stFile = Types.storageTypeToRaw StorageFile
359

    
360
stLvmPv :: String
361
stLvmPv = Types.storageTypeToRaw StorageLvmPv
362

    
363
stLvmVg :: String
364
stLvmVg = Types.storageTypeToRaw StorageLvmVg
365

    
366
stRados :: String
367
stRados = Types.storageTypeToRaw StorageRados
368

    
369
storageTypes :: FrozenSet String
370
storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
371

    
372
-- * Storage fields
373
-- ** First two are valid in LU context only, not passed to backend
374

    
375
sfNode :: String
376
sfNode = "node"
377

    
378
sfType :: String
379
sfType = "type"
380

    
381
-- ** and the rest are valid in backend
382

    
383
sfAllocatable :: String
384
sfAllocatable = Types.storageFieldToRaw SFAllocatable
385

    
386
sfFree :: String
387
sfFree = Types.storageFieldToRaw SFFree
388

    
389
sfName :: String
390
sfName = Types.storageFieldToRaw SFName
391

    
392
sfSize :: String
393
sfSize = Types.storageFieldToRaw SFSize
394

    
395
sfUsed :: String
396
sfUsed = Types.storageFieldToRaw SFUsed
397

    
398
-- * Disk template types
399

    
400
dtDiskless :: String
401
dtDiskless = Types.diskTemplateToRaw DTDiskless
402

    
403
dtFile :: String
404
dtFile = Types.diskTemplateToRaw DTFile
405

    
406
dtSharedFile :: String
407
dtSharedFile = Types.diskTemplateToRaw DTSharedFile
408

    
409
dtPlain :: String
410
dtPlain = Types.diskTemplateToRaw DTPlain
411

    
412
dtBlock :: String
413
dtBlock = Types.diskTemplateToRaw DTBlock
414

    
415
dtDrbd8 :: String
416
dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
417

    
418
dtRbd :: String
419
dtRbd = Types.diskTemplateToRaw DTRbd
420

    
421
dtExt :: String
422
dtExt = Types.diskTemplateToRaw DTExt
423

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

    
434
diskTemplates :: FrozenSet String
435
diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
436

    
437
-- | Disk templates that are enabled by default
438
defaultEnabledDiskTemplates :: [String]
439
defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
440

    
441
-- * File backend driver
442

    
443
fdBlktap :: String
444
fdBlktap = Types.fileDriverToRaw FileBlktap
445

    
446
fdLoop :: String
447
fdLoop = Types.fileDriverToRaw FileLoop
448

    
449
-- * Disk access mode
450

    
451
diskRdonly :: String
452
diskRdonly = Types.diskModeToRaw DiskRdOnly
453

    
454
diskRdwr :: String
455
diskRdwr = Types.diskModeToRaw DiskRdWr
456

    
457
diskAccessSet :: FrozenSet String
458
diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..]
459

    
460
-- * Instance export mode
461

    
462
exportModeLocal :: String
463
exportModeLocal = Types.exportModeToRaw ExportModeLocal
464

    
465
exportModeRemote :: String
466
exportModeRemote = Types.exportModeToRaw ExportModeRemote
467

    
468
exportModes :: FrozenSet String
469
exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
470

    
471
-- * Instance creation modes
472

    
473
instanceCreate :: String
474
instanceCreate = Types.instCreateModeToRaw InstCreate
475

    
476
instanceImport :: String
477
instanceImport = Types.instCreateModeToRaw InstImport
478

    
479
instanceRemoteImport :: String
480
instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
481

    
482
instanceCreateModes :: FrozenSet String
483
instanceCreateModes =
484
  ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
485

    
486
-- * Dynamic device modification
487

    
488
ddmAdd :: String
489
ddmAdd = Types.ddmFullToRaw DdmFullAdd
490

    
491
ddmModify :: String
492
ddmModify = Types.ddmFullToRaw DdmFullModify
493

    
494
ddmRemove :: String
495
ddmRemove = Types.ddmFullToRaw DdmFullRemove
496

    
497
ddmsValues :: FrozenSet String
498
ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
499

    
500
ddmsValuesWithModify :: FrozenSet String
501
ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
502

    
503
-- * Common exit codes
504

    
505
exitSuccess :: Int
506
exitSuccess = 0
507

    
508
exitFailure :: Int
509
exitFailure = ConstantUtils.exitFailure
510

    
511
exitNotcluster :: Int
512
exitNotcluster = 5
513

    
514
exitNotmaster :: Int
515
exitNotmaster = 11
516

    
517
exitNodesetupError :: Int
518
exitNodesetupError = 12
519

    
520
-- | Need user confirmation
521
exitConfirmation :: Int
522
exitConfirmation = 13
523

    
524
-- | Exit code for query operations with unknown fields
525
exitUnknownField :: Int
526
exitUnknownField = 14
527

    
528
-- * Tags
529

    
530
tagCluster :: String
531
tagCluster = Types.tagKindToRaw TagKindCluster
532

    
533
tagInstance :: String
534
tagInstance = Types.tagKindToRaw TagKindInstance
535

    
536
tagNetwork :: String
537
tagNetwork = Types.tagKindToRaw TagKindNetwork
538

    
539
tagNode :: String
540
tagNode = Types.tagKindToRaw TagKindNode
541

    
542
tagNodegroup :: String
543
tagNodegroup = Types.tagKindToRaw TagKindGroup
544

    
545
validTagTypes :: FrozenSet String
546
validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
547

    
548
maxTagLen :: Int
549
maxTagLen = 128
550

    
551
maxTagsPerObj :: Int
552
maxTagsPerObj = 4096
553

    
554
-- | Node clock skew in seconds
555
nodeMaxClockSkew :: Int
556
nodeMaxClockSkew = 150
557

    
558
-- | Disk index separator
559
diskSeparator :: String
560
diskSeparator = AutoConf.diskSeparator
561

    
562
ipCommandPath :: String
563
ipCommandPath = AutoConf.ipPath
564

    
565
-- * Reboot types
566

    
567
instanceRebootSoft :: String
568
instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
569

    
570
instanceRebootHard :: String
571
instanceRebootHard = Types.rebootTypeToRaw RebootHard
572

    
573
instanceRebootFull :: String
574
instanceRebootFull = Types.rebootTypeToRaw RebootFull
575

    
576
rebootTypes :: FrozenSet String
577
rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
578

    
579
-- * VTypes
580

    
581
vtypeBool :: String
582
vtypeBool = Types.vTypeToRaw VTypeBool
583

    
584
vtypeInt :: String
585
vtypeInt = Types.vTypeToRaw VTypeInt
586

    
587
vtypeMaybeString :: String
588
vtypeMaybeString = Types.vTypeToRaw VTypeMaybeString
589

    
590
-- | Size in MiBs
591
vtypeSize :: String
592
vtypeSize = Types.vTypeToRaw VTypeSize
593

    
594
vtypeString :: String
595
vtypeString = Types.vTypeToRaw VTypeString
596

    
597
enforceableTypes :: FrozenSet String
598
enforceableTypes = ConstantUtils.mkSet $ map Types.vTypeToRaw [minBound..]
599

    
600
-- * OOB supported commands
601

    
602
oobPowerOn :: String
603
oobPowerOn = Types.oobCommandToRaw OobPowerOn
604

    
605
oobPowerOff :: String
606
oobPowerOff = Types.oobCommandToRaw OobPowerOff
607

    
608
oobPowerCycle :: String
609
oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
610

    
611
oobPowerStatus :: String
612
oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
613

    
614
oobHealth :: String
615
oobHealth = Types.oobCommandToRaw OobHealth
616

    
617
oobCommands :: FrozenSet String
618
oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
619

    
620
oobPowerStatusPowered :: String
621
oobPowerStatusPowered = "powered"
622

    
623
-- | 60 seconds
624
oobTimeout :: Int
625
oobTimeout = 60
626

    
627
-- | 2 seconds
628
oobPowerDelay :: Double
629
oobPowerDelay = 2.0
630

    
631
oobStatusCritical :: String
632
oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
633

    
634
oobStatusOk :: String
635
oobStatusOk = Types.oobStatusToRaw OobStatusOk
636

    
637
oobStatusUnknown :: String
638
oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
639

    
640
oobStatusWarning :: String
641
oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
642

    
643
oobStatuses :: FrozenSet String
644
oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
645

    
646
-- * NIC_* constants are used inside the ganeti config
647

    
648
nicLink :: String
649
nicLink = "link"
650

    
651
nicMode :: String
652
nicMode = "mode"
653

    
654
nicVlan :: String
655
nicVlan = "vlan"
656

    
657
nicModeBridged :: String
658
nicModeBridged = Types.nICModeToRaw NMBridged
659

    
660
nicModeRouted :: String
661
nicModeRouted = Types.nICModeToRaw NMRouted
662

    
663
nicModeOvs :: String
664
nicModeOvs = Types.nICModeToRaw NMOvs
665

    
666
nicIpPool :: String
667
nicIpPool = Types.nICModeToRaw NMPool
668

    
669
nicValidModes :: FrozenSet String
670
nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
671

    
672
-- * Hypervisor constants
673

    
674
htXenPvm :: String
675
htXenPvm = Types.hypervisorToRaw XenPvm
676

    
677
htFake :: String
678
htFake = Types.hypervisorToRaw Fake
679

    
680
htXenHvm :: String
681
htXenHvm = Types.hypervisorToRaw XenHvm
682

    
683
htKvm :: String
684
htKvm = Types.hypervisorToRaw Kvm
685

    
686
htChroot :: String
687
htChroot = Types.hypervisorToRaw Chroot
688

    
689
htLxc :: String
690
htLxc = Types.hypervisorToRaw Lxc
691

    
692
hyperTypes :: FrozenSet String
693
hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
694

    
695
htsReqPort :: FrozenSet String
696
htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
697

    
698
-- * Migration type
699

    
700
htMigrationLive :: String
701
htMigrationLive = Types.migrationModeToRaw MigrationLive
702

    
703
htMigrationNonlive :: String
704
htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
705

    
706
htMigrationModes :: FrozenSet String
707
htMigrationModes =
708
  ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
709

    
710
-- * Cluster verify steps
711

    
712
verifyNplusoneMem :: String
713
verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
714

    
715
verifyOptionalChecks :: FrozenSet String
716
verifyOptionalChecks =
717
  ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
718

    
719
-- * Cluster Verify error classes
720

    
721
cvTcluster :: String
722
cvTcluster = "cluster"
723

    
724
cvTgroup :: String
725
cvTgroup = "group"
726

    
727
cvTnode :: String
728
cvTnode = "node"
729

    
730
cvTinstance :: String
731
cvTinstance = "instance"
732

    
733
-- * Cluster Verify error codes and documentation
734

    
735
cvEclustercert :: (String, String, String)
736
cvEclustercert =
737
  ("cluster",
738
   Types.cVErrorCodeToRaw CvECLUSTERCERT,
739
   "Cluster certificate files verification failure")
740

    
741
cvEclustercfg :: (String, String, String)
742
cvEclustercfg =
743
  ("cluster",
744
   Types.cVErrorCodeToRaw CvECLUSTERCFG,
745
   "Cluster configuration verification failure")
746

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

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

    
759
cvEclusterfilecheck :: (String, String, String)
760
cvEclusterfilecheck =
761
  ("cluster",
762
   Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
763
   "Cluster configuration verification failure")
764

    
765
cvEgroupdifferentpvsize :: (String, String, String)
766
cvEgroupdifferentpvsize =
767
  ("group",
768
   Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
769
   "PVs in the group have different sizes")
770

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

    
777
cvEinstancedown :: (String, String, String)
778
cvEinstancedown =
779
  ("instance",
780
   Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
781
   "Instance not running on its primary node")
782

    
783
cvEinstancefaultydisk :: (String, String, String)
784
cvEinstancefaultydisk =
785
  ("instance",
786
   Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
787
   "Impossible to retrieve status for a disk")
788

    
789
cvEinstancelayout :: (String, String, String)
790
cvEinstancelayout =
791
  ("instance",
792
   Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
793
   "Instance has multiple secondary nodes")
794

    
795
cvEinstancemissingcfgparameter :: (String, String, String)
796
cvEinstancemissingcfgparameter =
797
  ("instance",
798
   Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
799
   "A configuration parameter for an instance is missing")
800

    
801
cvEinstancemissingdisk :: (String, String, String)
802
cvEinstancemissingdisk =
803
  ("instance",
804
   Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
805
   "Missing volume on an instance")
806

    
807
cvEinstancepolicy :: (String, String, String)
808
cvEinstancepolicy =
809
  ("instance",
810
   Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
811
   "Instance does not meet policy")
812

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

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

    
825
cvEinstancewrongnode :: (String, String, String)
826
cvEinstancewrongnode =
827
  ("instance",
828
   Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
829
   "Instance running on the wrong node")
830

    
831
cvEnodedrbd :: (String, String, String)
832
cvEnodedrbd =
833
  ("node",
834
   Types.cVErrorCodeToRaw CvENODEDRBD,
835
   "Error parsing the DRBD status file")
836

    
837
cvEnodedrbdhelper :: (String, String, String)
838
cvEnodedrbdhelper =
839
  ("node",
840
   Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
841
   "Error caused by the DRBD helper")
842

    
843
cvEnodedrbdversion :: (String, String, String)
844
cvEnodedrbdversion =
845
  ("node",
846
   Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
847
   "DRBD version mismatch within a node group")
848

    
849
cvEnodefilecheck :: (String, String, String)
850
cvEnodefilecheck =
851
  ("node",
852
   Types.cVErrorCodeToRaw CvENODEFILECHECK,
853
   "Error retrieving the checksum of the node files")
854

    
855
cvEnodefilestoragepaths :: (String, String, String)
856
cvEnodefilestoragepaths =
857
  ("node",
858
   Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
859
   "Detected bad file storage paths")
860

    
861
cvEnodefilestoragepathunusable :: (String, String, String)
862
cvEnodefilestoragepathunusable =
863
  ("node",
864
   Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
865
   "File storage path unusable")
866

    
867
cvEnodehooks :: (String, String, String)
868
cvEnodehooks =
869
  ("node",
870
   Types.cVErrorCodeToRaw CvENODEHOOKS,
871
   "Communication failure in hooks execution")
872

    
873
cvEnodehv :: (String, String, String)
874
cvEnodehv =
875
  ("node",
876
   Types.cVErrorCodeToRaw CvENODEHV,
877
   "Hypervisor parameters verification failure")
878

    
879
cvEnodelvm :: (String, String, String)
880
cvEnodelvm =
881
  ("node",
882
   Types.cVErrorCodeToRaw CvENODELVM,
883
   "LVM-related node error")
884

    
885
cvEnoden1 :: (String, String, String)
886
cvEnoden1 =
887
  ("node",
888
   Types.cVErrorCodeToRaw CvENODEN1,
889
   "Not enough memory to accommodate instance failovers")
890

    
891
cvEnodenet :: (String, String, String)
892
cvEnodenet =
893
  ("node",
894
   Types.cVErrorCodeToRaw CvENODENET,
895
   "Network-related node error")
896

    
897
cvEnodeoobpath :: (String, String, String)
898
cvEnodeoobpath =
899
  ("node",
900
   Types.cVErrorCodeToRaw CvENODEOOBPATH,
901
   "Invalid Out Of Band path")
902

    
903
cvEnodeorphaninstance :: (String, String, String)
904
cvEnodeorphaninstance =
905
  ("node",
906
   Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
907
   "Unknown intance running on a node")
908

    
909
cvEnodeorphanlv :: (String, String, String)
910
cvEnodeorphanlv =
911
  ("node",
912
   Types.cVErrorCodeToRaw CvENODEORPHANLV,
913
   "Unknown LVM logical volume")
914

    
915
cvEnodeos :: (String, String, String)
916
cvEnodeos =
917
  ("node",
918
   Types.cVErrorCodeToRaw CvENODEOS,
919
   "OS-related node error")
920

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

    
927
cvEnodesetup :: (String, String, String)
928
cvEnodesetup =
929
  ("node",
930
   Types.cVErrorCodeToRaw CvENODESETUP,
931
   "Node setup error")
932

    
933
cvEnodesharedfilestoragepathunusable :: (String, String, String)
934
cvEnodesharedfilestoragepathunusable =
935
  ("node",
936
   Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
937
   "Shared file storage path unusable")
938

    
939
cvEnodessh :: (String, String, String)
940
cvEnodessh =
941
  ("node",
942
   Types.cVErrorCodeToRaw CvENODESSH,
943
   "SSH-related node error")
944

    
945
cvEnodetime :: (String, String, String)
946
cvEnodetime =
947
  ("node",
948
   Types.cVErrorCodeToRaw CvENODETIME,
949
   "Node returned invalid time")
950

    
951
cvEnodeuserscripts :: (String, String, String)
952
cvEnodeuserscripts =
953
  ("node",
954
   Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
955
   "User scripts not present or not executable")
956

    
957
cvEnodeversion :: (String, String, String)
958
cvEnodeversion =
959
  ("node",
960
   Types.cVErrorCodeToRaw CvENODEVERSION,
961
   "Protocol version mismatch or Ganeti version mismatch")
962

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

    
1005
cvAllEcodesStrings :: FrozenSet String
1006
cvAllEcodesStrings =
1007
  ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
1008

    
1009
-- * Instance status
1010

    
1011
inststAdmindown :: String
1012
inststAdmindown = Types.instanceStatusToRaw StatusDown
1013

    
1014
inststAdminoffline :: String
1015
inststAdminoffline = Types.instanceStatusToRaw StatusOffline
1016

    
1017
inststErrordown :: String
1018
inststErrordown = Types.instanceStatusToRaw ErrorDown
1019

    
1020
inststErrorup :: String
1021
inststErrorup = Types.instanceStatusToRaw ErrorUp
1022

    
1023
inststNodedown :: String
1024
inststNodedown = Types.instanceStatusToRaw NodeDown
1025

    
1026
inststNodeoffline :: String
1027
inststNodeoffline = Types.instanceStatusToRaw NodeOffline
1028

    
1029
inststRunning :: String
1030
inststRunning = Types.instanceStatusToRaw Running
1031

    
1032
inststWrongnode :: String
1033
inststWrongnode = Types.instanceStatusToRaw WrongNode
1034

    
1035
inststAll :: FrozenSet String
1036
inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
1037

    
1038
-- * Admin states
1039

    
1040
adminstDown :: String
1041
adminstDown = Types.adminStateToRaw AdminDown
1042

    
1043
adminstOffline :: String
1044
adminstOffline = Types.adminStateToRaw AdminOffline
1045

    
1046
adminstUp :: String
1047
adminstUp = Types.adminStateToRaw AdminUp
1048

    
1049
adminstAll :: FrozenSet String
1050
adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
1051

    
1052
-- * Node roles
1053

    
1054
nrDrained :: String
1055
nrDrained = Types.nodeRoleToRaw NRDrained
1056

    
1057
nrMaster :: String
1058
nrMaster = Types.nodeRoleToRaw NRMaster
1059

    
1060
nrMcandidate :: String
1061
nrMcandidate = Types.nodeRoleToRaw NRCandidate
1062

    
1063
nrOffline :: String
1064
nrOffline = Types.nodeRoleToRaw NROffline
1065

    
1066
nrRegular :: String
1067
nrRegular = Types.nodeRoleToRaw NRRegular
1068

    
1069
nrAll :: FrozenSet String
1070
nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
1071

    
1072
-- * Allocator framework constants
1073

    
1074
iallocatorVersion :: Int
1075
iallocatorVersion = 2
1076

    
1077
iallocatorDirIn :: String
1078
iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
1079

    
1080
iallocatorDirOut :: String
1081
iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
1082

    
1083
validIallocatorDirections :: FrozenSet String
1084
validIallocatorDirections =
1085
  ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
1086

    
1087
iallocatorModeAlloc :: String
1088
iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
1089

    
1090
iallocatorModeChgGroup :: String
1091
iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
1092

    
1093
iallocatorModeMultiAlloc :: String
1094
iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
1095

    
1096
iallocatorModeNodeEvac :: String
1097
iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
1098

    
1099
iallocatorModeReloc :: String
1100
iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
1101

    
1102
validIallocatorModes :: FrozenSet String
1103
validIallocatorModes =
1104
  ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
1105

    
1106
iallocatorSearchPath :: [String]
1107
iallocatorSearchPath = AutoConf.iallocatorSearchPath
1108

    
1109
defaultIallocatorShortcut :: String
1110
defaultIallocatorShortcut = "."
1111

    
1112
-- * Node evacuation
1113

    
1114
nodeEvacPri :: String
1115
nodeEvacPri = Types.evacModeToRaw ChangePrimary
1116

    
1117
nodeEvacSec :: String
1118
nodeEvacSec = Types.evacModeToRaw ChangeSecondary
1119

    
1120
nodeEvacAll :: String
1121
nodeEvacAll = Types.evacModeToRaw ChangeAll
1122

    
1123
nodeEvacModes :: FrozenSet String
1124
nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..]
1125

    
1126
-- * Job status
1127

    
1128
jobStatusQueued :: String
1129
jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
1130

    
1131
jobStatusWaiting :: String
1132
jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
1133

    
1134
jobStatusCanceling :: String
1135
jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
1136

    
1137
jobStatusRunning :: String
1138
jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
1139

    
1140
jobStatusCanceled :: String
1141
jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
1142

    
1143
jobStatusSuccess :: String
1144
jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
1145

    
1146
jobStatusError :: String
1147
jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
1148

    
1149
jobsPending :: FrozenSet String
1150
jobsPending =
1151
  ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
1152

    
1153
jobsFinalized :: FrozenSet String
1154
jobsFinalized =
1155
  ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
1156

    
1157
jobStatusAll :: FrozenSet String
1158
jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
1159

    
1160
-- * OpCode status
1161

    
1162
-- ** Not yet finalized opcodes
1163

    
1164
opStatusCanceling :: String
1165
opStatusCanceling = "canceling"
1166

    
1167
opStatusQueued :: String
1168
opStatusQueued = "queued"
1169

    
1170
opStatusRunning :: String
1171
opStatusRunning = "running"
1172

    
1173
opStatusWaiting :: String
1174
opStatusWaiting = "waiting"
1175

    
1176
-- ** Finalized opcodes
1177

    
1178
opStatusCanceled :: String
1179
opStatusCanceled = "canceled"
1180

    
1181
opStatusError :: String
1182
opStatusError = "error"
1183

    
1184
opStatusSuccess :: String
1185
opStatusSuccess = "success"
1186

    
1187
opsFinalized :: FrozenSet String
1188
opsFinalized =
1189
  ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
1190

    
1191
-- * OpCode priority
1192

    
1193
opPrioLowest :: Int
1194
opPrioLowest = 19
1195

    
1196
opPrioHighest :: Int
1197
opPrioHighest = -20
1198

    
1199
opPrioLow :: Int
1200
opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
1201

    
1202
opPrioNormal :: Int
1203
opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
1204

    
1205
opPrioHigh :: Int
1206
opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
1207

    
1208
opPrioSubmitValid :: FrozenSet Int
1209
opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
1210

    
1211
opPrioDefault :: Int
1212
opPrioDefault = opPrioNormal
1213

    
1214
-- * Execution log types
1215

    
1216
elogMessage :: String
1217
elogMessage = Types.eLogTypeToRaw ELogMessage
1218

    
1219
elogRemoteImport :: String
1220
elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
1221

    
1222
elogJqueueTest :: String
1223
elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
1224

    
1225
-- * A few common errors for confd
1226

    
1227
confdErrorArgument :: Int
1228
confdErrorArgument = 3
1229

    
1230
confdErrorInternal :: Int
1231
confdErrorInternal = 2
1232

    
1233
confdErrorUnknownEntry :: Int
1234
confdErrorUnknownEntry = 1
1235

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

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

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

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

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

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

    
1279
-- * Possible values for NodeGroup.alloc_policy
1280

    
1281
allocPolicyLastResort :: String
1282
allocPolicyLastResort = Types.allocPolicyToRaw AllocLastResort
1283

    
1284
allocPolicyPreferred :: String
1285
allocPolicyPreferred = Types.allocPolicyToRaw AllocPreferred
1286

    
1287
allocPolicyUnallocable :: String
1288
allocPolicyUnallocable = Types.allocPolicyToRaw AllocUnallocable
1289

    
1290
validAllocPolicies :: [String]
1291
validAllocPolicies = map Types.allocPolicyToRaw [minBound..]
1292

    
1293
-- | Temporary external/shared storage parameters
1294
blockdevDriverManual :: String
1295
blockdevDriverManual = Types.blockDriverToRaw BlockDrvManual
1296

    
1297
-- | 'qemu-img' path, required for 'ovfconverter'
1298
qemuimgPath :: String
1299
qemuimgPath = AutoConf.qemuimgPath
1300

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

    
1308
-- | Path generating random UUID
1309
randomUuidFile :: String
1310
randomUuidFile = ConstantUtils.randomUuidFile
1311

    
1312
-- * Auto-repair tag prefixes
1313

    
1314
autoRepairTagPrefix :: String
1315
autoRepairTagPrefix = "ganeti:watcher:autorepair:"
1316

    
1317
autoRepairTagEnabled :: String
1318
autoRepairTagEnabled = autoRepairTagPrefix
1319

    
1320
autoRepairTagPending :: String
1321
autoRepairTagPending = autoRepairTagPrefix ++ "pending:"
1322

    
1323
autoRepairTagResult :: String
1324
autoRepairTagResult = autoRepairTagPrefix ++ "result:"
1325

    
1326
autoRepairTagSuspended :: String
1327
autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:"
1328

    
1329
-- * Auto-repair levels
1330

    
1331
autoRepairFailover :: String
1332
autoRepairFailover = "failover"
1333

    
1334
autoRepairFixStorage :: String
1335
autoRepairFixStorage = "fix-storage"
1336

    
1337
autoRepairMigrate :: String
1338
autoRepairMigrate = "migrate"
1339

    
1340
autoRepairReinstall :: String
1341
autoRepairReinstall = "reinstall"
1342

    
1343
autoRepairAllTypes :: FrozenSet String
1344
autoRepairAllTypes =
1345
  ConstantUtils.mkSet [autoRepairFailover,
1346
                       autoRepairFixStorage,
1347
                       autoRepairMigrate,
1348
                       autoRepairReinstall]
1349

    
1350
-- * Auto-repair results
1351

    
1352
autoRepairEnoperm :: String
1353
autoRepairEnoperm = "enoperm"
1354

    
1355
autoRepairFailure :: String
1356
autoRepairFailure = "failure"
1357

    
1358
autoRepairSuccess :: String
1359
autoRepairSuccess = "success"
1360

    
1361
autoRepairAllResults :: FrozenSet String
1362
autoRepairAllResults =
1363
  ConstantUtils.mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess]
1364

    
1365
-- | The version identifier for builtin data collectors
1366
builtinDataCollectorVersion :: String
1367
builtinDataCollectorVersion = "B"
1368

    
1369
-- | The reason trail opcode parameter name
1370
opcodeReason :: String
1371
opcodeReason = "reason"
1372

    
1373
diskstatsFile :: String
1374
diskstatsFile = "/proc/diskstats"
1375

    
1376
-- | CPU load collector
1377
statFile :: String
1378
statFile = "/proc/stat"
1379

    
1380
-- | Mond's variable for periodical data collection
1381
mondTimeInterval :: Int
1382
mondTimeInterval = 5
1383

    
1384
-- * Disk access modes
1385

    
1386
diskUserspace :: String
1387
diskUserspace = Types.diskAccessModeToRaw DiskUserspace
1388

    
1389
diskKernelspace :: String
1390
diskKernelspace = Types.diskAccessModeToRaw DiskKernelspace
1391

    
1392
diskValidAccessModes :: FrozenSet String
1393
diskValidAccessModes =
1394
  ConstantUtils.mkSet $ map Types.diskAccessModeToRaw [minBound..]
1395

    
1396
-- | Timeout for queue draining in upgrades
1397
upgradeQueueDrainTimeout :: Int
1398
upgradeQueueDrainTimeout = 36 * 60 * 60 -- 1.5 days
1399

    
1400
-- | Intervall at which the queue is polled during upgrades
1401
upgradeQueuePollInterval :: Int
1402
upgradeQueuePollInterval  = 10