Revision 72747d91 src/Ganeti/HTools/Node.hs
b/src/Ganeti/HTools/Node.hs | ||
---|---|---|
6 | 6 |
|
7 | 7 |
{- |
8 | 8 |
|
9 |
Copyright (C) 2009, 2010, 2011, 2012 Google Inc. |
|
9 |
Copyright (C) 2009, 2010, 2011, 2012, 2013 Google Inc.
|
|
10 | 10 |
|
11 | 11 |
This program is free software; you can redistribute it and/or modify |
12 | 12 |
it under the terms of the GNU General Public License as published by |
... | ... | |
679 | 679 |
, "pfmem", "pfdsk", "rcpu" |
680 | 680 |
, "cload", "mload", "dload", "nload" ] |
681 | 681 |
|
682 |
{-# ANN computeGroups "HLint: ignore Use alternative" #-} |
|
682 | 683 |
-- | Split a list of nodes into a list of (node group UUID, list of |
683 | 684 |
-- associated nodes). |
684 | 685 |
computeGroups :: [Node] -> [(T.Gdx, [Node])] |
685 | 686 |
computeGroups nodes = |
686 | 687 |
let nodes' = sortBy (comparing group) nodes |
687 | 688 |
nodes'' = groupBy ((==) `on` group) nodes' |
689 |
-- use of head here is OK, since groupBy returns non-empty lists; if |
|
690 |
-- you remove groupBy, also remove use of head |
|
688 | 691 |
in map (\nl -> (group (head nl), nl)) nodes'' |
Also available in: Unified diff