Revision 9fdd3d0f htools/Ganeti/HTools/Program/Hspace.hs

b/htools/Ganeti/HTools/Program/Hspace.hs
358 358
              -> Maybe Cluster.AllocResult  -- ^ Optional stop-allocation
359 359
              -> Result Cluster.AllocResult -- ^ Allocation result
360 360
              -> RSpec                      -- ^ Requested instance spec
361
              -> DiskTemplate               -- ^ Requested disk template
361 362
              -> SpecType                   -- ^ Allocation type
362 363
              -> Options                    -- ^ CLI options
363 364
              -> IO (FailStats, Node.List, Int, [(RSpec, Int)])
364
runAllocation cdata stop_allocation actual_result spec mode opts = do
365
runAllocation cdata stop_allocation actual_result spec dt mode opts = do
365 366
  (reasons, new_nl, new_il, new_ixes, _) <-
366 367
      case stop_allocation of
367 368
        Just result_noalloc -> return result_noalloc
......
371 372
      descr = name ++ " allocation"
372 373
      ldescr = "after " ++ map toLower descr
373 374

  
374
  printISpec (optMachineReadable opts) spec mode (optDiskTemplate opts)
375
  printISpec (optMachineReadable opts) spec mode dt
375 376

  
376 377
  printAllocationMap (optVerbose opts) descr new_nl new_ixes
377 378

  
......
399 400
         exitWith $ ExitFailure 1
400 401

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

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

  
408
  cluster_disk_template <-
409
    case iPolicyDiskTemplates ipol of
410
      first_templ:_ -> return first_templ
411
      _ -> do
412
         _ <- hPutStrLn stderr $ "Error: null list of disk templates\
413
                               \ received from cluster!"
414
         exitWith $ ExitFailure 1
415

  
409 416
  let num_instances = Container.size il
410 417
      all_nodes = Container.elems fixed_nl
411 418
      cdata = orig_cdata { cdNodes = fixed_nl }
419
      disk_template = fromMaybe cluster_disk_template (optDiskTemplate opts)
420
      req_nodes = Instance.requiredNodes disk_template
412 421
      csf = commonSuffix fixed_nl il
413 422

  
414 423
  when (not (null csf) && verbose > 1) $
......
440 449
    runAllocation cdata stop_allocation
441 450
       (Cluster.tieredAlloc nl il alloclimit
442 451
        (instFromSpec tspec disk_template) allocnodes [] [])
443
       tspec SpecTiered opts
452
       tspec disk_template SpecTiered opts
444 453

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

  
......
453 462
      runAllocation cdata stop_allocation
454 463
            (Cluster.iterateAlloc nl il alloclimit
455 464
             (instFromSpec ispec disk_template) allocnodes [] [])
456
            ispec SpecNormal opts
465
            ispec disk_template SpecNormal opts
457 466

  
458 467
  printResults machine_r nl fin_nl num_instances allocs sreason
459 468

  

Also available in: Unified diff