From 16197d6906579ed2ea0ecb01bdad5aa68a52239e Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Thu, 8 Mar 2012 03:03:14 +0200 Subject: [PATCH] Add more rebalance offline tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These test that we can actually rebalance (and that it results in replace-disks and failovers/migrations), and that we don't double-rebalance, etc. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: RenΓ© Nussbaumer <rn@google.com> --- htools/offline-test.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/htools/offline-test.sh b/htools/offline-test.sh index 28a5ad206..1004beb5c 100755 --- a/htools/offline-test.sh +++ b/htools/offline-test.sh @@ -96,4 +96,37 @@ for suffix in standard tiered; do done echo OK +echo Checking rebalancing +# we generate a cluster with two node groups, one with unallocable +# policy, then we change all nodes from this group to the allocable +# one, and we check for rebalancing +FROOT="$T/simu-rebal-orig" +hspace --simu p,4,8T,64g,16 --simu u,4,8T,64g,16 \ + -S $FROOT --disk-template drbd -l 8 >/dev/null 2>&1 +for suffix in standard tiered; do + RELOC="$T/simu-rebal-merged.$suffix" + # this relocates the nodes + sed -re 's/^(node-.*|fake-uuid-)-02(|.*)/\1-01\2/' \ + < $FROOT.$suffix > $RELOC + BACKEND="-t$RELOC" + hinfo -v -v -p --print-instances $BACKEND >/dev/null 2>&1 + hbal -v -v -v -p --print-instances $BACKEND -G group-01 2>/dev/null | \ + grep -qE -v "(Nothing to do, exiting|No solution found)" + hbal $BACKEND -G group-01 -C$T/rebal-cmds.$suffix \ + -S $T/simu-rebal.$suffix >/dev/null 2>&1 + grep -qE "gnt-instance (failover|migrate|replace-disks)" \ + $T/rebal-cmds.$suffix + hbal $BACKEND -G group-01 -C \ + -S $T/simu-rebal.$suffix 2>/dev/null | \ + grep -qE "gnt-instance (failover|migrate|replace-disks)" + # state saved by hbal should be original + cmp $RELOC $T/simu-rebal.$suffix.original + # and we can't double rebalance + hbal -t $T/simu-rebal.$suffix.balanced \ + -G group-01 | \ + grep -qE "(Nothing to do, exiting|No solution found)" + +done +echo OK + echo All OK -- GitLab