diff options
| author | Kaushik BV <kaushikbv@gluster.com> | 2010-10-05 07:01:52 +0000 | 
|---|---|---|
| committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-10-05 05:47:33 -0700 | 
| commit | 7aec50bdad06665243a16f1ce83a03037bcd5d56 (patch) | |
| tree | 7b034228b529e7bd8abe318e2f3d6609f4679ccb /libglusterfs/src/xlator.c | |
| parent | 79db3aced2ffca84a696192343d5b811833eb671 (diff) | |
mgmt/Glusterd : Reply to CLI error: graph construction
Signed-off-by: Kaushik BV <kaushikbv@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1159 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1159
Diffstat (limited to 'libglusterfs/src/xlator.c')
| -rw-r--r-- | libglusterfs/src/xlator.c | 59 | 
1 files changed, 59 insertions, 0 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index b9819584eee..ff1dc5efa26 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -763,6 +763,13 @@ xlator_dynload (xlator_t *xl)  			"dlsym(reconfigure) on %s -- neglecting",  			dlerror());  	} +         +        if (!(xl->validate_options = dlsym (handle, "validate_options"))) { +                gf_log ("xlator", GF_LOG_DEBUG, +                        "dlsym(validate_options) on %s -- neglecting", +                        dlerror()); +        } +  	INIT_LIST_HEAD (&xl->volume_options); @@ -978,6 +985,58 @@ out:  }  int +xlator_validate_rec (xlator_t *xlator, char **op_errstr) +{ +        xlator_list_t *trav = NULL; +        +        if (xlator == NULL )    { +                gf_log ("xlator", GF_LOG_DEBUG, "invalid argument"); +                return -1; +        } + +        trav = xlator->children; + +        while (trav) { +                if (xlator_validate_rec (trav->xlator, op_errstr) ) +                        return -1; + +                trav = trav->next; +        } +         +        if (xlator_dynload (xlator)) +                gf_log ("", GF_LOG_DEBUG, "Did not load the symbols"); + +        if (xlator->validate_options) { +                if (xlator->validate_options (xlator, xlator->options,  +                    op_errstr)) { +                        gf_log ("", GF_LOG_DEBUG, *op_errstr); +                        return -1; +                } +                gf_log (xlator->name, GF_LOG_DEBUG, "Validated option"); +                 +        } +         +        gf_log (xlator->name, GF_LOG_DEBUG, "No validate_options() found"); + +        return 0; +} + +int +graph_reconf_validateopt (glusterfs_graph_t *graph,  +                          char **op_errstr) +{ +        xlator_t *xlator = NULL; +        int ret = -1; + +        GF_ASSERT (graph); + +        xlator = graph->first; + +        ret = xlator_validate_rec (xlator, op_errstr); + +        return ret; +} +int  xlator_notify (xlator_t *xl, int event, void *data, ...)  {          xlator_t *old_THIS = NULL;  | 
