On Thu, Jun 25, 2015 at 10:39:35AM +0200, Klaus Aehlig wrote:
> > [...]
> > * more complex (two instances failover)
> > [...]
>
> > --- /dev/null
> > +++ b/test/data/htools/hbal-desiredlocation-2.data
> > @@ -0,0 +1,10 @@
> > +group-01|fake-uuid-01|preferred||
> > +
> > +node-01|16384|0|15360|409600|255400|16|N|fake-uuid-01|1|power:a
> > +node-02|16384|0|15360|409600|255400|16|N|fake-uuid-01|1|power:b
> > +
> > +inst1|1024|51200|1|running|Y|node-01|node-02|drbd|power:b|1
> > +inst2|1024|51200|1|running|Y|node-02|node-01|drbd|power:a|1
> > +
> > +htools:desiredlocation:power
> > +htools:nlocation:power
>
> > +./test/hs/hbal --print-nodes=name,pcnt -t
> > $TESTDATA_DIR/hbal-desiredlocation-2.data
> > +>>>2/Final cluster status:
> > + Name pcnt
> > + node-01 1
> > + node-02 1/
> > +>>>= 0
>
> You're not testing what you claim to test for. Not doing anything would also
> make this
> test pass. Even worse, I actually do get
>
> $ env HTOOLS=hbal ./src/htools -t test/data/htools/hbal-desiredlocation-2.data
> Warning: cluster has inconsistent data:
> - node node-02 is missing 0 MB ram and 50 GB disk
> - node node-01 is missing 0 MB ram and 50 GB disk
>
> Loaded 2 nodes, 2 instances
> Group size 2 nodes, 2 instances
> Selected node group: group-01
> Initial check done: 0 bad nodes, 0 bad instances.
> Initial score: 2.03125000
> Trying to minimize the CV...
> No solution found
> Solution length=0
> $
Note that this is even working as inteded: if we asume "full" dynmic load
(which is the default), the intermediate situation is too unattractive to
go through (score 4.31030273). Compare this behavior with
$ env HTOOLS=hbal ./src/htools -t test/data/htools/hbal-desiredlocation-2.data
--ignore-dynu
Warning: cluster has inconsistent data:
- node node-02 is missing 0 MB ram and 50 GB disk
- node node-01 is missing 0 MB ram and 50 GB disk
Loaded 2 nodes, 2 instances
Group size 2 nodes, 2 instances
Selected node group: group-01
Initial check done: 0 bad nodes, 0 bad instances.
Initial score: 2.03125000
Trying to minimize the CV...
1. inst1 node-01:node-02 => node-02:node-01 1.21875000 a=f
2. inst2 node-02:node-01 => node-01:node-02 0.03125000 a=f
Cluster score improved from 2.03125000 to 0.03125000
Solution length=2
$
So please change the test to actually test the property you want to test for.
Thanks,
Klaus
--
Klaus Aehlig
Google Germany GmbH, Dienerstr. 12, 80331 Muenchen
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores