Revision c890f66a

b/src/Ganeti/HsConstants.hs
58 58
esSearchPath :: [String]
59 59
esSearchPath = AutoConf.esSearchPath
60 60

  
61
-- * OOB supported commands
61
-- * User separation
62
daemonsGroup :: String
63
daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
62 64

  
63
oobPowerOn :: String
64
oobPowerOn = Types.oobCommandToRaw OobPowerOn
65
adminGroup :: String
66
adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
65 67

  
66
oobPowerOff :: String
67
oobPowerOff = Types.oobCommandToRaw OobPowerOff
68
masterdUser :: String
69
masterdUser = Runtime.daemonUser GanetiMasterd
68 70

  
69
oobPowerCycle :: String
70
oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
71
masterdGroup :: String
72
masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
71 73

  
72
oobPowerStatus :: String
73
oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
74
rapiUser :: String
75
rapiUser = Runtime.daemonUser GanetiRapi
74 76

  
75
oobHealth :: String
76
oobHealth = Types.oobCommandToRaw OobHealth
77
rapiGroup :: String
78
rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
77 79

  
78
oobCommands :: FrozenSet String
79
oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
80
confdUser :: String
81
confdUser = Runtime.daemonUser GanetiConfd
80 82

  
81
oobPowerStatusPowered :: String
82
oobPowerStatusPowered = "powered"
83
confdGroup :: String
84
confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
83 85

  
84
-- | 60 seconds
85
oobTimeout :: Int
86
oobTimeout = 60
86
luxidUser :: String
87
luxidUser = Runtime.daemonUser GanetiLuxid
87 88

  
88
-- | 2 seconds
89
oobPowerDelay :: Double
90
oobPowerDelay = 2.0
89
luxidGroup :: String
90
luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
91 91

  
92
oobStatusCritical :: String
93
oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
92
nodedUser :: String
93
nodedUser = Runtime.daemonUser GanetiNoded
94 94

  
95
oobStatusOk :: String
96
oobStatusOk = Types.oobStatusToRaw OobStatusOk
95
nodedGroup :: String
96
nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
97 97

  
98
oobStatusUnknown :: String
99
oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
98
mondUser :: String
99
mondUser = Runtime.daemonUser GanetiMond
100 100

  
101
oobStatusWarning :: String
102
oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
101
mondGroup :: String
102
mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
103 103

  
104
oobStatuses :: FrozenSet String
105
oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
104
sshLoginUser :: String
105
sshLoginUser = AutoConf.sshLoginUser
106 106

  
107
-- * NIC_* constants are used inside the ganeti config
107
sshConsoleUser :: String
108
sshConsoleUser = AutoConf.sshConsoleUser
108 109

  
109
nicLink :: String
110
nicLink = "link"
110
-- * SSH constants
111 111

  
112
nicMode :: String
113
nicMode = "mode"
112
ssh :: String
113
ssh = "ssh"
114 114

  
115
nicVlan :: String
116
nicVlan = "vlan"
115
scp :: String
116
scp = "scp"
117 117

  
118
nicModeBridged :: String
119
nicModeBridged = Types.nICModeToRaw NMBridged
118
-- * Daemons
120 119

  
121
nicModeRouted :: String
122
nicModeRouted = Types.nICModeToRaw NMRouted
120
confd :: String
121
confd = Runtime.daemonName GanetiConfd
123 122

  
124
nicModeOvs :: String
125
nicModeOvs = Types.nICModeToRaw NMOvs
123
masterd :: String
124
masterd = Runtime.daemonName GanetiMasterd
126 125

  
127
nicIpPool :: String
128
nicIpPool = Types.nICModeToRaw NMPool
126
mond :: String
127
mond = Runtime.daemonName GanetiMond
129 128

  
130
nicValidModes :: FrozenSet String
131
nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
129
noded :: String
130
noded = Runtime.daemonName GanetiNoded
132 131

  
133
-- * Hypervisor constants
132
luxid :: String
133
luxid = Runtime.daemonName GanetiLuxid
134 134

  
135
htXenPvm :: String
136
htXenPvm = Types.hypervisorToRaw XenPvm
135
rapi :: String
136
rapi = Runtime.daemonName GanetiRapi
137 137

  
138
htFake :: String
139
htFake = Types.hypervisorToRaw Fake
138
daemons :: FrozenSet String
139
daemons =
140
  ConstantUtils.mkSet [confd,
141
                       luxid,
142
                       masterd,
143
                       mond,
144
                       noded,
145
                       rapi]
140 146

  
141
htXenHvm :: String
142
htXenHvm = Types.hypervisorToRaw XenHvm
147
defaultConfdPort :: Int
148
defaultConfdPort = 1814
143 149

  
144
htKvm :: String
145
htKvm = Types.hypervisorToRaw Kvm
150
defaultMondPort :: Int
151
defaultMondPort = 1815
146 152

  
147
htChroot :: String
148
htChroot = Types.hypervisorToRaw Chroot
153
defaultNodedPort :: Int
154
defaultNodedPort = 1811
149 155

  
150
htLxc :: String
151
htLxc = Types.hypervisorToRaw Lxc
156
defaultRapiPort :: Int
157
defaultRapiPort = 5080
152 158

  
153
hyperTypes :: FrozenSet String
154
hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
159
daemonsPorts :: Map String (Protocol, Int)
160
daemonsPorts =
161
  Map.fromList [(confd, (Udp, defaultConfdPort)),
162
                (mond, (Tcp, defaultMondPort)),
163
                (noded, (Tcp, defaultNodedPort)),
164
                (rapi, (Tcp, defaultRapiPort)),
165
                (ssh, (Tcp, 22))]
155 166

  
156
htsReqPort :: FrozenSet String
157
htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
167
daemonsLogbase :: Map String String
168
daemonsLogbase =
169
  Map.fromList
