Revision 33e44f0c

b/Ganeti/HTools/CLI.hs
34 34
    , shTemplate
35 35
    , defaultLuxiSocket
36 36
    , maybePrintNodes
37
    , maybePrintInsts
37 38
    -- * The options
38 39
    , oDataFile
39 40
    , oDiskMoves
......
429 430
  hPutStrLn stderr ""
430 431
  hPutStrLn stderr (msg ++ " status:")
431 432
  hPutStrLn stderr $ fn fields
433

  
434

  
435
-- | Optionally print the instance list.
436
maybePrintInsts :: Bool   -- ^ Whether to print the instance list
437
                -> String -- ^ Type of the instance map (e.g. initial)
438
                -> String -- ^ The instance data
439
                -> IO ()
440
maybePrintInsts do_print msg instdata =
441
  when do_print $ do
442
    hPutStrLn stderr ""
443
    hPutStrLn stderr $ msg ++ " instance map:"
444
    hPutStr stderr instdata
b/hbal.hs
233 233
  let oneline = optOneline opts
234 234
      verbose = optVerbose opts
235 235
      shownodes = optShowNodes opts
236
      showinsts = optShowInsts opts
236 237

  
237 238
  ini_cdata@(ClusterData gl fixed_nl ilf ctags) <- loadExternalData opts
238 239

  
......
328 329
         putStrLn "Cluster is not N+1 happy, continuing but no guarantee \
329 330
                  \that the cluster will end N+1 happy."
330 331

  
331
  when (optShowInsts opts) $ do
332
         putStrLn ""
333
         putStrLn "Initial instance map:"
334
         putStrLn $ Cluster.printInsts nl il
332
  maybePrintInsts showinsts "Initial" (Cluster.printInsts nl il)
335 333

  
336 334
  maybePrintNodes shownodes "Initial cluster" (Cluster.printNodes nl)
337 335

  
......
397 395
  maybeSaveData (optSaveCluster opts) "balanced" "after balancing"
398 396
                (ClusterData gl fin_nl fin_il ctags)
399 397

  
400
  when (optShowInsts opts) $ do
401
         putStrLn ""
402
         putStrLn "Final instance map:"
403
         putStr $ Cluster.printInsts fin_nl fin_il
398
  maybePrintInsts showinsts "Final" (Cluster.printInsts fin_nl fin_il)
404 399

  
405 400
  maybePrintNodes shownodes "Final cluster" (Cluster.printNodes fin_nl)
406 401

  

Also available in: Unified diff