summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/bugs/glusterd/bug-1199451-op-version-retrieving-fix.t22
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c10
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/bugs/glusterd/bug-1199451-op-version-retrieving-fix.t b/tests/bugs/glusterd/bug-1199451-op-version-retrieving-fix.t
new file mode 100644
index 00000000000..43661b67628
--- /dev/null
+++ b/tests/bugs/glusterd/bug-1199451-op-version-retrieving-fix.t
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+## Test case for BZ-1199451 (gluster command should retrieve current op-version
+## of the NODE)
+
+. $(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/brick1 $H0:$B0/brick2
+TEST $CLI volume start $V0
+
+## glusterd command should retrieve current op-version of the node
+TEST $CLI volume get $V0 cluster.op-version
+
+cleanup;
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 62fc0e6f053..7cd05f40ddf 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -4361,6 +4361,16 @@ glusterd_get_volume_opts (rpcsvc_request_t *req, dict_t *dict)
" details", key);
}
}
+
+ /* Request is for a single option, explicitly set count to 1
+ * in the dictionary.
+ */
+ ret = dict_set_int32 (dict, "count", 1);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to set count "
+ "value in the dictionary");
+ goto out;
+ }
} else {
/* Handle the "all" volume option request */
ret = glusterd_get_default_val_for_volopt (dict, _gf_true, NULL,