170
  [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
158 171

  
159
-- * Migration type
172
extraLogreasonAccess :: String
173
extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
160 174

  
161
htMigrationLive :: String
162
htMigrationLive = Types.migrationModeToRaw MigrationLive
175
extraLogreasonError :: String
176
extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
163 177

  
164
htMigrationNonlive :: String
165
htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
178
devConsole :: String
179
devConsole = ConstantUtils.devConsole
166 180

  
167
htMigrationModes :: FrozenSet String
168
htMigrationModes =
169
  ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
181
-- * Syslog
170 182

  
171
-- * Cluster verify steps
183
syslogUsage :: String
184
syslogUsage = AutoConf.syslogUsage
172 185

  
173
verifyNplusoneMem :: String
174
verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
186
syslogNo :: String
187
syslogNo = Logging.syslogUsageToRaw SyslogNo
175 188

  
176
verifyOptionalChecks :: FrozenSet String
177
verifyOptionalChecks =
178
  ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
189
syslogYes :: String
190
syslogYes = Logging.syslogUsageToRaw SyslogYes
179 191

  
180
-- * Cluster Verify error classes
192
syslogOnly :: String
193
syslogOnly = Logging.syslogUsageToRaw SyslogOnly
181 194

  
182
cvTcluster :: String
183
cvTcluster = "cluster"
195
syslogSocket :: String
196
syslogSocket = "/dev/log"
184 197

  
185
cvTgroup :: String
186
cvTgroup = "group"
198
-- * Xen
187 199

  
188
cvTnode :: String
189
cvTnode = "node"
200
xenBootloader :: String
201
xenBootloader = AutoConf.xenBootloader
190 202

  
191
cvTinstance :: String
192
cvTinstance = "instance"
203
xenCmdXl :: String
204
xenCmdXl = "xl"
193 205

  
194
-- * Cluster Verify error codes and documentation
206
xenCmdXm :: String
207
xenCmdXm = "xm"
195 208

  
196
cvEclustercert :: (String, String, String)
197
cvEclustercert =
198
  ("cluster",
199
   Types.cVErrorCodeToRaw CvECLUSTERCERT,
200
   "Cluster certificate files verification failure")
209
xenInitrd :: String
210
xenInitrd = AutoConf.xenInitrd
201 211

  
202
cvEclustercfg :: (String, String, String)
203
cvEclustercfg =
204
  ("cluster",
205
   Types.cVErrorCodeToRaw CvECLUSTERCFG,
206
   "Cluster configuration verification failure")
212
xenKernel :: String
213
xenKernel = AutoConf.xenKernel
207 214

  
208
cvEclusterdanglinginst :: (String, String, String)
209
cvEclusterdanglinginst =
210
  ("node",
211
   Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
212
   "Some instances have a non-existing primary node")
215
-- FIXME: perhaps rename to 'validXenCommands' for consistency with
216
-- other constants
217
knownXenCommands :: FrozenSet String
218
knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
213 219

  
214
cvEclusterdanglingnodes :: (String, String, String)
215
cvEclusterdanglingnodes =
216
  ("node",
217
   Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
218
   "Some nodes belong to non-existing groups")
220
-- * Storage types
219 221

  
220
cvEclusterfilecheck :: (String, String, String)
221
cvEclusterfilecheck =
222
  ("cluster",
223
   Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
224
   "Cluster configuration verification failure")
222
stBlock :: String
223
stBlock = Types.storageTypeToRaw StorageBlock
225 224

  
226
cvEgroupdifferentpvsize :: (String, String, String)
227
cvEgroupdifferentpvsize =
228
  ("group",
229
   Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
230
   "PVs in the group have different sizes")
225
stDiskless :: String
226
stDiskless = Types.storageTypeToRaw StorageDiskless
231 227

  
232
cvEinstancebadnode :: (String, String, String)
233
cvEinstancebadnode =
234
  ("instance",
235
   Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
236
   "Instance marked as running lives on an offline node")
228
stExt :: String
229
stExt = Types.storageTypeToRaw StorageExt
237 230

  
238
cvEinstancedown :: (String, String, String)
239
cvEinstancedown =
240
  ("instance",
241
   Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
242
   "Instance not running on its primary node")
231
stFile :: String
232
stFile = Types.storageTypeToRaw StorageFile
243 233

  
244
cvEinstancefaultydisk :: (String, String, String)
245
cvEinstancefaultydisk =
246
  ("instance",
247
   Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
248
   "Impossible to retrieve status for a disk")
234
stLvmPv :: String
235
stLvmPv = Types.storageTypeToRaw StorageLvmPv
249 236

  
250
cvEinstancelayout :: (String, String, String)
251
cvEinstancelayout =
252
  ("instance",
253
   Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
254
   "Instance has multiple secondary nodes")
255

  
256
cvEinstancemissingcfgparameter :: (String, String, String)
257
cvEinstancemissingcfgparameter =
258
  ("instance",
259
   Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
260
   "A configuration parameter for an instance is missing")
237
stLvmVg :: String
238
stLvmVg = Types.storageTypeToRaw StorageLvmVg
261 239

  
262
cvEinstancemissingdisk :: (String, String, String)
263
cvEinstancemissingdisk =
264
  ("instance",
265
   Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
266
   "Missing volume on an instance")
240
stRados :: String
241
stRados = Types.storageTypeToRaw StorageRados
267 242

  
268
cvEinstancepolicy :: (String, String, String)
269
cvEinstancepolicy =
270
  ("instance",
271
   Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
272
   "Instance does not meet policy")
243
storageTypes :: FrozenSet String
244
storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
273 245

  
274
cvEinstancesplitgroups :: (String, String, String)
275
cvEinstancesplitgroups =
276
  ("instance",
277
   Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
278
   "Instance with primary and secondary nodes in different groups")
246
-- * Storage fields
247
-- ** First two are valid in LU context only, not passed to backend
279 248

  
280
cvEinstanceunsuitablenode :: (String, String, String)
281
cvEinstanceunsuitablenode =
282
  ("instance",
283
   Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
284
   "Instance running on nodes that are not suitable for it")
249
sfNode :: String
250
sfNode = "node"
285 251

  
286
cvEinstancewrongnode :: (String, String, String)
287
cvEinstancewrongnode =
288
  ("instance",
289
   Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
290
   "Instance running on the wrong node")
252
sfType :: String
253
sfType = "type"
291 254

  
292
cvEnodedrbd :: (String, String, String)
293
cvEnodedrbd =
294
  ("node",
295
   Types.cVErrorCodeToRaw CvENODEDRBD,
296
   "Error parsing the DRBD status file")
255
-- ** and the rest are valid in backend
297 256

  
298
cvEnodedrbdhelper :: (String, String, String)
299
cvEnodedrbdhelper =
300
  ("node",
301
   Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
302
   "Error caused by the DRBD helper")
257
sfAllocatable :: String
258
sfAllocatable = Types.storageFieldToRaw SFAllocatable
303 259

  
304
cvEnodedrbdversion :: (String, String, String)
305
cvEnodedrbdversion =
306
  ("node",
307
   Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
308
   "DRBD version mismatch within a node group")
260
sfFree :: String
261
sfFree = Types.storageFieldToRaw SFFree
309 262

  
310
cvEnodefilecheck :: (String, String, String)
311
cvEnodefilecheck =
312
  ("node",
313
   Types.cVErrorCodeToRaw CvENODEFILECHECK,
314
   "Error retrieving the checksum of the node files")
263
sfName :: String
264
sfName = Types.storageFieldToRaw SFName
315 265

  
316
cvEnodefilestoragepaths :: (String, String, String)
317
cvEnodefilestoragepaths =
318
  ("node",
319
   Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
320
   "Detected bad file storage paths")
266
sfSize :: String
267
sfSize = Types.storageFieldToRaw SFSize
321 268

  
322
cvEnodefilestoragepathunusable :: (String, String, String)
323
cvEnodefilestoragepathunusable =
324
  ("node",
325
   Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
326
   "File storage path unusable")
269
sfUsed :: String
270
sfUsed = Types.storageFieldToRaw SFUsed
327 271

  
328
cvEnodehooks :: (String, String, String)
329
cvEnodehooks =
330
  ("node",
331
   Types.cVErrorCodeToRaw CvENODEHOOKS,
332
   "Communication failure in hooks execution")
272
-- * Disk template types
333 273

  
334
cvEnodehv :: (String, String, String)
335
cvEnodehv =
336
  ("node",
337
   Types.cVErrorCodeToRaw CvENODEHV,
338
   "Hypervisor parameters verification failure")
274
dtDiskless :: String
275
dtDiskless = Types.diskTemplateToRaw DTDiskless
339 276

  
340
cvEnodelvm :: (String, String, String)
341
cvEnodelvm =
342
  ("node",
343
   Types.cVErrorCodeToRaw CvENODELVM,
344
   "LVM-related node error")
277
dtFile :: String
278
dtFile = Types.diskTemplateToRaw DTFile
345 279

  
346
cvEnoden1 :: (String, String, String)
347
cvEnoden1 =
348
  ("node",
349
   Types.cVErrorCodeToRaw CvENODEN1,
350
   "Not enough memory to accommodate instance failovers")
280
dtSharedFile :: String
281
dtSharedFile = Types.diskTemplateToRaw DTSharedFile
351 282

  
352
cvEnodenet :: (String, String, String)
353
cvEnodenet =
354
  ("node",
355
   Types.cVErrorCodeToRaw CvENODENET,
356
   "Network-related node error")
283
dtPlain :: String
284
dtPlain = Types.diskTemplateToRaw DTPlain
357 285

  
358
cvEnodeoobpath :: (String, String, String)
359
cvEnodeoobpath =
360
  ("node",
361
   Types.cVErrorCodeToRaw CvENODEOOBPATH,
362
   "Invalid Out Of Band path")
286
dtBlock :: String
287
dtBlock = Types.diskTemplateToRaw DTBlock
363 288

  
364
cvEnodeorphaninstance :: (String, String, String)
365
cvEnodeorphaninstance =
366
  ("node",
367
   Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
368
   "Unknown intance running on a node")
289
dtDrbd8 :: String
290
dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
369 291

  
370
cvEnodeorphanlv :: (String, String, String)
371
cvEnodeorphanlv =
372
  ("node",
373
   Types.cVErrorCodeToRaw CvENODEORPHANLV,
374
   "Unknown LVM logical volume")
292
dtRbd :: String
293
dtRbd = Types.diskTemplateToRaw DTRbd
375 294

  
376
cvEnodeos :: (String, String, String)
377
cvEnodeos =
378
  ("node",
379
   Types.cVErrorCodeToRaw CvENODEOS,
380
   "OS-related node error")
295
dtExt :: String
296
dtExt = Types.diskTemplateToRaw DTExt
381 297

  
382
cvEnoderpc :: (String, String, String)
383
cvEnoderpc =
384
  ("node",
385
   Types.cVErrorCodeToRaw CvENODERPC,
386
   "Error during connection to the primary node of an instance")
298
-- | This is used to order determine the default disk template when
299
-- the list of enabled disk templates is inferred from the current
300
-- state of the cluster.  This only happens on an upgrade from a
301
-- version of Ganeti that did not support the 'enabled_disk_templates'
302
-- so far.
303
diskTemplatePreference :: [String]
304
diskTemplatePreference =
305
  map Types.diskTemplateToRaw
306
  [DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile]
387 307

  
388
cvEnodesetup :: (String, String, String)
389
cvEnodesetup =
390
  ("node",
391
   Types.cVErrorCodeToRaw CvENODESETUP,
392
   "Node setup error")
308
diskTemplates :: FrozenSet String
309
diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
393 310

  
394
cvEnodesharedfilestoragepathunusable :: (String, String, String)
395
cvEnodesharedfilestoragepathunusable =
396
  ("node",
397
   Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
398
   "Shared file storage path unusable")
311
-- | Disk templates that are enabled by default
312
defaultEnabledDiskTemplates :: [String]
313
defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
399 314

  
400
cvEnodessh :: (String, String, String)
401
cvEnodessh =
402
  ("node",
403
   Types.cVErrorCodeToRaw CvENODESSH,
404
   "SSH-related node error")
315
-- * File backend driver
405 316

  
406
cvEnodetime :: (String, String, String)
407
cvEnodetime =
408
  ("node",
409
   Types.cVErrorCodeToRaw CvENODETIME,
410
   "Node returned invalid time")
317
fdBlktap :: String
318
fdBlktap = Types.fileDriverToRaw FileBlktap
411 319

  
412
cvEnodeuserscripts :: (String, String, String)
413
cvEnodeuserscripts =
414
  ("node",
415
   Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
416
   "User scripts not present or not executable")
320
fdLoop :: String
321
fdLoop = Types.fileDriverToRaw FileLoop
417 322

  
418
cvEnodeversion :: (String, String, String)
419
cvEnodeversion =
420
  ("node",
421
   Types.cVErrorCodeToRaw CvENODEVERSION,
422
   "Protocol version mismatch or Ganeti version mismatch")
323
-- * Disk access mode
423 324

  
424
cvAllEcodes :: FrozenSet (String, String, String)
425
cvAllEcodes =
426
  ConstantUtils.mkSet
427
  [cvEclustercert,
428
   cvEclustercfg,
429
   cvEclusterdanglinginst,
430
   cvEclusterdanglingnodes,
431
   cvEclusterfilecheck,
432
   cvEgroupdifferentpvsize,
433
   cvEinstancebadnode,
434
   cvEinstancedown,
435
   cvEinstancefaultydisk,
436
   cvEinstancelayout,
437
   cvEinstancemissingcfgparameter,
438
   cvEinstancemissingdisk,
439
   cvEinstancepolicy,
440
   cvEinstancesplitgroups,
441
   cvEinstanceunsuitablenode,
442
   cvEinstancewrongnode,
443
   cvEnodedrbd,
444
   cvEnodedrbdhelper,
445
   cvEnodedrbdversion,
446
   cvEnodefilecheck,
447
   cvEnodefilestoragepaths,
448
   cvEnodefilestoragepathunusable,
449
   cvEnodehooks,
450
   cvEnodehv,
451
   cvEnodelvm,
452
   cvEnoden1,
453
   cvEnodenet,
454
   cvEnodeoobpath,
455
   cvEnodeorphaninstance,
456
   cvEnodeorphanlv,
457
   cvEnodeos,
458
   cvEnoderpc,
459
   cvEnodesetup,
460
   cvEnodesharedfilestoragepathunusable,
461
   cvEnodessh,
462
   cvEnodetime,
463
   cvEnodeuserscripts,
464
   cvEnodeversion]
325
diskRdonly :: String
326
diskRdonly = Types.diskModeToRaw DiskRdOnly
465 327

  
466
cvAllEcodesStrings :: FrozenSet String
467
cvAllEcodesStrings =
468
  ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
328
diskRdwr :: String
329
diskRdwr = Types.diskModeToRaw DiskRdWr
469 330

  
470
-- * Instance status
331
diskAccessSet :: FrozenSet String
332
diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..]
471 333

  
472
inststAdmindown :: String
473
inststAdmindown = Types.instanceStatusToRaw StatusDown
334
-- * Instance export mode
474 335

  
475
inststAdminoffline :: String
476
inststAdminoffline = Types.instanceStatusToRaw StatusOffline
336
exportModeLocal :: String
337
exportModeLocal = Types.exportModeToRaw ExportModeLocal
477 338

  
478
inststErrordown :: String
479
inststErrordown = Types.instanceStatusToRaw ErrorDown
339
exportModeRemote :: String
340
exportModeRemote = Types.exportModeToRaw ExportModeRemote
480 341

  
481
inststErrorup :: String
482
inststErrorup = Types.instanceStatusToRaw ErrorUp
342
exportModes :: FrozenSet String
343
exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
483 344

  
484
inststNodedown :: String
485
inststNodedown = Types.instanceStatusToRaw NodeDown
345
-- * Instance creation modes
486 346

  
487
inststNodeoffline :: String
488
inststNodeoffline = Types.instanceStatusToRaw NodeOffline
347
instanceCreate :: String
348
instanceCreate = Types.instCreateModeToRaw InstCreate
489 349

  
490
inststRunning :: String
491
inststRunning = Types.instanceStatusToRaw Running
350
instanceImport :: String
351
instanceImport = Types.instCreateModeToRaw InstImport
492 352

  
493
inststWrongnode :: String
494
inststWrongnode = Types.instanceStatusToRaw WrongNode
353
instanceRemoteImport :: String
354
instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
495 355

  
496
inststAll :: FrozenSet String
497
inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
356
instanceCreateModes :: FrozenSet String
357
instanceCreateModes =
358
  ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
