From 924f9c163a2319861a7eabf5162b8bef844651eb Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Tue, 13 Oct 2009 10:43:10 +0200
Subject: [PATCH] Extend the MoveJob type to hold the instance index

This will be needed in order to generate the proper instance move commands.

Signed-off-by: Iustin Pop <iustin@google.com>
---
 Ganeti/HTools/Cluster.hs | 6 +++---
 Ganeti/HTools/Types.hs   | 2 +-
 hbal.hs                  | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Ganeti/HTools/Cluster.hs b/Ganeti/HTools/Cluster.hs
index 9c923d49a..e4c96c764 100644
--- a/Ganeti/HTools/Cluster.hs
+++ b/Ganeti/HTools/Cluster.hs
@@ -619,8 +619,8 @@ involvedNodes il plc =
 -- | Inner function for splitJobs, that either appends the next job to
 -- the current jobset, or starts a new jobset.
 mergeJobs :: ([JobSet], [Ndx]) -> MoveJob -> ([JobSet], [Ndx])
-mergeJobs ([], _) n@(ndx, _, _) = ([[n]], ndx)
-mergeJobs (cjs@(j:js), nbuf) n@(ndx, _, _)
+mergeJobs ([], _) n@(ndx, _, _, _) = ([[n]], ndx)
+mergeJobs (cjs@(j:js), nbuf) n@(ndx, _, _, _)
     | null (ndx `intersect` nbuf) = ((n:j):js, ndx ++ nbuf)
     | otherwise = ([n]:cjs, ndx)
 
@@ -632,7 +632,7 @@ splitJobs = fst . foldl mergeJobs ([], [])
 -- | Given a list of commands, prefix them with @gnt-instance@ and
 -- also beautify the display a little.
 formatJob :: Int -> Int -> (Int, MoveJob) -> [String]
-formatJob jsn jsl (sn, (_, _, cmds)) =
+formatJob jsn jsl (sn, (_, _, _, cmds)) =
     let out =
             printf "  echo job %d/%d" jsn sn:
             printf "  check":
diff --git a/Ganeti/HTools/Types.hs b/Ganeti/HTools/Types.hs
index a977622f9..000b7a65e 100644
--- a/Ganeti/HTools/Types.hs
+++ b/Ganeti/HTools/Types.hs
@@ -68,7 +68,7 @@ data IMove = Failover                -- ^ Failover the instance (f)
 
 -- | Formatted solution output for one move (involved nodes and
 -- commands
-type MoveJob = ([Ndx], IMove, [String])
+type MoveJob = ([Ndx], Idx, IMove, [String])
 
 -- | A list of command elements
 type JobSet = [MoveJob]
diff --git a/hbal.hs b/hbal.hs
index 6be57c418..88cdd156e 100644
--- a/hbal.hs
+++ b/hbal.hs
@@ -91,11 +91,11 @@ iterateDepth ini_tbl max_rounds disk_moves nmlen imlen
               let
                   (Cluster.Table _ _ _ fin_plc) = fin_tbl
                   fin_plc_len = length fin_plc
-                  cur_plc@(_, _, _, move, _) = head fin_plc
+                  cur_plc@(idx, _, _, move, _) = head fin_plc
                   (sol_line, cmds) = Cluster.printSolutionLine ini_nl ini_il
                                      nmlen imlen cur_plc fin_plc_len
                   afn = Cluster.involvedNodes ini_il cur_plc
-                  upd_cmd_strs = (afn, move, cmds):cmd_strs
+                  upd_cmd_strs = (afn, idx, move, cmds):cmd_strs
               unless oneline $ do
                        putStrLn sol_line
                        hFlush stdout
-- 
GitLab