131 |
131 |
import Text.JSON (JSON, readJSON, showJSON)
|
132 |
132 |
import Data.Ratio (numerator, denominator)
|
133 |
133 |
|
134 |
|
import qualified Ganeti.Constants as C
|
135 |
|
import qualified Ganeti.THH as THH
|
|
134 |
import qualified Ganeti.ConstantUtils as ConstantUtils
|
136 |
135 |
import Ganeti.JSON
|
|
136 |
import qualified Ganeti.THH as THH
|
137 |
137 |
import Ganeti.Utils
|
138 |
138 |
|
139 |
139 |
-- * Generic types
|
... | ... | |
253 |
253 |
-- * Ganeti types
|
254 |
254 |
|
255 |
255 |
-- | Instance disk template type.
|
256 |
|
$(THH.declareSADT "DiskTemplate"
|
257 |
|
[ ("DTDiskless", 'C.dtDiskless)
|
258 |
|
, ("DTFile", 'C.dtFile)
|
259 |
|
, ("DTSharedFile", 'C.dtSharedFile)
|
260 |
|
, ("DTPlain", 'C.dtPlain)
|
261 |
|
, ("DTBlock", 'C.dtBlock)
|
262 |
|
, ("DTDrbd8", 'C.dtDrbd8)
|
263 |
|
, ("DTRbd", 'C.dtRbd)
|
264 |
|
, ("DTExt", 'C.dtExt)
|
|
256 |
$(THH.declareLADT ''String "DiskTemplate"
|
|
257 |
[ ("DTDiskless", "diskless")
|
|
258 |
, ("DTFile", "file")
|
|
259 |
, ("DTSharedFile", "sharedfile")
|
|
260 |
, ("DTPlain", "plain")
|
|
261 |
, ("DTBlock", "blockdev")
|
|
262 |
, ("DTDrbd8", "drbd")
|
|
263 |
, ("DTRbd", "rbd")
|
|
264 |
, ("DTExt", "ext")
|
265 |
265 |
])
|
266 |
266 |
$(THH.makeJSONInstance ''DiskTemplate)
|
267 |
267 |
|
... | ... | |
270 |
270 |
toStringRepr = diskTemplateToRaw
|
271 |
271 |
|
272 |
272 |
-- | Data type representing what items the tag operations apply to.
|
273 |
|
$(THH.declareSADT "TagKind"
|
274 |
|
[ ("TagKindInstance", 'C.tagInstance)
|
275 |
|
, ("TagKindNode", 'C.tagNode)
|
276 |
|
, ("TagKindGroup", 'C.tagNodegroup)
|
277 |
|
, ("TagKindCluster", 'C.tagCluster)
|
|
273 |
$(THH.declareLADT ''String "TagKind"
|
|
274 |
[ ("TagKindInstance", "instance")
|
|
275 |
, ("TagKindNode", "node")
|
|
276 |
, ("TagKindGroup", "nodegroup")
|
|
277 |
, ("TagKindCluster", "cluster")
|
278 |
278 |
])
|
279 |
279 |
$(THH.makeJSONInstance ''TagKind)
|
280 |
280 |
|
... | ... | |
284 |
284 |
-- Ord instance will order them in the order they are defined, so when
|
285 |
285 |
-- changing this data type be careful about the interaction with the
|
286 |
286 |
-- desired sorting order.
|
287 |
|
$(THH.declareSADT "AllocPolicy"
|
288 |
|
[ ("AllocPreferred", 'C.allocPolicyPreferred)
|
289 |
|
, ("AllocLastResort", 'C.allocPolicyLastResort)
|
290 |
|
, ("AllocUnallocable", 'C.allocPolicyUnallocable)
|
|
287 |
$(THH.declareLADT ''String "AllocPolicy"
|
|
288 |
[ ("AllocPreferred", "preferred")
|
|
289 |
, ("AllocLastResort", "last_resort")
|
|
290 |
, ("AllocUnallocable", "unallocable")
|
291 |
291 |
])
|
292 |
292 |
$(THH.makeJSONInstance ''AllocPolicy)
|
293 |
293 |
|
294 |
294 |
-- | The Instance real state type. FIXME: this could be improved to
|
295 |
295 |
-- just wrap a /NormalState AdminStatus | ErrorState ErrorCondition/.
|
296 |
|
$(THH.declareSADT "InstanceStatus"
|
297 |
|
[ ("StatusDown", 'C.inststAdmindown)
|
298 |
|
, ("StatusOffline", 'C.inststAdminoffline)
|
299 |
|
, ("ErrorDown", 'C.inststErrordown)
|
300 |
|
, ("ErrorUp", 'C.inststErrorup)
|
301 |
|
, ("NodeDown", 'C.inststNodedown)
|
302 |
|
, ("NodeOffline", 'C.inststNodeoffline)
|
303 |
|
, ("Running", 'C.inststRunning)
|
304 |
|
, ("WrongNode", 'C.inststWrongnode)
|
|
296 |
$(THH.declareLADT ''String "InstanceStatus"
|
|
297 |
[ ("StatusDown", "ADMIN_down")
|
|
298 |
, ("StatusOffline", "ADMIN_offline")
|
|
299 |
, ("ErrorDown", "ERROR_down")
|
|
300 |
, ("ErrorUp", "ERROR_up")
|
|
301 |
, ("NodeDown", "ERROR_nodedown")
|
|
302 |
, ("NodeOffline", "ERROR_nodeoffline")
|
|
303 |
, ("Running", "running")
|
|
304 |
, ("WrongNode", "ERROR_wrongnode")
|
305 |
305 |
])
|
306 |
306 |
$(THH.makeJSONInstance ''InstanceStatus)
|
307 |
307 |
|
308 |
308 |
-- | Migration mode.
|
309 |
|
$(THH.declareSADT "MigrationMode"
|
310 |
|
[ ("MigrationLive", 'C.htMigrationLive)
|
311 |
|
, ("MigrationNonLive", 'C.htMigrationNonlive)
|
|
309 |
$(THH.declareLADT ''String "MigrationMode"
|
|
310 |
[ ("MigrationLive", "live")
|
|
311 |
, ("MigrationNonLive", "non-live")
|
312 |
312 |
])
|
313 |
313 |
$(THH.makeJSONInstance ''MigrationMode)
|
314 |
314 |
|
315 |
315 |
-- | Verify optional checks.
|
316 |
|
$(THH.declareSADT "VerifyOptionalChecks"
|
317 |
|
[ ("VerifyNPlusOneMem", 'C.verifyNplusoneMem)
|
|
316 |
$(THH.declareLADT ''String "VerifyOptionalChecks"
|
|
317 |
[ ("VerifyNPlusOneMem", "nplusone_mem")
|
318 |
318 |
])
|
319 |
319 |
$(THH.makeJSONInstance ''VerifyOptionalChecks)
|
320 |
320 |
|
321 |
321 |
-- | Cluster verify error codes.
|
322 |
|
$(THH.declareSADT "CVErrorCode"
|
323 |
|
[ ("CvECLUSTERCFG", 'C.cvEclustercfgCode)
|
324 |
|
, ("CvECLUSTERCERT", 'C.cvEclustercertCode)
|
325 |
|
, ("CvECLUSTERFILECHECK", 'C.cvEclusterfilecheckCode)
|
326 |
|
, ("CvECLUSTERDANGLINGNODES", 'C.cvEclusterdanglingnodesCode)
|
327 |
|
, ("CvECLUSTERDANGLINGINST", 'C.cvEclusterdanglinginstCode)
|
328 |
|
, ("CvEINSTANCEBADNODE", 'C.cvEinstancebadnodeCode)
|
329 |
|
, ("CvEINSTANCEDOWN", 'C.cvEinstancedownCode)
|
330 |
|
, ("CvEINSTANCELAYOUT", 'C.cvEinstancelayoutCode)
|
331 |
|
, ("CvEINSTANCEMISSINGDISK", 'C.cvEinstancemissingdiskCode)
|
332 |
|
, ("CvEINSTANCEFAULTYDISK", 'C.cvEinstancefaultydiskCode)
|
333 |
|
, ("CvEINSTANCEWRONGNODE", 'C.cvEinstancewrongnodeCode)
|
334 |
|
, ("CvEINSTANCESPLITGROUPS", 'C.cvEinstancesplitgroupsCode)
|
335 |
|
, ("CvEINSTANCEPOLICY", 'C.cvEinstancepolicyCode)
|
336 |
|
, ("CvENODEDRBD", 'C.cvEnodedrbdCode)
|
337 |
|
, ("CvENODEDRBDHELPER", 'C.cvEnodedrbdhelperCode)
|
338 |
|
, ("CvENODEFILECHECK", 'C.cvEnodefilecheckCode)
|
339 |
|
, ("CvENODEHOOKS", 'C.cvEnodehooksCode)
|
340 |
|
, ("CvENODEHV", 'C.cvEnodehvCode)
|
341 |
|
, ("CvENODELVM", 'C.cvEnodelvmCode)
|
342 |
|
, ("CvENODEN1", 'C.cvEnoden1Code)
|
343 |
|
, ("CvENODENET", 'C.cvEnodenetCode)
|
344 |
|
, ("CvENODEOS", 'C.cvEnodeosCode)
|
345 |
|
, ("CvENODEORPHANINSTANCE", 'C.cvEnodeorphaninstanceCode)
|
346 |
|
, ("CvENODEORPHANLV", 'C.cvEnodeorphanlvCode)
|
347 |
|
, ("CvENODERPC", 'C.cvEnoderpcCode)
|
348 |
|
, ("CvENODESSH", 'C.cvEnodesshCode)
|
349 |
|
, ("CvENODEVERSION", 'C.cvEnodeversionCode)
|
350 |
|
, ("CvENODESETUP", 'C.cvEnodesetupCode)
|
351 |
|
, ("CvENODETIME", 'C.cvEnodetimeCode)
|
352 |
|
, ("CvENODEOOBPATH", 'C.cvEnodeoobpathCode)
|
353 |
|
, ("CvENODEUSERSCRIPTS", 'C.cvEnodeuserscriptsCode)
|
354 |
|
, ("CvENODEFILESTORAGEPATHS", 'C.cvEnodefilestoragepathsCode)
|
355 |
|
, ("CvENODEFILESTORAGEPATHUNUSABLE", 'C.cvEnodefilestoragepathunusableCode)
|
|
322 |
$(THH.declareLADT ''String "CVErrorCode"
|
|
323 |
[ ("CvECLUSTERCFG", "ECLUSTERCFG")
|
|
324 |
, ("CvECLUSTERCERT", "ECLUSTERCERT")
|
|
325 |
, ("CvECLUSTERFILECHECK", "ECLUSTERFILECHECK")
|
|
326 |
, ("CvECLUSTERDANGLINGNODES", "ECLUSTERDANGLINGNODES")
|
|
327 |
, ("CvECLUSTERDANGLINGINST", "ECLUSTERDANGLINGINST")
|
|
328 |
, ("CvEINSTANCEBADNODE", "EINSTANCEBADNODE")
|
|
329 |
, ("CvEINSTANCEDOWN", "EINSTANCEDOWN")
|
|
330 |
, ("CvEINSTANCELAYOUT", "EINSTANCELAYOUT")
|
|
331 |
, ("CvEINSTANCEMISSINGDISK", "EINSTANCEMISSINGDISK")
|
|
332 |
, ("CvEINSTANCEFAULTYDISK", "EINSTANCEFAULTYDISK")
|
|
333 |
, ("CvEINSTANCEWRONGNODE", "EINSTANCEWRONGNODE")
|
|
334 |
, ("CvEINSTANCESPLITGROUPS", "EINSTANCESPLITGROUPS")
|
|
335 |
, ("CvEINSTANCEPOLICY", "EINSTANCEPOLICY")
|
|
336 |
, ("CvENODEDRBD", "ENODEDRBD")
|
|
337 |
, ("CvENODEDRBDHELPER", "ENODEDRBDHELPER")
|
|
338 |
, ("CvENODEFILECHECK", "ENODEFILECHECK")
|
|
339 |
, ("CvENODEHOOKS", "ENODEHOOKS")
|
|
340 |
, ("CvENODEHV", "ENODEHV")
|
|
341 |
, ("CvENODELVM", "ENODELVM")
|
|
342 |
, ("CvENODEN1", "ENODEN1")
|
|
343 |
, ("CvENODENET", "ENODENET")
|
|
344 |
, ("CvENODEOS", "ENODEOS")
|
|
345 |
, ("CvENODEORPHANINSTANCE", "ENODEORPHANINSTANCE")
|
|
346 |
, ("CvENODEORPHANLV", "ENODEORPHANLV")
|
|
347 |
, ("CvENODERPC", "ENODERPC")
|
|
348 |
, ("CvENODESSH", "ENODESSH")
|
|
349 |
, ("CvENODEVERSION", "ENODEVERSION")
|
|
350 |
, ("CvENODESETUP", "ENODESETUP")
|
|
351 |
, ("CvENODETIME", "ENODETIME")
|
|
352 |
, ("CvENODEOOBPATH", "ENODEOOBPATH")
|
|
353 |
, ("CvENODEUSERSCRIPTS", "ENODEUSERSCRIPTS")
|
|
354 |
, ("CvENODEFILESTORAGEPATHS", "ENODEFILESTORAGEPATHS")
|
|
355 |
, ("CvENODEFILESTORAGEPATHUNUSABLE", "ENODEFILESTORAGEPATHUNUSABLE")
|
356 |
356 |
, ("CvENODESHAREDFILESTORAGEPATHUNUSABLE",
|
357 |
|
'C.cvEnodesharedfilestoragepathunusableCode)
|
|
357 |
"ENODESHAREDFILESTORAGEPATHUNUSABLE")
|
358 |
358 |
])
|
359 |
359 |
$(THH.makeJSONInstance ''CVErrorCode)
|
360 |
360 |
|
361 |
361 |
-- | Dynamic device modification, just add\/remove version.
|
362 |
|
$(THH.declareSADT "DdmSimple"
|
363 |
|
[ ("DdmSimpleAdd", 'C.ddmAdd)
|
364 |
|
, ("DdmSimpleRemove", 'C.ddmRemove)
|
|
362 |
$(THH.declareLADT ''String "DdmSimple"
|
|
363 |
[ ("DdmSimpleAdd", "add")
|
|
364 |
, ("DdmSimpleRemove", "remove")
|
365 |
365 |
])
|
366 |
366 |
$(THH.makeJSONInstance ''DdmSimple)
|
367 |
367 |
|
368 |
368 |
-- | Dynamic device modification, all operations version.
|
369 |
|
$(THH.declareSADT "DdmFull"
|
370 |
|
[ ("DdmFullAdd", 'C.ddmAdd)
|
371 |
|
, ("DdmFullRemove", 'C.ddmRemove)
|
372 |
|
, ("DdmFullModify", 'C.ddmModify)
|
|
369 |
$(THH.declareLADT ''String "DdmFull"
|
|
370 |
[ ("DdmFullAdd", "add")
|
|
371 |
, ("DdmFullRemove", "remove")
|
|
372 |
, ("DdmFullModify", "modify")
|
373 |
373 |
])
|
374 |
374 |
$(THH.makeJSONInstance ''DdmFull)
|
375 |
375 |
|
376 |
376 |
-- | Hypervisor type definitions.
|
377 |
|
$(THH.declareSADT "Hypervisor"
|
378 |
|
[ ( "Kvm", 'C.htKvm )
|
379 |
|
, ( "XenPvm", 'C.htXenPvm )
|
380 |
|
, ( "Chroot", 'C.htChroot )
|
381 |
|
, ( "XenHvm", 'C.htXenHvm )
|
382 |
|
, ( "Lxc", 'C.htLxc )
|
383 |
|
, ( "Fake", 'C.htFake )
|
|
377 |
$(THH.declareLADT ''String "Hypervisor"
|
|
378 |
[ ("Kvm", "kvm")
|
|
379 |
, ("XenPvm", "xen-pvm")
|
|
380 |
, ("Chroot", "chroot")
|
|
381 |
, ("XenHvm", "xen-hvm")
|
|
382 |
, ("Lxc", "lxc")
|
|
383 |
, ("Fake", "fake")
|
384 |
384 |
])
|
385 |
385 |
$(THH.makeJSONInstance ''Hypervisor)
|
386 |
386 |
|
387 |
387 |
-- | Oob command type.
|
388 |
|
$(THH.declareSADT "OobCommand"
|
389 |
|
[ ("OobHealth", 'C.oobHealth)
|
390 |
|
, ("OobPowerCycle", 'C.oobPowerCycle)
|
391 |
|
, ("OobPowerOff", 'C.oobPowerOff)
|
392 |
|
, ("OobPowerOn", 'C.oobPowerOn)
|
393 |
|
, ("OobPowerStatus", 'C.oobPowerStatus)
|
|
388 |
$(THH.declareLADT ''String "OobCommand"
|
|
389 |
[ ("OobHealth", "health")
|
|
390 |
, ("OobPowerCycle", "power-cycle")
|
|
391 |
, ("OobPowerOff", "power-off")
|
|
392 |
, ("OobPowerOn", "power-on")
|
|
393 |
, ("OobPowerStatus", "power-status")
|
394 |
394 |
])
|
395 |
395 |
$(THH.makeJSONInstance ''OobCommand)
|
396 |
396 |
|
397 |
397 |
-- | Storage type.
|
398 |
|
$(THH.declareSADT "StorageType"
|
399 |
|
[ ("StorageFile", 'C.stFile)
|
400 |
|
, ("StorageLvmPv", 'C.stLvmPv)
|
401 |
|
, ("StorageLvmVg", 'C.stLvmVg)
|
402 |
|
, ("StorageDiskless", 'C.stDiskless)
|
403 |
|
, ("StorageBlock", 'C.stBlock)
|
404 |
|
, ("StorageRados", 'C.stRados)
|
405 |
|
, ("StorageExt", 'C.stExt)
|
|
398 |
$(THH.declareLADT ''String "StorageType"
|
|
399 |
[ ("StorageFile", "file")
|
|
400 |
, ("StorageLvmPv", "lvm-pv")
|
|
401 |
, ("StorageLvmVg", "lvm-vg")
|
|
402 |
, ("StorageDiskless", "diskless")
|
|
403 |
, ("StorageBlock", "blockdev")
|
|
404 |
, ("StorageRados", "rados")
|
|
405 |
, ("StorageExt", "ext")
|
406 |
406 |
])
|
407 |
407 |
$(THH.makeJSONInstance ''StorageType)
|
408 |
408 |
|
... | ... | |
456 |
456 |
showSULvm :: StorageType -> StorageKey -> SPExclusiveStorage -> String
|
457 |
457 |
showSULvm st sk es = show (storageTypeToRaw st, sk, [es])
|
458 |
458 |
|
459 |
|
-- | Mapping fo disk templates to storage type
|
|
459 |
-- | Mapping from disk templates to storage types
|
460 |
460 |
-- FIXME: This is semantically the same as the constant
|
461 |
461 |
-- C.diskTemplatesStorageType, remove this when python constants
|
462 |
462 |
-- are generated from haskell constants
|
... | ... | |
481 |
481 |
addParamsToStorageUnit _ (SURaw StorageRados key) = SURados key
|
482 |
482 |
|
483 |
483 |
-- | Node evac modes.
|
484 |
|
$(THH.declareSADT "NodeEvacMode"
|
485 |
|
[ ("NEvacPrimary", 'C.iallocatorNevacPri)
|
486 |
|
, ("NEvacSecondary", 'C.iallocatorNevacSec)
|
487 |
|
, ("NEvacAll", 'C.iallocatorNevacAll)
|
|
484 |
$(THH.declareLADT ''String "NodeEvacMode"
|
|
485 |
[ ("NEvacPrimary", "primary-only")
|
|
486 |
, ("NEvacSecondary", "secondary-only")
|
|
487 |
, ("NEvacAll", "all")
|
488 |
488 |
])
|
489 |
489 |
$(THH.makeJSONInstance ''NodeEvacMode)
|
490 |
490 |
|
491 |
491 |
-- | The file driver type.
|
492 |
|
$(THH.declareSADT "FileDriver"
|
493 |
|
[ ("FileLoop", 'C.fdLoop)
|
494 |
|
, ("FileBlktap", 'C.fdBlktap)
|
|
492 |
$(THH.declareLADT ''String "FileDriver"
|
|
493 |
[ ("FileLoop", "loop")
|
|
494 |
, ("FileBlktap", "blktap")
|
495 |
495 |
])
|
496 |
496 |
$(THH.makeJSONInstance ''FileDriver)
|
497 |
497 |
|
498 |
498 |
-- | The instance create mode.
|
499 |
|
$(THH.declareSADT "InstCreateMode"
|
500 |
|
[ ("InstCreate", 'C.instanceCreate)
|
501 |
|
, ("InstImport", 'C.instanceImport)
|
502 |
|
, ("InstRemoteImport", 'C.instanceRemoteImport)
|
|
499 |
$(THH.declareLADT ''String "InstCreateMode"
|
|
500 |
[ ("InstCreate", "create")
|
|
501 |
, ("InstImport", "import")
|
|
502 |
, ("InstRemoteImport", "remote-import")
|
503 |
503 |
])
|
504 |
504 |
$(THH.makeJSONInstance ''InstCreateMode)
|
505 |
505 |
|
506 |
506 |
-- | Reboot type.
|
507 |
|
$(THH.declareSADT "RebootType"
|
508 |
|
[ ("RebootSoft", 'C.instanceRebootSoft)
|
509 |
|
, ("RebootHard", 'C.instanceRebootHard)
|
510 |
|
, ("RebootFull", 'C.instanceRebootFull)
|
|
507 |
$(THH.declareLADT ''String "RebootType"
|
|
508 |
[ ("RebootSoft", "soft")
|
|
509 |
, ("RebootHard", "hard")
|
|
510 |
, ("RebootFull", "full")
|
511 |
511 |
])
|
512 |
512 |
$(THH.makeJSONInstance ''RebootType)
|
513 |
513 |
|
514 |
514 |
-- | Export modes.
|
515 |
|
$(THH.declareSADT "ExportMode"
|
516 |
|
[ ("ExportModeLocal", 'C.exportModeLocal)
|
517 |
|
, ("ExportModeRemove", 'C.exportModeRemote)
|
|
515 |
$(THH.declareLADT ''String "ExportMode"
|
|
516 |
[ ("ExportModeLocal", "local")
|
|
517 |
, ("ExportModeRemove", "remote")
|
518 |
518 |
])
|
519 |
519 |
$(THH.makeJSONInstance ''ExportMode)
|
520 |
520 |
|
521 |
521 |
-- | IAllocator run types (OpTestIAllocator).
|
522 |
|
$(THH.declareSADT "IAllocatorTestDir"
|
523 |
|
[ ("IAllocatorDirIn", 'C.iallocatorDirIn)
|
524 |
|
, ("IAllocatorDirOut", 'C.iallocatorDirOut)
|
|
522 |
$(THH.declareLADT ''String "IAllocatorTestDir"
|
|
523 |
[ ("IAllocatorDirIn", "in")
|
|
524 |
, ("IAllocatorDirOut", "out")
|
525 |
525 |
])
|
526 |
526 |
$(THH.makeJSONInstance ''IAllocatorTestDir)
|
527 |
527 |
|
528 |
528 |
-- | IAllocator mode. FIXME: use this in "HTools.Backend.IAlloc".
|
529 |
|
$(THH.declareSADT "IAllocatorMode"
|
530 |
|
[ ("IAllocatorAlloc", 'C.iallocatorModeAlloc)
|
531 |
|
, ("IAllocatorMultiAlloc", 'C.iallocatorModeMultiAlloc)
|
532 |
|
, ("IAllocatorReloc", 'C.iallocatorModeReloc)
|
533 |
|
, ("IAllocatorNodeEvac", 'C.iallocatorModeNodeEvac)
|
534 |
|
, ("IAllocatorChangeGroup", 'C.iallocatorModeChgGroup)
|
|
529 |
$(THH.declareLADT ''String "IAllocatorMode"
|
|
530 |
[ ("IAllocatorAlloc", "allocate")
|
|
531 |
, ("IAllocatorMultiAlloc", "multi-allocate")
|
|
532 |
, ("IAllocatorReloc", "relocate")
|
|
533 |
, ("IAllocatorNodeEvac", "node-evacuate")
|
|
534 |
, ("IAllocatorChangeGroup", "change-group")
|
535 |
535 |
])
|
536 |
536 |
$(THH.makeJSONInstance ''IAllocatorMode)
|
537 |
537 |
|
538 |
538 |
-- | Network mode.
|
539 |
|
$(THH.declareSADT "NICMode"
|
540 |
|
[ ("NMBridged", 'C.nicModeBridged)
|
541 |
|
, ("NMRouted", 'C.nicModeRouted)
|
542 |
|
, ("NMOvs", 'C.nicModeOvs)
|
|
539 |
$(THH.declareLADT ''String "NICMode"
|
|
540 |
[ ("NMBridged", "bridged")
|
|
541 |
, ("NMRouted", "routed")
|
|
542 |
, ("NMOvs", "openvswitch")
|
543 |
543 |
])
|
544 |
544 |
$(THH.makeJSONInstance ''NICMode)
|
545 |
545 |
|
546 |
546 |
-- | The JobStatus data type. Note that this is ordered especially
|
547 |
547 |
-- such that greater\/lesser comparison on values of this type makes
|
548 |
548 |
-- sense.
|
549 |
|
$(THH.declareSADT "JobStatus"
|
550 |
|
[ ("JOB_STATUS_QUEUED", 'C.jobStatusQueued)
|
551 |
|
, ("JOB_STATUS_WAITING", 'C.jobStatusWaiting)
|
552 |
|
, ("JOB_STATUS_CANCELING", 'C.jobStatusCanceling)
|
553 |
|
, ("JOB_STATUS_RUNNING", 'C.jobStatusRunning)
|
554 |
|
, ("JOB_STATUS_CANCELED", 'C.jobStatusCanceled)
|
555 |
|
, ("JOB_STATUS_SUCCESS", 'C.jobStatusSuccess)
|
556 |
|
, ("JOB_STATUS_ERROR", 'C.jobStatusError)
|
|
549 |
$(THH.declareLADT ''String "JobStatus"
|
|
550 |
[ ("JOB_STATUS_QUEUED", "queued")
|
|
551 |
, ("JOB_STATUS_WAITING", "waiting")
|
|
552 |
, ("JOB_STATUS_CANCELING", "canceling")
|
|
553 |
, ("JOB_STATUS_RUNNING", "running")
|
|
554 |
, ("JOB_STATUS_CANCELED", "canceled")
|
|
555 |
, ("JOB_STATUS_SUCCESS", "success")
|
|
556 |
, ("JOB_STATUS_ERROR", "error")
|
557 |
557 |
])
|
558 |
558 |
$(THH.makeJSONInstance ''JobStatus)
|
559 |
559 |
|
560 |
560 |
-- | Finalized job status.
|
561 |
|
$(THH.declareSADT "FinalizedJobStatus"
|
562 |
|
[ ("JobStatusCanceled", 'C.jobStatusCanceled)
|
563 |
|
, ("JobStatusSuccessful", 'C.jobStatusSuccess)
|
564 |
|
, ("JobStatusFailed", 'C.jobStatusError)
|
|
561 |
$(THH.declareLADT ''String "FinalizedJobStatus"
|
|
562 |
[ ("JobStatusCanceled", "canceled")
|
|
563 |
, ("JobStatusSuccessful", "success")
|
|
564 |
, ("JobStatusFailed", "error")
|
565 |
565 |
])
|
566 |
566 |
$(THH.makeJSONInstance ''FinalizedJobStatus)
|
567 |
567 |
|
... | ... | |
619 |
619 |
|
620 |
620 |
-- | Valid opcode priorities for submit.
|
621 |
621 |
$(THH.declareIADT "OpSubmitPriority"
|
622 |
|
[ ("OpPrioLow", 'C.opPrioLow)
|
623 |
|
, ("OpPrioNormal", 'C.opPrioNormal)
|
624 |
|
, ("OpPrioHigh", 'C.opPrioHigh)
|
|
622 |
[ ("OpPrioLow", 'ConstantUtils.priorityLow)
|
|
623 |
, ("OpPrioNormal", 'ConstantUtils.priorityNormal)
|
|
624 |
, ("OpPrioHigh", 'ConstantUtils.priorityHigh)
|
625 |
625 |
])
|
626 |
626 |
$(THH.makeJSONInstance ''OpSubmitPriority)
|
627 |
627 |
|
... | ... | |
639 |
639 |
fmtSubmitPriority OpPrioHigh = "high"
|
640 |
640 |
|
641 |
641 |
-- | Our ADT for the OpCode status at runtime (while in a job).
|
642 |
|
$(THH.declareSADT "OpStatus"
|
643 |
|
[ ("OP_STATUS_QUEUED", 'C.opStatusQueued)
|
644 |
|
, ("OP_STATUS_WAITING", 'C.opStatusWaiting)
|
645 |
|
, ("OP_STATUS_CANCELING", 'C.opStatusCanceling)
|
646 |
|
, ("OP_STATUS_RUNNING", 'C.opStatusRunning)
|
647 |
|
, ("OP_STATUS_CANCELED", 'C.opStatusCanceled)
|
648 |
|
, ("OP_STATUS_SUCCESS", 'C.opStatusSuccess)
|
649 |
|
, ("OP_STATUS_ERROR", 'C.opStatusError)
|
|
642 |
$(THH.declareLADT ''String "OpStatus"
|
|
643 |
[ ("OP_STATUS_QUEUED", "queued")
|
|
644 |
, ("OP_STATUS_WAITING", "waiting")
|
|
645 |
, ("OP_STATUS_CANCELING", "canceling")
|
|
646 |
, ("OP_STATUS_RUNNING", "running")
|
|
647 |
, ("OP_STATUS_CANCELED", "canceled")
|
|
648 |
, ("OP_STATUS_SUCCESS", "success")
|
|
649 |
, ("OP_STATUS_ERROR", "error")
|
650 |
650 |
])
|
651 |
651 |
$(THH.makeJSONInstance ''OpStatus)
|
652 |
652 |
|
653 |
653 |
-- | Type for the job message type.
|
654 |
|
$(THH.declareSADT "ELogType"
|
655 |
|
[ ("ELogMessage", 'C.elogMessage)
|
656 |
|
, ("ELogRemoteImport", 'C.elogRemoteImport)
|
657 |
|
, ("ELogJqueueTest", 'C.elogJqueueTest)
|
|
654 |
$(THH.declareLADT ''String "ELogType"
|
|
655 |
[ ("ELogMessage", "message")
|
|
656 |
, ("ELogRemoteImport", "remote-import")
|
|
657 |
, ("ELogJqueueTest", "jqueue-test")
|
658 |
658 |
])
|
659 |
659 |
$(THH.makeJSONInstance ''ELogType)
|
660 |
660 |
|