diff --git a/htools/Ganeti/HTools/QC.hs b/htools/Ganeti/HTools/QC.hs index 74ab160d1a74f1aa5f39f5340a406adb139e2ae8..c90b63686550d3ccf5d8599a3aa0f403f1477cc6 100644 --- a/htools/Ganeti/HTools/QC.hs +++ b/htools/Ganeti/HTools/QC.hs @@ -990,15 +990,20 @@ prop_Node_addPriFM node inst = inst' = setInstanceSmallerThanNode node inst inst'' = inst' { Instance.mem = Instance.mem inst } +-- | Check that adding a primary instance with too much disk fails +-- with type FailDisk. prop_Node_addPriFD node inst = + forAll (elements Instance.localStorageTemplates) $ \dt -> Instance.dsk inst >= Node.fDsk node && not (Node.failN1 node) ==> - case Node.addPri node inst'' of - Types.OpFail Types.FailDisk -> True - _ -> False - where _types = (node::Node.Node, inst::Instance.Instance) - inst' = setInstanceSmallerThanNode node inst - inst'' = inst' { Instance.dsk = Instance.dsk inst } + let inst' = setInstanceSmallerThanNode node inst + inst'' = inst' { Instance.dsk = Instance.dsk inst + , Instance.diskTemplate = dt } + in case Node.addPri node inst'' of + Types.OpFail Types.FailDisk -> True + _ -> False +-- | Check that adding a primary instance with too many VCPUs fails +-- with type FailCPU. prop_Node_addPriFC = forAll (choose (1, maxCpu)) $ \extra -> forAll genOnlineNode $ \node ->