summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
authorSamikshan Bairagya <samikshan@gmail.com>2016-09-23 16:35:15 +0530
committerAtin Mukherjee <amukherj@redhat.com>2016-12-30 20:47:27 -0800
commit08056421b886b1ebf1e0eed93d9f6f9b6d017489 (patch)
treea83374aa443f956d17d4b0de897345c7be47c1a4 /xlators/mgmt/glusterd/src/glusterd-op-sm.c
parent14ae0c6b14c9a32f15cdb3c94edbf08bb2e708b6 (diff)
glusterd, cli: Get global options through volume get functionality
Currently it is not possible to retrieve values of global options by using the 'gluster volume get' functionality if there are no volumes present. In order to get the global options one has to use 'gluster volume get' with a specific volume name. This usage makes the illusion as though the option is set only on one volume, which is incorrect. When setting the global options, 'gluster volume set' provides a way to set them using the volume name as 'all'. Similarly, retrieving the global options should be made possible by using the volume name 'all' with the 'gluster volume get' functionality. This patch adds that functionality to 'volume get' Usage: # gluster volume get all <OPTION/all> Change-Id: Ic2fdb9eda69d4806d432dae26d117d9660fe6d4e BUG: 1378842 Signed-off-by: Samikshan Bairagya <samikshan@gmail.com> Reviewed-on: http://review.gluster.org/15563 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c34
1 files changed, 5 insertions, 29 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 3d9372a5357..c2b0f53dcc4 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -63,38 +63,13 @@ glusterd_set_shared_storage (dict_t *dict, char *key, char *value,
* all volumes, we can just add more entries to this *
* table *
*/
-glusterd_all_vol_opts valid_all_vol_opts[] = {
+glusterd_all_vol_opts valid_all_vol_opts[] = {
{ GLUSTERD_QUORUM_RATIO_KEY },
{ GLUSTERD_SHARED_STORAGE_KEY },
+ { GLUSTERD_GLOBAL_OP_VERSION_KEY },
{ NULL },
};
-#define ALL_VOLUME_OPTION_CHECK(volname, key, ret, op_errstr, label) \
- do { \
- gf_boolean_t _all = !strcmp ("all", volname); \
- gf_boolean_t _ratio = _gf_false; \
- int32_t i = 0; \
- \
- for (i = 0; valid_all_vol_opts[i].option; i++) { \
- if (!strcmp (key, valid_all_vol_opts[i].option)) { \
- _ratio = _gf_true; \
- break; \
- } \
- } \
- \
- if (_all && !_ratio) { \
- ret = -1; \
- *op_errstr = gf_strdup ("Not a valid option for all " \
- "volumes"); \
- goto label; \
- } else if (!_all && _ratio) { \
- ret = -1; \
- *op_errstr = gf_strdup ("Not a valid option for " \
- "single volume"); \
- goto label; \
- } \
- } while (0)
-
static struct cds_list_head gd_op_sm_queue;
synclock_t gd_op_sm_lock;
glusterd_op_info_t opinfo = {{0},};
@@ -1202,7 +1177,8 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr)
goto cont;
}
- ALL_VOLUME_OPTION_CHECK (volname, key, ret, op_errstr, out);
+ ALL_VOLUME_OPTION_CHECK (volname, _gf_false, key, ret,
+ op_errstr, out);
ret = glusterd_validate_quorum_options (this, key, value,
op_errstr);
if (ret)
@@ -1562,7 +1538,7 @@ glusterd_op_stage_reset_volume (dict_t *dict, char **op_errstr)
ret = -1;
goto out;
}
- ALL_VOLUME_OPTION_CHECK (volname, key, ret,
+ ALL_VOLUME_OPTION_CHECK (volname, _gf_false, key, ret,
op_errstr, out);
}
}