summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
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
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')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-messages.h10
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c53
2 files changed, 62 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-messages.h b/xlators/mgmt/glusterd/src/glusterd-messages.h
index dbc146babc7..cf84cd30f11 100644
--- a/xlators/mgmt/glusterd/src/glusterd-messages.h
+++ b/xlators/mgmt/glusterd/src/glusterd-messages.h
@@ -41,7 +41,7 @@
#define GLUSTERD_COMP_BASE GLFS_MSGID_GLUSTERD
-#define GLFS_NUM_MESSAGES 612
+#define GLFS_NUM_MESSAGES 613
#define GLFS_MSGID_END (GLUSTERD_COMP_BASE + GLFS_NUM_MESSAGES + 1)
/* Messaged with message IDs */
@@ -4945,6 +4945,14 @@
*/
#define GD_MSG_PORTS_EXHAUSTED (GLUSTERD_COMP_BASE + 612)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_CHANGELOG_GET_FAIL (GLUSTERD_COMP_BASE + 613)
+
/*------------*/
#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 7f7f82493e2..c07cbf396cc 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)