Revision ce0392e6
b/Ganeti/HTools/Loader.hs | ||
---|---|---|
135 | 135 |
Instance.AssocList) -- ^ Data from either Text.loadData |
136 | 136 |
-- or Rapi.loadData |
137 | 137 |
-> Result (Node.List, Instance.List, String) |
138 |
mergeData um (nl, il) = do
|
|
138 |
mergeData um (nl, il) = |
|
139 | 139 |
let il2 = Container.fromAssocList il |
140 | 140 |
il3 = foldl' (\im (name, n_util) -> |
141 | 141 |
case Container.findByName im name of |
... | ... | |
144 | 144 |
let new_i = inst { Instance.util = n_util } |
145 | 145 |
in Container.add (Instance.idx inst) new_i im |
146 | 146 |
) il2 um |
147 |
let nl2 = foldl' fixNodes nl (Container.elems il3)
|
|
148 |
let nl3 = Container.fromAssocList
|
|
147 |
nl2 = foldl' fixNodes nl (Container.elems il3)
|
|
148 |
nl3 = Container.fromAssocList
|
|
149 | 149 |
(map (\ (k, v) -> (k, Node.buildPeers v il3)) nl2) |
150 |
node_names = map Node.name $ Container.elems nl3
|
|
151 |
inst_names = map Instance.name $ Container.elems il3
|
|
150 |
node_names = map (Node.name . snd) nl
|
|
151 |
inst_names = map (Instance.name . snd) il
|
|
152 | 152 |
common_suffix = longestDomain (node_names ++ inst_names) |
153 | 153 |
csl = length common_suffix |
154 | 154 |
snl = Container.map (\n -> setName n (stripSuffix csl $ nameOf n)) nl3 |
155 | 155 |
sil = Container.map (\i -> setName i (stripSuffix csl $ nameOf i)) il3 |
156 |
return (snl, sil, common_suffix)
|
|
156 |
in Ok (snl, sil, common_suffix)
|
|
157 | 157 |
|
158 | 158 |
-- | Checks the cluster data for consistency. |
159 | 159 |
checkData :: Node.List -> Instance.List |
Also available in: Unified diff