Skip to content
Snippets Groups Projects
Commit a5f8dcdc authored by Iustin Pop's avatar Iustin Pop
Browse files

hbal: ignore unknown instance in dynload file

Since the utilisation file might be generated at a different time from
the hbal run, and instances could dissapear in the meantime, it's better
to simply ignore unknown instances rather than abort.
parent 4bfe220e
No related branches found
No related tags found
Loading
...@@ -37,7 +37,6 @@ module Ganeti.HTools.Loader ...@@ -37,7 +37,6 @@ module Ganeti.HTools.Loader
, Request(..) , Request(..)
) where ) where
import Control.Monad (foldM)
import Data.Function (on) import Data.Function (on)
import Data.List import Data.List
import Data.Maybe (fromJust) import Data.Maybe (fromJust)
...@@ -138,11 +137,13 @@ mergeData :: [(String, DynUtil)] -- ^ Instance utilisation data ...@@ -138,11 +137,13 @@ mergeData :: [(String, DynUtil)] -- ^ Instance utilisation data
-> Result (Node.List, Instance.List, String) -> Result (Node.List, Instance.List, String)
mergeData um (nl, il) = do mergeData um (nl, il) = do
let il2 = Container.fromAssocList il let il2 = Container.fromAssocList il
il3 <- foldM (\im (name, n_util) -> do il3 = foldl' (\im (name, n_util) ->
inst <- Container.findByName im name case Container.findByName im name of
let new_i = inst { Instance.util = n_util } Nothing -> im -- skipping unknown instance
return $ Container.add (Instance.idx inst) new_i im Just inst ->
) il2 um let new_i = inst { Instance.util = n_util }
in Container.add (Instance.idx inst) new_i im
) il2 um
let nl2 = foldl' fixNodes nl (Container.elems il3) let nl2 = foldl' fixNodes nl (Container.elems il3)
let nl3 = Container.fromAssocList let nl3 = Container.fromAssocList
(map (\ (k, v) -> (k, Node.buildPeers v il3)) nl2) (map (\ (k, v) -> (k, Node.buildPeers v il3)) nl2)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment