diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2018-07-02 10:39:56 +0530 |
---|---|---|
committer | Ravishankar N <ravishankar@redhat.com> | 2018-07-03 12:48:56 +0000 |
commit | ce69fb659657a6d7ca9f5b44bab282533e3bfd26 (patch) | |
tree | 7e00b6489769d832add364953c17dc4926d594e8 | |
parent | a585425aad5f07a406da26ba38c59fa0e5ad3036 (diff) |
afr,ec: Print if the subvolume is up in statedump
fixes bz#1597156
Change-Id: I323eb9190e40b12df216698dcdba74a6d336beeb
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
-rw-r--r-- | tests/afr.rc | 8 | ||||
-rw-r--r-- | tests/basic/afr/afr-up.t | 28 | ||||
-rw-r--r-- | tests/basic/ec/ec-up.t | 28 | ||||
-rw-r--r-- | tests/ec.rc | 9 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 1 | ||||
-rw-r--r-- | xlators/cluster/ec/src/ec.c | 1 |
6 files changed, 75 insertions, 0 deletions
diff --git a/tests/afr.rc b/tests/afr.rc index bdf4075a233..12cbd974cd7 100644 --- a/tests/afr.rc +++ b/tests/afr.rc @@ -89,3 +89,11 @@ function count_index_entries() { ls $1/.glusterfs/indices/xattrop | wc -l } + +function afr_up_status() +{ + local v=$1 + local m=$2 + local replica_id=$3 + grep -E "^up = " $m/.meta/graphs/active/${v}-replicate-${replica_id}/private | cut -f2 -d'=' +} diff --git a/tests/basic/afr/afr-up.t b/tests/basic/afr/afr-up.t new file mode 100644 index 00000000000..428aac875e0 --- /dev/null +++ b/tests/basic/afr/afr-up.t @@ -0,0 +1,28 @@ +#!/bin/bash +#Tests that afr up/down works as expected + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../afr.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,3,4,5,6} +TEST $CLI volume start $V0 +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0; +EXPECT "1" afr_up_status $V0 $M0 0 +EXPECT "1" afr_up_status $V0 $M0 1 + +#kill two bricks in first replica and check that afr_up_status is 0 for it +TEST kill_brick $V0 $H0 $B0/${V0}0 +TEST kill_brick $V0 $H0 $B0/${V0}1 + +EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT "0" afr_up_status $V0 $M0 0 +EXPECT "1" afr_up_status $V0 $M0 1 + +TEST $CLI volume start $V0 force +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_up_status $V0 $M0 0 +EXPECT "1" afr_up_status $V0 $M0 1 +cleanup; diff --git a/tests/basic/ec/ec-up.t b/tests/basic/ec/ec-up.t new file mode 100644 index 00000000000..d54e7e1d022 --- /dev/null +++ b/tests/basic/ec/ec-up.t @@ -0,0 +1,28 @@ +#!/bin/bash +#Tests that ec subvolume is up/down correctly + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../ec.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 disperse-data 2 redundancy 1 $H0:$B0/${V0}{0,1,3,4,5,6} +TEST $CLI volume start $V0 +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0; +EXPECT "1" ec_up_status $V0 $M0 0 +EXPECT "1" ec_up_status $V0 $M0 1 + +#kill two bricks in first disperse subvolume and check that ec_up_status is 0 for it +TEST kill_brick $V0 $H0 $B0/${V0}0 +TEST kill_brick $V0 $H0 $B0/${V0}1 + +EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT "0" ec_up_status $V0 $M0 0 +EXPECT "1" ec_up_status $V0 $M0 1 + +TEST $CLI volume start $V0 force +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" ec_up_status $V0 $M0 0 +EXPECT "1" ec_up_status $V0 $M0 1 +cleanup; diff --git a/tests/ec.rc b/tests/ec.rc new file mode 100644 index 00000000000..04405ecb829 --- /dev/null +++ b/tests/ec.rc @@ -0,0 +1,9 @@ +#!/bin/bash + +function ec_up_status() +{ + local v=$1 + local m=$2 + local ec_id=$3 + grep -E "^up =" $m/.meta/graphs/active/${v}-disperse-${ec_id}/private | cut -f2 -d'=' +} diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 1e0c1a7b265..e2821f1b295 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -4904,6 +4904,7 @@ afr_priv_dump (xlator_t *this) gf_proc_dump_write("quorum-type", "fixed"); gf_proc_dump_write("quorum-count", "%d", priv->quorum_count); } + gf_proc_dump_write("up", "%u", afr_has_quorum (priv->child_up, this)); return 0; } diff --git a/xlators/cluster/ec/src/ec.c b/xlators/cluster/ec/src/ec.c index 31e9c0ec584..cb995646959 100644 --- a/xlators/cluster/ec/src/ec.c +++ b/xlators/cluster/ec/src/ec.c @@ -1370,6 +1370,7 @@ int32_t ec_dump_private(xlator_t *this) snprintf(key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.%s", this->type, this->name); gf_proc_dump_add_section(key_prefix); + gf_proc_dump_write("up", "%u", ec->up); gf_proc_dump_write("nodes", "%u", ec->nodes); gf_proc_dump_write("redundancy", "%u", ec->redundancy); gf_proc_dump_write("fragment_size", "%u", ec->fragment_size); |