498 359

  
499
-- * Admin states
360
-- * Dynamic device modification
500 361

  
501
adminstDown :: String
502
adminstDown = Types.adminStateToRaw AdminDown
362
ddmAdd :: String
363
ddmAdd = Types.ddmFullToRaw DdmFullAdd
503 364

  
504
adminstOffline :: String
505
adminstOffline = Types.adminStateToRaw AdminOffline
365
ddmModify :: String
366
ddmModify = Types.ddmFullToRaw DdmFullModify
506 367

  
507
adminstUp :: String
508
adminstUp = Types.adminStateToRaw AdminUp
368
ddmRemove :: String
369
ddmRemove = Types.ddmFullToRaw DdmFullRemove
509 370

  
510
adminstAll :: FrozenSet String
511
adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
371
ddmsValues :: FrozenSet String
372
ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
512 373

  
513
-- * Node roles
374
ddmsValuesWithModify :: FrozenSet String
375
ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
514 376

  
515
nrDrained :: String
516
nrDrained = Types.nodeRoleToRaw NRDrained
377
-- * Common exit codes
517 378

  
518
nrMaster :: String
519
nrMaster = Types.nodeRoleToRaw NRMaster
379
exitSuccess :: Int
380
exitSuccess = 0
520 381

  
521
nrMcandidate :: String
522
nrMcandidate = Types.nodeRoleToRaw NRCandidate
382
exitFailure :: Int
383
exitFailure = ConstantUtils.exitFailure
523 384

  
524
nrOffline :: String
525
nrOffline = Types.nodeRoleToRaw NROffline
385
exitNotcluster :: Int
386
exitNotcluster = 5
526 387

  
527
nrRegular :: String
528
nrRegular = Types.nodeRoleToRaw NRRegular
388
exitNotmaster :: Int
389
exitNotmaster = 11
529 390

  
530
nrAll :: FrozenSet String
531
nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
391
exitNodesetupError :: Int
392
exitNodesetupError = 12
532 393

  
533
-- * Allocator framework constants
394
-- | Need user confirmation
395
exitConfirmation :: Int
396
exitConfirmation = 13
534 397

  
535
iallocatorVersion :: Int
536
iallocatorVersion = 2
398
-- | Exit code for query operations with unknown fields
399
exitUnknownField :: Int
400
exitUnknownField = 14
537 401

  
538
iallocatorDirIn :: String
539
iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
402
-- * Tags
540 403

  
541
iallocatorDirOut :: String
542
iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
404
tagCluster :: String
405
tagCluster = Types.tagKindToRaw TagKindCluster
543 406

  
544
validIallocatorDirections :: FrozenSet String
545
validIallocatorDirections =
546
  ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
