Hi! On Tue, Oct 7, 2014 at 4:52 PM, 'Klaus Aehlig' via ganeti-devel < ganeti-devel@googlegroups.com> wrote:
> Start a new module for htools-related tag interpretation and > move the definition of exclusion tags there. This module will > contain all the tags and tag-prefixes that have a special > meaning to htools, so that they can be found at a single place. > > Signed-off-by: Klaus Aehlig <aeh...@google.com> > --- > Makefile.am | 1 + > src/Ganeti/HTools/Loader.hs | 9 ++------- > src/Ganeti/HTools/Tags.hs | 46 > +++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 49 insertions(+), 7 deletions(-) > create mode 100644 src/Ganeti/HTools/Tags.hs > > diff --git a/Makefile.am b/Makefile.am > index 5d09c33..1f41f7a 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -847,6 +847,7 @@ HS_LIB_SRCS = \ > src/Ganeti/HTools/Program/Hsqueeze.hs \ > src/Ganeti/HTools/Program/Hroller.hs \ > src/Ganeti/HTools/Program/Main.hs \ > + src/Ganeti/HTools/Tags.hs \ > src/Ganeti/HTools/Types.hs \ > src/Ganeti/Hypervisor/Xen.hs \ > src/Ganeti/Hypervisor/Xen/XmParser.hs \ > diff --git a/src/Ganeti/HTools/Loader.hs b/src/Ganeti/HTools/Loader.hs > index 4fc2dff..3db7381 100644 > --- a/src/Ganeti/HTools/Loader.hs > +++ b/src/Ganeti/HTools/Loader.hs > @@ -69,16 +69,11 @@ 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 > import Ganeti.Types (EvacMode) > > --- * Constants > - > --- | The exclusion tag prefix. > -exTagsPrefix :: String > -exTagsPrefix = "htools:iextags:" > - > -- * Types > > {-| The iallocator request type. > @@ -256,7 +251,7 @@ longestDomain (x:xs) = > > -- | Extracts the exclusion tags from the cluster configuration. > extractExTags :: [String] -> [String] > -extractExTags = filter (not . null) . mapMaybe (chompPrefix exTagsPrefix) > +extractExTags = filter (not . null) . mapMaybe (chompPrefix > Tags.exTagsPrefix) > > -- | Extracts the common suffix from node\/instance names. > commonSuffix :: Node.List -> Instance.List -> String > diff --git a/src/Ganeti/HTools/Tags.hs b/src/Ganeti/HTools/Tags.hs > new file mode 100644 > index 0000000..b9b252d > --- /dev/null > +++ b/src/Ganeti/HTools/Tags.hs > @@ -0,0 +1,46 @@ > +{-| Tags > + > +This module holds all the tag interpretation done by htools. > + > +-} > + > +{- > + > +Copyright (C) 2014 Google Inc. > +All rights reserved. > + > +Redistribution and use in source and binary forms, with or without > +modification, are permitted provided that the following conditions are > +met: > + > +1. Redistributions of source code must retain the above copyright notice, > +this list of conditions and the following disclaimer. > + > +2. Redistributions in binary form must reproduce the above copyright > +notice, this list of conditions and the following disclaimer in the > +documentation and/or other materials provided with the distribution. > + > +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS > +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED > +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR > +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR > +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, > +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, > +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR > +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF > +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING > +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS > +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + > +-} > + > +module Ganeti.HTools.Tags > + ( exTagsPrefix > + ) where > + > +-- * Constants > + > +-- | The exclusion tag prefix. > +exTagsPrefix :: String > +exTagsPrefix = "htools:iextags:" > + > I suggest adding another sentence that shortly explains what exclusion tags are for. Rest LGTM, no need to resend. > -- > 2.1.0.rc2.206.gedb03e5 > > -- 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