Commit a5f87855 authored by Klaus Aehlig's avatar Klaus Aehlig

Make genInstanceMaybeBiggerThanNode honor policy lower bound

Note that in all current calls to this function, the node has the
nullIPolicy, to the semantics does not change here.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parent 20a812b8
......@@ -48,6 +48,7 @@ import Control.Applicative ((<$>))
import Control.Monad (liftM)
import Test.QuickCheck hiding (Result)
import Test.Ganeti.TestHTools (nullISpec)
import Test.Ganeti.TestHelper
import Test.Ganeti.TestCommon
import Test.Ganeti.HTools.Types ()
......@@ -98,12 +99,20 @@ genInstanceSmallerThanNode node =
else Nothing)
-- | Generates an instance possibly bigger than a node.
-- In any case, that instance will be bigger than the node's ipolicy's lower
-- bound.
genInstanceMaybeBiggerThanNode :: Node.Node -> Gen Instance.Instance
genInstanceMaybeBiggerThanNode node =
genInstanceSmallerThan (Node.availMem node + Types.unitMem * 2)
(Node.availDisk node + Types.unitDsk * 3)
(Node.availCpu node + Types.unitCpu * 4)
(if Node.exclStorage node
let minISpec = runListHead nullISpec Types.minMaxISpecsMinSpec
. Types.iPolicyMinMaxISpecs $ Node.iPolicy node
in genInstanceWithin (Types.iSpecMemorySize minISpec)
(Types.iSpecDiskSize minISpec)
(Types.iSpecCpuCount minISpec)
(Types.iSpecSpindleUse minISpec)
(Node.availMem node + Types.unitMem * 2)
(Node.availDisk node + Types.unitDsk * 3)
(Node.availCpu node + Types.unitCpu * 4)
(if Node.exclStorage node
then Just $ Node.fSpindles node +
Types.unitSpindle * 5
else Nothing)
......
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