Safe Haskell | Safe-Infered |
---|
- data Disk = Disk {
- dskSize :: Int
- dskSpindles :: Maybe Int
- 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]
- locationScore :: Int
- arPolicy :: AutoRepairPolicy
- nics :: [Nic]
- forthcoming :: Bool
- isRunning :: Instance -> Bool
- isOffline :: Instance -> Bool
- notOffline :: Instance -> Bool
- instanceDown :: Instance -> Bool
- applyIfOnline :: Instance -> (a -> a) -> a -> a
- usesSecMem :: Instance -> Bool
- localStorageTemplates :: [DiskTemplate]
- movableDiskTemplates :: [DiskTemplate]
- type AssocList = [(Idx, Instance)]
- type List = Container Instance
- create :: String -> Int -> Int -> [Disk] -> Int -> InstanceStatus -> [String] -> Bool -> Ndx -> Ndx -> DiskTemplate -> Int -> [Nic] -> Bool -> Instance
- 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
- shrinkByType :: Instance -> FailMode -> Result Instance
- getTotalSpindles :: Instance -> Maybe Int
- specOf :: Instance -> RSpec
- instCompareISpec :: Ordering -> Instance -> ISpec -> Bool -> OpResult ()
- instBelowISpec :: Instance -> ISpec -> Bool -> OpResult ()
- instAboveISpec :: Instance -> ISpec -> Bool -> OpResult ()
- instMatchesMinMaxSpecs :: Instance -> MinMaxISpecs -> Bool -> OpResult ()
- instMatchesSpecs :: Instance -> [MinMaxISpecs] -> Bool -> OpResult ()
- instMatchesPolicy :: Instance -> IPolicy -> Bool -> OpResult ()
- hasSecondary :: Instance -> Bool
- requiredNodes :: DiskTemplate -> Int
- allNodes :: Instance -> [Ndx]
- usesLocalStorage :: Instance -> Bool
- supportsMoves :: DiskTemplate -> Bool
- mirrorType :: Instance -> MirrorType
- usesMemory :: Instance -> Bool
Type declarations
Disk | |
|
The instance type.
Instance | |
|
notOffline :: Instance -> BoolSource
Helper to check if the instance is not offline.
instanceDown :: Instance -> BoolSource
Check if instance is down.
applyIfOnline :: Instance -> (a -> a) -> a -> aSource
Apply the function if the instance is online. Otherwise use the initial value
usesSecMem :: Instance -> BoolSource
Helper for determining whether an instance's memory needs to be taken into account for secondary memory reservation.
localStorageTemplates :: [DiskTemplate]Source
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.
Initialization
create :: String -> Int -> Int -> [Disk] -> Int -> InstanceStatus -> [String] -> Bool -> Ndx -> Ndx -> DiskTemplate -> Int -> [Nic] -> Bool -> InstanceSource
Create an instance.
Some parameters are not initialized by function, and must be set
later (via setIdx
for example).
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.
Update functions
Changes the primary node of the instance.
Changes the secondary node of the instance.
:: 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.
shrinkByType :: Instance -> FailMode -> Result InstanceSource
Try to shrink the instance based on the reason why we can't allocate it.
getTotalSpindles :: Instance -> Maybe IntSource
Get the number of disk spindles
instCompareISpec :: Ordering -> Instance -> ISpec -> Bool -> OpResult ()Source
instBelowISpec :: Instance -> ISpec -> Bool -> OpResult ()Source
Checks if an instance is smaller than a given spec.
instAboveISpec :: Instance -> ISpec -> Bool -> OpResult ()Source
Checks if an instance is bigger than a given spec.
instMatchesMinMaxSpecs :: Instance -> MinMaxISpecs -> Bool -> OpResult ()Source
instMatchesSpecs :: Instance -> [MinMaxISpecs] -> Bool -> OpResult ()Source
instMatchesPolicy :: Instance -> IPolicy -> Bool -> OpResult ()Source
Checks if an instance matches a policy.
hasSecondary :: Instance -> BoolSource
Checks whether the instance uses a secondary node.
Note: This should be reconciled with
.
sNode
==
noSecondary
requiredNodes :: DiskTemplate -> IntSource
Computed the number of nodes for a given disk template.
usesLocalStorage :: Instance -> BoolSource
Checks whether a given disk template uses local storage.
supportsMoves :: DiskTemplate -> BoolSource
mirrorType :: Instance -> MirrorTypeSource
A simple wrapper over templateMirrorType
.
usesMemory :: Instance -> BoolSource
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.