diff --git a/Ganeti/HTools/Cluster.hs b/Ganeti/HTools/Cluster.hs
index 7562f21d851a6b7bece3aca9bc09537a0234ae9c..97b3ec46286df57741f03163ac84347057a351da 100644
--- a/Ganeti/HTools/Cluster.hs
+++ b/Ganeti/HTools/Cluster.hs
@@ -431,10 +431,10 @@ checkMove nodes_idx disk_moves ini_tbl victims =
-- iterate over all instances, computing the best move
best_tbl =
foldl'
- (\ step_tbl elem ->
- if Instance.snode elem == Node.noSecondary then step_tbl
+ (\ step_tbl em ->
+ if Instance.snode em == Node.noSecondary then step_tbl
else compareTables step_tbl $
- checkInstanceMove nodes_idx disk_moves ini_tbl elem)
+ checkInstanceMove nodes_idx disk_moves ini_tbl em)
ini_tbl victims
Table _ _ _ best_plc = best_tbl
in
@@ -478,9 +478,9 @@ collapseFailures flst =
-- | Update current Allocation solution and failure stats with new
-- elements
concatAllocs :: AllocSolution -> OpResult AllocElement -> AllocSolution
-concatAllocs (flst, succ, sols) (OpFail reason) = (reason:flst, succ, sols)
+concatAllocs (flst, cntok, sols) (OpFail reason) = (reason:flst, cntok, sols)
-concatAllocs (flst, succ, osols) (OpGood ns@(nl, _, _)) =
+concatAllocs (flst, cntok, osols) (OpGood ns@(nl, _, _)) =
let nscore = compCV nl
-- Choose the old or new solution, based on the cluster score
nsols = case osols of
@@ -489,7 +489,7 @@ concatAllocs (flst, succ, osols) (OpGood ns@(nl, _, _)) =
if oscore < nscore
then osols
else Just (nscore, ns)
- nsuc = succ + 1
+ nsuc = cntok + 1
-- Note: we force evaluation of nsols here in order to keep the
-- memory profile low - we know that we will need nsols for sure
-- in the next cycle, so we force evaluation of nsols, since the
@@ -539,11 +539,11 @@ tryReloc nl il xid 1 ex_idx =
valid_nodes = filter (not . flip elem ex_idx' . Node.idx) all_nodes
valid_idxes = map Node.idx valid_nodes
sols1 = foldl' (\cstate x ->
- let elem = do
+ let em = do
(mnl, i, _, _) <-
applyMove nl inst (ReplaceSecondary x)
return (mnl, i, [Container.find x mnl])
- in concatAllocs cstate elem
+ in concatAllocs cstate em
) ([], 0, Nothing) valid_idxes
in return sols1
diff --git a/Ganeti/HTools/Luxi.hs b/Ganeti/HTools/Luxi.hs
index fdb1105f12e837f2798b9eb0897f82ef49d0f17b..8cdf43633ec4f3fb42a97b2f81198b4a0e4640ac 100644
--- a/Ganeti/HTools/Luxi.hs
+++ b/Ganeti/HTools/Luxi.hs
@@ -133,10 +133,10 @@ recvMsg s = do
let _recv obuf = do
nbuf <- withTimeout queryTimeout "reading luxi response" $
S.recv (socket s) 4096
- let (msg, rbuf) = break ((==) eOM) (obuf ++ nbuf)
- (if null rbuf
+ let (msg, remaining) = break ((==) eOM) (obuf ++ nbuf)
+ (if null remaining
then _recv msg
- else return (msg, drop 1 rbuf))
+ else return (msg, tail remaining))
cbuf <- readIORef $ rbuf s
(msg, nbuf) <- _recv cbuf
writeIORef (rbuf s) nbuf
diff --git a/Ganeti/HTools/Node.hs b/Ganeti/HTools/Node.hs
index fcbcd44db464d120038b913da9812287def53189..dad11bdaf8ac3df27155753126d2df3841ac97d8 100644
--- a/Ganeti/HTools/Node.hs
+++ b/Ganeti/HTools/Node.hs
@@ -217,11 +217,11 @@ buildPeers t il =
-- | Assigns an instance to a node as primary without other updates.
setPri :: Node -> T.Idx -> Node
-setPri t idx = t { plist = idx:plist t }
+setPri t ix = t { plist = ix:plist t }
-- | Assigns an instance to a node as secondary without other updates.
setSec :: Node -> T.Idx -> Node
-setSec t idx = t { slist = idx:slist t }
+setSec t ix = t { slist = ix:slist t }
-- | Add primary cpus to a node
addCpus :: Node -> Int -> Node
diff --git a/Ganeti/HTools/QC.hs b/Ganeti/HTools/QC.hs
index 191fcbec8fe90e9f51251e43d85cd27aa67ffbb1..bb5b455e76cf28242f9eebf7660784301ab51224 100644
--- a/Ganeti/HTools/QC.hs
+++ b/Ganeti/HTools/QC.hs
@@ -88,11 +88,11 @@ instance Arbitrary Node.Node where
return n'
-- | Make sure add is idempotent
-prop_PeerMap_addIdempotent pmap key elem =
+prop_PeerMap_addIdempotent pmap key em =
fn puniq == fn (fn puniq)
where _types = (pmap::PeerMap.PeerMap,
- key::PeerMap.Key, elem::PeerMap.Elem)
- fn = PeerMap.add key elem
+ key::PeerMap.Key, em::PeerMap.Elem)
+ fn = PeerMap.add key em
puniq = PeerMap.accumArray const pmap
-- | Make sure remove is idempotent
@@ -109,10 +109,10 @@ prop_PeerMap_findMissing pmap key =
puniq = PeerMap.accumArray const pmap
-- | Make sure an added item is found
-prop_PeerMap_addFind pmap key elem =
- PeerMap.find key (PeerMap.add key elem puniq) == elem
+prop_PeerMap_addFind pmap key em =
+ PeerMap.find key (PeerMap.add key em puniq) == em
where _types = (pmap::PeerMap.PeerMap,
- key::PeerMap.Key, elem::PeerMap.Elem)
+ key::PeerMap.Key, em::PeerMap.Elem)
puniq = PeerMap.accumArray const pmap
-- | Manual check that maxElem returns the maximum indeed, or 0 for null
diff --git a/Ganeti/HTools/Utils.hs b/Ganeti/HTools/Utils.hs
index cd55bebf3f9cd2f547c5781ee269a5af5b6b9cf9..295d6fcc0a264459de5ad318ed859fe94b6d7999 100644
--- a/Ganeti/HTools/Utils.hs
+++ b/Ganeti/HTools/Utils.hs
@@ -81,7 +81,7 @@ meanValue lst = sum lst / fromIntegral (length lst)
stdDev :: Floating a => [a] -> a
stdDev lst =
let mv = meanValue lst
- av = foldl' (\accu elem -> let d = elem - mv in accu + d * d) 0.0 lst
+ av = foldl' (\accu em -> let d = em - mv in accu + d * d) 0.0 lst
bv = sqrt (av / fromIntegral (length lst))
in bv
diff --git a/Makefile b/Makefile
index 89f26c30a45db7dce11be6e10dc90d381f2aedd9..8535e8dbdb1039df712b303c14bbee4b731a7b92 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ HDDIR = apidoc
DOCS = README.html NEWS.html
-HFLAGS = -O2 -W -fwarn-monomorphism-restriction -fwarn-tabs
+HFLAGS = -O2 -Wall -Werror -fwarn-monomorphism-restriction -fwarn-tabs
HEXTRA =
HPCEXCL = --exclude Main --exclude Ganeti.HTools.QC
@@ -17,7 +17,7 @@ all: $(HPROGS)
$(HALLPROGS): %: %.hs Ganeti/HTools/Version.hs $(HSRCS) Makefile
ghc --make $(HFLAGS) $(HEXTRA) $@
-test: HEXTRA=-fhpc
+test: HEXTRA=-fhpc -Wwarn
$(DOCS) : %.html : %
rst2html $< $@
diff --git a/hail.hs b/hail.hs
index 7690f44af08cc1aa85023b1d131e4a6869cd3a2a..74c2ac2799cf667f0f86b5cca6a4f3da987689a4 100644
--- a/hail.hs
+++ b/hail.hs
@@ -47,14 +47,14 @@ options :: [OptType]
options = [oShowVer, oShowHelp]
processResults :: (Monad m) => Cluster.AllocSolution -> m (String, [Node.Node])
-processResults (fstats, succ, sols) =
+processResults (fstats, successes, sols) =
case sols of
Nothing -> fail "No valid allocation solutions"
Just (best, (_, _, w)) ->
let tfails = length fstats
info = printf "successes %d, failures %d,\
\ best score: %.8f for node(s) %s"
- succ tfails
+ successes tfails
best (intercalate "/" . map Node.name $ w)::String
in return (info, w)
@@ -90,8 +90,8 @@ main = do
sols = processRequest request >>= processResults
let (ok, info, rn) =
case sols of
- Ok (info, sn) -> (True, "Request successful: " ++ info,
- map ((++ csf) . Node.name) sn)
+ Ok (ginfo, sn) -> (True, "Request successful: " ++ ginfo,
+ map ((++ csf) . Node.name) sn)
Bad s -> (False, "Request failed: " ++ s, [])
resp = formatResponse ok info rn
putStrLn resp