407
tagInstance :: String
408
tagInstance = Types.tagKindToRaw TagKindInstance
547 409

  
548
iallocatorModeAlloc :: String
549
iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
410
tagNetwork :: String
411
tagNetwork = Types.tagKindToRaw TagKindNetwork
550 412

  
551
iallocatorModeChgGroup :: String
552
iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
413
tagNode :: String
414
tagNode = Types.tagKindToRaw TagKindNode
553 415

  
554
iallocatorModeMultiAlloc :: String
555
iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
416
tagNodegroup :: String
417
tagNodegroup = Types.tagKindToRaw TagKindGroup
556 418

  
557
iallocatorModeNodeEvac :: String
558
iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
419
validTagTypes :: FrozenSet String
420
validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
559 421

  
560
iallocatorModeReloc :: String
561
iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
422
maxTagLen :: Int
423
maxTagLen = 128
562 424

  
563
validIallocatorModes :: FrozenSet String
564
validIallocatorModes =
565
  ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
425
maxTagsPerObj :: Int
426
maxTagsPerObj = 4096
566 427

  
567
iallocatorSearchPath :: [String]
568
iallocatorSearchPath = AutoConf.iallocatorSearchPath
428
-- * Reboot types
569 429

  
570
defaultIallocatorShortcut :: String
571
defaultIallocatorShortcut = "."
430
instanceRebootSoft :: String
431
instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
572 432

  
573
iallocatorNevacPri :: String
574
iallocatorNevacPri = Types.nodeEvacModeToRaw NEvacPrimary
433
instanceRebootHard :: String
434
instanceRebootHard = Types.rebootTypeToRaw RebootHard
575 435

  
576
iallocatorNevacSec :: String
577
iallocatorNevacSec = Types.nodeEvacModeToRaw NEvacSecondary
436
instanceRebootFull :: String
437
instanceRebootFull = Types.rebootTypeToRaw RebootFull
578 438

  
579
iallocatorNevacAll :: String
580
iallocatorNevacAll = Types.nodeEvacModeToRaw NEvacAll
439
rebootTypes :: FrozenSet String
440
rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
581 441

  
582
iallocatorNevacModes :: FrozenSet String
583
iallocatorNevacModes =
584
  ConstantUtils.mkSet $ map Types.nodeEvacModeToRaw [minBound..]
