On Wed, Mar 07, 2012 at 03:08:43PM +0000, Guido Trotter wrote:
> On Tue, Mar 6, 2012 at 11:59 PM, Iustin Pop <[email protected]> wrote:
> > Currently, this test assumes localStorageTemplates, so let's make sure
> > we enforce that on the given instance
> > ---
> > htools/Ganeti/HTools/QC.hs | 13 +++++++------
> > 1 files changed, 7 insertions(+), 6 deletions(-)
> >
> > diff --git a/htools/Ganeti/HTools/QC.hs b/htools/Ganeti/HTools/QC.hs
> > index 8c52a34..b37fe4d 100644
> > --- a/htools/Ganeti/HTools/QC.hs
> > +++ b/htools/Ganeti/HTools/QC.hs
> > @@ -968,13 +968,14 @@ prop_Node_addPriFM node inst =
> > inst'' = inst' { Instance.mem = Instance.mem inst }
> >
> > prop_Node_addPriFD node inst =
>
> addwhat? :) Can you at least add a comment explaining this name?
>
> > + 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
> >
> > prop_Node_addPriFC =
>
> Same for this one, while you're at it! :)
Heh, sure, but note that these were old functions :)
Interdiff:
diff --git a/htools/Ganeti/HTools/QC.hs b/htools/Ganeti/HTools/QC.hs
index f621f0a..f2cfc34 100644
--- a/htools/Ganeti/HTools/QC.hs
+++ b/htools/Ganeti/HTools/QC.hs
@@ -977,6 +977,8 @@ 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) ==>
@@ -987,6 +989,8 @@ prop_Node_addPriFD node inst =
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 ->
--
iustin