diff options
author | Yaniv Kaul <ykaul@redhat.com> | 2020-07-07 21:49:50 +0300 |
---|---|---|
committer | MOHIT AGRAWAL <moagrawa@redhat.com> | 2020-07-10 05:15:16 +0000 |
commit | f3df1a5d6e44f70c51a3cdbb4873c1c5a2fd0771 (patch) | |
tree | 5a7eb8f00221c0bef6b32aa8d3b099182ea783d2 /xlators/mgmt/glusterd/src/glusterd-utils.c | |
parent | 906154bf2e5a65c438cb09fd318ca5f2f301b738 (diff) | |
download | glusterfs-f3df1a5d6e44f70c51a3cdbb4873c1c5a2fd0771.tar.gz glusterfs-f3df1a5d6e44f70c51a3cdbb4873c1c5a2fd0771.tar.xz glusterfs-f3df1a5d6e44f70c51a3cdbb4873c1c5a2fd0771.zip |
[RFC]glusterd-utils.c: display which options have changed
Display which options were not changed from the default.
The user may have opted to change some global or volume options
from the default they were initially. Display '(DEFAULT)' if the values
used are those that were not explicitly set by the user.
Example output:
Option Value
------ -----
cluster.server-quorum-ratio 50
cluster.enable-shared-storage disable (DEFAULT)
cluster.op-version 80000
cluster.max-op-version 90000
cluster.brick-multiplex disable (DEFAULT)
cluster.max-bricks-per-process 250 (DEFAULT)
glusterd.vol_count_per_thread 100 (DEFAULT)
cluster.localtime-logging disable (DEFAULT)
cluster.daemon-log-level INFO (DEFAULT)
Since glusterfind uses the value, it is now filtering the value
and only picking the 1st word (which is the value itself) and ignores
the rest, which may now be '(DEFAULT)'.
Fixes: #1357
Change-Id: I7c59055158d099a5de38943f2169fd02c77f5d09
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index aebacabd49..6b974648df 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -13328,7 +13328,9 @@ glusterd_get_global_options_for_all_vols(rpcsvc_request_t *req, dict_t *ctx, gf_asprintf(&def_val, "%d", priv->op_version); need_free = _gf_true; } else { - def_val = valid_all_vol_opts[i].dflt_val; + gf_asprintf(&def_val, "%s (DEFAULT)", + valid_all_vol_opts[i].dflt_val); + need_free = _gf_true; } } @@ -13414,6 +13416,7 @@ glusterd_get_default_val_for_volopt(dict_t *ctx, gf_boolean_t all_opts, int count = 0; xlator_t *this = NULL; char *def_val = NULL; + char *def_val_str = NULL; char dict_key[50] = ""; int keylen; gf_boolean_t key_found = _gf_false; @@ -13474,7 +13477,13 @@ glusterd_get_default_val_for_volopt(dict_t *ctx, gf_boolean_t all_opts, goto out; } sprintf(dict_key, "value%d", count); - ret = dict_set_dynstr_with_alloc(ctx, dict_key, def_val); + if (get_value_vme) { // the value was never changed - DEFAULT is used + gf_asprintf(&def_val_str, "%s (DEFAULT)", def_val); + ret = dict_set_dynstr_with_alloc(ctx, dict_key, def_val_str); + GF_FREE(def_val_str); + def_val_str = NULL; + } else + ret = dict_set_dynstr_with_alloc(ctx, dict_key, def_val); if (ret) { gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED, "Failed to " |