Revision be468da0 htools/Ganeti/HTools/Program/Hspace.hs

b/htools/Ganeti/HTools/Program/Hspace.hs
29 29
import Data.Char (toUpper, isAlphaNum, toLower)
30 30
import Data.Function (on)
31 31
import Data.List
32
import Data.Maybe (fromMaybe)
32 33
import Data.Ord (comparing)
33 34
import System.Exit
34 35
import System.IO
......
398 399
         exitWith $ ExitFailure 1
399 400

  
400 401
  let verbose = optVerbose opts
401
      ispec = optStdSpec opts
402 402
      disk_template = optDiskTemplate opts
403 403
      req_nodes = Instance.requiredNodes disk_template
404 404
      machine_r = optMachineReadable opts
405 405

  
406
  orig_cdata@(ClusterData gl fixed_nl il _ _) <- loadExternalData opts
406
  orig_cdata@(ClusterData gl fixed_nl il _ ipol) <- loadExternalData opts
407 407
  nl <- setNodeStatus opts fixed_nl
408 408

  
409 409
  let num_instances = Container.size il
......
431 431

  
432 432
  allocnodes <- exitIfBad $ Cluster.genAllocNodes gl nl req_nodes True
433 433

  
434
  -- Run the tiered allocation, if enabled
434
  -- Run the tiered allocation
435 435

  
436
  case optTieredSpec opts of
437
    Nothing -> return ()
438
    Just tspec -> do
439
         (treason, trl_nl, _, spec_map) <-
440
           runAllocation cdata stop_allocation
441
             (Cluster.tieredAlloc nl il alloclimit
442
              (instFromSpec tspec disk_template) allocnodes [] [])
443
             tspec SpecTiered opts
436
  let tspec = fromMaybe (rspecFromISpec (iPolicyMaxSpec ipol))
437
              (optTieredSpec opts)
444 438

  
445
         printTiered machine_r spec_map (optMcpu opts) nl trl_nl treason
439
  (treason, trl_nl, _, spec_map) <-
440
    runAllocation cdata stop_allocation
441
       (Cluster.tieredAlloc nl il alloclimit
442
        (instFromSpec tspec disk_template) allocnodes [] [])
443
       tspec SpecTiered opts
444

  
445
  printTiered machine_r spec_map (optMcpu opts) nl trl_nl treason
446 446

  
447 447
  -- Run the standard (avg-mode) allocation
448 448

  
449
  let ispec = fromMaybe (rspecFromISpec (iPolicyStdSpec ipol))
450
              (optStdSpec opts)
451

  
449 452
  (sreason, fin_nl, allocs, _) <-
450 453
      runAllocation cdata stop_allocation
451 454
            (Cluster.iterateAlloc nl il alloclimit
......
454 457

  
455 458
  printResults machine_r nl fin_nl num_instances allocs sreason
456 459

  
460
  -- Print final result
461

  
457 462
  printFinal machine_r

Also available in: Unified diff