ganeti-htoolsSource codeContentsIndex
Ganeti.HTools.CLI
Contents
Constants
Data types
Helper functions
Command line options
Functions
Description

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 used in many other places and this is more IO oriented.

Synopsis
defaultLuxiSocket :: FilePath
data Options = Options {
optDataFile :: Maybe FilePath
optDiskMoves :: Bool
optInstMoves :: Bool
optDiskTemplate :: Maybe DiskTemplate
optSpindleUse :: Maybe Int
optDynuFile :: Maybe FilePath
optEvacMode :: Bool
optExInst :: [String]
optExTags :: Maybe [String]
optExecJobs :: Bool
optGroup :: Maybe GroupID
optIAllocSrc :: Maybe FilePath
optSelInst :: [String]
optLuxi :: Maybe FilePath
optMachineReadable :: Bool
optMaster :: String
optMaxLength :: Int
optMcpu :: Maybe Double
optMdsk :: Double
optMinGain :: Score
optMinGainLim :: Score
optMinScore :: Score
optNoHeaders :: Bool
optNoSimulation :: Bool
optNodeSim :: [String]
optOffline :: [String]
optOutPath :: FilePath
optSaveCluster :: Maybe FilePath
optShowCmds :: Maybe FilePath
optShowHelp :: Bool
optShowInsts :: Bool
optShowNodes :: Maybe [String]
optShowVer :: Bool
optStdSpec :: Maybe RSpec
optTestCount :: Maybe Int
optTieredSpec :: Maybe RSpec
optReplay :: Maybe String
optVerbose :: Int
}
defaultOptions :: Options
type OptType = OptDescr (Options -> Result Options)
parseISpecString :: String -> String -> Result RSpec
oDataFile :: OptType
oDiskMoves :: OptType
oDiskTemplate :: OptType
oSpindleUse :: OptType
oSelInst :: OptType
oInstMoves :: OptType
oDynuFile :: OptType
oEvacMode :: OptType
oExInst :: OptType
oExTags :: OptType
oExecJobs :: OptType
oGroup :: OptType
oIAllocSrc :: OptType
oLuxiSocket :: OptType
oMachineReadable :: OptType
oMaxCpu :: OptType
oMaxSolLength :: OptType
oMinDisk :: OptType
oMinGain :: OptType
oMinGainLim :: OptType
oMinScore :: OptType
oNoHeaders :: OptType
oNoSimulation :: OptType
oNodeSim :: OptType
oOfflineNode :: OptType
oOutputDir :: OptType
oPrintCommands :: OptType
oPrintInsts :: OptType
oPrintNodes :: OptType
oQuiet :: OptType
oRapiMaster :: OptType
oSaveCluster :: OptType
oShowHelp :: OptType
oShowVer :: OptType
oStdSpec :: OptType
oTestCount :: OptType
oTieredSpec :: OptType
oReplay :: OptType
oVerbose :: OptType
parseYesNo :: Bool -> Maybe String -> Result Bool
usageHelp :: String -> [OptType] -> String
versionInfo :: String -> String
parseOpts :: [String] -> String -> [OptType] -> IO (Options, [String])
parseOptsInner :: [String] -> String -> [OptType] -> Either (Int, String) (Options, [String])
shTemplate :: String
maybePrintNodes :: Maybe [String] -> String -> ([String] -> String) -> IO ()
maybePrintInsts :: Bool -> String -> String -> IO ()
maybeShowWarnings :: [String] -> IO ()
printKeys :: String -> [(String, String)] -> IO ()
printFinal :: String -> Bool -> IO ()
setNodeOffline :: [Ndx] -> Node -> Node
setNodeStatus :: Options -> List -> IO List
Constants
defaultLuxiSocket :: FilePathSource

The default value for the luxi socket.

This is re-exported from the Ganeti.Constants module.

