ganeti
Safe HaskellNone

Ganeti.HTools.Program.Hspace

Description

Cluster space sizing

Synopsis

Documentation

options :: IO [OptType] Source #

Options list and functions.

arguments :: [ArgCompletion] Source #

The list of arguments supported by the program.

data Phase Source #

The allocation phase we're in (initial, after tiered allocs, or after regular allocation).

Constructors

PInitial 
PFinal 
PTiered 

data SpecType Source #

The kind of instance spec we print.

Constructors

SpecNormal 
SpecTiered 

htsPrefix :: String Source #

Prefix for machine readable names

specPrefix :: SpecType -> String Source #

What we prefix a spec with.

specDescription :: SpecType -> String Source #

The description of a spec.

specName :: SpecType -> String Source #

The "name" of a SpecType.

effFn :: (CStats -> Integer) -> (CStats -> Double) -> CStats -> Double Source #

Efficiency generic function.

memEff :: CStats -> Double Source #

Memory efficiency.

dskEff :: CStats -> Double Source #

Disk efficiency.

cpuEff :: CStats -> Double Source #

Cpu efficiency.

spnEff :: CStats -> Double Source #

Spindles efficiency.

statsData :: [(String, CStats -> String)] Source #

Holds data for converting a CStats structure into detailed statistics.

specData :: [(String, RSpec -> String)] Source #

List holding RSpec formatting information.

specDataSpn :: [(String, RSpec -> String)] Source #

RSpec formatting information including spindles.

clusterData :: [(String, CStats -> String)] Source #

List holding CStats formatting information.

clusterDataSpn :: [(String, CStats -> String)] Source #

CStats formatting information including spindles

printStats :: Phase -> CStats -> [(String, String)] Source #

Function to print stats for a given phase.

printFRScores :: List -> List -> [(FailMode, Int)] -> IO () Source #

Print failure reason and scores

printResults :: Bool -> List -> List -> Int -> Int -> [(FailMode, Int)] -> IO () Source #

Print final stats and related metrics.

printFinalHTS :: Bool -> IO () Source #

Prints the final OK marker in machine readable output.

tieredSpecMap :: [Instance] -> [(RSpec, Int)] Source #

Compute the tiered spec counts from a list of allocated instances.

formatSpecMap :: [(RSpec, Int)] -> [String] Source #

Formats a spec map to strings.

formatRSpec :: String -> AllocInfo -> [(String, String)] Source #

Formats "key-metrics" values.

printAllocationStats :: List -> List -> IO () Source #

Shows allocations stats.

printKeysHTS :: [(String, String)] -> IO () Source #

Format a list of key/values as a shell fragment.

printInstance :: List -> Instance -> [String] Source #

Converts instance data to a list of strings.

printAllocationMap :: Int -> String -> List -> [Instance] -> IO () Source #

Optionally print the allocation map.

formatResources :: a -> [(String, a -> String)] -> String Source #

Formats nicely a list of resources.

printCluster :: Bool -> CStats -> Int -> Bool -> IO () Source #

Print the cluster resources.

printISpec :: Bool -> RSpec -> SpecType -> DiskTemplate -> Bool -> IO () Source #

Prints the normal instance spec.

printTiered :: Bool -> [(RSpec, Int)] -> List -> List -> [(FailMode, Int)] -> IO () Source #

Prints the tiered results.

printClusterScores :: List -> List -> IO () Source #

Displays the initial/final cluster scores.

printClusterEff :: CStats -> Bool -> IO () Source #

Displays the cluster efficiency.

failureReason :: [(FailMode, Int)] -> String Source #

Computes the most likely failure reason.

sortReasons :: [(FailMode, Int)] -> [(FailMode, Int)] Source #

Sorts the failure reasons.

runAllocation Source #

Arguments

:: ClusterData

Cluster data

-> Maybe AllocResult

Optional stop-allocation

-> Result AllocResult

Allocation result

-> RSpec

Requested instance spec

-> DiskTemplate

Requested disk template

-> SpecType

Allocation type

-> Options

CLI options

-> IO (FailStats, List, Int, [(RSpec, Int)]) 

Runs an allocation algorithm and saves cluster state.

instFromSpec :: RSpec -> DiskTemplate -> Int -> Instance Source #

Create an instance from a given spec. For values not implied by the resorce specification (like distribution of of the disk space to individual disks), sensible defaults are guessed (e.g., having a single disk).

main :: Options -> [String] -> IO () Source #

Main function.