summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2009-06-16 05:25:17 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-06-18 15:54:13 -0700
commit93c8ce0e3fc295087775185c0f8594f06244098d (patch)
tree75f36ba79f6b249d805ab5a98f1798734225e090
parentcc931ebf51e7a810e08155ba0b916b10f25d7f16 (diff)
Add command line option to specify central log server.
Added two command line options: --log-server SERVER --log-server-port PORT Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
-rw-r--r--glusterfsd/src/glusterfsd.c29
-rw-r--r--glusterfsd/src/glusterfsd.h2
-rw-r--r--libglusterfs/src/glusterfs.h2
3 files changed, 31 insertions, 2 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index 0afbe5c97..ae887e9ce 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -101,6 +101,10 @@ static struct argp_option gf_options[] = {
{"spec-file", ARGP_VOLUME_FILE_KEY, "VOLFILE", OPTION_HIDDEN,
"File to use as VOLFILE [default : "DEFAULT_CLIENT_VOLUME_FILE" or "
DEFAULT_SERVER_VOLUME_FILE"]"},
+ {"log-server", ARGP_LOG_SERVER_KEY, "LOG SERVER", 0,
+ "Server to use as the central log server."
+ "--log-server option"},
+
{"log-level", ARGP_LOG_LEVEL_KEY, "LOGLEVEL", 0,
"Logging severity. Valid options are DEBUG, NORMAL, WARNING, ERROR, "
"CRITICAL and NONE [default: NORMAL]"},
@@ -116,6 +120,8 @@ static struct argp_option gf_options[] = {
"Transport type to get volfile from server [default: socket]"},
{"volfile-id", ARGP_VOLFILE_ID_KEY, "KEY", 0,
"'key' of the volfile to be fetched from server"},
+ {"log-server-port", ARGP_LOG_SERVER_PORT_KEY, "PORT", 0,
+ "Listening port number of log server"},
{"pid-file", ARGP_PID_FILE_KEY, "PIDFILE", 0,
"File to use as pid file"},
{"no-daemon", ARGP_NO_DAEMON_KEY, 0, 0,
@@ -667,7 +673,7 @@ parse_opts (int key, char *arg, struct argp_state *state)
switch (key) {
case ARGP_VOLFILE_SERVER_KEY:
- cmd_args->volfile_server = strdup (arg);
+ cmd_args->volfile_server = strdup (arg);
break;
case ARGP_VOLFILE_MAX_FETCH_ATTEMPTS:
@@ -685,6 +691,10 @@ parse_opts (int key, char *arg, struct argp_state *state)
case ARGP_VOLUME_FILE_KEY:
cmd_args->volume_file = strdup (arg);
break;
+
+ case ARGP_LOG_SERVER_KEY:
+ cmd_args->log_server = strdup (arg);
+ break;
case ARGP_LOG_LEVEL_KEY:
if (strcasecmp (arg, ARGP_LOG_LEVEL_NONE_OPTION) == 0) {
@@ -734,6 +744,18 @@ parse_opts (int key, char *arg, struct argp_state *state)
argp_failure (state, -1, 0,
"unknown volfile server port %s", arg);
break;
+
+ case ARGP_LOG_SERVER_PORT_KEY:
+ n = 0;
+
+ if (gf_string2uint_base10 (arg, &n) == 0) {
+ cmd_args->log_server_port = n;
+ break;
+ }
+
+ argp_failure (state, -1, 0,
+ "unknown log server port %s", arg);
+ break;
case ARGP_VOLFILE_SERVER_TRANSPORT_KEY:
cmd_args->volfile_server_transport = strdup (arg);
@@ -1215,7 +1237,10 @@ main (int argc, char *argv[])
gf_log ("glusterfs", GF_LOG_NORMAL, "Successfully started");
- if (cmd_args->volfile_server) {
+ if (cmd_args->log_server) {
+ gf_log_central_init (ctx, cmd_args->log_server,
+ "socket", cmd_args->log_server_port);
+ } else if (cmd_args->volfile_server) {
gf_log_central_init (ctx, cmd_args->volfile_server,
"socket", cmd_args->volfile_server_port);
}
diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h
index e06526b06..d661335e3 100644
--- a/glusterfsd/src/glusterfsd.h
+++ b/glusterfsd/src/glusterfsd.h
@@ -72,6 +72,8 @@ enum argp_option_keys {
ARGP_VOLFILE_ID_KEY = 143,
ARGP_VOLFILE_CHECK_KEY = 144,
ARGP_VOLFILE_MAX_FETCH_ATTEMPTS = 145,
+ ARGP_LOG_SERVER_KEY = 146,
+ ARGP_LOG_SERVER_PORT_KEY = 147,
};
/* Moved here from fetch-spec.h */
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index bf269df4b..bb93f5faa 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -217,12 +217,14 @@ struct _cmd_args {
/* basic options */
char *volfile_server;
char *volume_file;
+ char *log_server;
gf_loglevel_t log_level;
char *log_file;
int32_t max_connect_attempts;
/* advanced options */
uint32_t volfile_server_port;
char *volfile_server_transport;
+ uint32_t log_server_port;
char *pid_file;
int no_daemon_mode;
char *run_id;