Revision 5f3b040a htools/Ganeti/HTools/Program/Hspace.hs

b/htools/Ganeti/HTools/Program/Hspace.hs
228 228
  ]
229 229

  
230 230
-- | Shows allocations stats.
231
printAllocationStats :: Double -> Node.List -> Node.List -> IO ()
232
printAllocationStats m_cpu ini_nl fin_nl = do
231
printAllocationStats :: Node.List -> Node.List -> IO ()
232
printAllocationStats ini_nl fin_nl = do
233 233
  let ini_stats = Cluster.totalResources ini_nl
234 234
      fin_stats = Cluster.totalResources fin_nl
235
      avg_vcpu_ratio = fromIntegral (Cluster.csVcpu fin_stats) /
236
                       Cluster.csTcpu fin_stats
235 237
      (rini, ralo, runa) = Cluster.computeAllocationDelta ini_stats fin_stats
236
  printKeys $ formatRSpec m_cpu  "USED" rini
237
  printKeys $ formatRSpec m_cpu "POOL"ralo
238
  printKeys $ formatRSpec m_cpu "UNAV" runa
238
  printKeys $ formatRSpec avg_vcpu_ratio "USED" rini
239
  printKeys $ formatRSpec avg_vcpu_ratio "POOL"ralo
240
  printKeys $ formatRSpec avg_vcpu_ratio "UNAV" runa
239 241

  
240 242
-- | Ensure a value is quoted if needed.
241 243
ensureQuoted :: String -> String
......
309 311
         (formatResources ispec specData) (diskTemplateToRaw disk_template)
310 312

  
311 313
-- | Prints the tiered results.
312
printTiered :: Bool -> [(RSpec, Int)] -> Double
314
printTiered :: Bool -> [(RSpec, Int)]
313 315
            -> Node.List -> Node.List -> [(FailMode, Int)] -> IO ()
314
printTiered True spec_map m_cpu nl trl_nl _ = do
316
printTiered True spec_map nl trl_nl _ = do
315 317
  printKeys $ printStats PTiered (Cluster.totalResources trl_nl)
316 318
  printKeys [("TSPEC", unwords (formatSpecMap spec_map))]
317
  printAllocationStats m_cpu nl trl_nl
319
  printAllocationStats nl trl_nl
318 320

  
319
printTiered False spec_map _ ini_nl fin_nl sreason = do
321
printTiered False spec_map ini_nl fin_nl sreason = do
320 322
  _ <- printf "Tiered allocation results:\n"
321 323
  if null spec_map
322 324
    then putStrLn "  - no instances allocated"
......
449 451
        (instFromSpec tspec disk_template) allocnodes [] [])
450 452
       tspec disk_template SpecTiered opts
451 453

  
452
  printTiered machine_r spec_map (optMcpu opts) nl trl_nl treason
454
  printTiered machine_r spec_map nl trl_nl treason
453 455

  
454 456
  -- Run the standard (avg-mode) allocation
455 457

  

Also available in: Unified diff