Revision 16197d69

b/htools/offline-test.sh
96 96
done
97 97
echo OK
98 98

  
99
echo Checking rebalancing
100
# we generate a cluster with two node groups, one with unallocable
101
# policy, then we change all nodes from this group to the allocable
102
# one, and we check for rebalancing
103
FROOT="$T/simu-rebal-orig"
104
hspace --simu p,4,8T,64g,16 --simu u,4,8T,64g,16 \
105
  -S $FROOT --disk-template drbd -l 8 >/dev/null 2>&1
106
for suffix in standard tiered; do
107
  RELOC="$T/simu-rebal-merged.$suffix"
108
  # this relocates the nodes
109
  sed -re 's/^(node-.*|fake-uuid-)-02(|.*)/\1-01\2/' \
110
    < $FROOT.$suffix > $RELOC
111
  BACKEND="-t$RELOC"
112
  hinfo -v -v -p --print-instances $BACKEND >/dev/null 2>&1
113
  hbal -v -v -v -p --print-instances $BACKEND -G group-01 2>/dev/null | \
114
    grep -qE -v "(Nothing to do, exiting|No solution found)"
115
  hbal $BACKEND -G group-01 -C$T/rebal-cmds.$suffix \
116
    -S $T/simu-rebal.$suffix >/dev/null 2>&1
117
  grep -qE "gnt-instance (failover|migrate|replace-disks)" \
118
    $T/rebal-cmds.$suffix
119
  hbal $BACKEND -G group-01 -C \
120
    -S $T/simu-rebal.$suffix 2>/dev/null | \
121
    grep -qE "gnt-instance (failover|migrate|replace-disks)"
122
  # state saved by hbal should be original
123
  cmp $RELOC $T/simu-rebal.$suffix.original
124
  # and we can't double rebalance
125
  hbal -t $T/simu-rebal.$suffix.balanced \
126
    -G group-01 | \
127
    grep -qE "(Nothing to do, exiting|No solution found)"
128

  
129
done
130
echo OK
131

  
99 132
echo All OK

Also available in: Unified diff