Revision f5e67f55

b/Ganeti/HTools/Loader.hs
48 48

  
49 49
import Ganeti.HTools.Types
50 50

  
51
-- * Constants
52

  
53
-- | The exclusion tag prefix
54
exTagsPrefix :: String
55
exTagsPrefix = "htools:iextags:"
56

  
51 57
-- * Types
52 58

  
53 59
{-| The request type.
......
136 142
stripSuffix :: Int -> String -> String
137 143
stripSuffix sflen name = take (length name - sflen) name
138 144

  
145
-- | Extracts the exclusion tags from the cluster configuration
146
extractExTags :: [String] -> [String]
147
extractExTags =
148
    map (drop (length exTagsPrefix)) .
149
    filter (isPrefixOf exTagsPrefix)
150

  
139 151
-- | Initializer function that loads the data from a node and instance
140 152
-- list and massages it into the correct format.
141 153
mergeData :: [(String, DynUtil)]  -- ^ Instance utilisation data
......
152 164
                              let new_i = inst { Instance.util = n_util }
153 165
                              in Container.add (Instance.idx inst) new_i im
154 166
                   ) il2 um
155
      il4 = Container.map (filterExTags extags) il3
167
      allextags = extags ++ extractExTags tags
168
      il4 = Container.map (filterExTags allextags) il3
156 169
      nl2 = foldl' fixNodes nl (Container.elems il4)
157 170
      nl3 = Container.fromAssocList
158 171
            (map (\ (k, v) -> (k, Node.buildPeers v il4)) nl2)

Also available in: Unified diff