{-| Implementation of command-line functions.
This module holds the common command-line related functions for the
-binaries, separated into this module since "Ganeti.HTools.Utils" is
+binaries, separated into this module since "Ganeti.Utils" is
used in many other places and this is more IO oriented.
-}
import qualified Ganeti.HTools.Node as Node
import qualified Ganeti.Path as Path
import Ganeti.HTools.Types
-import Ganeti.HTools.Utils
import Ganeti.BasicTypes
import Ganeti.Common as Common
+import Ganeti.Utils
-- * Data types
return $ opts { optSpindleUse = Just su })
"SPINDLES") "select how many virtual spindle instances use\
\ [default read from cluster]",
- OptComplNumeric)
+ OptComplFloat)
oSelInst :: OptType
oSelInst =
return $ opts { optMcpu = Just mcpu }) "RATIO")
"maximum virtual-to-physical cpu ratio for nodes (from 0\
\ upwards) [default read from cluster]",
- OptComplNumeric)
+ OptComplFloat)
oMaxSolLength :: OptType
oMaxSolLength =
"cap the solution at this many balancing or allocation \
\ rounds (useful for very unbalanced clusters or empty \
\ clusters)",
- OptComplNumeric)
+ OptComplInteger)
oMinDisk :: OptType
oMinDisk =
(reqWithConversion (tryRead "min free disk space")
(\n opts -> Ok opts { optMdsk = n }) "RATIO")
"minimum free disk space for nodes (between 0 and 1) [0]",
- OptComplNumeric)
+ OptComplFloat)
oMinGain :: OptType
oMinGain =
(reqWithConversion (tryRead "min gain")
(\g opts -> Ok opts { optMinGain = g }) "DELTA")
"minimum gain to aim for in a balancing step before giving up",
- OptComplNumeric)
+ OptComplFloat)
oMinGainLim :: OptType
oMinGainLim =
(reqWithConversion (tryRead "min gain limit")
(\g opts -> Ok opts { optMinGainLim = g }) "SCORE")
"minimum cluster score for which we start checking the min-gain",
- OptComplNumeric)
+ OptComplFloat)
oMinScore :: OptType
oMinScore =
(reqWithConversion (tryRead "min score")
(\e opts -> Ok opts { optMinScore = e }) "EPSILON")
"mininum score to aim for",
- OptComplNumeric)
+ OptComplFloat)
oNoHeaders :: OptType
oNoHeaders =
parseOpts :: [String] -- ^ The command line arguments
-> String -- ^ The program name
-> [OptType] -- ^ The supported command line options
+ -> [ArgCompletion] -- ^ The supported command line arguments
-> IO (Options, [String]) -- ^ The resulting options and leftover
-- arguments
parseOpts = Common.parseOpts defaultOptions