projects
/
ganeti-local
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7e74e7d
)
Some docstring updates
author
Iustin Pop
<iustin@google.com>
Mon, 6 Jul 2009 14:46:51 +0000
(16:46 +0200)
committer
Iustin Pop
<iustin@google.com>
Tue, 7 Jul 2009 07:55:00 +0000
(09:55 +0200)
hspace.hs
patch
|
blob
|
history
diff --git
a/hspace.hs
b/hspace.hs
index
0c9738a
..
891c390
100644
(file)
--- a/
hspace.hs
+++ b/
hspace.hs
@@
-147,6
+147,7
@@
options =
"show help"
]
"show help"
]
+-- | Build failure stats out of a list of failure reasons
concatFailure :: [(FailMode, Int)] -> FailMode -> [(FailMode, Int)]
concatFailure flst reason =
let cval = lookup reason flst
concatFailure :: [(FailMode, Int)] -> FailMode -> [(FailMode, Int)]
concatFailure flst reason =
let cval = lookup reason flst
@@
-155,6
+156,8
@@
concatFailure flst reason =
Just val -> let plain = filter (\(x, _) -> x /= reason) flst
in (reason, val+1):plain
Just val -> let plain = filter (\(x, _) -> x /= reason) flst
in (reason, val+1):plain
+-- | Build list of failures and placements out of an list of possible
+-- | allocations
filterFails :: Cluster.AllocSolution
-> ([(FailMode, Int)],
[(Node.List, Instance.Instance, [Node.Node])])
filterFails :: Cluster.AllocSolution
-> ([(FailMode, Int)],
[(Node.List, Instance.Instance, [Node.Node])])
@@
-168,6
+171,7
@@
filterFails sols =
bval = concat blst
in (foldl' concatFailure [] aval, bval)
bval = concat blst
in (foldl' concatFailure [] aval, bval)
+-- | Get the placement with best score out of a list of possible placements
processResults :: [(Node.List, Instance.Instance, [Node.Node])]
-> (Node.List, Instance.Instance, [Node.Node])
processResults sols =
processResults :: [(Node.List, Instance.Instance, [Node.Node])]
-> (Node.List, Instance.Instance, [Node.Node])
processResults sols =
@@
-175,6
+179,7
@@
processResults sols =
sols'' = sortBy (compare `on` fst) sols'
in snd $ head sols''
sols'' = sortBy (compare `on` fst) sols'
in snd $ head sols''
+-- | Recursively place instances on the cluster until we're out of space
iterateDepth :: Node.List
-> Instance.List
-> Instance.Instance
iterateDepth :: Node.List
-> Instance.List
-> Instance.Instance
@@
-197,6
+202,7
@@
iterateDepth nl il newinst nreq ixes =
else let (xnl, xi, _) = processResults sols3
in iterateDepth xnl il newinst nreq (xi:ixes)
else let (xnl, xi, _) = processResults sols3
in iterateDepth xnl il newinst nreq (xi:ixes)
+-- | Function to print stats for a given phase
printStats :: String -> Cluster.CStats -> IO ()
printStats kind cs = do
printf "%s free RAM: %d\n" kind (Cluster.cs_fmem cs)
printStats :: String -> Cluster.CStats -> IO ()
printStats kind cs = do
printf "%s free RAM: %d\n" kind (Cluster.cs_fmem cs)