Commit 15752d81 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Make hspace support --independent-groups



If this option is given, relax the check for a previous
not N+1 happy cluster to ignore the affected group, but
still consider allocations in other groups.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parent b1c0c535
......@@ -32,6 +32,7 @@ module Ganeti.HTools.Program.Hspace
import Control.Monad
import Data.Char (toUpper, toLower)
import Data.Function (on)
import qualified Data.IntMap as IntMap
import Data.List
import Data.Maybe (fromMaybe)
import Data.Ord (comparing)
......@@ -41,6 +42,7 @@ import Text.Printf (printf, hPrintf)
import qualified Ganeti.HTools.Container as Container
import qualified Ganeti.HTools.Cluster as Cluster
import qualified Ganeti.HTools.Group as Group
import qualified Ganeti.HTools.Node as Node
import qualified Ganeti.HTools.Instance as Instance
......@@ -67,6 +69,7 @@ options = do
, oIAllocSrc
, oVerbose
, oQuiet
, oIndependentGroups
, oOfflineNode
, oMachineReadable
, oMaxCpu
......@@ -447,6 +450,7 @@ main opts args = do
let verbose = optVerbose opts
machine_r = optMachineReadable opts
independent_grps = optIndependentGroups opts
orig_cdata@(ClusterData gl fixed_nl il _ ipol) <- loadExternalData opts
nl <- setNodeStatus opts fixed_nl
......@@ -477,15 +481,20 @@ main opts args = do
printCluster machine_r (Cluster.totalResources nl) (length all_nodes)
(Node.haveExclStorage nl)
let stop_allocation = case Cluster.computeBadItems nl il of
([], _) -> Nothing
let (bad_nodes, _) = Cluster.computeBadItems nl il
gl' = foldl (flip $ IntMap.adjust Group.setUnallocable) gl
$ map Node.group bad_nodes
grps_remaining = any Group.isAllocable $ IntMap.elems gl'
stop_allocation = case () of
_ | independent_grps && grps_remaining -> Nothing
_ | null bad_nodes -> Nothing
_ -> Just ([(FailN1, 1)]::FailStats, nl, il, [], [])
alloclimit = if optMaxLength opts == -1
then Nothing
else Just (optMaxLength opts)
allocnodes <- exitIfBad "failure during allocation" $
Cluster.genAllocNodes gl nl req_nodes True
Cluster.genAllocNodes gl' nl req_nodes True
when (verbose > 3)
. hPrintf stderr "Allocatable nodes: %s\n" $ show allocnodes
......
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