ganeti-3.1: Cluster-based virtualization management software
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ganeti.HTools.Instance

Description

Module describing an instance.

The instance data type holds very few fields, the algorithm intelligence is in the Node and Cluster modules.

Synopsis

Documentation

data Instance #

The instance type.

Constructors

Instance 

Fields

Instances

Instances details
Show Instance # 
Instance details

Defined in Ganeti.HTools.Instance

Methods

showsPrec :: Int -> Instance -> ShowS

show :: Instance -> String

showList :: [Instance] -> ShowS

Element Instance # 
Instance details

Defined in Ganeti.HTools.Instance

Methods

nameOf :: Instance -> String #

allNames :: Instance -> [String] #

idxOf :: Instance -> Int #

setAlias :: Instance -> String -> Instance #

computeAlias :: String -> Instance -> Instance #

setIdx :: Instance -> Int -> Instance #

Eq Instance # 
Instance details

Defined in Ganeti.HTools.Instance

Methods

(==) :: Instance -> Instance -> Bool

(/=) :: Instance -> Instance -> Bool

data Disk #

Constructors

Disk 

Fields

Instances

Instances details
Show Disk # 
Instance details

Defined in Ganeti.HTools.Instance

Methods

showsPrec :: Int -> Disk -> ShowS

show :: Disk -> String

showList :: [Disk] -> ShowS

Eq Disk # 
Instance details

Defined in Ganeti.HTools.Instance

Methods

(==) :: Disk -> Disk -> Bool

(/=) :: Disk -> Disk -> Bool

type AssocList = [(Idx, Instance)] #

A simple name for the int, instance association list.

type List = Container Instance #

A simple name for an instance map.

create :: String -> Int -> Int -> [Disk] -> Int -> InstanceStatus -> [String] -> Bool -> Ndx -> Ndx -> DiskTemplate -> Int -> [Nic] -> Bool -> Instance #

Create an instance.

Some parameters are not initialized by function, and must be set later (via setIdx for example).

isRunning :: Instance -> Bool #

Check if instance is running.

isOffline :: Instance -> Bool #

Check if instance is offline.

notOffline :: Instance -> Bool #

Helper to check if the instance is not offline.

instanceDown :: Instance -> Bool #

Check if instance is down.

usesSecMem :: Instance -> Bool #

Helper for determining whether an instance's memory needs to be taken into account for secondary memory reservation.

applyIfOnline :: Instance -> (a -> a) -> a -> a #

Apply the function if the instance is online. Otherwise use the initial value

setIdx #

Arguments

:: Instance

The original instance

-> Idx

New index

-> Instance

The modified instance

Changes the index.

This is used only during the building of the data structures.

setName #

Arguments

:: Instance

The original instance

-> String

New name

-> Instance

The modified instance

Changes the name.

This is used only during the building of the data structures.

setAlias #

Arguments

:: Instance

The original instance

-> String

New alias

-> Instance

The modified instance

Changes the alias.

This is used only during the building of the data structures.

setPri #

Arguments

:: Instance

the original instance

-> Ndx

the new primary node

-> Instance

the modified instance

Changes the primary node of the instance.

setSec #

Arguments

:: Instance

the original instance

-> Ndx

the new secondary node

-> Instance

the modified instance

Changes the secondary node of the instance.

setBoth #

Arguments

:: Instance

the original instance

-> Ndx

new primary node index

-> Ndx

new secondary node index

-> Instance

the modified instance

Changes both nodes of the instance.

setMovable #

Arguments

:: Instance

The original instance

-> Bool

New movable flag

-> Instance

The modified instance

Sets the movable flag on an instance.

specOf :: Instance -> RSpec #

Return the spec of an instance.

getTotalSpindles :: Instance -> Maybe Int #

Get the number of disk spindles

instBelowISpec :: Instance -> ISpec -> Bool -> OpResult () #

Checks if an instance is smaller than a given spec.

instAboveISpec :: Instance -> ISpec -> Bool -> OpResult () #

Checks if an instance is bigger than a given spec.

instMatchesPolicy :: Instance -> IPolicy -> Bool -> OpResult () #

Checks if an instance matches a policy.

shrinkByType :: Instance -> FailMode -> Result Instance #

Try to shrink the instance based on the reason why we can't allocate it.

localStorageTemplates :: [DiskTemplate] #

Constant holding the local storage templates.

Note: Currently Ganeti only exports node total/free disk space for LVM-based storage; file-based storage is ignored in this model, so even though file-based storage uses in reality disk space on the node, in our model it won't affect it and we can't compute whether there is enough disk space for a file-based instance. Therefore we will treat this template as 'foreign' storage.

hasSecondary :: Instance -> Bool #

Checks whether the instance uses a secondary node.

Note: This should be reconciled with sNode == noSecondary.

requiredNodes :: DiskTemplate -> Int #

Computed the number of nodes for a given disk template.

allNodes :: Instance -> [Ndx] #

Computes all nodes of an instance.

usesLocalStorage :: Instance -> Bool #

Checks whether a given disk template uses local storage.

mirrorType :: Instance -> MirrorType #

A simple wrapper over templateMirrorType.

usesMemory :: Instance -> Bool #

Whether the instance uses memory on its host node. Depends on the InstanceStatus and on whether the instance is forthcoming; instances that aren't running or existent don't use memory.