summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volgen.c
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2013-02-18 14:22:07 +0530
committerAnand Avati <avati@redhat.com>2013-02-19 00:09:34 -0800
commiteac54f6f76e6fca4f94028b47d963108f63c8f02 (patch)
tree0992b0443f4df9e622bee77aef050d0cbe46b07e /xlators/mgmt/glusterd/src/glusterd-volgen.c
parent81dceec250c9b2f5b87650e28e736e04c4b8597e (diff)
glusterd: Added option description, and validation function fields.
In volopt_map_entry table, added option description field, and option validation function pointer. Change-Id: I21c6bccd175970592b470ce3ef3f418cb99a5a43 BUG: 903478 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/4535 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index d650111f04b..d154c4fd242 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -1916,33 +1916,37 @@ glusterd_get_volopt_content (dict_t * ctx, gf_boolean_t xml_out)
if (get_key_from_volopt (vme, &key))
goto out; /*Some error while getin key*/
- if (!xlator_type || strcmp (vme->voltype, xlator_type)){
- ret = xlator_volopt_dynload (vme->voltype,
- &dl_handle,
- &vol_opt_handle);
- if (ret) {
- dl_handle = NULL;
- continue;
+ if (vme->description) {
+ descr = vme->description;
+ def_val = vme->value;
+ } else {
+ if (!xlator_type || strcmp (vme->voltype, xlator_type)){
+ ret = xlator_volopt_dynload (vme->voltype,
+ &dl_handle,
+ &vol_opt_handle);
+ if (ret) {
+ dl_handle = NULL;
+ continue;
+ }
}
+ ret = xlator_option_info_list (&vol_opt_handle, key,
+ &def_val, &descr);
+ if (ret) /*Swallow Error i.e if option not found*/
+ continue;
}
- ret = xlator_option_info_list (&vol_opt_handle, key,
- &def_val, &descr);
- if (ret) /*Swallow Error i.e if option not found*/
- continue;
-
if (xml_out) {
#if (HAVE_LIB_XML)
if (xml_add_volset_element (writer,vme->key,
- def_val, descr))
+ def_val, descr))
goto out;
#else
gf_log ("glusterd", GF_LOG_ERROR, "Libxml not present");
#endif
} else {
snprintf (tmp_str, 2048, "Option: %s\nDefault "
- "Value: %s\nDescription: %s\n\n",
- vme->key, def_val, descr);
+ "Value: %s\nDescription: %s\n\n",
+ vme->key, def_val, descr);
strcat (output_string, tmp_str);
}