The bug is using incorrect location score during failover and replace action. Thus the idea of the test is to introduce a situation in which it's profitably to perform failover and replace move in order to optimize cluster score (if ignoring location tags). Considering location tags another final placement is optimal.
In this test the optimal placement should locate primary instances to nodes 1 and 3 with secondaries on the second node. Signed-off-by: Oleg Ponomarev <[email protected]> --- Makefile.am | 1 + test/data/htools/hbal-location-2.data | 10 ++++++++++ test/hs/shelltests/htools-hbal.test | 9 ++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 test/data/htools/hbal-location-2.data diff --git a/Makefile.am b/Makefile.am index ea051b5..fa490a3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1668,6 +1668,7 @@ TEST_FILES = \ test/data/htools/hbal-excl-tags.data \ test/data/htools/hbal-forth.data \ test/data/htools/hbal-location-1.data \ + test/data/htools/hbal-location-2.data \ test/data/htools/hbal-migration-1.data \ test/data/htools/hbal-migration-2.data \ test/data/htools/hbal-migration-3.data \ diff --git a/test/data/htools/hbal-location-2.data b/test/data/htools/hbal-location-2.data new file mode 100644 index 0000000..2ac05f6 --- /dev/null +++ b/test/data/htools/hbal-location-2.data @@ -0,0 +1,10 @@ +group-01|fake-uuid-01|preferred|| + +node-01|16384|0|15360|409600|306600|16|N|fake-uuid-01|1|power:a,power:c +node-02|2048|0|1024|109600|6600|16|N|fake-uuid-01|1|power:b +node-03|2048|0|2048|409600|409600|16|N|fake-uuid-01|1|power:a,power:c + +inst1|1024|51200|1|running|Y|node-01|node-02|drbd||1 +inst2|1024|51200|1|running|Y|node-02|node-01|drbd||1 + +htools:nlocation:power diff --git a/test/hs/shelltests/htools-hbal.test b/test/hs/shelltests/htools-hbal.test index 4ebe30c..dbbb0d4 100644 --- a/test/hs/shelltests/htools-hbal.test +++ b/test/hs/shelltests/htools-hbal.test @@ -25,7 +25,14 @@ node-04 0/ >>>= 0 - ./test/hs/hbal -t $TESTDATA_DIR/hbal-location-1.data >>>/Solution length=[1-9]/ >>>= 0 + +./test/hs/hbal --print-nodes=name,pcnt -t $TESTDATA_DIR/hbal-location-2.data +>>>2/Final cluster status: + Name pcnt + node-01 1 + node-02 0 + node-03 1/ +>>>= 0 -- 1.9.1
