X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/707cd3d7feb083a41fde3aa3f2a5e20b40b99ba2..228ef0f2bcdacea52cf512779b99947d1b8cb173:/htools/Ganeti/HTools/Program/Hbal.hs diff --git a/htools/Ganeti/HTools/Program/Hbal.hs b/htools/Ganeti/HTools/Program/Hbal.hs index bc83d05..fa0728b 100644 --- a/htools/Ganeti/HTools/Program/Hbal.hs +++ b/htools/Ganeti/HTools/Program/Hbal.hs @@ -51,6 +51,7 @@ import qualified Ganeti.HTools.Instance as Instance import Ganeti.BasicTypes import Ganeti.Common +import Ganeti.Errors import Ganeti.HTools.CLI import Ganeti.HTools.ExtLoader import Ganeti.HTools.Types @@ -61,35 +62,37 @@ import qualified Ganeti.Luxi as L import Ganeti.Jobs -- | Options list and functions. -options :: [OptType] -options = - [ oPrintNodes - , oPrintInsts - , oPrintCommands - , oDataFile - , oEvacMode - , oRapiMaster - , oLuxiSocket - , oIAllocSrc - , oExecJobs - , oGroup - , oMaxSolLength - , oVerbose - , oQuiet - , oOfflineNode - , oMinScore - , oMaxCpu - , oMinDisk - , oMinGain - , oMinGainLim - , oDiskMoves - , oSelInst - , oInstMoves - , oDynuFile - , oExTags - , oExInst - , oSaveCluster - ] +options :: IO [OptType] +options = do + luxi <- oLuxiSocket + return + [ oPrintNodes + , oPrintInsts + , oPrintCommands + , oDataFile + , oEvacMode + , oRapiMaster + , luxi + , oIAllocSrc + , oExecJobs + , oGroup + , oMaxSolLength + , oVerbose + , oQuiet + , oOfflineNode + , oMinScore + , oMaxCpu + , oMinDisk + , oMinGain + , oMinGainLim + , oDiskMoves + , oSelInst + , oInstMoves + , oDynuFile + , oExTags + , oExInst + , oSaveCluster + ] -- | The list of arguments supported by the program. arguments :: [ArgCompletion] @@ -169,7 +172,7 @@ waitForJobs :: L.Client -> [L.JobId] -> IO (Result [JobStatus]) waitForJobs client jids = do sts <- L.queryJobsStatus client jids case sts of - Bad x -> return $ Bad x + Bad e -> return . Bad $ "Checking job status: " ++ formatError e Ok s -> if any (<= JOB_STATUS_RUNNING) s then do -- TODO: replace hardcoded value with a better thing @@ -208,14 +211,14 @@ execJobSet master nl il cref (js:jss) = do (\client -> do jids <- L.submitManyJobs client jobs case jids of - Bad x -> return $ Bad x + Bad e -> return . Bad $ "Job submission error: " ++ formatError e Ok x -> do putStrLn $ "Got job IDs " ++ commaJoin (map show x) waitForJobs client x ) case jrs of Bad x -> do - hPutStrLn stderr $ "Cannot compute job status, aborting: " ++ show x + hPutStrLn stderr x return False Ok x -> if checkJobsStatus x then execWrapper master nl il cref jss