Revision f0753837

b/htools/Ganeti/HTools/CLI.hs
44 44
  , oDataFile
45 45
  , oDiskMoves
46 46
  , oDiskTemplate
47
  , oSpindleUse
47 48
  , oDynuFile
48 49
  , oEvacMode
49 50
  , oExInst
......
113 114
  , optDiskMoves   :: Bool           -- ^ Allow disk moves
114 115
  , optInstMoves   :: Bool           -- ^ Allow instance moves
115 116
  , optDiskTemplate :: Maybe DiskTemplate  -- ^ Override for the disk template
117
  , optSpindleUse  :: Maybe Int      -- ^ Override for the spindle usage
116 118
  , optDynuFile    :: Maybe FilePath -- ^ Optional file with dynamic use data
117 119
  , optEvacMode    :: Bool           -- ^ Enable evacuation mode
118 120
  , optExInst      :: [String]       -- ^ Instances to be excluded
......
154 156
  , optDiskMoves   = True
155 157
  , optInstMoves   = True
156 158
  , optDiskTemplate = Nothing
159
  , optSpindleUse  = Nothing
157 160
  , optDynuFile    = Nothing
158 161
  , optEvacMode    = False
159 162
  , optExInst      = []
......
228 231
                           return $ opts { optDiskTemplate = Just dt })
229 232
                 "TEMPLATE") "select the desired disk template"
230 233

  
234
oSpindleUse :: OptType
235
oSpindleUse = Option "" ["spindle-use"]
236
              (ReqArg (\ n opts -> do
237
                         su <- tryRead "parsing spindle-use" n
238
                         when (su < 0) $
239
                              fail "Invalid value of the spindle-use\
240
                                   \ (expected >= 0)"
241
                         return $ opts { optSpindleUse = Just su })
242
               "SPINDLES") "select how many virtual spindle instances use\
243
                           \ [default read from cluster]"
244

  
231 245
oSelInst :: OptType
232 246
oSelInst = Option "" ["select-instances"]
233 247
          (ReqArg (\ f opts -> Ok opts { optSelInst = sepSplit ',' f }) "INSTS")
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
b/man/hspace.rst
207 207
  one of the Ganeti disk templates (e.g. plain, drbd, so on) should be
208 208
  passed in.
209 209

  
210
\--spindle-use *spindles*
211
  Override the spindle use for the instance read from the cluster. The
212
  value can be 0 (for example for instances that use very low I/O), but not
213
  negative. For shared storage the value is ignored.
214

  
210 215
\--max-cpu=*cpu-ratio*
211 216
  The maximum virtual to physical cpu ratio, as a floating point number
212 217
  greater than or equal to one. For example, specifying *cpu-ratio* as

Also available in: Unified diff