Revision 424ec11d

b/htools/Ganeti/HTools/Loader.hs
288 288
                              in Container.add (Instance.idx inst) new_i im
289 289
                   ) il2 um
290 290
      allextags = extags ++ extractExTags tags
291
      inst_names = map Instance.name il
292
      selinst_lkp = map (lookupName inst_names) selinsts
293
      exinst_lkp = map (lookupName inst_names) exinsts
294
      lkp_unknown = filter (not . goodLookupResult) (selinst_lkp ++ exinst_lkp)
295
      selinst_names = map lrContent selinst_lkp
296
      exinst_names = map lrContent exinst_lkp
291 297
      il4 = Container.map (filterExTags allextags .
292
                           updateMovable selinsts exinsts) il3
298
                           updateMovable selinst_names exinst_names) il3
293 299
      nl2 = foldl' fixNodes nl (Container.elems il4)
294 300
      nl3 = Container.map (flip Node.buildPeers il4) nl2
295 301
      node_names = map Node.name (Container.elems nl)
296
      inst_names = map Instance.name il
297 302
      common_suffix = longestDomain (node_names ++ inst_names)
298 303
      snl = Container.map (computeAlias common_suffix) nl3
299 304
      sil = Container.map (computeAlias common_suffix) il4
300
      all_inst_names = concatMap allNames $ Container.elems sil
301
  in if not $ all (`elem` all_inst_names) exinsts
302
     then Bad $ "Some of the excluded instances are unknown: " ++
303
          show (exinsts \\ all_inst_names)
304
     else if not $ all (`elem` all_inst_names) selinsts
305
          then Bad $ "Some of the selected instances are unknown: " ++
306
               show (selinsts \\ all_inst_names)
307
          else Ok cdata { cdNodes = snl, cdInstances = sil }
305
  in if' (null lkp_unknown)
306
         (Ok cdata { cdNodes = snl, cdInstances = sil })
307
         (Bad $ "Unknown instance(s): " ++ show(map lrContent lkp_unknown))
308 308

  
309 309
-- | Checks the cluster data for consistency.
310 310
checkData :: Node.List -> Instance.List

Also available in: Unified diff