summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volgen.c
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2010-10-05 07:01:52 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-10-05 05:47:33 -0700
commit7aec50bdad06665243a16f1ce83a03037bcd5d56 (patch)
tree7b034228b529e7bd8abe318e2f3d6609f4679ccb /xlators/mgmt/glusterd/src/glusterd-volgen.c
parent79db3aced2ffca84a696192343d5b811833eb671 (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 'xlators/mgmt/glusterd/src/glusterd-volgen.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c97
1 files changed, 97 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 1b01e10eb0d..9d3ceaf5659 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -1254,3 +1254,100 @@ glusterd_delete_volfile (glusterd_volinfo_t *volinfo,
get_brick_filepath (filename, volinfo, brickinfo);
return unlink (filename);
}
+
+int
+validate_clientopts (glusterd_volinfo_t *volinfo,
+ dict_t *val_dict,
+ char **op_errstr)
+{
+ glusterfs_graph_t graph = {{0,},};
+ int ret = -1;
+
+ GF_ASSERT (volinfo);
+
+
+ ret = build_client_graph (&graph, volinfo, val_dict);
+ if (!ret)
+ ret = graph_reconf_validateopt (&graph, op_errstr);
+
+ volgen_graph_free (&graph);
+
+ gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ return ret;
+}
+
+int
+validate_brickopts (glusterd_volinfo_t *volinfo,
+ char *brickinfo_path,
+ dict_t *val_dict,
+ char **op_errstr)
+{
+ glusterfs_graph_t graph = {{0,},};
+ int ret = -1;
+
+ GF_ASSERT (volinfo);
+
+
+
+ ret = build_server_graph (&graph, volinfo, val_dict, brickinfo_path);
+ if (!ret)
+ ret = graph_reconf_validateopt (&graph, op_errstr);
+
+ volgen_graph_free (&graph);
+
+ gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ return ret;
+}
+
+int
+glusterd_validate_brickreconf (glusterd_volinfo_t *volinfo,
+ dict_t *val_dict,
+ char **op_errstr)
+{
+ glusterd_brickinfo_t *brickinfo = NULL;
+ int ret = -1;
+
+ list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ gf_log ("", GF_LOG_DEBUG,
+ "Validating %s", brickinfo->hostname);
+
+ ret = validate_brickopts (volinfo, brickinfo->path, val_dict,
+ op_errstr);
+ if (ret)
+ goto out;
+ }
+
+ ret = 0;
+out:
+
+ return ret;
+}
+
+int
+glusterd_validate_reconfopts (glusterd_volinfo_t *volinfo, dict_t *val_dict,
+ char **op_errstr)
+{
+ int ret = -1;
+
+ gf_log ("", GF_LOG_DEBUG, "Inside Validate reconfigure options");
+
+ ret = glusterd_validate_brickreconf (volinfo, val_dict, op_errstr);
+
+ if (ret) {
+ gf_log ("", GF_LOG_DEBUG,
+ "Could not Validate bricks");
+ goto out;
+ }
+
+ ret = validate_clientopts (volinfo, val_dict, op_errstr);
+ if (ret) {
+ gf_log ("", GF_LOG_DEBUG,
+ "Could not Validate client");
+ goto out;
+ }
+
+
+out:
+ gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ return ret;
+} \ No newline at end of file