Revision 59bcd180 src/Ganeti/Types.hs

b/src/Ganeti/Types.hs
143 143
  , storageFieldToRaw
144 144
  , DiskAccessMode(..)
145 145
  , diskAccessModeToRaw
146
  , LocalDiskStatus(..)
147
  , localDiskStatusFromRaw
148
  , localDiskStatusToRaw
149
  , localDiskStatusName
146 150
  , ReplaceDisksMode(..)
147 151
  , replaceDisksModeToRaw
148 152
  , RpcTimeout(..)
......
398 402
$(THH.makeJSONInstance ''DdmSimple)
399 403

  
400 404
-- | Dynamic device modification, all operations version.
405
--
406
-- TODO: DDM_SWAP, DDM_MOVE?
401 407
$(THH.declareLADT ''String "DdmFull"
402 408
     [ ("DdmFullAdd",    "add")
403 409
     , ("DdmFullRemove", "remove")
......
724 730
  ])
725 731
$(THH.makeJSONInstance ''VType)
726 732

  
733
instance THH.PyValue VType where
734
  showValue = THH.showValue . vTypeToRaw
735

  
727 736
-- * Node role type
728 737

  
729 738
$(THH.declareLADT ''String "NodeRole"
......
785 794
  ])
786 795
$(THH.makeJSONInstance ''DiskAccessMode)
787 796

  
797
-- | Local disk status
798
--
799
-- Python code depends on:
800
--   DiskStatusOk < DiskStatusUnknown < DiskStatusFaulty
801
$(THH.declareILADT "LocalDiskStatus"
802
  [ ("DiskStatusFaulty",  3)
803
  , ("DiskStatusOk",      1)
804
  , ("DiskStatusUnknown", 2)
805
  ])
806

  
807
localDiskStatusName :: LocalDiskStatus -> String
808
localDiskStatusName DiskStatusFaulty = "faulty"
809
localDiskStatusName DiskStatusOk = "ok"
810
localDiskStatusName DiskStatusUnknown = "unknown"
811

  
788 812
-- | Replace disks type.
789 813
$(THH.declareLADT ''String "ReplaceDisksMode"
790 814
  [ -- Replace disks on primary

Also available in: Unified diff