Revision 14933c17
b/src/Ganeti/Rpc.hs | ||
---|---|---|
43 | 43 |
|
44 | 44 |
, rpcResultFill |
45 | 45 |
|
46 |
, InstanceInfo(..) |
|
47 | 46 |
, RpcCallInstanceInfo(..) |
47 |
, InstanceState(..) |
|
48 |
, InstanceInfo(..) |
|
48 | 49 |
, RpcResultInstanceInfo(..) |
49 | 50 |
|
50 | 51 |
, RpcCallAllInstancesInfo(..) |
... | ... | |
270 | 271 |
, simpleField "hname" [t| Hypervisor |] |
271 | 272 |
]) |
272 | 273 |
|
274 |
$(declareILADT "InstanceState" |
|
275 |
[ ("InstanceStateRunning", 0) |
|
276 |
, ("InstanceStateShutdown", 1) |
|
277 |
]) |
|
278 |
|
|
279 |
$(makeJSONInstance ''InstanceState) |
|
280 |
|
|
281 |
instance PyValue InstanceState where |
|
282 |
showValue = show . instanceStateToRaw |
|
283 |
|
|
273 | 284 |
$(buildObject "InstanceInfo" "instInfo" |
274 | 285 |
[ simpleField "memory" [t| Int|] |
275 |
, simpleField "state" [t| String |] -- It depends on hypervisor :(
|
|
286 |
, simpleField "state" [t| InstanceState |]
|
|
276 | 287 |
, simpleField "vcpus" [t| Int |] |
277 | 288 |
, simpleField "time" [t| Int |] |
278 | 289 |
]) |
b/test/hs/Test/Ganeti/Query/Instance.hs | ||
---|---|---|
56 | 56 |
|
57 | 57 |
-- | A fake InstanceInfo to be used to check values. |
58 | 58 |
fakeInstanceInfo :: InstanceInfo |
59 |
fakeInstanceInfo = InstanceInfo 0 "" 0 0
|
|
59 |
fakeInstanceInfo = InstanceInfo 0 InstanceStateRunning 0 0
|
|
60 | 60 |
|
61 | 61 |
-- | Erroneous node response - the exact error does not matter. |
62 | 62 |
responseError :: String -> (String, ERpcError a) |
Also available in: Unified diff