Hi!

On Tue, Oct 7, 2014 at 4:53 PM, 'Klaus Aehlig' via ganeti-devel <
ganeti-devel@googlegroups.com> wrote:

> These tags are only used by the htools, hence group them
> together with the other htools-controlling tags.
>
> Signed-off-by: Klaus Aehlig <aeh...@google.com>
> ---
>  src/Ganeti/Constants.hs            | 20 +++-----------------
>  src/Ganeti/HTools/Loader.hs        |  5 ++---
>  src/Ganeti/HTools/Program/Harep.hs |  9 +++++----
>  src/Ganeti/HTools/Tags.hs          | 21 +++++++++++++++++++++
>  4 files changed, 31 insertions(+), 24 deletions(-)
>
> diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs
> index a02a81b..3709b2d 100644
> --- a/src/Ganeti/Constants.hs
> +++ b/src/Ganeti/Constants.hs
> @@ -54,8 +54,8 @@ import qualified AutoConf
>  import Ganeti.ConstantUtils (PythonChar(..), FrozenSet, Protocol(..),
>                               buildVersion)
>  import qualified Ganeti.ConstantUtils as ConstantUtils
> -import Ganeti.HTools.Types (AutoRepairResult(..), AutoRepairType(..))
>  import qualified Ganeti.HTools.Types as Types
> +import Ganeti.HTools.Types (AutoRepairResult(..), AutoRepairType(..))
>  import Ganeti.Logging (SyslogUsage(..))
>  import qualified Ganeti.Logging as Logging (syslogUsageToRaw)
>  import qualified Ganeti.Runtime as Runtime
> @@ -4658,22 +4658,6 @@ opcodeReasonSources =
>  randomUuidFile :: String
>  randomUuidFile = ConstantUtils.randomUuidFile
>
> --- * Auto-repair tag prefixes
> -
> -autoRepairTagPrefix :: String
> -autoRepairTagPrefix = "ganeti:watcher:autorepair:"
> -
> -autoRepairTagEnabled :: String
> -autoRepairTagEnabled = autoRepairTagPrefix
> -
> -autoRepairTagPending :: String
> -autoRepairTagPending = autoRepairTagPrefix ++ "pending:"
> -
> -autoRepairTagResult :: String
> -autoRepairTagResult = autoRepairTagPrefix ++ "result:"
> -
> -autoRepairTagSuspended :: String
> -autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:"
>
>  -- * Auto-repair levels
>
> @@ -4711,6 +4695,8 @@ autoRepairAllResults :: FrozenSet String
>  autoRepairAllResults =
>    ConstantUtils.mkSet [autoRepairEnoperm, autoRepairFailure,
> autoRepairSuccess]
>
> +
> +
>  -- | The version identifier for builtin data collectors
>  builtinDataCollectorVersion :: String
>  builtinDataCollectorVersion = "B"
> diff --git a/src/Ganeti/HTools/Loader.hs b/src/Ganeti/HTools/Loader.hs
> index 3db7381..bd5e42f 100644
> --- a/src/Ganeti/HTools/Loader.hs
> +++ b/src/Ganeti/HTools/Loader.hs
> @@ -68,7 +68,6 @@ import qualified Ganeti.HTools.Group as Group
>  import qualified Ganeti.HTools.Cluster as Cluster
>
>  import Ganeti.BasicTypes
> -import qualified Ganeti.Constants as C
>  import qualified Ganeti.HTools.Tags as Tags
>  import Ganeti.HTools.Types
>  import Ganeti.Utils
> @@ -225,8 +224,8 @@ setArPolicy ctags gl nl il time =
>  getArPolicy :: [String] -> ClockTime -> Maybe AutoRepairPolicy
>  getArPolicy tags time =
>    let enabled = mapMaybe (autoRepairTypeFromRaw <=<
> -                          chompPrefix C.autoRepairTagEnabled) tags
> -      suspended = mapMaybe (chompPrefix C.autoRepairTagSuspended) tags
> +                          chompPrefix Tags.autoRepairTagEnabled) tags
> +      suspended = mapMaybe (chompPrefix Tags.autoRepairTagSuspended) tags
>        futureTs = filter (> time) . map (flip TOD 0) $
>                     mapMaybe (tryRead "auto-repair suspend time") suspended
>    in
> diff --git a/src/Ganeti/HTools/Program/Harep.hs
> b/src/Ganeti/HTools/Program/Harep.hs
> index 84588ab..ee2299d 100644
> --- a/src/Ganeti/HTools/Program/Harep.hs
> +++ b/src/Ganeti/HTools/Program/Harep.hs
> @@ -63,6 +63,7 @@ import qualified Ganeti.Path as Path
>  import Ganeti.HTools.CLI
>  import Ganeti.HTools.Loader
>  import Ganeti.HTools.ExtLoader
> +import qualified Ganeti.HTools.Tags as Tags
>  import Ganeti.HTools.Types
>  import qualified Ganeti.HTools.Container as Container
>  import qualified Ganeti.HTools.Instance as Instance
> @@ -93,13 +94,13 @@ data InstanceData = InstanceData { arInstance ::
> Instance.Instance
>  parseInitTag :: String -> Maybe AutoRepairData
>  parseInitTag tag =
>    let parsePending = do
> -        subtag <- chompPrefix C.autoRepairTagPending tag
> +        subtag <- chompPrefix Tags.autoRepairTagPending tag
>          case sepSplit ':' subtag of
>            [rtype, uuid, ts, jobs] -> makeArData rtype uuid ts jobs
>            _                       -> fail ("Invalid tag: " ++ show tag)
>
>        parseResult = do
> -        subtag <- chompPrefix C.autoRepairTagResult tag
> +        subtag <- chompPrefix Tags.autoRepairTagResult tag
>          case sepSplit ':' subtag of
>            [rtype, uuid, ts, result, jobs] -> do
>              arData <- makeArData rtype uuid ts jobs
> @@ -252,8 +253,8 @@ updateTag arData =
>        end = [intercalate "+" . map (show . fromJobId) $ arJobs arData]
>        (pfx, middle) =
>           case arResult arData of
> -          Nothing -> (C.autoRepairTagPending, [])
> -          Just rs -> (C.autoRepairTagResult, [autoRepairResultToRaw rs])
> +          Nothing -> (Tags.autoRepairTagPending, [])
> +          Just rs -> (Tags.autoRepairTagResult, [autoRepairResultToRaw
> rs])
>    in
>     arData { arTag = pfx ++ intercalate ":" (ini ++ middle ++ end) }
>
> diff --git a/src/Ganeti/HTools/Tags.hs b/src/Ganeti/HTools/Tags.hs
> index 263ba73..ae09bbc 100644
> --- a/src/Ganeti/HTools/Tags.hs
> +++ b/src/Ganeti/HTools/Tags.hs
> @@ -38,6 +38,11 @@ module Ganeti.HTools.Tags
>    ( exTagsPrefix
>    , standbyAuto
>    , hasStandbyTag
> +  , autoRepairTagPrefix
> +  , autoRepairTagEnabled
> +  , autoRepairTagPending
> +  , autoRepairTagResult
> +  , autoRepairTagSuspended
>    ) where
>
>  import Data.List (isPrefixOf)
> @@ -59,6 +64,22 @@ standbyPrefix = "htools:standby:"
>  standbyAuto :: String
>  standbyAuto = "htools:standby:auto"
>
> +-- | Auto-repair tag prefix
> +autoRepairTagPrefix :: String
> +autoRepairTagPrefix = "ganeti:watcher:autorepair:"
> +
> +autoRepairTagEnabled :: String
> +autoRepairTagEnabled = autoRepairTagPrefix
> +
> +autoRepairTagPending :: String
> +autoRepairTagPending = autoRepairTagPrefix ++ "pending:"
> +
> +autoRepairTagResult :: String
> +autoRepairTagResult = autoRepairTagPrefix ++ "result:"
> +
> +autoRepairTagSuspended :: String
> +autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:"
> +
>  -- * Predicates
>
>  -- | Predicate of having a standby tag.
> --
> 2.1.0.rc2.206.gedb03e5
>
>
LGTM, thanks

-- 
Helga Velroyen | Software Engineer | hel...@google.com |

Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to