Revision b2278348 Ganeti/HTools/CLI.hs

b/Ganeti/HTools/CLI.hs
43 43
    , oOutputDir
44 44
    , oNodeFile
45 45
    , oInstFile
46
    , oNodeSim
46 47
    , oRapiMaster
47 48
    , oLuxiSocket
48 49
    , oMaxSolLength
......
74 75
import qualified Ganeti.HTools.Version as Version(version)
75 76
import qualified Ganeti.HTools.Luxi as Luxi
76 77
import qualified Ganeti.HTools.Rapi as Rapi
78
import qualified Ganeti.HTools.Simu as Simu
77 79
import qualified Ganeti.HTools.Text as Text
78 80
import qualified Ganeti.HTools.Loader as Loader
79 81
import qualified Ganeti.HTools.Instance as Instance
......
97 99
    , optNodeSet   :: Bool           -- ^ The nodes have been set by options
98 100
    , optInstFile  :: FilePath       -- ^ Path to the instances file
99 101
    , optInstSet   :: Bool           -- ^ The insts have been set by options
102
    , optNodeSim   :: Maybe String   -- ^ Cluster simulation mode
100 103
    , optMaxLength :: Int            -- ^ Stop after this many steps
101 104
    , optMaster    :: String         -- ^ Collect data from RAPI
102 105
    , optLuxi      :: Maybe FilePath -- ^ Collect data from Luxi
......
125 128
 , optNodeSet   = False
126 129
 , optInstFile  = "instances"
127 130
 , optInstSet   = False
131
 , optNodeSim   = Nothing
128 132
 , optMaxLength = -1
129 133
 , optMaster    = ""
130 134
 , optLuxi      = Nothing
......
183 187
            (ReqArg (\ f o -> o { optInstFile = f, optInstSet = True }) "FILE")
184 188
            "the instance list FILE"
185 189

  
190
oNodeSim :: OptType
191
oNodeSim = Option "" ["simulate"]
192
            (ReqArg (\ f o -> o { optNodeSim = Just f }) "SPEC")
193
            "simulate an empty cluster, given as 'num_nodes,disk,memory,cpus'"
194

  
186 195
oRapiMaster :: OptType
187 196
oRapiMaster = Option "m" ["master"]
188 197
              (ReqArg (\ m opts -> opts { optMaster = m }) "ADDRESS")
......
330 339
              else env_inst
331 340
      mhost = optMaster opts
332 341
      lsock = optLuxi opts
342
      simdata = optNodeSim opts
333 343
      setRapi = mhost /= ""
334 344
      setLuxi = isJust lsock
345
      setSim = isJust simdata
335 346
      setFiles = optNodeSet opts || optInstSet opts
336 347
      allSet = filter id [setRapi, setLuxi, setFiles]
337 348
  when (length allSet > 1) $
......
344 355
      case () of
345 356
        _ | setRapi -> wrapIO $ Rapi.loadData mhost
346 357
          | setLuxi -> wrapIO $ Luxi.loadData $ fromJust lsock
358
          | setSim -> Simu.loadData $ fromJust simdata
347 359
          | otherwise -> wrapIO $ Text.loadData nodef instf
348 360

  
349 361
  let ldresult = input_data >>= Loader.mergeData

Also available in: Unified diff