diff --git a/htools/Ganeti/HTools/Program/Hbal.hs b/htools/Ganeti/HTools/Program/Hbal.hs index daa51b36ca5af9ddc05b5fb4da657cd480b66ee6..bbc62c32ea6f9bc03d66ce0158c7800e5a7e4b1f 100644 --- a/htools/Ganeti/HTools/Program/Hbal.hs +++ b/htools/Ganeti/HTools/Program/Hbal.hs @@ -160,7 +160,7 @@ saveBalanceCommands opts cmd_data = do -- | Polls a set of jobs at a fixed interval until all are finished -- one way or another. -waitForJobs :: L.Client -> [String] -> IO (Result [JobStatus]) +waitForJobs :: L.Client -> [L.JobId] -> IO (Result [JobStatus]) waitForJobs client jids = do sts <- L.queryJobsStatus client jids case sts of diff --git a/htools/Ganeti/Luxi.hs b/htools/Ganeti/Luxi.hs index 4c0daedee20bd3d00cadfd37c5b4548d623845dc..03f2ef0f65c6928cdf8250143634ef1070db8e55 100644 --- a/htools/Ganeti/Luxi.hs +++ b/htools/Ganeti/Luxi.hs @@ -31,6 +31,7 @@ module Ganeti.Luxi , ResultStatus(..) , LuxiReq(..) , Client + , JobId , checkRS , getClient , closeClient @@ -71,6 +72,9 @@ withTimeout secs descr action = do -- * Generic protocol functionality +-- | The Ganeti job type. +type JobId = String + $(declareSADT "QrViaLuxi" [ ("QRLock", 'qrLock) , ("QRInstance", 'qrInstance) @@ -354,7 +358,7 @@ callMethod method s = do return rval -- | Specialized submitManyJobs call. -submitManyJobs :: Client -> [[OpCode]] -> IO (Result [String]) +submitManyJobs :: Client -> [[OpCode]] -> IO (Result [JobId]) submitManyJobs s jobs = do rval <- callMethod (SubmitManyJobs jobs) s -- map each result (status, payload) pair into a nice Result ADT @@ -371,7 +375,7 @@ submitManyJobs s jobs = do x -> Bad ("Cannot parse response from Ganeti: " ++ show x) -- | Custom queryJobs call. -queryJobsStatus :: Client -> [String] -> IO (Result [JobStatus]) +queryJobsStatus :: Client -> [JobId] -> IO (Result [JobStatus]) queryJobsStatus s jids = do rval <- callMethod (QueryJobs (map read jids) ["status"]) s return $ case rval of