summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-messages.h26
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c66
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c30
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c20
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h2
8 files changed, 155 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index ba6f4afa94d..523e9d51bec 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -4585,6 +4585,7 @@ gd_is_global_option (char *opt_key)
strcmp (opt_key, GLUSTERD_QUORUM_RATIO_KEY) == 0 ||
strcmp (opt_key, GLUSTERD_GLOBAL_OP_VERSION_KEY) == 0 ||
strcmp (opt_key, GLUSTERD_BRICK_MULTIPLEX_KEY) == 0 ||
+ strcmp (opt_key, GLUSTERD_LOCALTIME_LOGGING_KEY) == 0 ||
strcmp (opt_key, GLUSTERD_MAX_OP_VERSION_KEY) == 0);
out:
diff --git a/xlators/mgmt/glusterd/src/glusterd-messages.h b/xlators/mgmt/glusterd/src/glusterd-messages.h
index 2caa16c2eda..36d1408965f 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 606
+#define GLFS_NUM_MESSAGES 610
#define GLFS_MSGID_END (GLUSTERD_COMP_BASE + GLFS_NUM_MESSAGES + 1)
/* Messaged with message IDs */
@@ -4909,6 +4909,30 @@
*/
#define GD_MSG_STATVFS_FAILED (GLUSTERD_COMP_BASE + 607)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_LOCALTIME_LOGGING_VOL_OPT_VALIDATE_FAIL (GLUSTERD_COMP_BASE + 608)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_LOCALTIME_LOGGING_ENABLE (GLUSTERD_COMP_BASE + 609)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_LOCALTIME_LOGGING_DISABLE (GLUSTERD_COMP_BASE + 610)
+
/*------------*/
#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 6be92d8ad7e..7bb3d537097 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -85,6 +85,7 @@ glusterd_all_vol_opts valid_all_vol_opts[] = {
* TBD: Discuss the default value for this. Maybe this should be a
* dynamic value depending on the memory specifications per node */
{ GLUSTERD_BRICKMUX_LIMIT_KEY, "0"},
+ { GLUSTERD_LOCALTIME_LOGGING_KEY, "disable"},
{ NULL },
};
@@ -870,6 +871,60 @@ out:
}
static int
+glusterd_validate_localtime_logging (char *key, char *value, char *errstr)
+{
+ int32_t ret = -1;
+ xlator_t *this = NULL;
+ glusterd_conf_t *conf = NULL;
+ int already_enabled = 0;
+
+ this = THIS;
+ GF_VALIDATE_OR_GOTO ("glusterd", this, out);
+
+ conf = this->private;
+ GF_VALIDATE_OR_GOTO (this->name, conf, out);
+
+ GF_VALIDATE_OR_GOTO (this->name, key, out);
+ GF_VALIDATE_OR_GOTO (this->name, value, out);
+ GF_VALIDATE_OR_GOTO (this->name, errstr, out);
+
+ ret = 0;
+
+ if (strcmp (key, GLUSTERD_LOCALTIME_LOGGING_KEY)) {
+ goto out;
+ }
+
+ if ((strcmp (value, "enable")) &&
+ (strcmp (value, "disable"))) {
+ snprintf (errstr, PATH_MAX,
+ "Invalid option(%s). Valid options "
+ "are 'enable' and 'disable'", value);
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INVALID_ENTRY, "%s", errstr);
+ ret = -1;
+ }
+
+ already_enabled = gf_log_get_localtime ();
+
+ if (strcmp (value, "enable") == 0) {
+ gf_log_set_localtime (1);
+ if (!already_enabled)
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_LOCALTIME_LOGGING_ENABLE,
+ "localtime logging enable");
+ } else if (strcmp (value, "disable") == 0) {
+ gf_log_set_localtime (0);
+ if (already_enabled)
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_LOCALTIME_LOGGING_DISABLE,
+ "localtime logging disable");
+ }
+
+out:
+ return ret;
+}
+
+static int
glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr)
{
int ret = -1;
@@ -1253,6 +1308,14 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr)
goto out;
}
+ ret = glusterd_validate_localtime_logging (key, value, errstr);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_LOCALTIME_LOGGING_VOL_OPT_VALIDATE_FAIL,
+ "Failed to validate localtime "
+ "logging volume options");
+ goto out;
+ }
if (volinfo) {
ret = glusterd_volinfo_get (volinfo,
@@ -2639,6 +2702,7 @@ out:
return ret;
}
+
int
glusterd_op_get_max_opversion (char **op_errstr, dict_t *rsp_dict)
{
@@ -2658,6 +2722,7 @@ out:
return ret;
}
+
static int
glusterd_set_shared_storage (dict_t *dict, char *key, char *value,
char **op_errstr)
@@ -2735,7 +2800,6 @@ out:
}
-
static int
glusterd_op_set_volume (dict_t *dict, char **errstr)
{
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index f1627df688f..9dcb4f78089 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1937,6 +1937,7 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo,
int port = 0;
int rdma_port = 0;
char *bind_address = NULL;
+ char *localtime_logging = NULL;
char socketpath[PATH_MAX] = {0};
char glusterd_uuid[1024] = {0,};
char valgrind_logfile[PATH_MAX] = {0};
@@ -2056,6 +2057,12 @@ retry:
"--xlator-option", glusterd_uuid,
NULL);
+ if (dict_get_str (priv->opts, GLUSTERD_LOCALTIME_LOGGING_KEY,
+ &localtime_logging) == 0) {
+ if (strcmp (localtime_logging, "enable") == 0)
+ runner_add_arg (&runner, "--localtime-logging");
+ }
+
runner_add_arg (&runner, "--brick-port");
if (volinfo->transport_type != GF_TRANSPORT_BOTH_TCP_RDMA) {
runner_argprintf (&runner, "%d", port);
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 1ada7232f3e..d82e0f1ae86 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -1310,6 +1310,25 @@ log_format_option_handler (volgen_graph_t *graph, struct volopt_map_entry *vme,
}
static int
+log_localtime_logging_option_handler (volgen_graph_t *graph, struct volopt_map_entry *vme,
+ void *param)
+{
+ char *role = NULL;
+ struct volopt_map_entry vme2 = {0,};
+
+ role = (char *) param;
+
+ if (strcmp (vme->option, "!cluster.localtime-logging") != 0 ||
+ !strstr (vme->key, role))
+ return 0;
+
+ memcpy (&vme2, vme, sizeof (vme2));
+ vme2.option = GLUSTERD_LOCALTIME_LOGGING_KEY;
+
+ return basic_option_handler (graph, &vme2, NULL);
+}
+
+static int
log_buf_size_option_handler (volgen_graph_t *graph,
struct volopt_map_entry *vme,
void *param)
@@ -1414,6 +1433,9 @@ server_spec_option_handler (volgen_graph_t *graph,
if (!ret)
ret = log_flush_timeout_option_handler (graph, vme, "brick");
+ if (!ret)
+ ret = log_localtime_logging_option_handler (graph, vme, "brick");
+
return ret;
}
@@ -3974,6 +3996,14 @@ graph_set_generic_options (xlator_t *this, volgen_graph_t *graph,
GD_MSG_GRAPH_SET_OPT_FAIL,
"Failed to change "
"log-flush-timeout option");
+
+ ret = volgen_graph_set_options_generic (graph, set_dict, "client",
+ &log_localtime_logging_option_handler);
+ if (ret)
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_GRAPH_SET_OPT_FAIL,
+ "Failed to change "
+ "log-localtime-logging option");
return 0;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 2983484d12e..5eabd5e6481 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -3515,7 +3515,12 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.op_version = GD_OP_VERSION_3_11_0,
.flags = OPT_FLAG_CLIENT_OPT
},
-
+ { .key = GLUSTERD_LOCALTIME_LOGGING_KEY,
+ .voltype = "mgmt/glusterd",
+ .type = GLOBAL_DOC,
+ .op_version = GD_OP_VERSION_3_12_0,
+ .validate_fn = validate_boolean
+ },
{ .key = NULL
}
};
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index f8a38f965a6..68998f0a877 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -1401,6 +1401,7 @@ init (xlator_t *this)
int32_t workers = 0;
gf_boolean_t upgrade = _gf_false;
gf_boolean_t downgrade = _gf_false;
+ char *localtime_logging = NULL;
#ifndef GF_DARWIN_HOST_OS
{
@@ -1846,6 +1847,25 @@ init (xlator_t *this)
if (ret < 0)
goto out;
+ if (dict_get_str (conf->opts, GLUSTERD_LOCALTIME_LOGGING_KEY,
+ &localtime_logging) == 0) {
+ int already_enabled = gf_log_get_localtime ();
+
+ if (strcmp (localtime_logging, "enable") == 0) {
+ gf_log_set_localtime (1);
+ if (!already_enabled)
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_LOCALTIME_LOGGING_ENABLE,
+ "localtime logging enable");
+ } else if (strcmp (localtime_logging, "disable") == 0) {
+ gf_log_set_localtime (0);
+ if (already_enabled)
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_LOCALTIME_LOGGING_DISABLE,
+ "localtime logging disable");
+ }
+ }
+
conf->blockers = 0;
/* If the peer count is less than 2 then this would be the best time to
* spawn process/bricks that may need (re)starting since last time
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 3226ec24c0f..228a3454c1b 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -54,8 +54,8 @@
#define GLUSTER_SHARED_STORAGE "gluster_shared_storage"
#define GLUSTERD_SHARED_STORAGE_KEY "cluster.enable-shared-storage"
#define GLUSTERD_BRICK_MULTIPLEX_KEY "cluster.brick-multiplex"
-
#define GLUSTERD_BRICKMUX_LIMIT_KEY "cluster.max-bricks-per-process"
+#define GLUSTERD_LOCALTIME_LOGGING_KEY "cluster.localtime-logging"
#define GLUSTERD_SNAPS_MAX_HARD_LIMIT 256
#define GLUSTERD_SNAPS_DEF_SOFT_LIMIT_PERCENT 90