, oOneline
, oNoHeaders
, oOutputDir
- , oNodeFile
- , oInstFile
+ , oDataFile
, oNodeSim
, oRapiMaster
, oLuxiSocket
, oDiskMoves
, oDynuFile
, oTieredSpec
+ , oExTags
, oShowVer
, oShowHelp
) where
-- | Command line options structure.
data Options = Options
- { optShowNodes :: Bool -- ^ Whether to show node status
+ { optShowNodes :: Maybe [String] -- ^ Whether to show node status
, optShowInsts :: Bool -- ^ Whether to show the instance map
, optShowCmds :: Maybe FilePath -- ^ Whether to show the command list
, optOneline :: Bool -- ^ Switch output to a single line
, optOutPath :: FilePath -- ^ Path to the output directory
, optNoHeaders :: Bool -- ^ Do not show a header line
- , optNodeFile :: FilePath -- ^ Path to the nodes file
- , optNodeSet :: Bool -- ^ The nodes have been set by options
- , optInstFile :: FilePath -- ^ Path to the instances file
- , optInstSet :: Bool -- ^ The insts have been set by options
+ , optDataFile :: Maybe FilePath -- ^ Path to the cluster data file
, optNodeSim :: Maybe String -- ^ Cluster simulation mode
, optMaxLength :: Int -- ^ Stop after this many steps
, optMaster :: String -- ^ Collect data from RAPI
, optMdsk :: Double -- ^ Max disk usage ratio for nodes
, optDiskMoves :: Bool -- ^ Allow disk moves
, optDynuFile :: Maybe FilePath -- ^ Optional file with dynamic use data
+ , optExTags :: Maybe [String] -- ^ Tags to use for exclusion
, optVerbose :: Int -- ^ Verbosity level
, optShowVer :: Bool -- ^ Just show the program version
, optShowHelp :: Bool -- ^ Just show the help
-- | Default values for the command line options.
defaultOptions :: Options
defaultOptions = Options
- { optShowNodes = False
+ { optShowNodes = Nothing
, optShowInsts = False
, optShowCmds = Nothing
, optOneline = False
, optNoHeaders = False
, optOutPath = "."
- , optNodeFile = "nodes"
- , optNodeSet = False
- , optInstFile = "instances"
- , optInstSet = False
+ , optDataFile = Nothing
, optNodeSim = Nothing
, optMaxLength = -1
, optMaster = ""
, optMdsk = -1
, optDiskMoves = True
, optDynuFile = Nothing
+ , optExTags = Nothing
, optVerbose = 1
, optShowVer = False
, optShowHelp = False
oPrintNodes :: OptType
oPrintNodes = Option "p" ["print-nodes"]
- (NoArg (\ opts -> Ok opts { optShowNodes = True }))
+ (OptArg ((\ f opts ->
+ let splitted = sepSplit ',' f
+ in Ok opts { optShowNodes = Just splitted }) .
+ fromMaybe []) "FIELDS")
"print the final node list"
oPrintInsts :: OptType
(ReqArg (\ d opts -> Ok opts { optOutPath = d }) "PATH")
"directory in which to write output files"
-oNodeFile :: OptType
-oNodeFile = Option "n" ["nodes"]
- (ReqArg (\ f o -> Ok o { optNodeFile = f,
- optNodeSet = True }) "FILE")
- "the node list FILE"
-
-oInstFile :: OptType
-oInstFile = Option "i" ["instances"]
- (ReqArg (\ f o -> Ok o { optInstFile = f,
- optInstSet = True }) "FILE")
- "the instance list FILE"
+oDataFile :: OptType
+oDataFile = Option "t" ["text-data"]
+ (ReqArg (\ f o -> Ok o { optDataFile = Just f }) "FILE")
+ "the cluster data FILE"
oNodeSim :: OptType
oNodeSim = Option "" ["simulate"]
(ReqArg (\ f o -> Ok o { optNodeSim = Just f }) "SPEC")
- "simulate an empty cluster, given as 'num_nodes,disk,memory,cpus'"
+ "simulate an empty cluster, given as 'num_nodes,disk,ram,cpu'"
oRapiMaster :: OptType
oRapiMaster = Option "m" ["master"]
(ReqArg (\ f opts -> Ok opts { optDynuFile = Just f }) "FILE")
"Import dynamic utilisation data from the given FILE"
+oExTags :: OptType
+oExTags = Option "" ["exclusion-tags"]
+ (ReqArg (\ f opts -> Ok opts { optExTags = Just $ sepSplit ',' f })
+ "TAG,...") "Enable instance exclusion based on given tag prefix"
+
oTieredSpec :: OptType
oTieredSpec = Option "" ["tiered-alloc"]
(ReqArg (\ inp opts -> do
prs <- mapM (tryRead "tiered specs") sp
tspec <-
case prs of
- [cpu, ram, dsk] -> return $ RSpec cpu ram dsk
+ [dsk, ram, cpu] -> return $ RSpec cpu ram dsk
_ -> Bad $ "Invalid specification: " ++ inp
return $ opts { optTieredSpec = Just tspec } )
"TSPEC")
- "enable tiered specs allocation, where we decrease the instance\
- \ spec on failure to allocate and restart the allocation process"
+ "enable tiered specs allocation, given as 'disk,ram,cpu'"
oShowVer :: OptType
oShowVer = Option "V" ["version"]