Move part of the loader pipeline to ClusterData
[ganeti-local] / Ganeti / HTools / CLI.hs
index 336980c..bc2dad0 100644 (file)
@@ -41,6 +41,7 @@ module Ganeti.HTools.CLI
     , oExInst
     , oExTags
     , oExecJobs
+    , oGroup
     , oIDisk
     , oIMem
     , oINodes
@@ -95,6 +96,7 @@ data Options = Options
     , optExInst      :: [String]       -- ^ Instances to be excluded
     , optExTags      :: Maybe [String] -- ^ Tags to use for exclusion
     , optExecJobs    :: Bool           -- ^ Execute the commands via Luxi
+    , optGroup       :: Maybe GroupID  -- ^ The UUID of the group to process
     , optINodes      :: Int            -- ^ Nodes required for an instance
     , optISpec       :: RSpec          -- ^ Requested instance specs
     , optLuxi        :: Maybe FilePath -- ^ Collect data from Luxi
@@ -106,7 +108,7 @@ data Options = Options
     , optMinGainLim  :: Score          -- ^ Limit below which we apply mingain
     , optMinScore    :: Score          -- ^ The minimum score we aim for
     , optNoHeaders   :: Bool           -- ^ Do not show a header line
-    , optNodeSim     :: Maybe String   -- ^ Cluster simulation mode
+    , optNodeSim     :: [String]       -- ^ Cluster simulation mode
     , optOffline     :: [String]       -- ^ Names of offline nodes
     , optOneline     :: Bool           -- ^ Switch output to a single line
     , optOutPath     :: FilePath       -- ^ Path to the output directory
@@ -130,6 +132,7 @@ defaultOptions  = Options
  , optExInst      = []
  , optExTags      = Nothing
  , optExecJobs    = False
+ , optGroup       = Nothing
  , optINodes      = 2
  , optISpec       = RSpec 1 4096 102400
  , optLuxi        = Nothing
@@ -141,7 +144,7 @@ defaultOptions  = Options
  , optMinGainLim  = 1e-1
  , optMinScore    = 1e-9
  , optNoHeaders   = False
- , optNodeSim     = Nothing
+ , optNodeSim     = []
  , optOffline     = []
  , optOneline     = False
  , optOutPath     = "."
@@ -196,6 +199,11 @@ oExecJobs = Option "X" ["exec"]
              "execute the suggested moves via Luxi (only available when using\
              \ it for data gathering)"
 
+oGroup :: OptType
+oGroup = Option "G" ["group"]
+            (ReqArg (\ f o -> Ok o { optGroup = Just f }) "ID")
+            "the ID of the group to balance"
+
 oIDisk :: OptType
 oIDisk = Option "" ["disk"]
          (ReqArg (\ d opts ->
@@ -270,7 +278,7 @@ oNoHeaders = Option "" ["no-headers"]
 
 oNodeSim :: OptType
 oNodeSim = Option "" ["simulate"]
-            (ReqArg (\ f o -> Ok o { optNodeSim = Just f }) "SPEC")
+            (ReqArg (\ f o -> Ok o { optNodeSim = f:optNodeSim o }) "SPEC")
             "simulate an empty cluster, given as 'num_nodes,disk,ram,cpu'"
 
 oOfflineNode :: OptType