ganeti
Safe HaskellNone

Ganeti.HTools.Program.Harep

Description

Auto-repair tool for Ganeti.

Synopsis

Documentation

options :: IO [OptType] Source #

Options list and functions.

annotateOpCode :: Maybe String -> Timestamp -> OpCode -> MetaOpCode Source #

Wraps an OpCode in a MetaOpCode while also adding a comment about what generated the opcode.

parseInitTag :: String -> Maybe AutoRepairData Source #

Parse a tag into an AutoRepairData record.

Nothing is returned if the tag is not an auto-repair tag, or if it's malformed.

arStateName :: AutoRepairStatus -> String Source #

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 InstanceData Source #

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 InstanceData Source #

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.

processPending :: Options -> Client -> InstanceData -> IO InstanceData Source #

Query jobs of a pending repair, returning the new instance data.

updateTag :: AutoRepairData -> AutoRepairData Source #

Update the tag of an AutoRepairData record to match all the other fields.

commitChange :: Options -> Client -> InstanceData -> IO InstanceData Source #

Apply and remove tags from an instance as indicated by InstanceData.

If the arState of the InstanceData record has an associated AutoRepairData, add its tag to the instance object. Additionally, if tagsToRemove is not empty, remove those tags from the instance object. The returned InstanceData object always has an empty tagsToRemove.

detectBroken :: List -> Instance -> Maybe (AutoRepairType, [OpCode]) Source #

Detect brokenness with an instance and suggest repair type and jobs to run.

submitJobs' :: Options -> [[MetaOpCode]] -> Client -> IO (Result [JobId]) Source #

Submit jobs, unless a dry-run is requested; in this case, just report the job that would be submitted.

doRepair Source #

Arguments

:: Options 
-> Client

The Luxi client

-> Double

Delay to insert before the first repair opcode

-> InstanceData

The instance data

-> (AutoRepairType, [OpCode])

The repair job to perform

-> IO InstanceData

The updated instance data

Perform the suggested repair on an instance if its policy allows it.

main :: Options -> [String] -> IO () Source #

Main function.