LGTM, thanks.
On Fri, Nov 8, 2013 at 5:24 PM, Jose A. Lopes <[email protected]> wrote: > Add 'InstanceState' datatype which is the Haskell counterpart of the > Python type 'HvInstanceState'. > > Signed-off-by: Jose A. Lopes <[email protected]> > --- > src/Ganeti/Rpc.hs | 15 +++++++++++++-- > test/hs/Test/Ganeti/Query/Instance.hs | 2 +- > 2 files changed, 14 insertions(+), 3 deletions(-) > > diff --git a/src/Ganeti/Rpc.hs b/src/Ganeti/Rpc.hs > index 7d48910..7d7a69b 100644 > --- a/src/Ganeti/Rpc.hs > +++ b/src/Ganeti/Rpc.hs > @@ -43,8 +43,9 @@ module Ganeti.Rpc > > , rpcResultFill > > - , InstanceInfo(..) > , RpcCallInstanceInfo(..) > + , InstanceState(..) > + , InstanceInfo(..) > , RpcResultInstanceInfo(..) > > , RpcCallAllInstancesInfo(..) > @@ -268,9 +269,19 @@ $(buildObject "RpcCallInstanceInfo" "rpcCallInstInfo" > , simpleField "hname" [t| Hypervisor |] > ]) > > +$(declareILADT "InstanceState" > + [ ("InstanceStateRunning", 0) > + , ("InstanceStateShutdown", 1) > + ]) > + > +$(makeJSONInstance ''InstanceState) > + > +instance PyValue InstanceState where > + showValue = show . instanceStateToRaw > + > $(buildObject "InstanceInfo" "instInfo" > [ simpleField "memory" [t| Int|] > - , simpleField "state" [t| String |] -- It depends on hypervisor :( > + , simpleField "state" [t| InstanceState |] > , simpleField "vcpus" [t| Int |] > , simpleField "time" [t| Int |] > ]) > diff --git a/test/hs/Test/Ganeti/Query/Instance.hs > b/test/hs/Test/Ganeti/Query/Instance.hs > index d08b99b..aa4c56e 100644 > --- a/test/hs/Test/Ganeti/Query/Instance.hs > +++ b/test/hs/Test/Ganeti/Query/Instance.hs > @@ -56,7 +56,7 @@ createInstance name pnodeUuid adminState = > > -- | A fake InstanceInfo to be used to check values. > fakeInstanceInfo :: InstanceInfo > -fakeInstanceInfo = InstanceInfo 0 "" 0 0 > +fakeInstanceInfo = InstanceInfo 0 InstanceStateRunning 0 0 > > -- | Erroneous node response - the exact error does not matter. > responseError :: String -> (String, ERpcError a) > -- > 1.8.4.1 > > Hrvoje Ribicic Ganeti Engineering Google Germany GmbH Dienerstr. 12, 80331, München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores Steuernummer: 48/725/00206 Umsatzsteueridentifikationsnummer: DE813741370
