, FilledBeParams(..)
, fillBeParams
, allBeParamFields
- , Hypervisor(..)
, AdminState(..)
, adminStateFromRaw
, Instance(..)
import Data.Maybe
import qualified Data.Map as Map
import qualified Data.Set as Set
-import Text.JSON (makeObj, showJSON, readJSON, JSON, JSValue(..))
+import Text.JSON (showJSON, readJSON, JSON, JSValue(..))
import qualified Text.JSON as J
import qualified Ganeti.Constants as C
import Ganeti.JSON
-
+import Ganeti.Types
import Ganeti.THH
-- * Generic definitions
])
$(makeJSONInstance ''DiskType)
--- | The file driver type.
-$(declareSADT "FileDriver"
- [ ("FileLoop", 'C.fdLoop)
- , ("FileBlktap", 'C.fdBlktap)
- ])
-$(makeJSONInstance ''FileDriver)
-
-- | The persistent block driver type. Currently only one type is allowed.
$(declareSADT "BlockDriver"
[ ("BlockDrvManual", 'C.blockdevDriverManual)
, defaultField [| DiskRdWr |] $ simpleField "mode" [t| DiskMode |]
])
--- * Hypervisor definitions
-
--- | This may be due to change when we add hypervisor parameters.
-$(declareSADT "Hypervisor"
- [ ( "Kvm", 'C.htKvm )
- , ( "XenPvm", 'C.htXenPvm )
- , ( "Chroot", 'C.htChroot )
- , ( "XenHvm", 'C.htXenHvm )
- , ( "Lxc", 'C.htLxc )
- , ( "Fake", 'C.htFake )
- ])
-$(makeJSONInstance ''Hypervisor)
-
-- * Instance definitions
--- | Instance disk template type. **Copied from HTools/Types.hs**
-$(declareSADT "DiskTemplate"
- [ ("DTDiskless", 'C.dtDiskless)
- , ("DTFile", 'C.dtFile)
- , ("DTSharedFile", 'C.dtSharedFile)
- , ("DTPlain", 'C.dtPlain)
- , ("DTBlock", 'C.dtBlock)
- , ("DTDrbd8", 'C.dtDrbd8)
- , ("DTRados", 'C.dtRbd)
- ])
-$(makeJSONInstance ''DiskTemplate)
-
$(declareSADT "AdminState"
[ ("AdminOffline", 'C.adminstOffline)
, ("AdminDown", 'C.adminstDown)
, simpleField C.ispecDiskSize [t| Int |]
, simpleField C.ispecDiskCount [t| Int |]
, simpleField C.ispecCpuCount [t| Int |]
+ , simpleField C.ispecNicCount [t| Int |]
, simpleField C.ispecSpindleUse [t| Int |]
])
-- * NodeGroup definitions
--- | The Group allocation policy type.
---
--- Note that the order of constructors is important as the automatic
--- Ord instance will order them in the order they are defined, so when
--- changing this data type be careful about the interaction with the
--- desired sorting order.
---
--- FIXME: COPIED from Types.hs; we need to eliminate this duplication later
-$(declareSADT "AllocPolicy"
- [ ("AllocPreferred", 'C.allocPolicyPreferred)
- , ("AllocLastResort", 'C.allocPolicyLastResort)
- , ("AllocUnallocable", 'C.allocPolicyUnallocable)
- ])
-$(makeJSONInstance ''AllocPolicy)
-
-- | The disk parameters type.
type DiskParams = Container (Container JSValue)