Tested only on GHC 7.x, will test on 6.1x too before commit. --- htools/Ganeti/HTools/CLI.hs | 4 ++-- htools/Ganeti/HTools/Cluster.hs | 2 +- htools/Ganeti/HTools/IAlloc.hs | 4 ++-- htools/Ganeti/HTools/Loader.hs | 2 +- htools/Ganeti/HTools/Program/Hbal.hs | 2 +- htools/Ganeti/HTools/Program/Hspace.hs | 6 +++--- htools/Ganeti/HTools/QC.hs | 10 +++++----- 7 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/htools/Ganeti/HTools/CLI.hs b/htools/Ganeti/HTools/CLI.hs index e92384b..8997494 100644 --- a/htools/Ganeti/HTools/CLI.hs +++ b/htools/Ganeti/HTools/CLI.hs @@ -250,7 +250,7 @@ oGroup = Option "G" ["group"] oIDisk :: OptType oIDisk = Option "" ["disk"] (ReqArg (\ d opts -> do - dsk <- annotateResult ("--disk option") (parseUnit d) + dsk <- annotateResult "--disk option" (parseUnit d) let ospec = optISpec opts nspec = ospec { rspecDsk = dsk } return $ opts { optISpec = nspec }) "DISK") @@ -259,7 +259,7 @@ oIDisk = Option "" ["disk"] oIMem :: OptType oIMem = Option "" ["memory"] (ReqArg (\ m opts -> do - mem <- annotateResult ("--memory option") (parseUnit m) + mem <- annotateResult "--memory option" (parseUnit m) let ospec = optISpec opts nspec = ospec { rspecMem = mem } return $ opts { optISpec = nspec }) "MEMORY") diff --git a/htools/Ganeti/HTools/Cluster.hs b/htools/Ganeti/HTools/Cluster.hs index de4f370..ce6f234 100644 --- a/htools/Ganeti/HTools/Cluster.hs +++ b/htools/Ganeti/HTools/Cluster.hs @@ -995,7 +995,7 @@ evacDrbdSecondaryInner nl inst gdx accu ndx = -- The fromJust below is ugly (it can fail nastily), but -- at this point we should have any internal mismatches, -- and adding a monad here would be quite involved - grpnodes = fromJust (gdx `lookup` (Node.computeGroups nodes)) + grpnodes = fromJust (gdx `lookup` Node.computeGroups nodes) new_cv = compCVNodes grpnodes new_accu = Right (nl', inst', new_cv, ndx) in case accu of diff --git a/htools/Ganeti/HTools/IAlloc.hs b/htools/Ganeti/HTools/IAlloc.hs index 630c211..3df9924 100644 --- a/htools/Ganeti/HTools/IAlloc.hs +++ b/htools/Ganeti/HTools/IAlloc.hs @@ -187,7 +187,7 @@ parseData body = do return $ NodeEvacuate rl_idx rl_mode | otherwise -> fail ("Invalid request type '" ++ optype ++ "'") - return $ (msgs, Request rqtype cdata) + return (msgs, Request rqtype cdata) -- | Formats the result into a valid IAllocator response message. formatResponse :: Bool -- ^ Whether the request was successful @@ -214,7 +214,7 @@ formatAllocate il as = do (nl, inst, nodes, _):[] -> do let il' = Container.add (Instance.idx inst) inst il - return (info, showJSON $ map (Node.name) nodes, nl, il') + return (info, showJSON $ map Node.name nodes, nl, il') _ -> fail "Internal error: multiple allocation solutions" -- | Convert a node-evacuation/change group result. diff --git a/htools/Ganeti/HTools/Loader.hs b/htools/Ganeti/HTools/Loader.hs index 39000c7..c1ca9d1 100644 --- a/htools/Ganeti/HTools/Loader.hs +++ b/htools/Ganeti/HTools/Loader.hs @@ -202,7 +202,7 @@ mergeData um extags selinsts exinsts cdata@(ClusterData _ nl il2 tags) = il4 = Container.map (filterExTags allextags . updateMovable selinsts exinsts) il3 nl2 = foldl' fixNodes nl (Container.elems il4) - nl3 = Container.map (flip Node.buildPeers il4) nl2 + nl3 = Container.map (`Node.buildPeers` il4) nl2 node_names = map Node.name (Container.elems nl) inst_names = map Instance.name il common_suffix = longestDomain (node_names ++ inst_names) diff --git a/htools/Ganeti/HTools/Program/Hbal.hs b/htools/Ganeti/HTools/Program/Hbal.hs index eefbc82..92f327f 100644 --- a/htools/Ganeti/HTools/Program/Hbal.hs +++ b/htools/Ganeti/HTools/Program/Hbal.hs @@ -274,7 +274,7 @@ main = do exitWith ExitSuccess let split_insts = Cluster.findSplitInstances nlf ilf - when (not . null $ split_insts) $ do + unless (null split_insts) $ do hPutStrLn stderr "Found instances belonging to multiple node groups:" mapM_ (\i -> hPutStrLn stderr $ " " ++ Instance.name i) split_insts hPutStrLn stderr "Aborting." diff --git a/htools/Ganeti/HTools/Program/Hspace.hs b/htools/Ganeti/HTools/Program/Hspace.hs index 0bc4423..4eecfa5 100644 --- a/htools/Ganeti/HTools/Program/Hspace.hs +++ b/htools/Ganeti/HTools/Program/Hspace.hs @@ -95,7 +95,7 @@ specDescription SpecTiered = "Tiered (initial size)" -- | Efficiency generic function. effFn :: (Cluster.CStats -> Integer) -> (Cluster.CStats -> Double) - -> (Cluster.CStats -> Double) + -> Cluster.CStats -> Double effFn fi ft cs = fromIntegral (fi cs) / ft cs -- | Memory efficiency. @@ -271,7 +271,7 @@ printAllocationMap verbose msg nl ixes = [False, False, False, True, True, True] -- | Formats nicely a list of resources. -formatResources :: a -> [(String, (a->String))] -> String +formatResources :: a -> [(String, a->String)] -> String formatResources res = intercalate ", " . map (\(a, fn) -> a ++ " " ++ fn res) @@ -298,7 +298,7 @@ printISpec True ispec spec disk_template = do where req_nodes = Instance.requiredNodes disk_template prefix = specPrefix spec -printISpec False ispec spec disk_template = do +printISpec False ispec spec disk_template = printf "%s instance spec is:\n %s, using disk\ \ template '%s'.\n" (specDescription spec) diff --git a/htools/Ganeti/HTools/QC.hs b/htools/Ganeti/HTools/QC.hs index 0cf59b5..8530d4c 100644 --- a/htools/Ganeti/HTools/QC.hs +++ b/htools/Ganeti/HTools/QC.hs @@ -312,7 +312,7 @@ prop_Utils_parseUnit (NonNegative n) = Utils.parseUnit (show n ++ "g") == Types.Ok (n*1024) && Utils.parseUnit (show n ++ "t") == Types.Ok (n*1048576) && Types.isBad (Utils.parseUnit (show n ++ "x")::Types.Result Int) - where _types = (n::Int) + where _types = n::Int -- | Test list for the Utils module. testUtils = @@ -549,8 +549,8 @@ prop_Text_Load_Instance name mem dsk vcpus status case inst of Types.Bad msg -> printTestCase ("Failed to load instance: " ++ msg) False - Types.Ok (_, i) -> printTestCase ("Mismatch in some field while\ - \ loading the instance") $ + Types.Ok (_, i) -> printTestCase "Mismatch in some field while\ + \ loading the instance" $ Instance.name i == name && Instance.vcpus i == vcpus && Instance.mem i == mem && @@ -692,8 +692,8 @@ prop_Node_rMem inst = inst_idx = Instance.idx inst_ab node_add_ab = Node.addSec node inst_ab (-1) node_add_nb = Node.addSec node inst_nb (-1) - node_del_ab = liftM (flip Node.removeSec inst_ab) node_add_ab - node_del_nb = liftM (flip Node.removeSec inst_nb) node_add_nb + node_del_ab = liftM (`Node.removeSec` inst_ab) node_add_ab + node_del_nb = liftM (`Node.removeSec` inst_nb) node_add_nb in case (node_add_ab, node_add_nb, node_del_ab, node_del_nb) of (Types.OpGood a_ab, Types.OpGood a_nb, Types.OpGood d_ab, Types.OpGood d_nb) -> -- 1.7.5.4