summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volgen.c
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2017-10-17 11:28:43 -0400
committerAtin Mukherjee <amukherj@redhat.com>2017-11-12 06:50:03 +0000
commit781bc5bd68824cae4456855823be17f43b5ae683 (patch)
treebd01fa9154463263bc07befce813c2accf51d08a /xlators/mgmt/glusterd/src/glusterd-volgen.c
parente5c33ca37f05d92312768976b1dbd359a213a4b3 (diff)
glusterd: Validate changelog on geo-rep volume
If geo-rep is configured on volume, don't allow to disable changelog. Change-Id: I7d1ba8b2939c8fe6ee6c59fb923d9aa1bdab553c BUG: 1503227 Signed-off-by: Kotresh HR <khiremat@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 7f7f824..c07cbf3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -1219,6 +1219,56 @@ loglevel_option_handler (volgen_graph_t *graph,
}
static int
+server_check_changelog_off (volgen_graph_t *graph, struct volopt_map_entry *vme,
+ glusterd_volinfo_t *volinfo)
+{
+ gf_boolean_t enabled = _gf_false;
+ int ret = 0;
+
+ GF_ASSERT (volinfo);
+ GF_ASSERT (vme);
+
+ if (strcmp (vme->option, "changelog") != 0)
+ return 0;
+
+ ret = gf_string2boolean (vme->value, &enabled);
+ if (ret || enabled)
+ goto out;
+
+ ret = glusterd_volinfo_get_boolean (volinfo, VKEY_CHANGELOG);
+ if (ret < 0) {
+ gf_msg ("glusterd", GF_LOG_WARNING, 0,
+ GD_MSG_CHANGELOG_GET_FAIL,
+ "failed to get the changelog status");
+ ret = -1;
+ goto out;
+ }
+
+ if (ret) {
+ enabled = _gf_false;
+ glusterd_check_geo_rep_configured (volinfo, &enabled);
+
+ if (enabled) {
+ gf_msg ("glusterd", GF_LOG_WARNING, 0,
+ GD_MSG_XLATOR_SET_OPT_FAIL,
+ GEOREP" sessions active"
+ "for the volume %s, cannot disable changelog ",
+ volinfo->volname);
+ set_graph_errstr (graph,
+ VKEY_CHANGELOG" cannot be disabled "
+ "while "GEOREP" sessions exist");
+ ret = -1;
+ goto out;
+ }
+ }
+
+ ret = 0;
+ out:
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
+ return ret;
+}
+
+static int
server_check_marker_off (volgen_graph_t *graph, struct volopt_map_entry *vme,
glusterd_volinfo_t *volinfo)
{
@@ -1434,6 +1484,9 @@ server_spec_option_handler (volgen_graph_t *graph,
ret = server_check_marker_off (graph, vme, volinfo);
if (!ret)
+ ret = server_check_changelog_off (graph, vme, volinfo);
+
+ if (!ret)
ret = loglevel_option_handler (graph, vme, "brick");
if (!ret)