|
|
3604df |
From eaceb4d8c5f08a97cc91843b0f80adc93fc3f391 Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Vijay Bellur <vbellur@redhat.com>
|
|
|
3604df |
Date: Wed, 10 Feb 2016 18:27:38 -0500
|
|
|
3604df |
Subject: [PATCH 21/86] logging: Change log file name for glusterd
|
|
|
3604df |
|
|
|
3604df |
Backport of http://review.gluster.org/13426
|
|
|
3604df |
|
|
|
3604df |
log file names are based on:
|
|
|
3604df |
|
|
|
3604df |
a. user provided input (through -l switch while starting a gluster process)
|
|
|
3604df |
b. mount point paths in the case of native clients
|
|
|
3604df |
c. volume/configuration files used for starting a gluster process
|
|
|
3604df |
d. volume server used for starting a gluster process
|
|
|
3604df |
|
|
|
3604df |
Currently glusterd uses scheme c. to have a log file name that reads as
|
|
|
3604df |
|
|
|
3604df |
INSTALL_PREFIX-etc-glusterfs-glusterd.log
|
|
|
3604df |
|
|
|
3604df |
Since glusterd has a well known configuration file, it does not make much
|
|
|
3604df |
sense to have log file name based on scheme c. This patch changes the name of
|
|
|
3604df |
glusterd's log file to "glusterd.log". Hopefully this enables users to identify
|
|
|
3604df |
glusterd's log file more easily.
|
|
|
3604df |
|
|
|
3604df |
>Reviewed-on: http://review.gluster.org/13426
|
|
|
3604df |
>Tested-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
>Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
|
|
|
3604df |
Change-Id: I2d04179c4b9b06271b50eeee3909ee259e8cf547
|
|
|
3604df |
BUG: 1306120
|
|
|
3604df |
Signed-off-by: Vijay Bellur <vbellur@redhat.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/84621
|
|
|
3604df |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
Tested-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
---
|
|
|
3604df |
api/src/glfs.c | 2 +-
|
|
|
3604df |
glusterfsd/src/glusterfsd.c | 6 +-----
|
|
|
3604df |
libglusterfs/src/common-utils.c | 12 +++++++++++-
|
|
|
3604df |
libglusterfs/src/common-utils.h | 8 +++++++-
|
|
|
3604df |
xlators/mgmt/glusterd/src/glusterd.h | 1 -
|
|
|
3604df |
5 files changed, 20 insertions(+), 9 deletions(-)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/api/src/glfs.c b/api/src/glfs.c
|
|
|
3604df |
index ee74487..3aec115 100644
|
|
|
3604df |
--- a/api/src/glfs.c
|
|
|
3604df |
+++ b/api/src/glfs.c
|
|
|
3604df |
@@ -847,7 +847,7 @@ pub_glfs_set_logging (struct glfs *fs, const char *logfile, int loglevel)
|
|
|
3604df |
THIS->ctx = fs->ctx;
|
|
|
3604df |
|
|
|
3604df |
if (!logfile) {
|
|
|
3604df |
- ret = gf_set_log_file_path (&fs->ctx->cmd_args);
|
|
|
3604df |
+ ret = gf_set_log_file_path (&fs->ctx->cmd_args, fs->ctx);
|
|
|
3604df |
if (ret)
|
|
|
3604df |
goto out;
|
|
|
3604df |
tmplog = fs->ctx->cmd_args.log_file;
|
|
|
3604df |
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
|
|
|
3604df |
index 4a2f7ad..e726cc5 100644
|
|
|
3604df |
--- a/glusterfsd/src/glusterfsd.c
|
|
|
3604df |
+++ b/glusterfsd/src/glusterfsd.c
|
|
|
3604df |
@@ -75,10 +75,6 @@
|
|
|
3604df |
#include "daemon.h"
|
|
|
3604df |
#include "tw.h"
|
|
|
3604df |
|
|
|
3604df |
-/* process mode definitions */
|
|
|
3604df |
-#define GF_SERVER_PROCESS 0
|
|
|
3604df |
-#define GF_CLIENT_PROCESS 1
|
|
|
3604df |
-#define GF_GLUSTERD_PROCESS 2
|
|
|
3604df |
|
|
|
3604df |
/* using argp for command line parsing */
|
|
|
3604df |
static char gf_doc[] = "";
|
|
|
3604df |
@@ -1556,7 +1552,7 @@ logging_init (glusterfs_ctx_t *ctx, const char *progpath)
|
|
|
3604df |
cmd_args = &ctx->cmd_args;
|
|
|
3604df |
|
|
|
3604df |
if (cmd_args->log_file == NULL) {
|
|
|
3604df |
- ret = gf_set_log_file_path (cmd_args);
|
|
|
3604df |
+ ret = gf_set_log_file_path (cmd_args, ctx);
|
|
|
3604df |
if (ret == -1) {
|
|
|
3604df |
fprintf (stderr, "ERROR: failed to set the log file "
|
|
|
3604df |
"path\n");
|
|
|
3604df |
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
|
|
|
3604df |
index 973e31c..9583352 100644
|
|
|
3604df |
--- a/libglusterfs/src/common-utils.c
|
|
|
3604df |
+++ b/libglusterfs/src/common-utils.c
|
|
|
3604df |
@@ -3413,7 +3413,7 @@ out:
|
|
|
3604df |
|
|
|
3604df |
/* Sets log file path from user provided arguments */
|
|
|
3604df |
int
|
|
|
3604df |
-gf_set_log_file_path (cmd_args_t *cmd_args)
|
|
|
3604df |
+gf_set_log_file_path (cmd_args_t *cmd_args, glusterfs_ctx_t *ctx)
|
|
|
3604df |
{
|
|
|
3604df |
int i = 0;
|
|
|
3604df |
int j = 0;
|
|
|
3604df |
@@ -3442,6 +3442,16 @@ gf_set_log_file_path (cmd_args_t *cmd_args)
|
|
|
3604df |
goto done;
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
+ if (ctx && GF_GLUSTERD_PROCESS == ctx->process_mode) {
|
|
|
3604df |
+ ret = gf_asprintf (&cmd_args->log_file,
|
|
|
3604df |
+ DEFAULT_LOG_FILE_DIRECTORY "/%s.log",
|
|
|
3604df |
+ GLUSTERD_NAME);
|
|
|
3604df |
+ if (ret > 0)
|
|
|
3604df |
+ ret = 0;
|
|
|
3604df |
+
|
|
|
3604df |
+ goto done;
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
if (cmd_args->volfile) {
|
|
|
3604df |
j = 0;
|
|
|
3604df |
i = 0;
|
|
|
3604df |
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
|
|
|
3604df |
index 93dee58..2930fea 100644
|
|
|
3604df |
--- a/libglusterfs/src/common-utils.h
|
|
|
3604df |
+++ b/libglusterfs/src/common-utils.h
|
|
|
3604df |
@@ -73,6 +73,7 @@ void trap (void);
|
|
|
3604df |
|
|
|
3604df |
#define GEOREP "geo-replication"
|
|
|
3604df |
#define GHADOOP "glusterfs-hadoop"
|
|
|
3604df |
+#define GLUSTERD_NAME "glusterd"
|
|
|
3604df |
|
|
|
3604df |
#define GF_SELINUX_XATTR_KEY "security.selinux"
|
|
|
3604df |
|
|
|
3604df |
@@ -83,6 +84,11 @@ void trap (void);
|
|
|
3604df |
!strcmp (fs_name, "ext3") || \
|
|
|
3604df |
!strcmp (fs_name, "ext4"))
|
|
|
3604df |
|
|
|
3604df |
+/* process mode definitions */
|
|
|
3604df |
+#define GF_SERVER_PROCESS 0
|
|
|
3604df |
+#define GF_CLIENT_PROCESS 1
|
|
|
3604df |
+#define GF_GLUSTERD_PROCESS 2
|
|
|
3604df |
+
|
|
|
3604df |
/* Defining this here as it is needed by glusterd for setting
|
|
|
3604df |
* nfs port in volume status.
|
|
|
3604df |
*/
|
|
|
3604df |
@@ -221,7 +227,7 @@ int32_t gf_resolve_ip6 (const char *hostname, uint16_t port, int family,
|
|
|
3604df |
|
|
|
3604df |
void gf_log_dump_graph (FILE *specfp, glusterfs_graph_t *graph);
|
|
|
3604df |
void gf_print_trace (int32_t signal, glusterfs_ctx_t *ctx);
|
|
|
3604df |
-int gf_set_log_file_path (cmd_args_t *cmd_args);
|
|
|
3604df |
+int gf_set_log_file_path (cmd_args_t *cmd_args, glusterfs_ctx_t *ctx);
|
|
|
3604df |
int gf_set_log_ident (cmd_args_t *cmd_args);
|
|
|
3604df |
|
|
|
3604df |
#define VECTORSIZE(count) (count * (sizeof (struct iovec)))
|
|
|
3604df |
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
3604df |
index 9889565..eec1adf 100644
|
|
|
3604df |
--- a/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
3604df |
+++ b/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
3604df |
@@ -38,7 +38,6 @@
|
|
|
3604df |
#include "glusterd-rcu.h"
|
|
|
3604df |
|
|
|
3604df |
#define GLUSTERD_TR_LOG_SIZE 50
|
|
|
3604df |
-#define GLUSTERD_NAME "glusterd"
|
|
|
3604df |
#define GLUSTERD_SOCKET_LISTEN_BACKLOG 128
|
|
|
3604df |
#define GLUSTERD_QUORUM_TYPE_KEY "cluster.server-quorum-type"
|
|
|
3604df |
#define GLUSTERD_QUORUM_RATIO_KEY "cluster.server-quorum-ratio"
|
|
|
3604df |
--
|
|
|
3604df |
1.7.1
|
|
|
3604df |
|