From 3122e47e70494fd224f764f86fae29eca16ac06b Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Thu, 21 Jan 2016 14:48:34 +0530 Subject: glusterd: volume get should pick options from priv->opts too Backport of http://review.gluster.org/13272 As of now volume get was not looking for all the global options maintained in option dictionary in glusterd_conf_t. This patch includes the same. Change-Id: Ib05259a2dcacc4a712cae4217fe4a6553b61da56 BUG: 1315939 Signed-off-by: Atin Mukherjee Reviewed-on: http://review.gluster.org/13272 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Gaurav Kumar Garg CentOS-regression: Gluster Build System Reviewed-by: Jeff Darcy Reviewed-on: http://review.gluster.org/13651 --- tests/bugs/cli/bug-983317-volume-get.t | 34 ++++++++++++++++++++++++++++++++++ tests/bugs/cli/bug-983317.t | 25 ------------------------- tests/volume.rc | 7 +++++++ 3 files changed, 41 insertions(+), 25 deletions(-) create mode 100644 tests/bugs/cli/bug-983317-volume-get.t delete mode 100644 tests/bugs/cli/bug-983317.t (limited to 'tests') diff --git a/tests/bugs/cli/bug-983317-volume-get.t b/tests/bugs/cli/bug-983317-volume-get.t new file mode 100644 index 00000000000..8f09d588565 --- /dev/null +++ b/tests/bugs/cli/bug-983317-volume-get.t @@ -0,0 +1,34 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; +TEST glusterd +TEST pidof glusterd + +TEST $CLI volume create $V0 $H0:$B0/$V0 + +# Set a volume option +TEST $CLI volume set $V0 open-behind on +TEST $CLI volume start $V0 + +TEST $CLI volume set all server-quorum-ratio 80 + +TEST $CLI volume set $V0 user.metadata 'dummy' + +# Execute volume get without having an explicit option, this should fail +TEST ! $CLI volume get $V0 + +# Execute volume get with an explicit option +TEST $CLI volume get $V0 open-behind +EXPECT 'on' volume_get_field $V0 'open-behind' + +# Execute volume get with 'all" +TEST $CLI volume get $V0 all + +# Check if volume get can display correct global options values as well +EXPECT '80' volume_get_field $V0 'server-quorum-ratio' + +# Check user.* options can also be retrived using volume get +EXPECT 'dummy' volume_get_field $V0 'user.metadata' diff --git a/tests/bugs/cli/bug-983317.t b/tests/bugs/cli/bug-983317.t deleted file mode 100644 index 11590ac280f..00000000000 --- a/tests/bugs/cli/bug-983317.t +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -. $(dirname $0)/../../include.rc -. $(dirname $0)/../../volume.rc - -cleanup; -TEST glusterd -TEST pidof glusterd - -TEST $CLI volume create $V0 $H0:$B0/$V0 - -# Set a volume option -TEST $CLI volume set $V0 open-behind on -TEST $CLI volume start $V0 - -# Execute volume get without having an explicit option, this should fail -TEST ! $CLI volume get $V0 - -# Execute volume get with an explicit option -TEST $CLI volume get $V0 open-behind - -# Execute volume get with 'all" -TEST $CLI volume get $V0 all - -cleanup; diff --git a/tests/volume.rc b/tests/volume.rc index 9bd9eca1ec5..9c6c6be2e8a 100644 --- a/tests/volume.rc +++ b/tests/volume.rc @@ -6,6 +6,13 @@ function volinfo_field() $CLI volume info $vol | grep "^$field: " | sed 's/.*: //'; } +function volume_get_field() +{ + local vol=$1 + local field=$2 + $CLI volume get $vol $field | tail -1 | awk '{print $2}' +} + function brick_count() { -- cgit