Safe Haskell | Safe-Infered |
---|
Implementation of the auto-repair logic for Ganeti.
- data InstanceData = InstanceData {
- arInstance :: Instance
- arState :: AutoRepairStatus
- tagsToRemove :: [String]
- parseInitTag :: String -> Maybe AutoRepairData
- getArData :: AutoRepairStatus -> Maybe AutoRepairData
- arStateName :: AutoRepairStatus -> String
- delCurTag :: InstanceData -> [String]
- setInitialState :: Instance -> Result InstanceData
- arStatusCmp :: InstanceData -> [AutoRepairData] -> Result InstanceData
- updateTag :: AutoRepairData -> AutoRepairData
- detectBroken :: List -> Instance -> Maybe (AutoRepairType, [OpCode])
Documentation
data InstanceData Source
Description of an instance annotated with repair-related information.
InstanceData | |
|
Eq InstanceData | |
Show InstanceData |
parseInitTag :: String -> Maybe AutoRepairDataSource
Parse a tag into an AutoRepairData
record.
Nothing
is returned if the tag is not an auto-repair tag, or if it's
malformed.
getArData :: AutoRepairStatus -> Maybe AutoRepairDataSource
Return the AutoRepairData
element of an AutoRepairStatus
type.
arStateName :: AutoRepairStatus -> StringSource
Return a short name for each auto-repair status.
This is a more concise representation of the status, because the default Show formatting includes all the accompanying auto-repair data.
delCurTag :: InstanceData -> [String]Source
Return a new list of tags to remove that includes arTag
if present.
setInitialState :: Instance -> Result InstanceDataSource
Set the initial auto-repair state of an instance from its auto-repair tags.
The rules when there are multiple tags is:
- the earliest failure result always wins
- two or more pending repairs results in a fatal error
- a pending result from id X and a success result from id Y result in error if Y is newer than X
- if there are no pending repairs, the newest success result wins, otherwise the pending result is used.
arStatusCmp :: InstanceData -> [AutoRepairData] -> Result InstanceDataSource
Update the initial status of an instance with new repair task tags.
This function gets called once per repair group in an instance's tag, and it
determines whether to set the status of the instance according to this new
group, or to keep the existing state. See the documentation for
setInitialState
for the rules to be followed when determining this.
updateTag :: AutoRepairData -> AutoRepairDataSource
Update the tag of an AutoRepairData
record to match all the other fields.
detectBroken :: List -> Instance -> Maybe (AutoRepairType, [OpCode])Source
Detect brokenness with an instance and suggest repair type and jobs to run.