|
Packit Service |
e080da |
#!/bin/bash
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
. $(dirname $0)/../include.rc
|
|
Packit Service |
e080da |
. $(dirname $0)/../cluster.rc
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
function check_peers {
|
|
Packit Service |
e080da |
$CLI_1 peer status | grep 'Peer in Cluster (Connected)' | wc -l
|
|
Packit Service |
e080da |
}
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
function volume_count {
|
|
Packit Service |
e080da |
local cli=$1;
|
|
Packit Service |
e080da |
if [ $cli -eq '1' ] ; then
|
|
Packit Service |
e080da |
$CLI_1 volume info | grep 'Volume Name' | wc -l;
|
|
Packit Service |
e080da |
else
|
|
Packit Service |
e080da |
$CLI_2 volume info | grep 'Volume Name' | wc -l;
|
|
Packit Service |
e080da |
fi
|
|
Packit Service |
e080da |
}
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
function volinfo_field()
|
|
Packit Service |
e080da |
{
|
|
Packit Service |
e080da |
local vol=$1;
|
|
Packit Service |
e080da |
local field=$2;
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
$CLI_1 volume info $vol | grep "^$field: " | sed 's/.*: //';
|
|
Packit Service |
e080da |
}
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
function two_diff_vols_create {
|
|
Packit Service |
e080da |
# Both volume creates should be successful
|
|
Packit Service |
e080da |
$CLI_1 volume create $V0 $H1:$B1/$V0 $H2:$B2/$V0 $H3:$B3/$V0 &
|
|
Packit Service |
e080da |
PID_1=$!
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
$CLI_2 volume create $V1 $H1:$B1/$V1 $H2:$B2/$V1 $H3:$B3/$V1 &
|
|
Packit Service |
e080da |
PID_2=$!
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
wait $PID_1 $PID_2
|
|
Packit Service |
e080da |
}
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
function two_diff_vols_start {
|
|
Packit Service |
e080da |
# Both volume starts should be successful
|
|
Packit Service |
e080da |
$CLI_1 volume start $V0 &
|
|
Packit Service |
e080da |
PID_1=$!
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
$CLI_2 volume start $V1 &
|
|
Packit Service |
e080da |
PID_2=$!
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
wait $PID_1 $PID_2
|
|
Packit Service |
e080da |
}
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
function two_diff_vols_stop_force {
|
|
Packit Service |
e080da |
# Force stop, so that if rebalance from the
|
|
Packit Service |
e080da |
# remove bricks is in progress, stop can
|
|
Packit Service |
e080da |
# still go ahead. Both volume stops should
|
|
Packit Service |
e080da |
# be successful
|
|
Packit Service |
e080da |
$CLI_1 volume stop $V0 force &
|
|
Packit Service |
e080da |
PID_1=$!
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
$CLI_2 volume stop $V1 force &
|
|
Packit Service |
e080da |
PID_2=$!
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
wait $PID_1 $PID_2
|
|
Packit Service |
e080da |
}
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
function same_vol_remove_brick {
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
# Running two same vol commands at the same time can result in
|
|
Packit Service |
e080da |
# two success', two failures, or one success and one failure, all
|
|
Packit Service |
e080da |
# of which are valid. The only thing that shouldn't happen is a
|
|
Packit Service |
e080da |
# glusterd crash.
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
local vol=$1
|
|
Packit Service |
e080da |
local brick=$2
|
|
Packit Service |
e080da |
$CLI_1 volume remove-brick $1 $2 start &
|
|
Packit Service |
e080da |
PID=$!
|
|
Packit Service |
e080da |
$CLI_2 volume remove-brick $1 $2 start
|
|
Packit Service |
e080da |
wait $PID
|
|
Packit Service |
e080da |
}
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
cleanup;
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
TEST launch_cluster 3;
|
|
Packit Service |
e080da |
TEST $CLI_1 peer probe $H2;
|
|
Packit Service |
e080da |
TEST $CLI_1 peer probe $H3;
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
EXPECT_WITHIN $PROBE_TIMEOUT 2 check_peers
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
two_diff_vols_create
|
|
Packit Service |
e080da |
EXPECT 'Created' volinfo_field $V0 'Status';
|
|
Packit Service |
e080da |
EXPECT 'Created' volinfo_field $V1 'Status';
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
two_diff_vols_start
|
|
Packit Service |
e080da |
EXPECT 'Started' volinfo_field $V0 'Status';
|
|
Packit Service |
e080da |
EXPECT 'Started' volinfo_field $V1 'Status';
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
same_vol_remove_brick $V0 $H2:$B2/$V0
|
|
Packit Service |
e080da |
# Checking glusterd crashed or not after same volume remove brick
|
|
Packit Service |
e080da |
# on both nodes.
|
|
Packit Service |
e080da |
EXPECT_WITHIN $PROBE_TIMEOUT 2 check_peers
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
same_vol_remove_brick $V1 $H2:$B2/$V1
|
|
Packit Service |
e080da |
# Checking glusterd crashed or not after same volume remove brick
|
|
Packit Service |
e080da |
# on both nodes.
|
|
Packit Service |
e080da |
EXPECT_WITHIN $PROBE_TIMEOUT 2 check_peers
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
$CLI_1 volume set $V0 diagnostics.client-log-level DEBUG &
|
|
Packit Service |
e080da |
PID=$!
|
|
Packit Service |
e080da |
$CLI_1 volume set $V1 diagnostics.client-log-level DEBUG
|
|
Packit Service |
e080da |
wait $PID
|
|
Packit Service |
e080da |
kill_glusterd 3
|
|
Packit Service |
e080da |
$CLI_1 volume status $V0
|
|
Packit Service |
e080da |
$CLI_2 volume status $V1
|
|
Packit Service |
e080da |
$CLI_1 peer status
|
|
Packit Service |
e080da |
EXPECT_WITHIN $PROBE_TIMEOUT 1 check_peers
|
|
Packit Service |
e080da |
EXPECT 'Started' volinfo_field $V0 'Status';
|
|
Packit Service |
e080da |
EXPECT 'Started' volinfo_field $V1 'Status';
|
|
Packit Service |
e080da |
|
|
Packit Service |
e080da |
TEST $glusterd_3
|
|
Packit Service |
e080da |
$CLI_1 volume status $V0
|
|
Packit Service |
e080da |
$CLI_2 volume status $V1
|
|
Packit Service |
e080da |
$CLI_1 peer status
|
|
Packit Service |
e080da |
cleanup;
|