442
-- * VTypes
585 443

  
586
-- * Node evacuation
444
vtypeBool :: String
445
vtypeBool = Types.vTypeToRaw VTypeBool
587 446

  
588
nodeEvacPri :: String
589
nodeEvacPri = Types.nodeEvacModeToRaw NEvacPrimary
447
vtypeInt :: String
448
vtypeInt = Types.vTypeToRaw VTypeInt
590 449

  
591
nodeEvacSec :: String
592
nodeEvacSec = Types.nodeEvacModeToRaw NEvacSecondary
450
vtypeMaybeString :: String
451
vtypeMaybeString = Types.vTypeToRaw VTypeMaybeString
593 452

  
594
nodeEvacAll :: String
595
nodeEvacAll = Types.nodeEvacModeToRaw NEvacAll
453
-- | Size in MiBs
454
vtypeSize :: String
455
vtypeSize = Types.vTypeToRaw VTypeSize
596 456

  
597
nodeEvacModes :: FrozenSet String
598
nodeEvacModes = ConstantUtils.mkSet $ map Types.nodeEvacModeToRaw [minBound..]
457
vtypeString :: String
458
vtypeString = Types.vTypeToRaw VTypeString
599 459

  
600
-- * Job status
460
enforceableTypes :: FrozenSet String
461
enforceableTypes = ConstantUtils.mkSet $ map Types.vTypeToRaw [minBound..]
601 462

  
602
jobStatusQueued :: String
603
jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
463
-- * OOB supported commands
604 464

  
605
jobStatusWaiting :: String
606
jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
465
oobPowerOn :: String
466
oobPowerOn = Types.oobCommandToRaw OobPowerOn
607 467

  
608
jobStatusCanceling :: String
609
jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
468
oobPowerOff :: String
469
oobPowerOff = Types.oobCommandToRaw OobPowerOff
610 470

  
611
jobStatusRunning :: String
612
jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
471
oobPowerCycle :: String
472
oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
613 473

  
614
jobStatusCanceled :: String
615
jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
474
oobPowerStatus :: String
475
oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
616 476

  
617
jobStatusSuccess :: String
618
jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
477
oobHealth :: String
478
oobHealth = Types.oobCommandToRaw OobHealth
619 479

  
620
jobStatusError :: String
621
jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
480
oobCommands :: FrozenSet String
481
oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
622 482

  
623
jobsPending :: FrozenSet String
624
jobsPending =
625
  ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
483
oobPowerStatusPowered :: String
484
oobPowerStatusPowered = "powered"
626 485

  
627
jobsFinalized :: FrozenSet String
628
jobsFinalized =
629
  ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
486
-- | 60 seconds
487
oobTimeout :: Int
488
oobTimeout = 60
630 489

  
631
jobStatusAll :: FrozenSet String
632
jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
490
-- | 2 seconds
491
oobPowerDelay :: Double
492
oobPowerDelay = 2.0
633 493

  
634
-- * OpCode status
494
oobStatusCritical :: String
495
oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
635 496

  
636
-- ** Not yet finalized opcodes
497
oobStatusOk :: String
498
oobStatusOk = Types.oobStatusToRaw OobStatusOk
637 499

  
638
opStatusCanceling :: String
639
opStatusCanceling = "canceling"
500
oobStatusUnknown :: String
501
oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
640 502

  
641
opStatusQueued :: String
642
opStatusQueued = "queued"
503
oobStatusWarning :: String
504
oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
643 505

  
644
opStatusRunning :: String
645
opStatusRunning = "running"
506
oobStatuses :: FrozenSet String
507
oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
646 508

  
647
opStatusWaiting :: String
648
opStatusWaiting = "waiting"
509
-- * NIC_* constants are used inside the ganeti config
649 510

  
650
-- ** Finalized opcodes
511
nicLink :: String
512
nicLink = "link"
651 513

  
652
opStatusCanceled :: String
653
opStatusCanceled = "canceled"
514
nicMode :: String
515
nicMode = "mode"
654 516

  
655
opStatusError :: String
656
opStatusError = "error"
517
nicVlan :: String
518
nicVlan = "vlan"
657 519

  
658
opStatusSuccess :: String
659
opStatusSuccess = "success"
520
nicModeBridged :: String
521
nicModeBridged = Types.nICModeToRaw NMBridged
660 522

  
661
opsFinalized :: FrozenSet String
662
opsFinalized =
663
  ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
