diff --git a/Makefile.am b/Makefile.am index 67876a0a710af272417cc22a13e467b29c96d542..338e7226ab10f0dd776e7bae471fc005ed339077 100644 --- a/Makefile.am +++ b/Makefile.am @@ -878,6 +878,7 @@ TEST_FILES = \ htest/data/hbal-split-insts.data \ htest/data/invalid-node.data \ htest/data/missing-resources.data \ + htest/data/n1-failure.data \ htest/data/rapi/groups.json \ htest/data/rapi/info.json \ htest/data/rapi/instances.json \ diff --git a/htest/data/n1-failure.data b/htest/data/n1-failure.data new file mode 100644 index 0000000000000000000000000000000000000000..8a90223b241a8157f2f47eedc610e6e2c0204c17 --- /dev/null +++ b/htest/data/n1-failure.data @@ -0,0 +1,25 @@ +group-01|fake-uuid-01|preferred| +group-02|fake-uuid-02|unallocable| + +node-01-001|256|0|0|7629394|7625298|16|N|fake-uuid-01|1 +node-01-002|256|0|0|7629394|7625298|16|N|fake-uuid-01|1 +node-01-003|256|0|0|7629394|7625298|16|N|fake-uuid-01|1 +node-01-004|256|0|0|7629394|7625298|16|N|fake-uuid-01|1 +node-02-001|65536|0|65536|7629394|7629394|16|N|fake-uuid-01|1 +node-02-002|65536|0|65536|7629394|7629394|16|N|fake-uuid-01|1 +node-02-003|65536|0|65536|7629394|7629394|16|N|fake-uuid-01|1 +node-02-004|65536|0|65536|7629394|7629394|16|N|fake-uuid-01|1 + +new-0|128|1024|1|running|Y|node-01-004|node-01-003|drbd||1 +new-1|128|1024|1|running|Y|node-01-002|node-01-001|drbd||1 +new-2|128|1024|1|running|Y|node-01-003|node-01-001|drbd||1 +new-3|128|1024|1|running|Y|node-01-001|node-01-004|drbd||1 +new-4|128|1024|1|running|Y|node-01-002|node-01-004|drbd||1 +new-5|128|1024|1|running|Y|node-01-003|node-01-002|drbd||1 +new-6|128|1024|1|running|Y|node-01-004|node-01-002|drbd||1 +new-7|128|1024|1|running|Y|node-01-001|node-01-003|drbd||1 + + +|128,1,1024,1,1,1|128,1,1024,1,1,1|32768,8,1048576,16,8,12|diskless,file,sharedfile,plain,blockdev,drbd,rbd,ext|4.0|32.0 +group-01|128,1,1024,1,1,1|128,1,1024,1,1,1|32768,8,1048576,16,8,12|diskless,file,sharedfile,plain,blockdev,drbd,rbd,ext|4.0|32.0 +group-02|128,1,1024,1,1,1|128,1,1024,1,1,1|32768,8,1048576,16,8,12|diskless,file,sharedfile,plain,blockdev,drbd,rbd,ext|4.0|32.0 diff --git a/htest/shelltests/htools-balancing.test b/htest/shelltests/htools-balancing.test index 004c56eb65ff9c86a91444e522b0a21ca922cf37..550cee984494a36a55334c32a6693562eba4063c 100644 --- a/htest/shelltests/htools-balancing.test +++ b/htest/shelltests/htools-balancing.test @@ -13,6 +13,18 @@ >>> /gnt-instance (failover|migrate|replace-disks)/ >>>= 0 +# test that hbal won't execute rebalances when using the text backend +./htest/hbal $BACKEND_BAL_STD -G group-01 -X +>>>2 +Error: hbal: Execution of commands possible only on LUXI +>>>= !0 + +# test that hbal won't execute any moves if we request an absurdly-high +# minimum-improvement +./htest/hbal $BACKEND_BAL_STD -G group-01 -C --min-gain 10000 --min-gain-limit 10000 +>>>/No solution found/ +>>>= 0 + # test saving commands ./htest/hbal $BACKEND_BAL_STD -G group-01 -C$T/rebal-cmds.standard >>>= 0 @@ -70,3 +82,22 @@ diff -u $T/simu-rebal-merged.tiered $T/simu-rebal.tiered.original ./htest/hbal -t $T/simu-rebal.tiered.balanced -G group-01 >>> /(Nothing to do, exiting|No solution found)/ >>>= 0 + +### now some other custom tests + +# n+1 bad instances are reported as such +./htest/hbal -t$TESTDATA_DIR/n1-failure.data -G group-01 +>>>/Initial check done: 4 bad nodes, 8 bad instances./ +>>>=0 + +# same test again, different message check (shelltest can't test multiple +# messages via regexp +./htest/hbal -t$TESTDATA_DIR/n1-failure.data -G group-01 +>>>/Cluster is not N\+1 happy, continuing but no guarantee that the cluster will end N\+1 happy./ +>>>2 +>>>=0 + +# hbal should work on empty groups as well +./htest/hbal -t$TESTDATA_DIR/n1-failure.data -G group-02 +>>>/Group size 0 nodes, 0 instances/ +>>>= 0 diff --git a/htest/shelltests/htools-multi-group.test b/htest/shelltests/htools-multi-group.test index b693a8a05b94bd94da2613e20a6c78b23b979590..34a41b4871478008de8bfba47c988544f4658428 100644 --- a/htest/shelltests/htools-multi-group.test +++ b/htest/shelltests/htools-multi-group.test @@ -39,7 +39,9 @@ >>> /HCHECK_OK=1/ >>>= 0 -# hcheck should be able to improve a group with split instances -./htest/hbal -t $TESTDATA_DIR/hbal-split-insts.data -G group-01 -O node-01-001 +# hcheck should be able to improve a group with split instances, and also +# warn us about them +./htest/hbal -t $TESTDATA_DIR/hbal-split-insts.data -G group-01 -O node-01-001 -v >>> /Cluster score improved from .* to .*/ +>>>2/Found instances belonging to multiple node groups:/ >>>= 0