Revision 8564fb47

b/htools/Ganeti/HTools/Program/Hspace.hs
381 381

  
382 382
  return (sortReasons reasons, new_nl, length new_ixes, tieredSpecMap new_ixes)
383 383

  
384
-- | Create an instance from a given spec.
385
instFromSpec :: RSpec -> DiskTemplate -> Instance.Instance
386
instFromSpec spx disk_template =
387
  Instance.create "new" (rspecMem spx) (rspecDsk spx)
388
    (rspecCpu spx) Running [] True (-1) (-1) disk_template
389

  
384 390
-- | Main function.
385 391
main :: IO ()
386 392
main = do
......
423 429
                   then Nothing
424 430
                   else Just (optMaxLength opts)
425 431

  
426
  -- utility functions
427
  let iofspec spx = Instance.create "new" (rspecMem spx) (rspecDsk spx)
428
                    (rspecCpu spx) Running [] True (-1) (-1) disk_template
429

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

  
432 434
  -- Run the tiered allocation, if enabled
......
436 438
    Just tspec -> do
437 439
         (treason, trl_nl, _, spec_map) <-
438 440
           runAllocation cdata stop_allocation
439
             (Cluster.tieredAlloc nl il alloclimit (iofspec tspec)
440
                     allocnodes [] []) tspec SpecTiered opts
441
             (Cluster.tieredAlloc nl il alloclimit
442
              (instFromSpec tspec disk_template) allocnodes [] [])
443
             tspec SpecTiered opts
441 444

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

  
......
445 448

  
446 449
  (sreason, fin_nl, allocs, _) <-
447 450
      runAllocation cdata stop_allocation
448
            (Cluster.iterateAlloc nl il alloclimit (iofspec ispec)
449
             allocnodes [] []) ispec SpecNormal opts
451
            (Cluster.iterateAlloc nl il alloclimit
452
             (instFromSpec ispec disk_template) allocnodes [] [])
453
            ispec SpecNormal opts
450 454

  
451 455
  printResults machine_r nl fin_nl num_instances allocs sreason
452 456

  

Also available in: Unified diff