523
nicModeRouted :: String
524
nicModeRouted = Types.nICModeToRaw NMRouted
664 525

  
665
-- * OpCode priority
526
nicModeOvs :: String
527
nicModeOvs = Types.nICModeToRaw NMOvs
666 528

  
667
opPrioLowest :: Int
668
opPrioLowest = 19
529
nicIpPool :: String
530
nicIpPool = Types.nICModeToRaw NMPool
669 531

  
670
opPrioHighest :: Int
671
opPrioHighest = -20
532
nicValidModes :: FrozenSet String
533
nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
672 534

  
673
opPrioLow :: Int
674
opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
535
-- * Hypervisor constants
675 536

  
676
opPrioNormal :: Int
677
opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
537
htXenPvm :: String
538
htXenPvm = Types.hypervisorToRaw XenPvm
678 539

  
679
opPrioHigh :: Int
680
opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
540
htFake :: String
541
htFake = Types.hypervisorToRaw Fake
681 542

  
682
opPrioSubmitValid :: FrozenSet Int
683
opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
543
htXenHvm :: String
544
htXenHvm = Types.hypervisorToRaw XenHvm
684 545

  
685
opPrioDefault :: Int
686
opPrioDefault = opPrioNormal
546
htKvm :: String
547
htKvm = Types.hypervisorToRaw Kvm
687 548

  
688
-- * Execution log types
549
htChroot :: String
550
htChroot = Types.hypervisorToRaw Chroot
689 551

  
690
elogMessage :: String
691
elogMessage = Types.eLogTypeToRaw ELogMessage
552
htLxc :: String
553
htLxc = Types.hypervisorToRaw Lxc
692 554

  
693
elogRemoteImport :: String
694
elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
555
hyperTypes :: FrozenSet String
556
hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
695 557

  
696
elogJqueueTest :: String
697
elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
558
htsReqPort :: FrozenSet String
559
htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
698 560

  
699
-- * User separation
561
-- * Migration type
700 562

  
701
daemonsGroup :: String
702
daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
563
htMigrationLive :: String
564
htMigrationLive = Types.migrationModeToRaw MigrationLive
703 565

  
704
adminGroup :: String
705
adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
566
htMigrationNonlive :: String
567
htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
706 568

  
707
masterdUser :: String
708
masterdUser = Runtime.daemonUser GanetiMasterd
569
htMigrationModes :: FrozenSet String
570
htMigrationModes =
571
  ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
709 572

  
710
masterdGroup :: String
711
masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
573
-- * Cluster verify steps
712 574

  
713
rapiUser :: String
714
rapiUser = Runtime.daemonUser GanetiRapi
575
verifyNplusoneMem :: String
576
verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
715 577

  
716
rapiGroup :: String
717
rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
578
verifyOptionalChecks :: FrozenSet String
579
verifyOptionalChecks =
580
  ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
718 581

  
719
confdUser :: String
720
confdUser = Runtime.daemonUser GanetiConfd
582
-- * Cluster Verify error classes
721 583

  
722
confdGroup :: String
723
confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
584
cvTcluster :: String
585
cvTcluster = "cluster"
724 586

  
725
luxidUser :: String
726
luxidUser = Runtime.daemonUser GanetiLuxid
587
cvTgroup :: String
588
cvTgroup = "group"
727 589

  
728
luxidGroup :: String
729
luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
590
cvTnode :: String
591
cvTnode = "node"
730 592

  
731
nodedUser :: String
732
nodedUser = Runtime.daemonUser GanetiNoded
593
cvTinstance :: String
594
cvTinstance = "instance"
733 595

  
734
nodedGroup :: String
735
nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
596
-- * Cluster Verify error codes and documentation
736 597

  
737
mondUser :: String
738
mondUser = Runtime.daemonUser GanetiMond
598
cvEclustercert :: (String, String, String)
599
cvEclustercert =
600
  ("cluster",
601
   Types.cVErrorCodeToRaw CvECLUSTERCERT,
602
   "Cluster certificate files verification failure")
739 603

  
740
mondGroup :: String
741
mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
604
cvEclustercfg :: (String, String, String)
605
cvEclustercfg =
606
  ("cluster",
607
   Types.cVErrorCodeToRaw CvECLUSTERCFG,
608
   "Cluster configuration verification failure")
742 609

  
743
sshLoginUser :: String
744
sshLoginUser = AutoConf.sshLoginUser
610
cvEclusterdanglinginst :: (String, String, String)
611
cvEclusterdanglinginst =
612
  ("node",
613
   Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
614
   "Some instances have a non-existing primary node")
745 615

  
746
sshConsoleUser :: String
747
sshConsoleUser = AutoConf.sshConsoleUser
616
cvEclusterdanglingnodes :: (String, String, String)
617
cvEclusterdanglingnodes =
618
  ("node",
619
   Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
620
   "Some nodes belong to non-existing groups")
748 621

  
749
-- * SSH constants
622
cvEclusterfilecheck :: (String, String, String)
623
cvEclusterfilecheck =
624
  ("cluster",
625
   Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
626
   "Cluster configuration verification failure")
750 627

  
751
ssh :: String
752
ssh = "ssh"
628
cvEgroupdifferentpvsize :: (String, String, String)
629
cvEgroupdifferentpvsize =
630
  ("group",
631
   Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
632
   "PVs in the group have different sizes")
753 633

  
754
scp :: String
755
scp = "scp"
634
cvEinstancebadnode :: (String, String, String)
635
cvEinstancebadnode =
636
  ("instance",
637
   Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
638
   "Instance marked as running lives on an offline node")
756 639

  
757
-- * Daemons
640
cvEinstancedown :: (String, String, String)
641
cvEinstancedown =
642
  ("instance",
643
   Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
644
   "Instance not running on its primary node")
758 645

  
759
confd :: String
760
confd = Runtime.daemonName GanetiConfd
646
cvEinstancefaultydisk :: (String, String, String)
647
cvEinstancefaultydisk =
648
  ("instance",
649
   Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
650
   "Impossible to retrieve status for a disk")
761 651

  
762
masterd :: String
763
masterd = Runtime.daemonName GanetiMasterd
652
cvEinstancelayout :: (String, String, String)
653
cvEinstancelayout =
654
  ("instance",
655
   Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
656
   "Instance has multiple secondary nodes")
764 657

  
765
mond :: String
766
mond = Runtime.daemonName GanetiMond
658
cvEinstancemissingcfgparameter :: (String, String, String)
659
cvEinstancemissingcfgparameter =
660
  ("instance",
661
   Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
662
   "A configuration parameter for an instance is missing")
767 663

  
768
noded :: String
769
noded = Runtime.daemonName GanetiNoded
664
cvEinstancemissingdisk :: (String, String, String)
665
cvEinstancemissingdisk =
666
  ("instance",
667
   Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
668
   "Missing volume on an instance")
