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

b/htools/Ganeti/HTools/Program/Hspace.hs
53 53
  [ oPrintNodes
54 54
  , oDataFile
55 55
  , oDiskTemplate
56
  , oSpindleUse
56 57
  , oNodeSim
57 58
  , oRapiMaster
58 59
  , oLuxiSocket
......
386 387
  return (sortReasons reasons, new_nl, length new_ixes, tieredSpecMap new_ixes)
387 388

  
388 389
-- | Create an instance from a given spec.
389
instFromSpec :: RSpec -> DiskTemplate -> Instance.Instance
390
instFromSpec spx disk_template =
390
instFromSpec :: RSpec -> DiskTemplate -> Int -> Instance.Instance
391
instFromSpec spx disk_template su =
391 392
  Instance.create "new" (rspecMem spx) (rspecDsk spx)
392
    (rspecCpu spx) Running [] True (-1) (-1) disk_template 1
393
    (rspecCpu spx) Running [] True (-1) (-1) disk_template su
393 394

  
394 395
-- | Main function.
395 396
main :: Options -> [String] -> IO ()
......
418 419
      disk_template = fromMaybe cluster_disk_template (optDiskTemplate opts)
419 420
      req_nodes = Instance.requiredNodes disk_template
420 421
      csf = commonSuffix fixed_nl il
422
      su = fromMaybe (iSpecSpindleUse $ iPolicyStdSpec ipol)
423
                     (optSpindleUse opts)
421 424

  
422 425
  when (not (null csf) && verbose > 1) $
423 426
       hPrintf stderr "Note: Stripping common suffix of '%s' from names\n" csf
......
447 450
  (treason, trl_nl, _, spec_map) <-
448 451
    runAllocation cdata stop_allocation
449 452
       (Cluster.tieredAlloc nl il alloclimit
450
        (instFromSpec tspec disk_template) allocnodes [] [])
453
        (instFromSpec tspec disk_template su) allocnodes [] [])
451 454
       tspec disk_template SpecTiered opts
452 455

  
453 456
  printTiered machine_r spec_map nl trl_nl treason
......
460 463
  (sreason, fin_nl, allocs, _) <-
461 464
      runAllocation cdata stop_allocation
462 465
            (Cluster.iterateAlloc nl il alloclimit
463
             (instFromSpec ispec disk_template) allocnodes [] [])
466
             (instFromSpec ispec disk_template su) allocnodes [] [])
464 467
            ispec disk_template SpecNormal opts
465 468

  
466 469
  printResults machine_r nl fin_nl num_instances allocs sreason

Also available in: Unified diff