Safe Haskell | None |
---|
Synopsis
- 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]
- dsrdLocTags :: Set 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 -> Bool Source #
Helper to check if the instance is not offline.
instanceDown :: Instance -> Bool Source #
Check if instance is down.
applyIfOnline :: Instance -> (a -> a) -> a -> a Source #
Apply the function if the instance is online. Otherwise use the initial value
usesSecMem :: Instance -> Bool Source #
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.
movableDiskTemplates :: [DiskTemplate] Source #
Constant holding the movable disk templates.
This only determines the initial movable
state of the
instance. Further the movable state can be restricted more due to
user choices, etc.
Initialization
create :: String -> Int -> Int -> [Disk] -> Int -> InstanceStatus -> [String] -> Bool -> Ndx -> Ndx -> DiskTemplate -> Int -> [Nic] -> Bool -> Instance Source #
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 Instance Source #
Try to shrink the instance based on the reason why we can't allocate it.
getTotalSpindles :: Instance -> Maybe Int Source #
Get the number of disk spindles
instCompareISpec :: Ordering -> Instance -> ISpec -> Bool -> OpResult () Source #
Checks if an instance is smaller/bigger than a given spec. Returns OpGood for a correct spec, otherwise Bad one of the possible failure modes.
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 #
Checks if an instance matches a min/max specs pair
instMatchesSpecs :: Instance -> [MinMaxISpecs] -> Bool -> OpResult () Source #
Checks if an instance matches any specs of a policy
instMatchesPolicy :: Instance -> IPolicy -> Bool -> OpResult () Source #
Checks if an instance matches a policy.
hasSecondary :: Instance -> Bool Source #
Checks whether the instance uses a secondary node.
Note: This should be reconciled with
.sNode
==
noSecondary
requiredNodes :: DiskTemplate -> Int Source #
Computed the number of nodes for a given disk template.
usesLocalStorage :: Instance -> Bool Source #
Checks whether a given disk template uses local storage.
supportsMoves :: DiskTemplate -> Bool Source #
Checks whether a given disk template supported moves.
mirrorType :: Instance -> MirrorType Source #
A simple wrapper over templateMirrorType
.
usesMemory :: Instance -> Bool Source #
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.