Statistics
| Branch: | Tag: | Revision:

root / src / Ganeti / HsConstants.hs @ 1c9e817d

History | View | Annotate | Download (34.3 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
configMajor :: Int
123
configMajor = AutoConf.versionMajor
124

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

    
128
-- | The configuration is supposed to remain stable across
129
-- revisions. Therefore, the revision number is cleared to '0'.
130
configRevision :: Int
131
configRevision = 0
132

    
133
configVersion :: Int
134
configVersion = buildVersion configMajor configMinor configRevision
135

    
136
-- | Similarly to the configuration (see 'configRevision'), the
137
-- protocols are supposed to remain stable across revisions.
138
protocolVersion :: Int
139
protocolVersion = buildVersion configMajor configMinor configRevision
140

    
141
-- * User separation
142
daemonsGroup :: String
143
daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
144

    
145
adminGroup :: String
146
adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
147

    
148
masterdUser :: String
149
masterdUser = Runtime.daemonUser GanetiMasterd
150

    
151
masterdGroup :: String
152
masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
153

    
154
rapiUser :: String
155
rapiUser = Runtime.daemonUser GanetiRapi
156

    
157
rapiGroup :: String
158
rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
159

    
160
confdUser :: String
161
confdUser = Runtime.daemonUser GanetiConfd
162

    
163
confdGroup :: String
164
confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
165

    
166
luxidUser :: String
167
luxidUser = Runtime.daemonUser GanetiLuxid
168

    
169
luxidGroup :: String
170
luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
171

    
172
nodedUser :: String
173
nodedUser = Runtime.daemonUser GanetiNoded
174

    
175
nodedGroup :: String
176
nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
177

    
178
mondUser :: String
179
mondUser = Runtime.daemonUser GanetiMond
180

    
181
mondGroup :: String
182
mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
183

    
184
sshLoginUser :: String
185
sshLoginUser = AutoConf.sshLoginUser
186

    
187
sshConsoleUser :: String
188
sshConsoleUser = AutoConf.sshConsoleUser
189

    
190
-- * 'autoconf' enable/disable
191

    
192
enableConfd :: Bool
193
enableConfd = AutoConf.enableConfd
194

    
195
enableMond :: Bool
196
enableMond = AutoConf.enableMond
197

    
198
enableRestrictedCommands :: Bool
199
enableRestrictedCommands = AutoConf.enableRestrictedCommands
200

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

    
204
-- * SSH constants
205

    
206
ssh :: String
207
ssh = "ssh"
208

    
209
scp :: String
210
scp = "scp"
211

    
212
-- * Daemons
213

    
214
confd :: String
215
confd = Runtime.daemonName GanetiConfd
216

    
217
masterd :: String
218
masterd = Runtime.daemonName GanetiMasterd
219

    
220
mond :: String
221
mond = Runtime.daemonName GanetiMond
222

    
223
noded :: String
224
noded = Runtime.daemonName GanetiNoded
225

    
226
luxid :: String
227
luxid = Runtime.daemonName GanetiLuxid
228

    
229
rapi :: String
230
rapi = Runtime.daemonName GanetiRapi
231

    
232
daemons :: FrozenSet String
233
daemons =
234
  ConstantUtils.mkSet [confd,
235
                       luxid,
236
                       masterd,
237
                       mond,
238
                       noded,
239
                       rapi]
240

    
241
defaultConfdPort :: Int
242
defaultConfdPort = 1814
243

    
244
defaultMondPort :: Int
245
defaultMondPort = 1815
246

    
247
defaultNodedPort :: Int
248
defaultNodedPort = 1811
249

    
250
defaultRapiPort :: Int
251
defaultRapiPort = 5080
252

    
253
daemonsPorts :: Map String (Protocol, Int)
254
daemonsPorts =
255
  Map.fromList [(confd, (Udp, defaultConfdPort)),
256
                (mond, (Tcp, defaultMondPort)),
257
                (noded, (Tcp, defaultNodedPort)),
258
                (rapi, (Tcp, defaultRapiPort)),
259
                (ssh, (Tcp, 22))]
260

    
261
daemonsLogbase :: Map String String
262
daemonsLogbase =
263
  Map.fromList
264
  [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
265

    
266
extraLogreasonAccess :: String
267
extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
268

    
269
extraLogreasonError :: String
270
extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
271

    
272
devConsole :: String
273
devConsole = ConstantUtils.devConsole
274

    
275
-- * Syslog
276

    
277
syslogUsage :: String
278
syslogUsage = AutoConf.syslogUsage
279

    
280
syslogNo :: String
281
syslogNo = Logging.syslogUsageToRaw SyslogNo
282

    
283
syslogYes :: String
284
syslogYes = Logging.syslogUsageToRaw SyslogYes
285

    
286
syslogOnly :: String
287
syslogOnly = Logging.syslogUsageToRaw SyslogOnly
288

    
289
syslogSocket :: String
290
syslogSocket = "/dev/log"
291

    
292
-- * Xen
293

    
294
xenBootloader :: String
295
xenBootloader = AutoConf.xenBootloader
296

    
297
xenCmdXl :: String
298
xenCmdXl = "xl"
299

    
300
xenCmdXm :: String
301
xenCmdXm = "xm"
302

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

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

    
309
-- FIXME: perhaps rename to 'validXenCommands' for consistency with
310
-- other constants
311
knownXenCommands :: FrozenSet String
312
knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
313

    
314
-- * KVM and socat
315

    
316
kvmPath :: String
317
kvmPath = AutoConf.kvmPath
318

    
319
kvmKernel :: String
320
kvmKernel = AutoConf.kvmKernel
321

    
322
socatEscapeCode :: String
323
socatEscapeCode = "0x1d"
324

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

    
328
socatUseCompress :: Bool
329
socatUseCompress = AutoConf.socatUseCompress
330

    
331
socatUseEscape :: Bool
332
socatUseEscape = AutoConf.socatUseEscape
333

    
334
-- * Storage types
335

    
336
stBlock :: String
337
stBlock = Types.storageTypeToRaw StorageBlock
338

    
339
stDiskless :: String
340
stDiskless = Types.storageTypeToRaw StorageDiskless
341

    
342
stExt :: String
343
stExt = Types.storageTypeToRaw StorageExt
344

    
345
stFile :: String
346
stFile = Types.storageTypeToRaw StorageFile
347

    
348
stLvmPv :: String
349
stLvmPv = Types.storageTypeToRaw StorageLvmPv
350

    
351
stLvmVg :: String
352
stLvmVg = Types.storageTypeToRaw StorageLvmVg
353

    
354
stRados :: String
355
stRados = Types.storageTypeToRaw StorageRados
356

    
357
storageTypes :: FrozenSet String
358
storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
359

    
360
-- * Storage fields
361
-- ** First two are valid in LU context only, not passed to backend
362

    
363
sfNode :: String
364
sfNode = "node"
365

    
366
sfType :: String
367
sfType = "type"
368

    
369
-- ** and the rest are valid in backend
370

    
371
sfAllocatable :: String
372
sfAllocatable = Types.storageFieldToRaw SFAllocatable
373

    
374
sfFree :: String
375
sfFree = Types.storageFieldToRaw SFFree
376

    
377
sfName :: String
378
sfName = Types.storageFieldToRaw SFName
379

    
380
sfSize :: String
381
sfSize = Types.storageFieldToRaw SFSize
382

    
383
sfUsed :: String
384
sfUsed = Types.storageFieldToRaw SFUsed
385

    
386
-- * Disk template types
387

    
388
dtDiskless :: String
389
dtDiskless = Types.diskTemplateToRaw DTDiskless
390

    
391
dtFile :: String
392
dtFile = Types.diskTemplateToRaw DTFile
393

    
394
dtSharedFile :: String
395
dtSharedFile = Types.diskTemplateToRaw DTSharedFile
396

    
397
dtPlain :: String
398
dtPlain = Types.diskTemplateToRaw DTPlain
399

    
400
dtBlock :: String
401
dtBlock = Types.diskTemplateToRaw DTBlock
402

    
403
dtDrbd8 :: String
404
dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
405

    
406
dtRbd :: String
407
dtRbd = Types.diskTemplateToRaw DTRbd
408

    
409
dtExt :: String
410
dtExt = Types.diskTemplateToRaw DTExt
411

    
412
-- | This is used to order determine the default disk template when
413
-- the list of enabled disk templates is inferred from the current
414
-- state of the cluster.  This only happens on an upgrade from a
415
-- version of Ganeti that did not support the 'enabled_disk_templates'
416
-- so far.
417
diskTemplatePreference :: [String]
418
diskTemplatePreference =
419
  map Types.diskTemplateToRaw
420
  [DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile]
421

    
422
diskTemplates :: FrozenSet String
423
diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
424

    
425
-- | Disk templates that are enabled by default
426
defaultEnabledDiskTemplates :: [String]
427
defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
428

    
429
-- * File backend driver
430

    
431
fdBlktap :: String
432
fdBlktap = Types.fileDriverToRaw FileBlktap
433

    
434
fdLoop :: String
435
fdLoop = Types.fileDriverToRaw FileLoop
436

    
437
-- * Disk access mode
438

    
439
diskRdonly :: String
440
diskRdonly = Types.diskModeToRaw DiskRdOnly
441

    
442
diskRdwr :: String
443
diskRdwr = Types.diskModeToRaw DiskRdWr
444

    
445
diskAccessSet :: FrozenSet String
446
diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..]
447

    
448
-- * Instance export mode
449

    
450
exportModeLocal :: String
451
exportModeLocal = Types.exportModeToRaw ExportModeLocal
452

    
453
exportModeRemote :: String
454
exportModeRemote = Types.exportModeToRaw ExportModeRemote
455

    
456
exportModes :: FrozenSet String
457
exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
458

    
459
-- * Instance creation modes
460

    
461
instanceCreate :: String
462
instanceCreate = Types.instCreateModeToRaw InstCreate
463

    
464
instanceImport :: String
465
instanceImport = Types.instCreateModeToRaw InstImport
466

    
467
instanceRemoteImport :: String
468
instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
469

    
470
instanceCreateModes :: FrozenSet String
471
instanceCreateModes =
472
  ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
473

    
474
-- * Dynamic device modification
475

    
476
ddmAdd :: String
477
ddmAdd = Types.ddmFullToRaw DdmFullAdd
478

    
479
ddmModify :: String
480
ddmModify = Types.ddmFullToRaw DdmFullModify
481

    
482
ddmRemove :: String
483
ddmRemove = Types.ddmFullToRaw DdmFullRemove
484

    
485
ddmsValues :: FrozenSet String
486
ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
487

    
488
ddmsValuesWithModify :: FrozenSet String
489
ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
490

    
491
-- * Common exit codes
492

    
493
exitSuccess :: Int
494
exitSuccess = 0
495

    
496
exitFailure :: Int
497
exitFailure = ConstantUtils.exitFailure
498

    
499
exitNotcluster :: Int
500
exitNotcluster = 5
501

    
502
exitNotmaster :: Int
503
exitNotmaster = 11
504

    
505
exitNodesetupError :: Int
506
exitNodesetupError = 12
507

    
508
-- | Need user confirmation
509
exitConfirmation :: Int
510
exitConfirmation = 13
511

    
512
-- | Exit code for query operations with unknown fields
513
exitUnknownField :: Int
514
exitUnknownField = 14
515

    
516
-- * Tags
517

    
518
tagCluster :: String
519
tagCluster = Types.tagKindToRaw TagKindCluster
520

    
521
tagInstance :: String
522
tagInstance = Types.tagKindToRaw TagKindInstance
523

    
524
tagNetwork :: String
525
tagNetwork = Types.tagKindToRaw TagKindNetwork
526

    
527
tagNode :: String
528
tagNode = Types.tagKindToRaw TagKindNode
529

    
530
tagNodegroup :: String
531
tagNodegroup = Types.tagKindToRaw TagKindGroup
532

    
533
validTagTypes :: FrozenSet String
534
validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
535

    
536
maxTagLen :: Int
537
maxTagLen = 128
538

    
539
maxTagsPerObj :: Int
540
maxTagsPerObj = 4096
541

    
542
-- | Node clock skew in seconds
543
nodeMaxClockSkew :: Int
544
nodeMaxClockSkew = 150
545

    
546
-- | Disk index separator
547
diskSeparator :: String
548
diskSeparator = AutoConf.diskSeparator
549

    
550
ipCommandPath :: String
551
ipCommandPath = AutoConf.ipPath
552

    
553
-- * Reboot types
554

    
555
instanceRebootSoft :: String
556
instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
557

    
558
instanceRebootHard :: String
559
instanceRebootHard = Types.rebootTypeToRaw RebootHard
560

    
561
instanceRebootFull :: String
562
instanceRebootFull = Types.rebootTypeToRaw RebootFull
563

    
564
rebootTypes :: FrozenSet String
565
rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
566

    
567
-- * VTypes
568

    
569
vtypeBool :: String
570
vtypeBool = Types.vTypeToRaw VTypeBool
571

    
572
vtypeInt :: String
573
vtypeInt = Types.vTypeToRaw VTypeInt
574

    
575
vtypeMaybeString :: String
576
vtypeMaybeString = Types.vTypeToRaw VTypeMaybeString
577

    
578
-- | Size in MiBs
579
vtypeSize :: String
580
vtypeSize = Types.vTypeToRaw VTypeSize
581

    
582
vtypeString :: String
583
vtypeString = Types.vTypeToRaw VTypeString
584

    
585
enforceableTypes :: FrozenSet String
586
enforceableTypes = ConstantUtils.mkSet $ map Types.vTypeToRaw [minBound..]
587

    
588
-- * OOB supported commands
589

    
590
oobPowerOn :: String
591
oobPowerOn = Types.oobCommandToRaw OobPowerOn
592

    
593
oobPowerOff :: String
594
oobPowerOff = Types.oobCommandToRaw OobPowerOff
595

    
596
oobPowerCycle :: String
597
oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
598

    
599
oobPowerStatus :: String
600
oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
601

    
602
oobHealth :: String
603
oobHealth = Types.oobCommandToRaw OobHealth
604

    
605
oobCommands :: FrozenSet String
606
oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
607

    
608
oobPowerStatusPowered :: String
609
oobPowerStatusPowered = "powered"
610

    
611
-- | 60 seconds
612
oobTimeout :: Int
613
oobTimeout = 60
614

    
615
-- | 2 seconds
616
oobPowerDelay :: Double
617
oobPowerDelay = 2.0
618

    
619
oobStatusCritical :: String
620
oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
621

    
622
oobStatusOk :: String
623
oobStatusOk = Types.oobStatusToRaw OobStatusOk
624

    
625
oobStatusUnknown :: String
626
oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
627

    
628
oobStatusWarning :: String
629
oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
630

    
631
oobStatuses :: FrozenSet String
632
oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
633

    
634
-- * NIC_* constants are used inside the ganeti config
635

    
636
nicLink :: String
637
nicLink = "link"
638

    
639
nicMode :: String
640
nicMode = "mode"
641

    
642
nicVlan :: String
643
nicVlan = "vlan"
644

    
645
nicModeBridged :: String
646
nicModeBridged = Types.nICModeToRaw NMBridged
647

    
648
nicModeRouted :: String
649
nicModeRouted = Types.nICModeToRaw NMRouted
650

    
651
nicModeOvs :: String
652
nicModeOvs = Types.nICModeToRaw NMOvs
653

    
654
nicIpPool :: String
655
nicIpPool = Types.nICModeToRaw NMPool
656

    
657
nicValidModes :: FrozenSet String
658
nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
659

    
660
-- * Hypervisor constants
661

    
662
htXenPvm :: String
663
htXenPvm = Types.hypervisorToRaw XenPvm
664

    
665
htFake :: String
666
htFake = Types.hypervisorToRaw Fake
667

    
668
htXenHvm :: String
669
htXenHvm = Types.hypervisorToRaw XenHvm
670

    
671
htKvm :: String
672
htKvm = Types.hypervisorToRaw Kvm
673

    
674
htChroot :: String
675
htChroot = Types.hypervisorToRaw Chroot
676

    
677
htLxc :: String
678
htLxc = Types.hypervisorToRaw Lxc
679

    
680
hyperTypes :: FrozenSet String
681
hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
682

    
683
htsReqPort :: FrozenSet String
684
htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
685

    
686
-- * Migration type
687

    
688
htMigrationLive :: String
689
htMigrationLive = Types.migrationModeToRaw MigrationLive
690

    
691
htMigrationNonlive :: String
692
htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
693

    
694
htMigrationModes :: FrozenSet String
695
htMigrationModes =
696
  ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
697

    
698
-- * Cluster verify steps
699

    
700
verifyNplusoneMem :: String
701
verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
702

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

    
707
-- * Cluster Verify error classes
708

    
709
cvTcluster :: String
710
cvTcluster = "cluster"
711

    
712
cvTgroup :: String
713
cvTgroup = "group"
714

    
715
cvTnode :: String
716
cvTnode = "node"
717

    
718
cvTinstance :: String
719
cvTinstance = "instance"
720

    
721
-- * Cluster Verify error codes and documentation
722

    
723
cvEclustercert :: (String, String, String)
724
cvEclustercert =
725
  ("cluster",
726
   Types.cVErrorCodeToRaw CvECLUSTERCERT,
727
   "Cluster certificate files verification failure")
728

    
729
cvEclustercfg :: (String, String, String)
730
cvEclustercfg =
731
  ("cluster",
732
   Types.cVErrorCodeToRaw CvECLUSTERCFG,
733
   "Cluster configuration verification failure")
734

    
735
cvEclusterdanglinginst :: (String, String, String)
736
cvEclusterdanglinginst =
737
  ("node",
738
   Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
739
   "Some instances have a non-existing primary node")
740

    
741
cvEclusterdanglingnodes :: (String, String, String)
742
cvEclusterdanglingnodes =
743
  ("node",
744
   Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
745
   "Some nodes belong to non-existing groups")
746

    
747
cvEclusterfilecheck :: (String, String, String)
748
cvEclusterfilecheck =
749
  ("cluster",
750
   Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
751
   "Cluster configuration verification failure")
752

    
753
cvEgroupdifferentpvsize :: (String, String, String)
754
cvEgroupdifferentpvsize =
755
  ("group",
756
   Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
757
   "PVs in the group have different sizes")
758

    
759
cvEinstancebadnode :: (String, String, String)
760
cvEinstancebadnode =
761
  ("instance",
762
   Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
763
   "Instance marked as running lives on an offline node")
764

    
765
cvEinstancedown :: (String, String, String)
766
cvEinstancedown =
767
  ("instance",
768
   Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
769
   "Instance not running on its primary node")
770

    
771
cvEinstancefaultydisk :: (String, String, String)
772
cvEinstancefaultydisk =
773
  ("instance",
774
   Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
775
   "Impossible to retrieve status for a disk")
776

    
777
cvEinstancelayout :: (String, String, String)
778
cvEinstancelayout =
779
  ("instance",
780
   Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
781
   "Instance has multiple secondary nodes")
782

    
783
cvEinstancemissingcfgparameter :: (String, String, String)
784
cvEinstancemissingcfgparameter =
785
  ("instance",
786
   Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
787
   "A configuration parameter for an instance is missing")
788

    
789
cvEinstancemissingdisk :: (String, String, String)
790
cvEinstancemissingdisk =
791
  ("instance",
792
   Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
793
   "Missing volume on an instance")
794

    
795
cvEinstancepolicy :: (String, String, String)
796
cvEinstancepolicy =
797
  ("instance",
798
   Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
799
   "Instance does not meet policy")
800

    
801
cvEinstancesplitgroups :: (String, String, String)
802
cvEinstancesplitgroups =
803
  ("instance",
804
   Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
805
   "Instance with primary and secondary nodes in different groups")
806

    
807
cvEinstanceunsuitablenode :: (String, String, String)
808
cvEinstanceunsuitablenode =
809
  ("instance",
810
   Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
811
   "Instance running on nodes that are not suitable for it")
812

    
813
cvEinstancewrongnode :: (String, String, String)
814
cvEinstancewrongnode =
815
  ("instance",
816
   Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
817
   "Instance running on the wrong node")
818

    
819
cvEnodedrbd :: (String, String, String)
820
cvEnodedrbd =
821
  ("node",
822
   Types.cVErrorCodeToRaw CvENODEDRBD,
823
   "Error parsing the DRBD status file")
824

    
825
cvEnodedrbdhelper :: (String, String, String)
826
cvEnodedrbdhelper =
827
  ("node",
828
   Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
829
   "Error caused by the DRBD helper")
830

    
831
cvEnodedrbdversion :: (String, String, String)
832
cvEnodedrbdversion =
833
  ("node",
834
   Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
835
   "DRBD version mismatch within a node group")
836

    
837
cvEnodefilecheck :: (String, String, String)
838
cvEnodefilecheck =
839
  ("node",
840
   Types.cVErrorCodeToRaw CvENODEFILECHECK,
841
   "Error retrieving the checksum of the node files")
842

    
843
cvEnodefilestoragepaths :: (String, String, String)
844
cvEnodefilestoragepaths =
845
  ("node",
846
   Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
847
   "Detected bad file storage paths")
848

    
849
cvEnodefilestoragepathunusable :: (String, String, String)
850
cvEnodefilestoragepathunusable =
851
  ("node",
852
   Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
853
   "File storage path unusable")
854

    
855
cvEnodehooks :: (String, String, String)
856
cvEnodehooks =
857
  ("node",
858
   Types.cVErrorCodeToRaw CvENODEHOOKS,
859
   "Communication failure in hooks execution")
860

    
861
cvEnodehv :: (String, String, String)
862
cvEnodehv =
863
  ("node",
864
   Types.cVErrorCodeToRaw CvENODEHV,
865
   "Hypervisor parameters verification failure")
866

    
867
cvEnodelvm :: (String, String, String)
868
cvEnodelvm =
869
  ("node",
870
   Types.cVErrorCodeToRaw CvENODELVM,
871
   "LVM-related node error")
872

    
873
cvEnoden1 :: (String, String, String)
874
cvEnoden1 =
875
  ("node",
876
   Types.cVErrorCodeToRaw CvENODEN1,
877
   "Not enough memory to accommodate instance failovers")
878

    
879
cvEnodenet :: (String, String, String)
880
cvEnodenet =
881
  ("node",
882
   Types.cVErrorCodeToRaw CvENODENET,
883
   "Network-related node error")
884

    
885
cvEnodeoobpath :: (String, String, String)
886
cvEnodeoobpath =
887
  ("node",
888
   Types.cVErrorCodeToRaw CvENODEOOBPATH,
889
   "Invalid Out Of Band path")
890

    
891
cvEnodeorphaninstance :: (String, String, String)
892
cvEnodeorphaninstance =
893
  ("node",
894
   Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
895
   "Unknown intance running on a node")
896

    
897
cvEnodeorphanlv :: (String, String, String)
898
cvEnodeorphanlv =
899
  ("node",
900
   Types.cVErrorCodeToRaw CvENODEORPHANLV,
901
   "Unknown LVM logical volume")
902

    
903
cvEnodeos :: (String, String, String)
904
cvEnodeos =
905
  ("node",
906
   Types.cVErrorCodeToRaw CvENODEOS,
907
   "OS-related node error")
908

    
909
cvEnoderpc :: (String, String, String)
910
cvEnoderpc =
911
  ("node",
912
   Types.cVErrorCodeToRaw CvENODERPC,
913
   "Error during connection to the primary node of an instance")
914

    
915
cvEnodesetup :: (String, String, String)
916
cvEnodesetup =
917
  ("node",
918
   Types.cVErrorCodeToRaw CvENODESETUP,
919
   "Node setup error")
920

    
921
cvEnodesharedfilestoragepathunusable :: (String, String, String)
922
cvEnodesharedfilestoragepathunusable =
923
  ("node",
924
   Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
925
   "Shared file storage path unusable")
926

    
927
cvEnodessh :: (String, String, String)
928
cvEnodessh =
929
  ("node",
930
   Types.cVErrorCodeToRaw CvENODESSH,
931
   "SSH-related node error")
932

    
933
cvEnodetime :: (String, String, String)
934
cvEnodetime =
935
  ("node",
936
   Types.cVErrorCodeToRaw CvENODETIME,
937
   "Node returned invalid time")
938

    
939
cvEnodeuserscripts :: (String, String, String)
940
cvEnodeuserscripts =
941
  ("node",
942
   Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
943
   "User scripts not present or not executable")
944

    
945
cvEnodeversion :: (String, String, String)
946
cvEnodeversion =
947
  ("node",
948
   Types.cVErrorCodeToRaw CvENODEVERSION,
949
   "Protocol version mismatch or Ganeti version mismatch")
950

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

    
993
cvAllEcodesStrings :: FrozenSet String
994
cvAllEcodesStrings =
995
  ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
996

    
997
-- * Instance status
998

    
999
inststAdmindown :: String
1000
inststAdmindown = Types.instanceStatusToRaw StatusDown
1001

    
1002
inststAdminoffline :: String
1003
inststAdminoffline = Types.instanceStatusToRaw StatusOffline
1004

    
1005
inststErrordown :: String
1006
inststErrordown = Types.instanceStatusToRaw ErrorDown
1007

    
1008
inststErrorup :: String
1009
inststErrorup = Types.instanceStatusToRaw ErrorUp
1010

    
1011
inststNodedown :: String
1012
inststNodedown = Types.instanceStatusToRaw NodeDown
1013

    
1014
inststNodeoffline :: String
1015
inststNodeoffline = Types.instanceStatusToRaw NodeOffline
1016

    
1017
inststRunning :: String
1018
inststRunning = Types.instanceStatusToRaw Running
1019

    
1020
inststWrongnode :: String
1021
inststWrongnode = Types.instanceStatusToRaw WrongNode
1022

    
1023
inststAll :: FrozenSet String
1024
inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
1025

    
1026
-- * Admin states
1027

    
1028
adminstDown :: String
1029
adminstDown = Types.adminStateToRaw AdminDown
1030

    
1031
adminstOffline :: String
1032
adminstOffline = Types.adminStateToRaw AdminOffline
1033

    
1034
adminstUp :: String
1035
adminstUp = Types.adminStateToRaw AdminUp
1036

    
1037
adminstAll :: FrozenSet String
1038
adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
1039

    
1040
-- * Node roles
1041

    
1042
nrDrained :: String
1043
nrDrained = Types.nodeRoleToRaw NRDrained
1044

    
1045
nrMaster :: String
1046
nrMaster = Types.nodeRoleToRaw NRMaster
1047

    
1048
nrMcandidate :: String
1049
nrMcandidate = Types.nodeRoleToRaw NRCandidate
1050

    
1051
nrOffline :: String
1052
nrOffline = Types.nodeRoleToRaw NROffline
1053

    
1054
nrRegular :: String
1055
nrRegular = Types.nodeRoleToRaw NRRegular
1056

    
1057
nrAll :: FrozenSet String
1058
nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
1059

    
1060
-- * Allocator framework constants
1061

    
1062
iallocatorVersion :: Int
1063
iallocatorVersion = 2
1064

    
1065
iallocatorDirIn :: String
1066
iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
1067

    
1068
iallocatorDirOut :: String
1069
iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
1070

    
1071
validIallocatorDirections :: FrozenSet String
1072
validIallocatorDirections =
1073
  ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
1074

    
1075
iallocatorModeAlloc :: String
1076
iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
1077

    
1078
iallocatorModeChgGroup :: String
1079
iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
1080

    
1081
iallocatorModeMultiAlloc :: String
1082
iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
1083

    
1084
iallocatorModeNodeEvac :: String
1085
iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
1086

    
1087
iallocatorModeReloc :: String
1088
iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
1089

    
1090
validIallocatorModes :: FrozenSet String
1091
validIallocatorModes =
1092
  ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
1093

    
1094
iallocatorSearchPath :: [String]
1095
iallocatorSearchPath = AutoConf.iallocatorSearchPath
1096

    
1097
defaultIallocatorShortcut :: String
1098
defaultIallocatorShortcut = "."
1099

    
1100
iallocatorNevacPri :: String
1101
iallocatorNevacPri = Types.nodeEvacModeToRaw NEvacPrimary
1102

    
1103
iallocatorNevacSec :: String
1104
iallocatorNevacSec = Types.nodeEvacModeToRaw NEvacSecondary
1105

    
1106
iallocatorNevacAll :: String
1107
iallocatorNevacAll = Types.nodeEvacModeToRaw NEvacAll
1108

    
1109
iallocatorNevacModes :: FrozenSet String
1110
iallocatorNevacModes =
1111
  ConstantUtils.mkSet $ map Types.nodeEvacModeToRaw [minBound..]
1112

    
1113
-- * Node evacuation
1114

    
1115
nodeEvacPri :: String
1116
nodeEvacPri = Types.nodeEvacModeToRaw NEvacPrimary
1117

    
1118
nodeEvacSec :: String
1119
nodeEvacSec = Types.nodeEvacModeToRaw NEvacSecondary
1120

    
1121
nodeEvacAll :: String
1122
nodeEvacAll = Types.nodeEvacModeToRaw NEvacAll
1123

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

    
1127
-- * Job status
1128

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

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

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

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

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

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

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

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

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

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

    
1161
-- * OpCode status
1162

    
1163
-- ** Not yet finalized opcodes
1164

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

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

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

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

    
1177
-- ** Finalized opcodes
1178

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

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

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

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

    
1192
-- * OpCode priority
1193

    
1194
opPrioLowest :: Int
1195
opPrioLowest = 19
1196

    
1197
opPrioHighest :: Int
1198
opPrioHighest = -20
1199

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

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

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

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

    
1212
opPrioDefault :: Int
1213
opPrioDefault = opPrioNormal
1214

    
1215
-- * Execution log types
1216

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

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

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

    
1226
-- * A few common errors for confd
1227

    
1228
confdErrorArgument :: Int
1229
confdErrorArgument = 3
1230

    
1231
confdErrorInternal :: Int
1232
confdErrorInternal = 2
1233

    
1234
confdErrorUnknownEntry :: Int
1235
confdErrorUnknownEntry = 1
1236

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

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

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

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

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

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

    
1280
-- * Possible values for NodeGroup.alloc_policy
1281

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

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

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

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

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

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

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

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

    
1313
-- * Auto-repair tag prefixes
1314

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

    
1318
autoRepairTagEnabled :: String
1319
autoRepairTagEnabled = autoRepairTagPrefix
1320

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

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

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

    
1330
-- * Auto-repair levels
1331

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

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

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

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

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

    
1351
-- * Auto-repair results
1352

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

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

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

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

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

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

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

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

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