770 669

  
771
luxid :: String
772
luxid = Runtime.daemonName GanetiLuxid
670
cvEinstancepolicy :: (String, String, String)
671
cvEinstancepolicy =
672
  ("instance",
673
   Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
674
   "Instance does not meet policy")
773 675

  
774
rapi :: String
775
rapi = Runtime.daemonName GanetiRapi
676
cvEinstancesplitgroups :: (String, String, String)
677
cvEinstancesplitgroups =
678
  ("instance",
679
   Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
680
   "Instance with primary and secondary nodes in different groups")
776 681

  
777
daemons :: FrozenSet String
778
daemons =
779
  ConstantUtils.mkSet [confd,
780
                       luxid,
781
                       masterd,
782
                       mond,
783
                       noded,
784
                       rapi]
682
cvEinstanceunsuitablenode :: (String, String, String)
683
cvEinstanceunsuitablenode =
684
  ("instance",
685
   Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
686
   "Instance running on nodes that are not suitable for it")
785 687

  
786
defaultConfdPort :: Int
787
defaultConfdPort = 1814
688
cvEinstancewrongnode :: (String, String, String)
689
cvEinstancewrongnode =
690
  ("instance",
691
   Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
692
   "Instance running on the wrong node")
788 693

  
789
defaultMondPort :: Int
790
defaultMondPort = 1815
694
cvEnodedrbd :: (String, String, String)
695
cvEnodedrbd =
696
  ("node",
697
   Types.cVErrorCodeToRaw CvENODEDRBD,
698
   "Error parsing the DRBD status file")
791 699

  
792
defaultNodedPort :: Int
793
defaultNodedPort = 1811
700
cvEnodedrbdhelper :: (String, String, String)
701
cvEnodedrbdhelper =
702
  ("node",
703
   Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
704
   "Error caused by the DRBD helper")
794 705

  
795
defaultRapiPort :: Int
796
defaultRapiPort = 5080
706
cvEnodedrbdversion :: (String, String, String)
707
cvEnodedrbdversion =
708
  ("node",
709
   Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
710
   "DRBD version mismatch within a node group")
797 711

  
798
daemonsPorts :: Map String (Protocol, Int)
799
daemonsPorts =
800
  Map.fromList [(confd, (Udp, defaultConfdPort)),
801
                (mond, (Tcp, defaultMondPort)),
802
                (noded, (Tcp, defaultNodedPort)),
803
                (rapi, (Tcp, defaultRapiPort)),
804
                (ssh, (Tcp, 22))]
712
cvEnodefilecheck :: (String, String, String)
713
cvEnodefilecheck =
714
  ("node",
715
   Types.cVErrorCodeToRaw CvENODEFILECHECK,
716
   "Error retrieving the checksum of the node files")
805 717

  
806
daemonsLogbase :: Map String String
807
daemonsLogbase =
808
  Map.fromList
