Revision a07343b2 htools/Ganeti/HTools/Types.hs

b/htools/Ganeti/HTools/Types.hs
72 72
  , connTimeout
73 73
  , queryTimeout
74 74
  , EvacMode(..)
75
  , ISpec(..)
76
  , IPolicy(..)
75 77
  ) where
76 78

  
77 79
import qualified Data.Map as M
78
import qualified Text.JSON as JSON
80
import Text.JSON (makeObj, readJSON, showJSON)
79 81

  
80 82
import qualified Ganeti.Constants as C
81 83
import qualified Ganeti.THH as THH
82 84
import Ganeti.BasicTypes
85
import Ganeti.HTools.JSON
83 86

  
84 87
-- | The instance index type.
85 88
type Idx = Int
......
139 142
  , rspecDsk  :: Int  -- ^ Requested disk
140 143
  } deriving (Show, Read, Eq)
141 144

  
145

  
146
-- | Instance specification type.
147
$(THH.buildObject "ISpec" "iSpec"
148
  [ THH.renameField "MemorySize" $ THH.simpleField "memory-size" [t| Int |]
149
  , THH.renameField "CpuCount"   $ THH.simpleField "cpu-count"   [t| Int |]
150
  , THH.renameField "DiskSize"   $ THH.simpleField "disk-size"   [t| Int |]
151
  , THH.renameField "DiskCount"  $ THH.simpleField "disk-count"  [t| Int |]
152
  , THH.renameField "NicCount"   $ THH.simpleField "nic-count"   [t| Int |]
153
  ])
154

  
155
-- | Instance policy type.
156
$(THH.buildObject "IPolicy" "iPolicy"
157
  [ THH.renameField "StdSpec" $ THH.simpleField "std" [t| ISpec |]
158
  , THH.renameField "MinSpec" $ THH.simpleField "min" [t| ISpec |]
159
  , THH.renameField "MaxSpec" $ THH.simpleField "max" [t| ISpec |]
160
  ])
161

  
142 162
-- | The dynamic resource specs of a machine (i.e. load or load
143 163
-- capacity, as opposed to size).
144 164
data DynUtil = DynUtil

Also available in: Unified diff