Data types
data Options Source
Command line options structure.
Constructors
Options
optDataFile :: Maybe FilePathPath to the cluster data file
optDiskMoves :: BoolAllow disk moves
optInstMoves :: BoolAllow instance moves
optDiskTemplate :: Maybe DiskTemplateOverride for the disk template
optSpindleUse :: Maybe IntOverride for the spindle usage
optDynuFile :: Maybe FilePathOptional file with dynamic use data
optEvacMode :: BoolEnable evacuation mode
optExInst :: [String]Instances to be excluded
optExTags :: Maybe [String]Tags to use for exclusion
optExecJobs :: BoolExecute the commands via Luxi
optGroup :: Maybe GroupIDThe UUID of the group to process
optIAllocSrc :: Maybe FilePathThe iallocation spec
optSelInst :: [String]Instances to be excluded
optLuxi :: Maybe FilePathCollect data from Luxi
optMachineReadable :: BoolOutput machine-readable format
optMaster :: StringCollect data from RAPI
optMaxLength :: IntStop after this many steps
optMcpu :: Maybe DoubleOverride max cpu ratio for nodes
optMdsk :: DoubleMax disk usage ratio for nodes
optMinGain :: ScoreMin gain we aim for in a step
optMinGainLim :: ScoreLimit below which we apply mingain
optMinScore :: ScoreThe minimum score we aim for
optNoHeaders :: BoolDo not show a header line
optNoSimulation :: BoolSkip the rebalancing dry-run
optNodeSim :: [String]Cluster simulation mode
optOffline :: [String]Names of offline nodes
optOutPath :: FilePathPath to the output directory
optSaveCluster :: Maybe FilePathSave cluster state to this file
optShowCmds :: Maybe FilePathWhether to show the command list
optShowHelp :: BoolJust show the help
optShowInsts :: BoolWhether to show the instance map
optShowNodes :: Maybe [String]Whether to show node status
optShowVer :: BoolJust show the program version
optStdSpec :: Maybe RSpecRequested standard specs
optTestCount :: Maybe IntOptional test count override
optTieredSpec :: Maybe RSpecRequested specs for tiered mode
optReplay :: Maybe StringUnittests: RNG state
optVerbose :: IntVerbosity level
defaultOptions :: OptionsSource
Default values for the command line options.
type OptType = OptDescr (Options -> Result Options)Source
Abrreviation for the option type.
Helper functions
parseISpecString :: String -> String -> Result RSpecSource
Command line options
oDataFile :: OptTypeSource
oDiskMoves :: OptTypeSource
oDiskTemplate :: OptTypeSource
oSpindleUse :: OptTypeSource
oSelInst :: OptTypeSource
oInstMoves :: OptTypeSource
oDynuFile :: OptTypeSource
oEvacMode :: OptTypeSource
oExInst :: OptTypeSource
oExTags :: OptTypeSource
oExecJobs :: OptTypeSource
oGroup :: OptTypeSource
oIAllocSrc :: OptTypeSource
oLuxiSocket :: OptTypeSource
oMachineReadable :: OptTypeSource
oMaxCpu :: OptTypeSource
oMaxSolLength :: OptTypeSource
oMinDisk :: OptTypeSource
oMinGain :: OptTypeSource
oMinGainLim :: OptTypeSource
oMinScore :: OptTypeSource
oNoHeaders :: OptTypeSource
oNoSimulation :: OptTypeSource
oNodeSim :: OptTypeSource
oOfflineNode :: OptTypeSource
oOutputDir :: OptTypeSource
oPrintCommands :: OptTypeSource
oPrintInsts :: OptTypeSource
oPrintNodes :: OptTypeSource
oQuiet :: OptTypeSource
oRapiMaster :: OptTypeSource
oSaveCluster :: OptTypeSource
oShowHelp :: OptTypeSource
oShowVer :: OptTypeSource
oStdSpec :: OptTypeSource
oTestCount :: OptTypeSource
oTieredSpec :: OptTypeSource
oReplay :: OptTypeSource
oVerbose :: OptTypeSource
Functions
parseYesNoSource
:: BoolDefault value (when we get a Nothing)
-> Maybe StringParameter value
-> Result BoolResulting boolean value
Helper for parsing a yes/no command line flag.
usageHelp :: String -> [OptType] -> StringSource
Usage info.
versionInfo :: String -> StringSource
Show the program version info.
parseOptsSource
:: [String]The command line arguments
-> StringThe program name
-> [OptType]The supported command line options
-> IO (Options, [String])The resulting options and leftover arguments
Command line parser, using the Options structure.
parseOptsInner :: [String] -> String -> [OptType] -> Either (Int, String) (Options, [String])Source
Inner parse options. The arguments are similar to parseOpts, but it returns either a Left composed of exit code and message, or a Right for the success case.
shTemplate :: StringSource
A shell script template for autogenerated scripts.
maybePrintNodesSource
:: Maybe [String]The field list
-> StringInformational message
-> [String] -> StringFunction to generate the listing
-> IO ()
Optionally print the node list.
maybePrintInstsSource
:: BoolWhether to print the instance list
-> StringType of the instance map (e.g. initial)
-> StringThe instance data
-> IO ()
Optionally print the instance list.
maybeShowWarningsSource
:: [String]The warning messages
-> IO ()
Function to display warning messages from parsing the cluster state.
printKeysSource
:: StringPrefix to printed variables
-> [(String, String)]List of (key, value) pairs to be printed
-> IO ()
Format a list of key, value as a shell fragment.
printFinalSource
:: StringPrefix to printed variable
-> BoolWhether output should be machine readable Note: if not, there is nothing to print
-> IO ()
Prints the final OK marker in machine readable output.
setNodeOffline :: [Ndx] -> Node -> NodeSource
Potentially set the node as offline based on passed offline list.
setNodeStatus :: Options -> List -> IO ListSource
Set node properties based on command line options.
Produced by Haddock version 2.6.0