From bcb423555ac7f0379344de41b50c012c1fde891d Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Mon, 18 Feb 2013 16:41:46 +0530 Subject: glusterd: Added validation function for performance cache max and min size. Change-Id: I0b8dbc4b65412b8aff24873f030c03e3dcfcb988 BUG: 782095 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/4541 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 8f0805217..e97b991b1 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -105,6 +105,8 @@ static char *glusterd_op_sm_event_names[] = { "GD_OP_EVENT_INVALID" }; +extern struct volopt_map_entry glusterd_volopt_map[]; + char* glusterd_op_sm_state_name_get (int state) { @@ -401,7 +403,8 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr) uint32_t local_key_op_version = 0; gf_boolean_t origin_glusterd = _gf_true; gf_boolean_t check_op_version = _gf_true; - gf_boolean_t all_vol = _gf_false; + gf_boolean_t all_vol = _gf_false; + struct volopt_map_entry *vme = NULL; GF_ASSERT (dict); this = THIS; @@ -559,6 +562,18 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr) if (is_key_glusterd_hooks_friendly (key)) continue; + for (vme = &glusterd_volopt_map[0]; vme->key; vme++) { + if ((vme->validate_fn) && + ((!strcmp (key, vme->key)) || + (!strcmp (key, strchr (vme->key, '.') + 1)))) { + ret = vme->validate_fn (dict, key, value, + op_errstr); + if (ret) + goto out; + break; + } + } + exists = glusterd_check_option_exists (key, &key_fixed); if (exists == -1) { ret = -1; -- cgit