809
  [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
718
cvEnodefilestoragepaths :: (String, String, String)
719
cvEnodefilestoragepaths =
720
  ("node",
721
   Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
722
   "Detected bad file storage paths")
810 723

  
811
extraLogreasonAccess :: String
812
extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
724
cvEnodefilestoragepathunusable :: (String, String, String)
725
cvEnodefilestoragepathunusable =
726
  ("node",
727
   Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
728
   "File storage path unusable")
813 729

  
814
extraLogreasonError :: String
815
extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
730
cvEnodehooks :: (String, String, String)
731
cvEnodehooks =
732
  ("node",
733
   Types.cVErrorCodeToRaw CvENODEHOOKS,
734
   "Communication failure in hooks execution")
816 735

  
817
devConsole :: String
818
devConsole = ConstantUtils.devConsole
736
cvEnodehv :: (String, String, String)
737
cvEnodehv =
738
  ("node",
739
   Types.cVErrorCodeToRaw CvENODEHV,
740
   "Hypervisor parameters verification failure")
819 741

  
820
-- * Syslog
742
cvEnodelvm :: (String, String, String)
743
cvEnodelvm =
744
  ("node",
745
   Types.cVErrorCodeToRaw CvENODELVM,
746
   "LVM-related node error")
821 747

  
822
syslogUsage :: String
823
syslogUsage = AutoConf.syslogUsage
748
cvEnoden1 :: (String, String, String)
749
cvEnoden1 =
750
  ("node",
751
   Types.cVErrorCodeToRaw CvENODEN1,
752
   "Not enough memory to accommodate instance failovers")
824 753

  
825
syslogNo :: String
826
syslogNo = Logging.syslogUsageToRaw SyslogNo
754
cvEnodenet :: (String, String, String)
755
cvEnodenet =
756
  ("node",
757
   Types.cVErrorCodeToRaw CvENODENET,
758
   "Network-related node error")
827 759

  
828
syslogYes :: String
829
syslogYes = Logging.syslogUsageToRaw SyslogYes
760
cvEnodeoobpath :: (String, String, String)
761
cvEnodeoobpath =
762
  ("node",
763
   Types.cVErrorCodeToRaw CvENODEOOBPATH,
764
   "Invalid Out Of Band path")
830 765

  
831
syslogOnly :: String
832
syslogOnly = Logging.syslogUsageToRaw SyslogOnly
766
cvEnodeorphaninstance :: (String, String, String)
767
cvEnodeorphaninstance =
768
  ("node",
769
   Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
770
   "Unknown intance running on a node")
833 771

  
834
syslogSocket :: String
835
syslogSocket = "/dev/log"
772
cvEnodeorphanlv :: (String, String, String)
773
cvEnodeorphanlv =
774
  ("node",
775
   Types.cVErrorCodeToRaw CvENODEORPHANLV,
776
   "Unknown LVM logical volume")
836 777

  
837
-- * Xen
778
cvEnodeos :: (String, String, String)
779
cvEnodeos =
780
  ("node",
781
   Types.cVErrorCodeToRaw CvENODEOS,
782
   "OS-related node error")
838 783

  
839
xenBootloader :: String
840
xenBootloader = AutoConf.xenBootloader
784
cvEnoderpc :: (String, String, String)
785
cvEnoderpc =
786
  ("node",
787
   Types.cVErrorCodeToRaw CvENODERPC,
788
   "Error during connection to the primary node of an instance")
841 789

  
842
xenCmdXl :: String
843
xenCmdXl = "xl"
790
cvEnodesetup :: (String, String, String)
791
cvEnodesetup =
792
  ("node",
793
   Types.cVErrorCodeToRaw CvENODESETUP,
794
   "Node setup error")
844 795

  
845
xenCmdXm :: String
846
xenCmdXm = "xm"
796
cvEnodesharedfilestoragepathunusable :: (String, String, String)
797
cvEnodesharedfilestoragepathunusable =
798
  ("node",
799
   Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
800
   "Shared file storage path unusable")
847 801

  
848
xenInitrd :: String
849
xenInitrd = AutoConf.xenInitrd
802
cvEnodessh :: (String, String, String)
803
cvEnodessh =
804
  ("node",
805
   Types.cVErrorCodeToRaw CvENODESSH,
806
   "SSH-related node error")
850 807

  
851
xenKernel :: String
852
xenKernel = AutoConf.xenKernel
808
cvEnodetime :: (String, String, String)
809
cvEnodetime =
810
  ("node",
811
   Types.cVErrorCodeToRaw CvENODETIME,
812
   "Node returned invalid time")
853 813

  
854
-- FIXME: perhaps rename to 'validXenCommands' for consistency with
855
-- other constants
856
knownXenCommands :: FrozenSet String
857
knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
814
cvEnodeuserscripts :: (String, String, String)
815
cvEnodeuserscripts =
816
  ("node",
817
   Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
818
   "User scripts not present or not executable")
858 819

  
859
-- * Storage types
820
cvEnodeversion :: (String, String, String)
821
cvEnodeversion =
822
  ("node",
823
   Types.cVErrorCodeToRaw CvENODEVERSION,
824
   "Protocol version mismatch or Ganeti version mismatch")
860 825

  
861
stBlock :: String
862
stBlock = Types.storageTypeToRaw StorageBlock
826
cvAllEcodes :: FrozenSet (String, String, String)
827
cvAllEcodes =
828
  ConstantUtils.mkSet
829
  [cvEclustercert,
830
   cvEclustercfg,
831
   cvEclusterdanglinginst,
832
   cvEclusterdanglingnodes,
833
   cvEclusterfilecheck,
834
   cvEgroupdifferentpvsize,
835
   cvEinstancebadnode,
836
   cvEinstancedown,
837
   cvEinstancefaultydisk,
838
   cvEinstancelayout,
839
   cvEinstancemissingcfgparameter,
840
   cvEinstancemissingdisk,
841
   cvEinstancepolicy,
842
   cvEinstancesplitgroups,
843
   cvEinstanceunsuitablenode,
844
   cvEinstancewrongnode,
845
   cvEnodedrbd,
846
   cvEnodedrbdhelper,
847
   cvEnodedrbdversion,
848
   cvEnodefilecheck,
849
   cvEnodefilestoragepaths,
850
   cvEnodefilestoragepathunusable,
851
   cvEnodehooks,
852
   cvEnodehv,
853
   cvEnodelvm,
854
   cvEnoden1,
855
   cvEnodenet,
856
   cvEnodeoobpath,
857
   cvEnodeorphaninstance,
858
   cvEnodeorphanlv,
859
   cvEnodeos,
860
   cvEnoderpc,
861
   cvEnodesetup,
862
   cvEnodesharedfilestoragepathunusable,
863
   cvEnodessh,
864
   cvEnodetime,
865
   cvEnodeuserscripts,
866
   cvEnodeversion]
863 867

  
864
stDiskless :: String
865
stDiskless = Types.storageTypeToRaw StorageDiskless
868
cvAllEcodesStrings :: FrozenSet String
869
cvAllEcodesStrings =
870
  ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
866 871

  
867
stExt :: String
868
stExt = Types.storageTypeToRaw StorageExt
872
-- * Instance status
869 873

  
870
stFile :: String
871
stFile = Types.storageTypeToRaw StorageFile
874
inststAdmindown :: String
875
inststAdmindown = Types.instanceStatusToRaw StatusDown
872 876

  
873
stLvmPv :: String
874
stLvmPv = Types.storageTypeToRaw StorageLvmPv
877
inststAdminoffline :: String
878
inststAdminoffline = Types.instanceStatusToRaw StatusOffline
875 879

  
876
stLvmVg :: String
877
stLvmVg = Types.storageTypeToRaw StorageLvmVg
880
inststErrordown :: String
881
inststErrordown = Types.instanceStatusToRaw ErrorDown
878 882

  
879
stRados :: String
880
stRados = Types.storageTypeToRaw StorageRados
883
inststErrorup :: String
884
inststErrorup = Types.instanceStatusToRaw ErrorUp
881 885

  
882
storageTypes :: FrozenSet String
883
storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
886
inststNodedown :: String
887
inststNodedown = Types.instanceStatusToRaw NodeDown
884 888

  
885
-- * Storage fields
886
-- ** First two are valid in LU context only, not passed to backend
889
inststNodeoffline :: String
890
inststNodeoffline = Types.instanceStatusToRaw NodeOffline
887 891

  
888
sfNode :: String
889
sfNode = "node"
892
inststRunning :: String
893
inststRunning = Types.instanceStatusToRaw Running
890 894

  
891
sfType :: String
892
sfType = "type"
895
inststWrongnode :: String
896
inststWrongnode = Types.instanceStatusToRaw WrongNode
893 897

  
894
-- ** and the rest are valid in backend
898
inststAll :: FrozenSet String
899
inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
895 900

  
896
sfAllocatable :: String
897
sfAllocatable = Types.storageFieldToRaw SFAllocatable
901
-- * Admin states
898 902

  
899
sfFree :: String
900
sfFree = Types.storageFieldToRaw SFFree
903
adminstDown :: String
904
adminstDown = Types.adminStateToRaw AdminDown
901 905

  
902
sfName :: String
903
sfName = Types.storageFieldToRaw SFName
906
adminstOffline :: String
907
adminstOffline = Types.adminStateToRaw AdminOffline
904 908

  
905
sfSize :: String
906
sfSize = Types.storageFieldToRaw SFSize
909
adminstUp :: String
910
adminstUp = Types.adminStateToRaw AdminUp
907 911

  
908
sfUsed :: String
909
sfUsed = Types.storageFieldToRaw SFUsed
912
adminstAll :: FrozenSet String
913
adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
910 914

  
911
-- * Disk template types
915
-- * Node roles
912 916

  
913
dtDiskless :: String
914
dtDiskless = Types.diskTemplateToRaw DTDiskless
917
nrDrained :: String
918
nrDrained = Types.nodeRoleToRaw NRDrained
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff