ganeti

Safe HaskellSafe-Infered

Ganeti.HTools.CLI

Contents

Description

Implementation of command-line functions.

This module holds the common command-line related functions for the binaries, separated into this module since Ganeti.Utils is used in many other places and this is more IO oriented.

Synopsis

Data types

data Options Source

Command line options structure.

Constructors

Options 

Fields

optDataFile :: Maybe FilePath

Path to the cluster data file

optDiskMoves :: Bool

Allow disk moves

optAvoidDiskMoves :: Double

Allow only disk moves improving cluster score in more than optAvoidDiskMoves times

optInstMoves :: Bool

Allow instance moves

optDiskTemplate :: Maybe DiskTemplate

Override for the disk template

optSpindleUse :: Maybe Int

Override for the spindle usage

optDynuFile :: Maybe FilePath

Optional file with dynamic use data

optIgnoreDynu :: Bool

Do not use dynamic use data

optIdleDefault :: Bool

Assume idle load for all not provided dynamic utilisation data

optIgnoreSoftErrors :: Bool

Ignore soft errors in balancing moves

optIndependentGroups :: Bool

consider groups independently

optAcceptExisting :: Bool

accept existing N+1 violations

optSoR :: Bool

only use state-of-record data

optMonD :: Bool

Query MonDs

optMonDFile :: Maybe FilePath

Optional file with data provided by MonDs

optMonDXen :: Bool

Should Xen-specific collectors be considered (only if MonD is queried)

optMonDKvmRSS :: Bool

Should kvm RSS information be considered (only if MonD is queried)

optMonDExitMissing :: Bool

If the program should exit on missing MonD data

optMemWeight :: Double

Rescale the weight of memory utilisation

optEvacMode :: Bool

Enable evacuation mode

optRestrictedMigrate :: Bool

Disallow replace-primary moves

optExInst :: [String]

Instances to be excluded

optExTags :: Maybe [String]

Tags to use for exclusion

optExecJobs :: Bool

Execute the commands via Luxi

optDryRun :: Bool

Only do a dry run

optFirstJobGroup :: Bool

Only execute the first group of jobs

optForce :: Bool

Force the execution

optFullEvacuation :: Bool

Fully evacuate nodes to be rebooted

optGroup :: Maybe GroupID

The UUID of the group to process

optIAllocSrc :: Maybe FilePath

The iallocation spec

optIgnoreNonRedundant :: Bool

Ignore non-redundant instances

optSelInst :: [String]

Instances to be excluded

optLuxi :: Maybe FilePath

Collect data from Luxi

optJobDelay :: Double

Delay before executing first job

optMachineReadable :: Bool

Output machine-readable format

optMaster :: String

Collect data from RAPI

optMaxLength :: Int

Stop after this many steps

optMcpu :: Maybe Double

Override max cpu ratio for nodes

optMdsk :: Double

Max disk usage ratio for nodes

optMinGain :: Score

Min gain we aim for in a step

optMinGainLim :: Score

Limit below which we apply mingain

optMinResources :: Double

Minimal resources for hsqueeze

optMinScore :: Score

The minimum score we aim for

optNoHeaders :: Bool

Do not show a header line

optNoSimulation :: Bool

Skip the rebalancing dry-run

optNodeSim :: [String]

Cluster simulation mode

optNodeTags :: Maybe [String]

List of node tags to restrict to

optOffline :: [String]

Names of offline nodes

optRestrictToNodes :: Maybe [String]

if not Nothing, restrict allocation to those nodes

optOfflineMaintenance :: Bool

Pretend all instances are offline

optOneStepOnly :: Bool

Only do the first step

optOutPath :: FilePath

Path to the output directory

optPrintMoves :: Bool

Whether to show the instance moves

optReason :: Maybe String

The reason to be passed when submitting jobs

optSaveCluster :: Maybe FilePath

Save cluster state to this file

optShowCmds :: Maybe FilePath

Whether to show the command list

optShowHelp :: Bool

Just show the help

optShowComp :: Bool

Just show the completion info

optShowInsts :: Bool

Whether to show the instance map

optShowNodes :: Maybe [String]

Whether to show node status

optShowVer :: Bool

Just show the program version

optSkipNonRedundant :: Bool

Skip nodes with non-redundant instance

optStdSpec :: Maybe RSpec

Requested standard specs

optTargetResources :: Double

Target resources for squeezing

optTestCount :: Maybe Int

Optional test count override

optTieredSpec :: Maybe RSpec

Requested specs for tiered mode

optReplay :: Maybe String

Unittests: RNG state

optVerbose :: Int

Verbosity level

optPriority :: Maybe OpSubmitPriority

OpCode submit priority

optCapacity :: Bool

Also do capacity-related checks

defaultOptions :: OptionsSource

Default values for the command line options.

type OptType = GenericOptType OptionsSource

Abbreviation for the option type.

Helper functions

parseISpecString :: String -> String -> Result RSpecSource

Command line options

Functions

parseOptsSource

Arguments

:: [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

Wrapper over parseOpts with our custom options.

shTemplate :: StringSource

A shell script template for autogenerated scripts.

maybeSaveCommandsSource

Arguments

:: String

Informal description

-> Options 
-> String

commands

-> IO () 

Optionally show or save a list of commands

maybePrintNodesSource

Arguments

:: Maybe [String]

The field list

-> String

Informational message

-> ([String] -> String)

Function to generate the listing

-> IO () 

Optionally print the node list.

maybePrintInstsSource

Arguments

:: Bool

Whether to print the instance list

-> String

Type of the instance map (e.g. initial)

-> String

The instance data

-> IO () 

Optionally print the instance list.

maybeShowWarningsSource

Arguments

:: [String]

The warning messages

-> IO () 

Function to display warning messages from parsing the cluster state.

printKeysSource

Arguments

:: String

Prefix 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

Arguments

:: String

Prefix to printed variable

-> Bool

Whether output should be machine readable; note: if not, there is nothing to print

-> IO () 

Prints the final OK marker in machine readable output.

setNodeStatus :: Options -> List -> IO ListSource

Set node properties based on command line options.