hbal: print short names in steps list
[ganeti-local] / hbal.hs
diff --git a/hbal.hs b/hbal.hs
index d76eea3..55f428d 100644 (file)
--- a/hbal.hs
+++ b/hbal.hs
@@ -193,7 +193,9 @@ main = do
       all_names = concatMap allNames all_nodes
       offline_wrong = filter (`notElem` all_names) offline_names
       offline_indices = map Node.idx $
-                        filter (\n -> Node.name n `elem` offline_names)
+                        filter (\n ->
+                                 Node.name n `elem` offline_names ||
+                                 Node.alias n `elem` offline_names)
                                all_nodes
       m_cpu = optMcpu opts
       m_dsk = optMdsk opts
@@ -263,8 +265,8 @@ main = do
                       printf "Initial score: %.8f\n" ini_cv)
 
   unless oneline $ putStrLn "Trying to minimize the CV..."
-  let imlen = Container.maxNameLen il
-      nmlen = Container.maxNameLen nl
+  let imlen = maximum . map (length . Instance.alias) $ Container.elems il
+      nmlen = maximum . map (length . Node.alias) $ Container.elems nl
 
   (fin_tbl, cmd_strs) <- iterateDepth ini_tbl (optMaxLength opts)
                          (optDiskMoves opts)