summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2016-01-21 14:48:34 +0530
committerAtin Mukherjee <amukherj@redhat.com>2016-03-08 23:25:52 -0800
commit3122e47e70494fd224f764f86fae29eca16ac06b (patch)
tree1228868389053ee6ef42d23ae280feb9a89d84cd /xlators/mgmt/glusterd/src/glusterd-utils.c
parentd1272ef0fdc9897fa388665e039b9f713109ef0c (diff)
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 <amukherj@redhat.com> Reviewed-on: http://review.gluster.org/13272 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Gaurav Kumar Garg <ggarg@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: http://review.gluster.org/13651
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 7e9781f190d..73cdf16badf 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -10635,10 +10635,14 @@ glusterd_get_default_val_for_volopt (dict_t *ctx, gf_boolean_t all_opts,
char *def_val = NULL;
char dict_key[50] = {0,};
gf_boolean_t key_found = _gf_false;
+ glusterd_conf_t *priv = NULL;
this = THIS;
GF_ASSERT (this);
+ priv = this->private;
+ GF_VALIDATE_OR_GOTO (this->name, priv, out);
+
GF_VALIDATE_OR_GOTO (this->name, vol_dict, out);
/* Check whether key is passed for a single option */
@@ -10653,19 +10657,23 @@ glusterd_get_default_val_for_volopt (dict_t *ctx, gf_boolean_t all_opts,
if (!all_opts && strcmp (vme->key, input_key))
continue;
key_found = _gf_true;
- /* First look for the key in the vol_dict, if its not
- * present then look for translator default value */
- ret = dict_get_str (vol_dict, vme->key, &def_val);
+ /* First look for the key in the priv->opts for global option
+ * and then into vol_dict, if its not present then look for
+ * translator default value */
+ ret = dict_get_str (priv->opts, vme->key, &def_val);
if (!def_val) {
- if (vme->value) {
- def_val = vme->value;
- } else {
- ret = glusterd_get_value_for_vme_entry
- (vme, &def_val);
- if (!all_opts && ret)
- goto out;
- else if (ret == -2)
- continue;
+ ret = dict_get_str (vol_dict, vme->key, &def_val);
+ if (!def_val) {
+ if (vme->value) {
+ def_val = vme->value;
+ } else {
+ ret = glusterd_get_value_for_vme_entry
+ (vme, &def_val);
+ if (!all_opts && ret)
+ goto out;
+ else if (ret == -2)
+ continue;
+ }
}
}
count++;