diff options
-rw-r--r-- | tests/bugs/bug-1140162-file-snapshot-and-features-encryption-option-validation.t | 33 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 5 |
2 files changed, 36 insertions, 2 deletions
diff --git a/tests/bugs/bug-1140162-file-snapshot-and-features-encryption-option-validation.t b/tests/bugs/bug-1140162-file-snapshot-and-features-encryption-option-validation.t new file mode 100644 index 00000000000..a7aa883cba8 --- /dev/null +++ b/tests/bugs/bug-1140162-file-snapshot-and-features-encryption-option-validation.t @@ -0,0 +1,33 @@ +#!/bin/bash + +## Test case for BZ-1140160 Volume option set <vol> <file-snapshot> and +## <features.encryption> <value> command input should validate correctly. + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc + +cleanup; + +## Start glusterd +TEST glusterd; +TEST pidof glusterd; + +## Lets create and start volume +TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2}; +TEST $CLI volume start $V0 + +## Set features.file-snapshot and features.encryption option with non-boolean +## value. These options should fail. +TEST ! $CLI volume set $V0 features.file-snapshot abcd +TEST ! $CLI volume set $V0 features.encryption redhat + +## Set other options with valid value. These options should succeed. +TEST $CLI volume set $V0 barrier enable +TEST $CLI volume set $V0 ping-timeout 60 + +## Set features.file-snapshot and features.encryption option with valid boolean +## value. These options should succeed. +TEST $CLI volume set $V0 features.file-snapshot on +TEST $CLI volume set $V0 features.encryption on + +cleanup; diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 7cd95fad5f2..476e3b0c1d9 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -2736,7 +2736,7 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, goto out; } - ret = glusterd_volinfo_get_boolean (volinfo, "features.encryption"); + ret = dict_get_str_boolean (set_dict, "features.encryption", _gf_false); if (ret == -1) goto out; if (ret) { @@ -2764,7 +2764,8 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, } - ret = glusterd_volinfo_get_boolean (volinfo, "features.file-snapshot"); + ret = dict_get_str_boolean (set_dict, "features.file-snapshot", + _gf_false); if (ret == -1) goto out; if (ret) { |