Revision e5cb098c

b/htools/Ganeti/Config.hs
36 36
    , getInstance
37 37
    , getGroup
38 38
    , getGroupNdParams
39
    , getGroupIpolicy
40
    , getGroupNodes
41
    , getGroupInstances
39 42
    , getGroupOfNode
40 43
    , getInstPrimaryNode
41 44
    , getInstMinorsForNode
......
168 171
getGroupNdParams cfg ng =
169 172
  fillNDParams (clusterNdparams $ configCluster cfg) (groupNdparams ng)
170 173

  
174
-- | Computes a node group's ipolicy.
175
getGroupIpolicy :: ConfigData -> NodeGroup -> FilledIPolicy
176
getGroupIpolicy cfg ng =
177
  fillIPolicy (clusterIpolicy $ configCluster cfg) (groupIpolicy ng)
178

  
179
-- | Get nodes of a given node group.
180
getGroupNodes :: ConfigData -> String -> [Node]
181
getGroupNodes cfg gname =
182
  let all_nodes = M.elems . fromContainer . configNodes $ cfg in
183
  filter ((==gname) . nodeGroup) all_nodes
184

  
185
-- | Get (primary, secondary) instances of a given node group.
186
getGroupInstances :: ConfigData -> String -> ([Instance], [Instance])
187
getGroupInstances cfg gname =
188
  let gnodes = map nodeName (getGroupNodes cfg gname)
189
      ginsts = map (getNodeInstances cfg) gnodes in
190
  (concatMap fst ginsts, concatMap snd ginsts)
191

  
171 192
-- | Looks up an instance's primary node.
172 193
getInstPrimaryNode :: ConfigData -> String -> Result Node
173 194
getInstPrimaryNode cfg name =

Also available in: Unified diff