Revision 7e723913 htools/Ganeti/HTools/Program/Hbal.hs
b/htools/Ganeti/HTools/Program/Hbal.hs | ||
---|---|---|
56 | 56 |
import Ganeti.HTools.ExtLoader |
57 | 57 |
import Ganeti.HTools.Types |
58 | 58 |
import Ganeti.HTools.Loader |
59 |
import Ganeti.OpCodes (wrapOpCode, setOpComment, OpCode, MetaOpCode) |
|
59 | 60 |
import Ganeti.Types (fromJobId) |
60 | 61 |
import Ganeti.Utils |
61 | 62 |
|
62 | 63 |
import qualified Ganeti.Luxi as L |
63 | 64 |
import Ganeti.Jobs |
65 |
import Ganeti.Version (version) |
|
64 | 66 |
|
65 | 67 |
-- | Options list and functions. |
66 | 68 |
options :: IO [OptType] |
... | ... | |
99 | 101 |
arguments :: [ArgCompletion] |
100 | 102 |
arguments = [] |
101 | 103 |
|
104 |
-- | Wraps an 'OpCode' in a 'MetaOpCode' while also adding a comment |
|
105 |
-- about what generated the opcode. |
|
106 |
annotateOpCode :: OpCode -> MetaOpCode |
|
107 |
annotateOpCode = |
|
108 |
setOpComment ("rebalancing via hbal " ++ version) . wrapOpCode |
|
109 |
|
|
102 | 110 |
{- | Start computing the solution at the given depth and recurse until |
103 | 111 |
we find a valid solution or we exceed the maximum depth. |
104 | 112 |
|
... | ... | |
205 | 213 |
execJobSet master nl il cref (js:jss) = do |
206 | 214 |
-- map from jobset (htools list of positions) to [[opcodes]] |
207 | 215 |
let jobs = map (\(_, idx, move, _) -> |
216 |
map annotateOpCode $ |
|
208 | 217 |
Cluster.iMoveToJob nl il idx move) js |
209 | 218 |
let descr = map (\(_, idx, _, _) -> Container.nameOf il idx) js |
210 | 219 |
putStrLn $ "Executing jobset for instances " ++ commaJoin descr |
Also available in: Unified diff