Revision 8e6ef316 src/Ganeti/Objects.hs
b/src/Ganeti/Objects.hs | ||
---|---|---|
29 | 29 |
-} |
30 | 30 |
|
31 | 31 |
module Ganeti.Objects |
32 |
( VType(..) |
|
33 |
, vTypeFromRaw |
|
34 |
, HvParams |
|
32 |
( HvParams |
|
35 | 33 |
, OsParams |
36 | 34 |
, PartialNicParams(..) |
37 | 35 |
, FilledNicParams(..) |
... | ... | |
39 | 37 |
, allNicParamFields |
40 | 38 |
, PartialNic(..) |
41 | 39 |
, FileDriver(..) |
42 |
, BlockDriver(..) |
|
43 |
, DiskMode(..) |
|
44 | 40 |
, DiskLogicalId(..) |
45 | 41 |
, Disk(..) |
46 | 42 |
, includesLogicalId |
... | ... | |
49 | 45 |
, FilledBeParams(..) |
50 | 46 |
, fillBeParams |
51 | 47 |
, allBeParamFields |
52 |
, AdminState(..) |
|
53 |
, adminStateFromRaw |
|
54 | 48 |
, Instance(..) |
55 | 49 |
, toDictInstance |
56 | 50 |
, PartialNDParams(..) |
... | ... | |
58 | 52 |
, fillNDParams |
59 | 53 |
, allNDParamFields |
60 | 54 |
, Node(..) |
61 |
, NodeRole(..) |
|
62 |
, nodeRoleToRaw |
|
63 |
, roleDescription |
|
64 | 55 |
, AllocPolicy(..) |
65 | 56 |
, FilledISpecParams(..) |
66 | 57 |
, PartialISpecParams(..) |
... | ... | |
119 | 110 |
let updated = Map.union custom defaults |
120 | 111 |
in foldl' (flip Map.delete) updated skip_keys |
121 | 112 |
|
122 |
-- | The VTYPES, a mini-type system in Python. |
|
123 |
$(declareSADT "VType" |
|
124 |
[ ("VTypeString", 'C.vtypeString) |
|
125 |
, ("VTypeMaybeString", 'C.vtypeMaybeString) |
|
126 |
, ("VTypeBool", 'C.vtypeBool) |
|
127 |
, ("VTypeSize", 'C.vtypeSize) |
|
128 |
, ("VTypeInt", 'C.vtypeInt) |
|
129 |
]) |
|
130 |
$(makeJSONInstance ''VType) |
|
131 |
|
|
132 | 113 |
-- | The hypervisor parameter type. This is currently a simple map, |
133 | 114 |
-- without type checking on key/value pairs. |
134 | 115 |
type HvParams = Container JSValue |
... | ... | |
155 | 136 |
class TagsObject a where |
156 | 137 |
tagsOf :: a -> Set.Set String |
157 | 138 |
|
158 |
-- * Node role object |
|
159 |
|
|
160 |
$(declareSADT "NodeRole" |
|
161 |
[ ("NROffline", 'C.nrOffline) |
|
162 |
, ("NRDrained", 'C.nrDrained) |
|
163 |
, ("NRRegular", 'C.nrRegular) |
|
164 |
, ("NRCandidate", 'C.nrMcandidate) |
|
165 |
, ("NRMaster", 'C.nrMaster) |
|
166 |
]) |
|
167 |
$(makeJSONInstance ''NodeRole) |
|
168 |
|
|
169 |
-- | The description of the node role. |
|
170 |
roleDescription :: NodeRole -> String |
|
171 |
roleDescription NROffline = "offline" |
|
172 |
roleDescription NRDrained = "drained" |
|
173 |
roleDescription NRRegular = "regular" |
|
174 |
roleDescription NRCandidate = "master candidate" |
|
175 |
roleDescription NRMaster = "master" |
|
176 |
|
|
177 | 139 |
-- * Network definitions |
178 | 140 |
|
179 | 141 |
-- ** Ipv4 types |
... | ... | |
297 | 259 |
|
298 | 260 |
-- * Disk definitions |
299 | 261 |
|
300 |
$(declareSADT "DiskMode" |
|
301 |
[ ("DiskRdOnly", 'C.diskRdonly) |
|
302 |
, ("DiskRdWr", 'C.diskRdwr) |
|
303 |
]) |
|
304 |
$(makeJSONInstance ''DiskMode) |
|
305 |
|
|
306 |
-- | The persistent block driver type. Currently only one type is allowed. |
|
307 |
$(declareSADT "BlockDriver" |
|
308 |
[ ("BlockDrvManual", 'C.blockdevDriverManual) |
|
309 |
]) |
|
310 |
$(makeJSONInstance ''BlockDriver) |
|
311 |
|
|
312 | 262 |
-- | Constant for the dev_type key entry in the disk config. |
313 | 263 |
devType :: String |
314 | 264 |
devType = "dev_type" |
... | ... | |
466 | 416 |
any (includesLogicalId vg_name lv_name) $ diskChildren disk |
467 | 417 |
_ -> False |
468 | 418 |
|
469 |
|
|
470 | 419 |
-- * Instance definitions |
471 | 420 |
|
472 |
$(declareSADT "AdminState" |
|
473 |
[ ("AdminOffline", 'C.adminstOffline) |
|
474 |
, ("AdminDown", 'C.adminstDown) |
|
475 |
, ("AdminUp", 'C.adminstUp) |
|
476 |
]) |
|
477 |
$(makeJSONInstance ''AdminState) |
|
478 |
|
|
479 | 421 |
$(buildParam "Be" "bep" |
480 | 422 |
[ simpleField "minmem" [t| Int |] |
481 | 423 |
, simpleField "maxmem" [t| Int |] |
Also available in: Unified diff