On Wed, Dec 12, 2012 at 09:13:30PM +0000, Dato Simó wrote:
> AutoRepairPolicy, AutoRepairStatus, and other auxiliary types are added.
> These are used only internally by the auto-repair tool, and parsed from the
> various object tags as defined in the design doc.
>
> Signed-off-by: Dato Simó <[email protected]>
> ---
> htools/Ganeti/HTools/Types.hs | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/htools/Ganeti/HTools/Types.hs b/htools/Ganeti/HTools/Types.hs
> index 9c6f680..d097ca3 100644
> --- a/htools/Ganeti/HTools/Types.hs
> +++ b/htools/Ganeti/HTools/Types.hs
> @@ -78,9 +78,14 @@ module Ganeti.HTools.Types
> , AutoRepairResult(..)
> , autoRepairResultToRaw
> , autoRepairResultFromRaw
> + , AutoRepairPolicy(..)
> + , AutoRepairSuspendTime(..)
> + , AutoRepairData(..)
> + , AutoRepairStatus(..)
> ) where
>
> import qualified Data.Map as M
> +import System.Time (ClockTime)
>
> import qualified Ganeti.Constants as C
> import qualified Ganeti.THH as THH
> @@ -368,3 +373,29 @@ $(THH.declareSADT "AutoRepairResult"
> , ("ArFailure", 'C.autoRepairFailure)
> , ("ArEnoperm", 'C.autoRepairEnoperm)
> ])
> +
> +-- | The possible auto-repair policy for a given instance.
> +data AutoRepairPolicy = ArEnabled AutoRepairType
> + | ArSuspended AutoRepairSuspendTime
> + | ArNotEnabled
> + deriving (Eq, Show)
Kindly ask you to add constructor docstrings, even if the names are quit
straightforward.
> +-- | The suspend timeout for 'ArSuspended'.
> +data AutoRepairSuspendTime = Forever
> + | Until ClockTime
> + deriving (Eq, Show)
> +
> +-- | The possible auto-repair states for any given instance.
> +data AutoRepairStatus = ArHealthy
> + | ArNeedsRepair AutoRepairData
> + | ArPendingRepair AutoRepairData
> + | ArFailedRepair AutoRepairData
> +
> +-- | The data accompanying a repair operation (future, pending, or failed).
> +data AutoRepairData = AutoRepairData { arType :: AutoRepairType
> + , arUuid :: String
> + , arTime :: ClockTime
> + , arJobs :: [JobId]
> + , arResult :: Maybe AutoRepairResult
> + }
Rest LGTM.
iustin