Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Ganeti.HTools.Instance
Description
Synopsis
- data Instance = Instance {
- name :: String
- alias :: String
- mem :: Int
- dsk :: Int
- disks :: [Disk]
- vcpus :: Int
- runSt :: InstanceStatus
- pNode :: Ndx
- sNode :: Ndx
- idx :: Idx
- util :: DynUtil
- movable :: Bool
- autoBalance :: Bool
- diskTemplate :: DiskTemplate
- spindleUse :: Int
- allTags :: [String]
- exclTags :: [String]
- dsrdLocTags :: Set String
- locationScore :: Int
- arPolicy :: AutoRepairPolicy
- nics :: [Nic]
- forthcoming :: Bool
- data Disk = Disk {
- dskSize :: Int
- dskSpindles :: Maybe Int
- type AssocList = [(Idx, Instance)]
- type List = Container Instance
- create :: String -> Int -> Int -> [Disk] -> Int -> InstanceStatus -> [String] -> Bool -> Ndx -> Ndx -> DiskTemplate -> Int -> [Nic] -> Bool -> Instance
- isRunning :: Instance -> Bool
- isOffline :: Instance -> Bool
- notOffline :: Instance -> Bool
- instanceDown :: Instance -> Bool
- usesSecMem :: Instance -> Bool
- applyIfOnline :: Instance -> (a -> a) -> a -> a
- setIdx :: Instance -> Idx -> Instance
- setName :: Instance -> String -> Instance
- setAlias :: Instance -> String -> Instance
- setPri :: Instance -> Ndx -> Instance
- setSec :: Instance -> Ndx -> Instance
- setBoth :: Instance -> Ndx -> Ndx -> Instance
- setMovable :: Instance -> Bool -> Instance
- specOf :: Instance -> RSpec
- getTotalSpindles :: Instance -> Maybe Int
- instBelowISpec :: Instance -> ISpec -> Bool -> OpResult ()
- instAboveISpec :: Instance -> ISpec -> Bool -> OpResult ()
- instMatchesPolicy :: Instance -> IPolicy -> Bool -> OpResult ()
- shrinkByType :: Instance -> FailMode -> Result Instance
- localStorageTemplates :: [DiskTemplate]
- hasSecondary :: Instance -> Bool
- requiredNodes :: DiskTemplate -> Int
- allNodes :: Instance -> [Ndx]
- usesLocalStorage :: Instance -> Bool
- mirrorType :: Instance -> MirrorType
- usesMemory :: Instance -> Bool
Documentation
The instance type.
Constructors
Instance | |
Fields
|
Constructors
Disk | |
Fields
|
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).
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
Changes the index.
This is used only during the building of the data structures.
Changes the name.
This is used only during the building of the data structures.
Changes the alias.
This is used only during the building of the data structures.
Changes the primary node of the instance.
Arguments
:: Instance | the original instance |
-> Ndx | the new secondary node |
-> Instance | the modified instance |
Changes the secondary node of the instance.
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.
Sets the movable flag on 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.
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.