Commit f9e7e331 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

In tiered allocation, cut non-promising shrinking tries

The heuristics for tiered allocation has been improved in that it
chooses to shrink such a resource next where by shrinking only this
resource a valid allocation can be made, if such a resource exists.
In order to decide whether such a resource exists, all potential
sizes of this resource are verified. We can improve performance by
cutting, as soon a potential allocation of an instance is no longer
blocked on this resource.
Signed-off-by: default avatarKlaus Aehlig <>
Reviewed-by: default avatarGuido Trotter <>
parent b22106d7
......@@ -76,6 +76,7 @@ module Ganeti.HTools.Cluster
, splitCluster
) where
import Control.Applicative (liftA2)
import qualified Data.IntSet as IntSet
import Data.List
import Data.Maybe (fromJust, fromMaybe, isJust, isNothing)
......@@ -1283,8 +1284,12 @@ iterateAlloc nl il limit newinst allocnodes ixes cstats =
-- allocation.
sufficesShrinking :: (Instance.Instance -> AllocSolution) -> Instance.Instance
-> FailMode -> Bool
sufficesShrinking allocFn inst fm = any isJust . map (asSolution . allocFn) $
iterateOk (`Instance.shrinkByType` fm) inst
sufficesShrinking allocFn inst fm =
any isJust
. map asSolution
. takeWhile (liftA2 (||) (elem fm . asFailures) (isJust . asSolution))
. map allocFn $
iterateOk (`Instance.shrinkByType` fm) inst
-- | Tiered allocation method.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment