47 |
47 |
import Ganeti.Logging (SyslogUsage(..))
|
48 |
48 |
import qualified Ganeti.Logging as Logging (syslogUsageToRaw)
|
49 |
49 |
import qualified Ganeti.Runtime as Runtime
|
|
50 |
import Ganeti.Types
|
|
51 |
import qualified Ganeti.Types as Types
|
|
52 |
|
|
53 |
-- * OOB supported commands
|
|
54 |
|
|
55 |
oobPowerOn :: String
|
|
56 |
oobPowerOn = Types.oobCommandToRaw OobHealth
|
|
57 |
|
|
58 |
oobPowerOff :: String
|
|
59 |
oobPowerOff = Types.oobCommandToRaw OobPowerOff
|
|
60 |
|
|
61 |
oobPowerCycle :: String
|
|
62 |
oobPowerCycle = Types.oobCommandToRaw OobPowerOn
|
|
63 |
|
|
64 |
oobPowerStatus :: String
|
|
65 |
oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
|
|
66 |
|
|
67 |
oobHealth :: String
|
|
68 |
oobHealth = Types.oobCommandToRaw OobHealth
|
|
69 |
|
|
70 |
oobCommands :: FrozenSet String
|
|
71 |
oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
|
|
72 |
|
|
73 |
oobPowerStatusPowered :: String
|
|
74 |
oobPowerStatusPowered = "powered"
|
|
75 |
|
|
76 |
-- | 60 seconds
|
|
77 |
oobTimeout :: Int
|
|
78 |
oobTimeout = 60
|
|
79 |
|
|
80 |
-- | 2 seconds
|
|
81 |
oobPowerDelay :: Double
|
|
82 |
oobPowerDelay = 2.0
|
|
83 |
|
|
84 |
oobStatusCritical :: String
|
|
85 |
oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
|
|
86 |
|
|
87 |
oobStatusOk :: String
|
|
88 |
oobStatusOk = Types.oobStatusToRaw OobStatusOk
|
|
89 |
|
|
90 |
oobStatusUnknown :: String
|
|
91 |
oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
|
|
92 |
|
|
93 |
oobStatusWarning :: String
|
|
94 |
oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
|
|
95 |
|
|
96 |
oobStatuses :: FrozenSet String
|
|
97 |
oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
|
|
98 |
|
|
99 |
-- * NIC_* constants are used inside the ganeti config
|
|
100 |
|
|
101 |
nicLink :: String
|
|
102 |
nicLink = "link"
|
|
103 |
|
|
104 |
nicMode :: String
|
|
105 |
nicMode = "mode"
|
|
106 |
|
|
107 |
nicVlan :: String
|
|
108 |
nicVlan = "vlan"
|
|
109 |
|
|
110 |
nicModeBridged :: String
|
|
111 |
nicModeBridged = Types.nICModeToRaw NMBridged
|
|
112 |
|
|
113 |
nicModeRouted :: String
|
|
114 |
nicModeRouted = Types.nICModeToRaw NMRouted
|
|
115 |
|
|
116 |
nicModeOvs :: String
|
|
117 |
nicModeOvs = Types.nICModeToRaw NMOvs
|
|
118 |
|
|
119 |
nicIpPool :: String
|
|
120 |
nicIpPool = Types.nICModeToRaw NMPool
|
|
121 |
|
|
122 |
nicValidModes :: FrozenSet String
|
|
123 |
nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
|
|
124 |
|
|
125 |
-- * Hypervisor constants
|
|
126 |
|
|
127 |
htXenPvm :: String
|
|
128 |
htXenPvm = Types.hypervisorToRaw XenPvm
|
|
129 |
|
|
130 |
htFake :: String
|
|
131 |
htFake = Types.hypervisorToRaw Fake
|
|
132 |
|
|
133 |
htXenHvm :: String
|
|
134 |
htXenHvm = Types.hypervisorToRaw XenHvm
|
|
135 |
|
|
136 |
htKvm :: String
|
|
137 |
htKvm = Types.hypervisorToRaw Kvm
|
|
138 |
|
|
139 |
htChroot :: String
|
|
140 |
htChroot = Types.hypervisorToRaw Chroot
|
|
141 |
|
|
142 |
htLxc :: String
|
|
143 |
htLxc = Types.hypervisorToRaw Lxc
|
|
144 |
|
|
145 |
hyperTypes :: FrozenSet String
|
|
146 |
hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
|
|
147 |
|
|
148 |
htsReqPort :: FrozenSet String
|
|
149 |
htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
|
|
150 |
|
|
151 |
-- * Migration type
|
|
152 |
|
|
153 |
htMigrationLive :: String
|
|
154 |
htMigrationLive = Types.migrationModeToRaw MigrationLive
|
|
155 |
|
|
156 |
htMigrationNonlive :: String
|
|
157 |
htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
|
|
158 |
|
|
159 |
htMigrationModes :: FrozenSet String
|
|
160 |
htMigrationModes =
|
|
161 |
ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
|
|
162 |
|
|
163 |
-- * Cluster verify steps
|
|
164 |
|
|
165 |
verifyNplusoneMem :: String
|
|
166 |
verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
|
|
167 |
|
|
168 |
verifyOptionalChecks :: FrozenSet String
|
|
169 |
verifyOptionalChecks =
|
|
170 |
ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
|
|
171 |
|
|
172 |
-- * Cluster Verify error classes
|
|
173 |
|
|
174 |
cvTcluster :: String
|
|
175 |
cvTcluster = "cluster"
|
|
176 |
|
|
177 |
cvTgroup :: String
|
|
178 |
cvTgroup = "group"
|
|
179 |
|
|
180 |
cvTnode :: String
|
|
181 |
cvTnode = "node"
|
|
182 |
|
|
183 |
cvTinstance :: String
|
|
184 |
cvTinstance = "instance"
|
|
185 |
|
|
186 |
-- * Cluster Verify error codes and documentation
|
|
187 |
|
|
188 |
cvEclustercert :: (String, String, String)
|
|
189 |
cvEclustercert =
|
|
190 |
("cluster",
|
|
191 |
Types.cVErrorCodeToRaw CvECLUSTERCERT,
|
|
192 |
"Cluster certificate files verification failure")
|
|
193 |
|
|
194 |
cvEclustercfg :: (String, String, String)
|
|
195 |
cvEclustercfg =
|
|
196 |
("cluster",
|
|
197 |
Types.cVErrorCodeToRaw CvECLUSTERCFG,
|
|
198 |
"Cluster configuration verification failure")
|
|
199 |
|
|
200 |
cvEclusterdanglinginst :: (String, String, String)
|
|
201 |
cvEclusterdanglinginst =
|
|
202 |
("node",
|
|
203 |
Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
|
|
204 |
"Some instances have a non-existing primary node")
|
|
205 |
|
|
206 |
cvEclusterdanglingnodes :: (String, String, String)
|
|
207 |
cvEclusterdanglingnodes =
|
|
208 |
("node",
|
|
209 |
Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
|
|
210 |
"Some nodes belong to non-existing groups")
|
|
211 |
|
|
212 |
cvEclusterfilecheck :: (String, String, String)
|
|
213 |
cvEclusterfilecheck =
|
|
214 |
("cluster",
|
|
215 |
Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
|
|
216 |
"Cluster configuration verification failure")
|
|
217 |
|
|
218 |
cvEgroupdifferentpvsize :: (String, String, String)
|
|
219 |
cvEgroupdifferentpvsize =
|
|
220 |
("group",
|
|
221 |
Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
|
|
222 |
"PVs in the group have different sizes")
|
|
223 |
|
|
224 |
cvEinstancebadnode :: (String, String, String)
|
|
225 |
cvEinstancebadnode =
|
|
226 |
("instance",
|
|
227 |
Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
|
|
228 |
"Instance marked as running lives on an offline node")
|
|
229 |
|
|
230 |
cvEinstancedown :: (String, String, String)
|
|
231 |
cvEinstancedown =
|
|
232 |
("instance",
|
|
233 |
Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
|
|
234 |
"Instance not running on its primary node")
|
|
235 |
|
|
236 |
cvEinstancefaultydisk :: (String, String, String)
|
|
237 |
cvEinstancefaultydisk =
|
|
238 |
("instance",
|
|
239 |
Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
|
|
240 |
"Impossible to retrieve status for a disk")
|
|
241 |
|
|
242 |
cvEinstancelayout :: (String, String, String)
|
|
243 |
cvEinstancelayout =
|
|
244 |
("instance",
|
|
245 |
Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
|
|
246 |
"Instance has multiple secondary nodes")
|
|
247 |
|
|
248 |
cvEinstancemissingcfgparameter :: (String, String, String)
|
|
249 |
cvEinstancemissingcfgparameter =
|
|
250 |
("instance",
|
|
251 |
Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
|
|
252 |
"A configuration parameter for an instance is missing")
|
|
253 |
|
|
254 |
cvEinstancemissingdisk :: (String, String, String)
|
|
255 |
cvEinstancemissingdisk =
|
|
256 |
("instance",
|
|
257 |
Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
|
|
258 |
"Missing volume on an instance")
|
|
259 |
|
|
260 |
cvEinstancepolicy :: (String, String, String)
|
|
261 |
cvEinstancepolicy =
|
|
262 |
("instance",
|
|
263 |
Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
|
|
264 |
"Instance does not meet policy")
|
|
265 |
|
|
266 |
cvEinstancesplitgroups :: (String, String, String)
|
|
267 |
cvEinstancesplitgroups =
|
|
268 |
("instance",
|
|
269 |
Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
|
|
270 |
"Instance with primary and secondary nodes in different groups")
|
|
271 |
|
|
272 |
cvEinstanceunsuitablenode :: (String, String, String)
|
|
273 |
cvEinstanceunsuitablenode =
|
|
274 |
("instance",
|
|
275 |
Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
|
|
276 |
"Instance running on nodes that are not suitable for it")
|
|
277 |
|
|
278 |
cvEinstancewrongnode :: (String, String, String)
|
|
279 |
cvEinstancewrongnode =
|
|
280 |
("instance",
|
|
281 |
Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
|
|
282 |
"Instance running on the wrong node")
|
|
283 |
|
|
284 |
cvEnodedrbd :: (String, String, String)
|
|
285 |
cvEnodedrbd =
|
|
286 |
("node",
|
|
287 |
Types.cVErrorCodeToRaw CvENODEDRBD,
|
|
288 |
"Error parsing the DRBD status file")
|
|
289 |
|
|
290 |
cvEnodedrbdhelper :: (String, String, String)
|
|
291 |
cvEnodedrbdhelper =
|
|
292 |
("node",
|
|
293 |
Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
|
|
294 |
"Error caused by the DRBD helper")
|
|
295 |
|
|
296 |
cvEnodedrbdversion :: (String, String, String)
|
|
297 |
cvEnodedrbdversion =
|
|
298 |
("node",
|
|
299 |
Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
|
|
300 |
"DRBD version mismatch within a node group")
|
|
301 |
|
|
302 |
cvEnodefilecheck :: (String, String, String)
|
|
303 |
cvEnodefilecheck =
|
|
304 |
("node",
|
|
305 |
Types.cVErrorCodeToRaw CvENODEFILECHECK,
|
|
306 |
"Error retrieving the checksum of the node files")
|
|
307 |
|
|
308 |
cvEnodefilestoragepaths :: (String, String, String)
|
|
309 |
cvEnodefilestoragepaths =
|
|
310 |
("node",
|
|
311 |
Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
|
|
312 |
"Detected bad file storage paths")
|
|
313 |
|
|
314 |
cvEnodefilestoragepathunusable :: (String, String, String)
|
|
315 |
cvEnodefilestoragepathunusable =
|
|
316 |
("node",
|
|
317 |
Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
|
|
318 |
"File storage path unusable")
|
|
319 |
|
|
320 |
cvEnodehooks :: (String, String, String)
|
|
321 |
cvEnodehooks =
|
|
322 |
("node",
|
|
323 |
Types.cVErrorCodeToRaw CvENODEHOOKS,
|
|
324 |
"Communication failure in hooks execution")
|
|
325 |
|
|
326 |
cvEnodehv :: (String, String, String)
|
|
327 |
cvEnodehv =
|
|
328 |
("node",
|
|
329 |
Types.cVErrorCodeToRaw CvENODEHV,
|
|
330 |
"Hypervisor parameters verification failure")
|
|
331 |
|
|
332 |
cvEnodelvm :: (String, String, String)
|
|
333 |
cvEnodelvm =
|
|
334 |
("node",
|
|
335 |
Types.cVErrorCodeToRaw CvENODELVM,
|
|
336 |
"LVM-related node error")
|
|
337 |
|
|
338 |
cvEnoden1 :: (String, String, String)
|
|
339 |
cvEnoden1 =
|
|
340 |
("node",
|
|
341 |
Types.cVErrorCodeToRaw CvENODEN1,
|
|
342 |
"Not enough memory to accommodate instance failovers")
|
|
343 |
|
|
344 |
cvEnodenet :: (String, String, String)
|
|
345 |
cvEnodenet =
|
|
346 |
("node",
|
|
347 |
Types.cVErrorCodeToRaw CvENODENET,
|
|
348 |
"Network-related node error")
|
|
349 |
|
|
350 |
cvEnodeoobpath :: (String, String, String)
|
|
351 |
cvEnodeoobpath =
|
|
352 |
("node",
|
|
353 |
Types.cVErrorCodeToRaw CvENODEOOBPATH,
|
|
354 |
"Invalid Out Of Band path")
|
|
355 |
|
|
356 |
cvEnodeorphaninstance :: (String, String, String)
|
|
357 |
cvEnodeorphaninstance =
|
|
358 |
("node",
|
|
359 |
Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
|
|
360 |
"Unknown intance running on a node")
|
|
361 |
|
|
362 |
cvEnodeorphanlv :: (String, String, String)
|
|
363 |
cvEnodeorphanlv =
|
|
364 |
("node",
|
|
365 |
Types.cVErrorCodeToRaw CvENODEORPHANLV,
|
|
366 |
"Unknown LVM logical volume")
|
|
367 |
|
|
368 |
cvEnodeos :: (String, String, String)
|
|
369 |
cvEnodeos =
|
|
370 |
("node",
|
|
371 |
Types.cVErrorCodeToRaw CvENODEOS,
|
|
372 |
"OS-related node error")
|
|
373 |
|
|
374 |
cvEnoderpc :: (String, String, String)
|
|
375 |
cvEnoderpc =
|
|
376 |
("node",
|
|
377 |
Types.cVErrorCodeToRaw CvENODERPC,
|
|
378 |
"Error during connection to the primary node of an instance")
|
|
379 |
|
|
380 |
cvEnodesetup :: (String, String, String)
|
|
381 |
cvEnodesetup =
|
|
382 |
("node",
|
|
383 |
Types.cVErrorCodeToRaw CvENODESETUP,
|
|
384 |
"Node setup error")
|
|
385 |
|
|
386 |
cvEnodesharedfilestoragepathunusable :: (String, String, String)
|
|
387 |
cvEnodesharedfilestoragepathunusable =
|
|
388 |
("node",
|
|
389 |
Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
|
|
390 |
"Shared file storage path unusable")
|
|
391 |
|
|
392 |
cvEnodessh :: (String, String, String)
|
|
393 |
cvEnodessh =
|
|
394 |
("node",
|
|
395 |
Types.cVErrorCodeToRaw CvENODESSH,
|
|
396 |
"SSH-related node error")
|
|
397 |
|
|
398 |
cvEnodetime :: (String, String, String)
|
|
399 |
cvEnodetime =
|
|
400 |
("node",
|
|
401 |
Types.cVErrorCodeToRaw CvENODETIME,
|
|
402 |
"Node returned invalid time")
|
|
403 |
|
|
404 |
cvEnodeuserscripts :: (String, String, String)
|
|
405 |
cvEnodeuserscripts =
|
|
406 |
("node",
|
|
407 |
Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
|
|
408 |
"User scripts not present or not executable")
|
|
409 |
|
|
410 |
cvEnodeversion :: (String, String, String)
|
|
411 |
cvEnodeversion =
|
|
412 |
("node",
|
|
413 |
Types.cVErrorCodeToRaw CvENODEVERSION,
|
|
414 |
"Protocol version mismatch or Ganeti version mismatch")
|
|
415 |
|
|
416 |
cvAllEcodes :: FrozenSet (String, String, String)
|
|
417 |
cvAllEcodes =
|
|
418 |
ConstantUtils.mkSet
|
|
419 |
[cvEclustercert,
|
|
420 |
cvEclustercfg,
|
|
421 |
cvEclusterdanglinginst,
|
|
422 |
cvEclusterdanglingnodes,
|
|
423 |
cvEclusterfilecheck,
|
|
424 |
cvEgroupdifferentpvsize,
|
|
425 |
cvEinstancebadnode,
|
|
426 |
cvEinstancedown,
|
|
427 |
cvEinstancefaultydisk,
|
|
428 |
cvEinstancelayout,
|
|
429 |
cvEinstancemissingcfgparameter,
|
|
430 |
cvEinstancemissingdisk,
|
|
431 |
cvEinstancepolicy,
|
|
432 |
cvEinstancesplitgroups,
|
|
433 |
cvEinstanceunsuitablenode,
|
|
434 |
cvEinstancewrongnode,
|
|
435 |
cvEnodedrbd,
|
|
436 |
cvEnodedrbdhelper,
|
|
437 |
cvEnodedrbdversion,
|
|
438 |
cvEnodefilecheck,
|
|
439 |
cvEnodefilestoragepaths,
|
|
440 |
cvEnodefilestoragepathunusable,
|
|
441 |
cvEnodehooks,
|
|
442 |
cvEnodehv,
|
|
443 |
cvEnodelvm,
|
|
444 |
cvEnoden1,
|
|
445 |
cvEnodenet,
|
|
446 |
cvEnodeoobpath,
|
|
447 |
cvEnodeorphaninstance,
|
|
448 |
cvEnodeorphanlv,
|
|
449 |
cvEnodeos,
|
|
450 |
cvEnoderpc,
|
|
451 |
cvEnodesetup,
|
|
452 |
cvEnodesharedfilestoragepathunusable,
|
|
453 |
cvEnodessh,
|
|
454 |
cvEnodetime,
|
|
455 |
cvEnodeuserscripts,
|
|
456 |
cvEnodeversion]
|
|
457 |
|
|
458 |
cvAllEcodesStrings :: FrozenSet String
|
|
459 |
cvAllEcodesStrings =
|
|
460 |
ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
|
|
461 |
|
|
462 |
-- * Instance status
|
|
463 |
|
|
464 |
inststAdmindown :: String
|
|
465 |
inststAdmindown = Types.instanceStatusToRaw StatusDown
|
|
466 |
|
|
467 |
inststAdminoffline :: String
|
|
468 |
inststAdminoffline = Types.instanceStatusToRaw StatusOffline
|
|
469 |
|
|
470 |
inststErrordown :: String
|
|
471 |
inststErrordown = Types.instanceStatusToRaw ErrorDown
|
|
472 |
|
|
473 |
inststErrorup :: String
|
|
474 |
inststErrorup = Types.instanceStatusToRaw ErrorUp
|
|
475 |
|
|
476 |
inststNodedown :: String
|
|
477 |
inststNodedown = Types.instanceStatusToRaw NodeDown
|
|
478 |
|
|
479 |
inststNodeoffline :: String
|
|
480 |
inststNodeoffline = Types.instanceStatusToRaw NodeOffline
|
|
481 |
|
|
482 |
inststRunning :: String
|
|
483 |
inststRunning = Types.instanceStatusToRaw Running
|
|
484 |
|
|
485 |
inststWrongnode :: String
|
|
486 |
inststWrongnode = Types.instanceStatusToRaw WrongNode
|
|
487 |
|
|
488 |
inststAll :: FrozenSet String
|
|
489 |
inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
|
50 |
490 |
|
51 |
491 |
-- * Admin states
|
52 |
492 |
|
... | ... | |
62 |
502 |
adminstAll :: FrozenSet String
|
63 |
503 |
adminstAll = ConstantUtils.mkSet [adminstDown, adminstOffline, adminstUp]
|
64 |
504 |
|
|
505 |
-- * Allocator framework constants
|
|
506 |
|
|
507 |
iallocatorVersion :: Int
|
|
508 |
iallocatorVersion = 2
|
|
509 |
|
|
510 |
iallocatorDirIn :: String
|
|
511 |
iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
|
|
512 |
|
|
513 |
iallocatorDirOut :: String
|
|
514 |
iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
|
|
515 |
|
|
516 |
validIallocatorDirections :: FrozenSet String
|
|
517 |
validIallocatorDirections =
|
|
518 |
ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
|
|
519 |
|
|
520 |
iallocatorModeAlloc :: String
|
|
521 |
iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
|
|
522 |
|
|
523 |
iallocatorModeChgGroup :: String
|
|
524 |
iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
|
|
525 |
|
|
526 |
iallocatorModeMultiAlloc :: String
|
|
527 |
iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
|
|
528 |
|
|
529 |
iallocatorModeNodeEvac :: String
|
|
530 |
iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
|
|
531 |
|
|
532 |
iallocatorModeReloc :: String
|
|
533 |
iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
|
|
534 |
|
|
535 |
validIallocatorModes :: FrozenSet String
|
|
536 |
validIallocatorModes =
|
|
537 |
ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
|
|
538 |
|
|
539 |
iallocatorSearchPath :: [String]
|
|
540 |
iallocatorSearchPath = AutoConf.iallocatorSearchPath
|
|
541 |
|
|
542 |
defaultIallocatorShortcut :: String
|
|
543 |
defaultIallocatorShortcut = "."
|
|
544 |
|
|
545 |
iallocatorNevacPri :: String
|
|
546 |
iallocatorNevacPri = Types.nodeEvacModeToRaw NEvacPrimary
|
|
547 |
|
|
548 |
iallocatorNevacSec :: String
|
|
549 |
iallocatorNevacSec = Types.nodeEvacModeToRaw NEvacSecondary
|
|
550 |
|
|
551 |
iallocatorNevacAll :: String
|
|
552 |
iallocatorNevacAll = Types.nodeEvacModeToRaw NEvacAll
|
|
553 |
|
|
554 |
iallocatorNevacModes :: FrozenSet String
|
|
555 |
iallocatorNevacModes =
|
|
556 |
ConstantUtils.mkSet $ map Types.nodeEvacModeToRaw [minBound..]
|
|
557 |
|
|
558 |
-- * Node evacuation
|
|
559 |
|
|
560 |
nodeEvacPri :: String
|
|
561 |
nodeEvacPri = Types.nodeEvacModeToRaw NEvacPrimary
|
|
562 |
|
|
563 |
nodeEvacSec :: String
|
|
564 |
nodeEvacSec = Types.nodeEvacModeToRaw NEvacSecondary
|
|
565 |
|
|
566 |
nodeEvacAll :: String
|
|
567 |
nodeEvacAll = Types.nodeEvacModeToRaw NEvacAll
|
|
568 |
|
|
569 |
nodeEvacModes :: FrozenSet String
|
|
570 |
nodeEvacModes = ConstantUtils.mkSet $ map Types.nodeEvacModeToRaw [minBound..]
|
|
571 |
|
|
572 |
-- * Job status
|
|
573 |
|
|
574 |
jobStatusQueued :: String
|
|
575 |
jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
|
|
576 |
|
|
577 |
jobStatusWaiting :: String
|
|
578 |
jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
|
|
579 |
|
|
580 |
jobStatusCanceling :: String
|
|
581 |
jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
|
|
582 |
|
|
583 |
jobStatusRunning :: String
|
|
584 |
jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
|
|
585 |
|
|
586 |
jobStatusCanceled :: String
|
|
587 |
jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
|
|
588 |
|
|
589 |
jobStatusSuccess :: String
|
|
590 |
jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
|
|
591 |
|
|
592 |
jobStatusError :: String
|
|
593 |
jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
|
|
594 |
|
|
595 |
jobsPending :: FrozenSet String
|
|
596 |
jobsPending =
|
|
597 |
ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
|
|
598 |
|
|
599 |
jobsFinalized :: FrozenSet String
|
|
600 |
jobsFinalized =
|
|
601 |
ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
|
|
602 |
|
|
603 |
jobStatusAll :: FrozenSet String
|
|
604 |
jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
|
|
605 |
|
|
606 |
-- * OpCode status
|
|
607 |
|
|
608 |
-- ** Not yet finalized opcodes
|
|
609 |
|
|
610 |
opStatusCanceling :: String
|
|
611 |
opStatusCanceling = "canceling"
|
|
612 |
|
|
613 |
opStatusQueued :: String
|
|
614 |
opStatusQueued = "queued"
|
|
615 |
|
|
616 |
opStatusRunning :: String
|
|
617 |
opStatusRunning = "running"
|
|
618 |
|
|
619 |
opStatusWaiting :: String
|
|
620 |
opStatusWaiting = "waiting"
|
|
621 |
|
|
622 |
-- ** Finalized opcodes
|
|
623 |
|
|
624 |
opStatusCanceled :: String
|
|
625 |
opStatusCanceled = "canceled"
|
|
626 |
|
|
627 |
opStatusError :: String
|
|
628 |
opStatusError = "error"
|
|
629 |
|
|
630 |
opStatusSuccess :: String
|
|
631 |
opStatusSuccess = "success"
|
|
632 |
|
|
633 |
opsFinalized :: FrozenSet String
|
|
634 |
opsFinalized =
|
|
635 |
ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
|
|
636 |
|
|
637 |
-- * OpCode priority
|
|
638 |
|
|
639 |
opPrioLowest :: Int
|
|
640 |
opPrioLowest = 19
|
|
641 |
|
|
642 |
opPrioHighest :: Int
|
|
643 |
opPrioHighest = -20
|
|
644 |
|
|
645 |
opPrioLow :: Int
|
|
646 |
opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
|
|
647 |
|
|
648 |
opPrioNormal :: Int
|
|
649 |
opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
|
|
650 |
|
|
651 |
opPrioHigh :: Int
|
|
652 |
opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
|
|
653 |
|
|
654 |
opPrioSubmitValid :: FrozenSet Int
|
|
655 |
opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
|
|
656 |
|
|
657 |
opPrioDefault :: Int
|
|
658 |
opPrioDefault = opPrioNormal
|
|
659 |
|
|
660 |
-- * Execution log types
|
|
661 |
|
|
662 |
elogMessage :: String
|
|
663 |
elogMessage = Types.eLogTypeToRaw ELogMessage
|
|
664 |
|
|
665 |
elogRemoteImport :: String
|
|
666 |
elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
|
|
667 |
|
|
668 |
elogJqueueTest :: String
|
|
669 |
elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
|
|
670 |
|
65 |
671 |
-- * User separation
|
66 |
672 |
|
67 |
673 |
daemonsGroup :: String
|
... | ... | |
222 |
828 |
knownXenCommands :: FrozenSet String
|
223 |
829 |
knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
|
224 |
830 |
|
|
831 |
-- * Storage types
|
|
832 |
|
|
833 |
stBlock :: String
|
|
834 |
stBlock = Types.storageTypeToRaw StorageBlock
|
|
835 |
|
|
836 |
stDiskless :: String
|
|
837 |
stDiskless = Types.storageTypeToRaw StorageDiskless
|
|
838 |
|
|
839 |
stExt :: String
|
|
840 |
stExt = Types.storageTypeToRaw StorageExt
|
|
841 |
|
|
842 |
stFile :: String
|
|
843 |
stFile = Types.storageTypeToRaw StorageFile
|
|
844 |
|
|
845 |
stLvmPv :: String
|
|
846 |
stLvmPv = Types.storageTypeToRaw StorageLvmPv
|
|
847 |
|
|
848 |
stLvmVg :: String
|
|
849 |
stLvmVg = Types.storageTypeToRaw StorageLvmVg
|
|
850 |
|
|
851 |
stRados :: String
|
|
852 |
stRados = Types.storageTypeToRaw StorageRados
|
|
853 |
|
|
854 |
storageTypes :: FrozenSet String
|
|
855 |
storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
|
|
856 |
|
|
857 |
-- * Disk template types
|
|
858 |
|
|
859 |
dtDiskless :: String
|
|
860 |
dtDiskless = Types.diskTemplateToRaw DTDiskless
|
|
861 |
|
|
862 |
dtFile :: String
|
|
863 |
dtFile = Types.diskTemplateToRaw DTFile
|
|
864 |
|
|
865 |
dtSharedFile :: String
|
|
866 |
dtSharedFile = Types.diskTemplateToRaw DTSharedFile
|
|
867 |
|
|
868 |
dtPlain :: String
|
|
869 |
dtPlain = Types.diskTemplateToRaw DTPlain
|
|
870 |
|
|
871 |
dtBlock :: String
|
|
872 |
dtBlock = Types.diskTemplateToRaw DTBlock
|
|
873 |
|
|
874 |
dtDrbd8 :: String
|
|
875 |
dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
|
|
876 |
|
|
877 |
dtRbd :: String
|
|
878 |
dtRbd = Types.diskTemplateToRaw DTRbd
|
|
879 |
|
|
880 |
dtExt :: String
|
|
881 |
dtExt = Types.diskTemplateToRaw DTExt
|
|
882 |
|
|
883 |
-- | This is used to order determine the default disk template when
|
|
884 |
-- the list of enabled disk templates is inferred from the current
|
|
885 |
-- state of the cluster. This only happens on an upgrade from a
|
|
886 |
-- version of Ganeti that did not support the 'enabled_disk_templates'
|
|
887 |
-- so far.
|
|
888 |
diskTemplatePreference :: [String]
|
|
889 |
diskTemplatePreference =
|
|
890 |
map Types.diskTemplateToRaw
|
|
891 |
[DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile]
|
|
892 |
|
|
893 |
diskTemplates :: FrozenSet String
|
|
894 |
diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
|
|
895 |
|
|
896 |
-- | Disk templates that are enabled by default
|
|
897 |
defaultEnabledDiskTemplates :: [String]
|
|
898 |
defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
|
|
899 |
|
|
900 |
-- * File backend driver
|
|
901 |
|
|
902 |
fdBlktap :: String
|
|
903 |
fdBlktap = Types.fileDriverToRaw FileBlktap
|
|
904 |
|
|
905 |
fdLoop :: String
|
|
906 |
fdLoop = Types.fileDriverToRaw FileLoop
|
|
907 |
|
|
908 |
-- * Instance export mode
|
|
909 |
|
|
910 |
exportModeLocal :: String
|
|
911 |
exportModeLocal = Types.exportModeToRaw ExportModeLocal
|
|
912 |
|
|
913 |
exportModeRemote :: String
|
|
914 |
exportModeRemote = Types.exportModeToRaw ExportModeRemote
|
|
915 |
|
|
916 |
exportModes :: FrozenSet String
|
|
917 |
exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
|
|
918 |
|
|
919 |
-- * Instance creation modes
|
|
920 |
|
|
921 |
instanceCreate :: String
|
|
922 |
instanceCreate = Types.instCreateModeToRaw InstCreate
|
|
923 |
|
|
924 |
instanceImport :: String
|
|
925 |
instanceImport = Types.instCreateModeToRaw InstImport
|
|
926 |
|
|
927 |
instanceRemoteImport :: String
|
|
928 |
instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
|
|
929 |
|
|
930 |
instanceCreateModes :: FrozenSet String
|
|
931 |
instanceCreateModes =
|
|
932 |
ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
|
|
933 |
|
|
934 |
-- * Dynamic device modification
|
|
935 |
|
|
936 |
ddmAdd :: String
|
|
937 |
ddmAdd = Types.ddmFullToRaw DdmFullAdd
|
|
938 |
|
|
939 |
ddmModify :: String
|
|
940 |
ddmModify = Types.ddmFullToRaw DdmFullModify
|
|
941 |
|
|
942 |
ddmRemove :: String
|
|
943 |
ddmRemove = Types.ddmFullToRaw DdmFullRemove
|
|
944 |
|
|
945 |
ddmsValues :: FrozenSet String
|
|
946 |
ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
|
|
947 |
|
|
948 |
ddmsValuesWithModify :: FrozenSet String
|
|
949 |
ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
|
|
950 |
|
225 |
951 |
-- * Common exit codes
|
226 |
952 |
|
227 |
953 |
exitSuccess :: Int
|
... | ... | |
247 |
973 |
exitUnknownField :: Int
|
248 |
974 |
exitUnknownField = 14
|
249 |
975 |
|
|
976 |
-- * Tags
|
|
977 |
|
|
978 |
tagCluster :: String
|
|
979 |
tagCluster = Types.tagKindToRaw TagKindCluster
|
|
980 |
|
|
981 |
tagInstance :: String
|
|
982 |
tagInstance = Types.tagKindToRaw TagKindInstance
|
|
983 |
|
|
984 |
tagNetwork :: String
|
|
985 |
tagNetwork = Types.tagKindToRaw TagKindNetwork
|
|
986 |
|
|
987 |
tagNode :: String
|
|
988 |
tagNode = Types.tagKindToRaw TagKindNode
|
|
989 |
|
|
990 |
tagNodegroup :: String
|
|
991 |
tagNodegroup = Types.tagKindToRaw TagKindGroup
|
|
992 |
|
|
993 |
validTagTypes :: FrozenSet String
|
|
994 |
validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
|
|
995 |
|
|
996 |
maxTagLen :: Int
|
|
997 |
maxTagLen = 128
|
|
998 |
|
|
999 |
maxTagsPerObj :: Int
|
|
1000 |
maxTagsPerObj = 4096
|
|
1001 |
|
|
1002 |
-- * Reboot types
|
|
1003 |
|
|
1004 |
instanceRebootSoft :: String
|
|
1005 |
instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
|
|
1006 |
|
|
1007 |
instanceRebootHard :: String
|
|
1008 |
instanceRebootHard = Types.rebootTypeToRaw RebootHard
|
|
1009 |
|
|
1010 |
instanceRebootFull :: String
|
|
1011 |
instanceRebootFull = Types.rebootTypeToRaw RebootFull
|
|
1012 |
|
|
1013 |
rebootTypes :: FrozenSet String
|
|
1014 |
rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
|
|
1015 |
|
250 |
1016 |
-- * Possible values for NodeGroup.alloc_policy
|
251 |
1017 |
|
252 |
1018 |
allocPolicyLastResort :: String
|