* [Cluster-devel] Cluster Project branch, master, updated. cluster-2.99.05-9-g95a5c6b
@ 2008-06-25 4:25 fabbione
2008-06-25 14:43 ` [Cluster-devel] logsys in fenced David Teigland
0 siblings, 1 reply; 9+ messages in thread
From: fabbione @ 2008-06-25 4:25 UTC (permalink / raw)
To: cluster-devel.redhat.com
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Cluster Project".
http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=95a5c6b13294742956b13070ebc4f4513278255f
The branch, master has been updated
via 95a5c6b13294742956b13070ebc4f4513278255f (commit)
via da704715c606c9c01637ae53d79f8dec6a8b0389 (commit)
via 4906d99305537dd4629b78caf6426c603d2a2e11 (commit)
via db2b176d89bcdf549189cdf686dcdffd7793ec98 (commit)
via 18e085596bb8844f74689a92662f2e5e9166836b (commit)
via c54c56c5a09f98547ceda3bc5fa9afa28b354480 (commit)
via cf4c7ebac813b0b607acf6cf74bbdddfc8cfb12a (commit)
from 274ad923e82cf0567e129d1250c7f50ee7ca3b4b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 95a5c6b13294742956b13070ebc4f4513278255f
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
Date: Wed Jun 25 06:24:11 2008 +0200
[FENCE] fenced: separate concept of fork and debugging
allow fenced to fork when debugging is set from the configuration
or the system will hang at boot.
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
commit da704715c606c9c01637ae53d79f8dec6a8b0389
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
Date: Wed Jun 25 05:19:35 2008 +0200
[FENCE] Allow fenced to configure logsys
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
commit 4906d99305537dd4629b78caf6426c603d2a2e11
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
Date: Wed Jun 25 05:15:55 2008 +0200
[QDISK] Set debug from syslog_level only when requested
Make also sure to set val to NULL after some operations.
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
commit db2b176d89bcdf549189cdf686dcdffd7793ec98
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
Date: Wed Jun 25 05:15:07 2008 +0200
[CCS] Set debug from syslog_level only when requested
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
commit 18e085596bb8844f74689a92662f2e5e9166836b
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
Date: Wed Jun 25 04:49:41 2008 +0200
[FENCE] Move logsys configuration calls where they belong
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
commit c54c56c5a09f98547ceda3bc5fa9afa28b354480
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
Date: Wed Jun 25 04:23:20 2008 +0200
[FENCE] Make fenced ready to load logsys config
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
commit cf4c7ebac813b0b607acf6cf74bbdddfc8cfb12a
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
Date: Tue Jun 24 14:34:35 2008 +0200
[FENCE] Start porting fenced to logsys
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
-----------------------------------------------------------------------
Summary of changes:
ccs/daemon/misc.c | 8 ++-
cman/qdisk/main.c | 13 +++-
fence/fenced/Makefile | 4 +-
fence/fenced/config.c | 147 ++++++++++++++++++++++++++++++++++++++++++--
fence/fenced/cpg.c | 116 ++++++++++++++++++-----------------
fence/fenced/fd.h | 15 ++---
fence/fenced/group.c | 33 +++++-----
fence/fenced/main.c | 61 ++++++++++++-------
fence/fenced/member_cman.c | 19 +++---
fence/fenced/recover.c | 26 ++++----
10 files changed, 304 insertions(+), 138 deletions(-)
diff --git a/ccs/daemon/misc.c b/ccs/daemon/misc.c
index 76f63de..96a7867 100644
--- a/ccs/daemon/misc.c
+++ b/ccs/daemon/misc.c
@@ -200,8 +200,12 @@ int set_ccs_logging(xmlDocPtr ldoc){
if (loglevel < 0)
loglevel = LOG_LEVEL_INFO;
- if(!debug)
+ if(!debug) {
+ if(loglevel == LOG_LEVEL_DEBUG)
+ debug = 1;
+
logsys_config_priority_set (loglevel);
+ }
free(res);
res=NULL;
@@ -276,7 +280,7 @@ int set_ccs_logging(xmlDocPtr ldoc){
}
if(logmode & LOG_MODE_BUFFER_BEFORE_CONFIG) {
- log_printf(LOG_DEBUG, "CCS logsys config enabled from set_ccs_logging\n");
+ log_printf(LOG_DEBUG, "logsys config enabled from set_ccs_logging\n");
logmode &= ~LOG_MODE_BUFFER_BEFORE_CONFIG;
logmode |= LOG_MODE_FLUSH_AFTER_CONFIG;
logsys_config_mode_set (logmode);
diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c
index 4202508..75ccafe 100644
--- a/cman/qdisk/main.c
+++ b/cman/qdisk/main.c
@@ -1109,11 +1109,14 @@ get_logsys_config_data(int *debug)
loglevel = LOG_LEVEL_INFO;
if (!*debug) {
- *debug = 1;
+ if (loglevel == LOG_LEVEL_DEBUG)
+ *debug = 1;
+
logsys_config_priority_set (loglevel);
}
free(val);
+ val = NULL;
} else
if (ccs_get(ccsfd, "/cluster/quorumd/@log_level", &val) == 0) { /* check backward compat options */
loglevel = logsys_priority_id_get (val);
@@ -1123,11 +1126,14 @@ get_logsys_config_data(int *debug)
log_printf(LOG_ERR, "<quorumd log_level=\"%s\".. option is depracated\n", val);
if (!*debug) {
- *debug = 1;
+ if (loglevel == LOG_LEVEL_DEBUG)
+ *debug = 1;
+
logsys_config_priority_set (loglevel);
}
free(val);
+ val = NULL;
}
} else
logsys_config_priority_set (LOG_LEVEL_DEBUG);
@@ -1197,10 +1203,11 @@ get_logsys_config_data(int *debug)
logsys_config_facility_set ("QDISK", facility);
free(val);
+ val = NULL;
}
if(logmode & LOG_MODE_BUFFER_BEFORE_CONFIG) {
- log_printf(LOG_DEBUG, "QDISK logsys config enabled from get_logsys_config_data\n");
+ log_printf(LOG_DEBUG, "logsys config enabled from get_logsys_config_data\n");
logmode &= ~LOG_MODE_BUFFER_BEFORE_CONFIG;
logmode |= LOG_MODE_FLUSH_AFTER_CONFIG;
logsys_config_mode_set (logmode);
diff --git a/fence/fenced/Makefile b/fence/fenced/Makefile
index 1e9bbc9..b2b1e04 100644
--- a/fence/fenced/Makefile
+++ b/fence/fenced/Makefile
@@ -22,8 +22,8 @@ CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${fenceincdir} -I${openaisincdir}
CFLAGS += -I$(S) -I$(S)/../include -I$(S)/../libfenced -I$(SRCDIR)/group/lib
CFLAGS += -I${incdir}
-LDFLAGS += -L${ccslibdir} -L${cmanlibdir} -L${openaislibdir} -lccs -lcman -lcpg
-LDFLAGS += -L${fencelibdir} -L${openaislibdir} -lfence -lcpg -lpthread
+LDFLAGS += -L${ccslibdir} -L${cmanlibdir} -L${openaislibdir} -lccs -lcman -lcpg -llogsys
+LDFLAGS += -L${fencelibdir} -lfence -lpthread
LDFLAGS += -L../../group/lib -l group
diff --git a/fence/fenced/config.c b/fence/fenced/config.c
index 56b7b0e..1a038ef 100644
--- a/fence/fenced/config.c
+++ b/fence/fenced/config.c
@@ -1,6 +1,8 @@
#include "fd.h"
#include "ccs.h"
+LOGSYS_DECLARE_SUBSYS ("FENCED", LOG_LEVEL_INFO);
+
static int open_ccs(void)
{
int i = 0, cd;
@@ -8,7 +10,7 @@ static int open_ccs(void)
while ((cd = ccs_connect()) < 0) {
sleep(1);
if (++i > 9 && !(i % 10))
- log_error("connect to ccs error %d, "
+ log_printf(LOG_ERR, "connect to ccs error %d, "
"check ccsd or cluster status", cd);
}
return cd;
@@ -27,15 +29,144 @@ static void read_ccs_int(int cd, char *path, int *config_val)
val = atoi(str);
if (val < 0) {
- log_error("ignore invalid value %d for %s", val, path);
+ log_printf(LOG_ERR, "ignore invalid value %d for %s", val, path);
return;
}
*config_val = val;
- log_debug("%s is %u", path, val);
+ log_printf_debug("%s is %u", path, val);
free(str);
}
+int get_logsys_config_data(void)
+{
+ int ccsfd = -1, loglevel = LOG_LEVEL_INFO, facility = SYSLOGFACILITY;
+ char *val = NULL, *error = NULL;
+ unsigned int logmode;
+ int global_debug = 0;
+
+ log_printf(LOG_DEBUG, "Loading logsys configuration information\n");
+
+ ccsfd = ccs_connect();
+ if (ccsfd < 0) {
+ log_printf(LOG_CRIT, "Connection to CCSD failed; cannot start\n");
+ return -1;
+ }
+
+ logmode = logsys_config_mode_get();
+
+ if (!daemon_debug_opt) {
+ if (ccs_get(ccsfd, "/cluster/logging/@debug", &val) == 0) {
+ if(!strcmp(val, "on")) {
+ global_debug = 1;
+ } else
+ if(!strcmp(val, "off")) {
+ global_debug = 0;
+ } else
+ log_printf(LOG_ERR, "global debug: unknown value\n");
+ free(val);
+ val = NULL;
+ }
+
+ if (ccs_get(ccsfd, "/cluster/logging/logger_subsys[@subsys=\"FENCED\"]/@debug", &val) == 0) {
+ if(!strcmp(val, "on")) {
+ daemon_debug_opt = 1;
+ } else
+ if(!strcmp(val, "off")) { /* debug from cmdline/envvars override config */
+ daemon_debug_opt = 0;
+ } else
+ log_printf(LOG_ERR, "subsys debug: unknown value: %s\n", val);
+ free(val);
+ val = NULL;
+ } else
+ daemon_debug_opt = global_debug; /* global debug overrides subsystem only if latter is not specified */
+
+ if (ccs_get(ccsfd, "/cluster/logging/logger_subsys[@subsys=\"FENCED\"]/@syslog_level", &val) == 0) {
+ loglevel = logsys_priority_id_get (val);
+ if (loglevel < 0)
+ loglevel = LOG_LEVEL_INFO;
+
+ if (!daemon_debug_opt) {
+ if (loglevel == LOG_LEVEL_DEBUG)
+ daemon_debug_opt = 1;
+
+ logsys_config_priority_set (loglevel);
+ }
+
+ free(val);
+ val = NULL;
+ }
+ } else
+ logsys_config_priority_set (LOG_LEVEL_DEBUG);
+
+ if (ccs_get(ccsfd, "/cluster/logging/@to_stderr", &val) == 0) {
+ if(!strcmp(val, "yes")) {
+ logmode |= LOG_MODE_OUTPUT_STDERR;
+ } else
+ if(!strcmp(val, "no")) {
+ logmode &= ~LOG_MODE_OUTPUT_STDERR;
+ } else
+ log_printf(LOG_ERR, "to_stderr: unknown value\n");
+ free(val);
+ val = NULL;
+ }
+
+ if (ccs_get(ccsfd, "/cluster/logging/@to_syslog", &val) == 0) {
+ if(!strcmp(val, "yes")) {
+ logmode |= LOG_MODE_OUTPUT_SYSLOG_THREADED;
+ } else
+ if(!strcmp(val, "no")) {
+ logmode &= ~LOG_MODE_OUTPUT_SYSLOG_THREADED;
+ } else
+ log_printf(LOG_ERR, "to_syslog: unknown value\n");
+ free(val);
+ val = NULL;
+ }
+
+ if (ccs_get(ccsfd, "/cluster/logging/@to_file", &val) == 0) {
+ if(!strcmp(val, "yes")) {
+ logmode |= LOG_MODE_OUTPUT_FILE;
+ } else
+ if(!strcmp(val, "no")) {
+ logmode &= ~LOG_MODE_OUTPUT_FILE;
+ } else
+ log_printf(LOG_ERR, "to_file: unknown value\n");
+ free(val);
+ val = NULL;
+ }
+
+ if (ccs_get(ccsfd, "/cluster/logging/@filename", &val) == 0) {
+ if(logsys_config_file_set(&error, val))
+ log_printf(LOG_ERR, "filename: unable to open %s for logging\n", val);
+ free(val);
+ val = NULL;
+ } else
+ log_printf(LOG_DEBUG, "filename: use default built-in log file: %s\n", LOGDIR "/fenced.log");
+
+ if (ccs_get(ccsfd, "/cluster/logging/@syslog_facility", &val) == 0) {
+ facility = logsys_facility_id_get (val);
+ if (facility < 0) {
+ log_printf(LOG_ERR, "syslog_facility: unknown value\n");
+ facility = SYSLOGFACILITY;
+ }
+
+ logsys_config_facility_set ("FENCED", facility);
+ free(val);
+ val = NULL;
+ }
+
+ if(logmode & LOG_MODE_BUFFER_BEFORE_CONFIG) {
+ log_printf(LOG_DEBUG, "logsys config enabled from get_logsys_config_data\n");
+ logmode &= ~LOG_MODE_BUFFER_BEFORE_CONFIG;
+ logmode |= LOG_MODE_FLUSH_AFTER_CONFIG;
+ logsys_config_mode_set (logmode);
+ }
+
+ ccs_disconnect(ccsfd);
+
+ return 0;
+}
+
#define OUR_NAME_PATH "/cluster/clusternodes/clusternode[@name=\"%s\"]/@name"
#define GROUPD_COMPAT_PATH "/cluster/group/@groupd_compat"
#define CLEAN_START_PATH "/cluster/fence_daemon/@clean_start"
@@ -50,6 +181,10 @@ int read_ccs(struct fd *fd)
char *str;
int error, cd, i = 0, count = 0;
+ if(trylater)
+ if(get_logsys_config_data())
+ log_printf(LOG_ERR, "Unable to configure logging system\n");
+
cd = open_ccs();
if (cd < 0)
return cd;
@@ -64,7 +199,7 @@ int read_ccs(struct fd *fd)
error = ccs_get(cd, path, &str);
if (error || !str) {
- log_error("local cman node name \"%s\" not found in the "
+ log_printf(LOG_ERR, "local cman node name \"%s\" not found in the "
"configuration", our_name);
return error;
}
@@ -102,7 +237,7 @@ int read_ccs(struct fd *fd)
}
if (comline.clean_start) {
- log_debug("clean start, skipping initial nodes");
+ log_printf_debug("clean start, skipping initial nodes");
goto out;
}
@@ -120,7 +255,7 @@ int read_ccs(struct fd *fd)
count++;
}
- log_debug("added %d nodes from ccs", count);
+ log_printf_debug("added %d nodes from ccs", count);
out:
ccs_disconnect(cd);
return 0;
diff --git a/fence/fenced/cpg.c b/fence/fenced/cpg.c
index c115cc9..3a6b80f 100644
--- a/fence/fenced/cpg.c
+++ b/fence/fenced/cpg.c
@@ -12,6 +12,8 @@ struct member {
uint32_t start_flags;
};
+LOGSYS_DECLARE_SUBSYS ("FENCED", LOG_LEVEL_INFO);
+
static char *msg_name(int type)
{
switch (type) {
@@ -62,18 +64,18 @@ static int _send_message(cpg_handle_t h, void *buf, int len, int type)
retries++;
usleep(1000);
if (!(retries % 100))
- log_error("cpg_mcast_joined retry %d %s",
+ log_printf(LOG_ERR, "cpg_mcast_joined retry %d %s",
retries, msg_name(type));
goto retry;
}
if (error != CPG_OK) {
- log_error("cpg_mcast_joined error %d handle %llx %s",
+ log_printf(LOG_ERR, "cpg_mcast_joined error %d handle %llx %s",
error, (unsigned long long)h, msg_name(type));
return -1;
}
if (retries)
- log_debug("cpg_mcast_joined retried %d %s",
+ log_printf_debug("cpg_mcast_joined retried %d %s",
retries, msg_name(type));
return 0;
@@ -180,7 +182,7 @@ static void node_history_start(struct fd *fd, int nodeid)
node = get_node_history(fd, nodeid);
if (!node) {
- log_error("node_history_start no nodeid %d", nodeid);
+ log_printf(LOG_ERR, "node_history_start no nodeid %d", nodeid);
return;
}
@@ -193,7 +195,7 @@ static void node_history_left(struct fd *fd, int nodeid)
node = get_node_history(fd, nodeid);
if (!node) {
- log_error("node_history_left no nodeid %d", nodeid);
+ log_printf(LOG_ERR, "node_history_left no nodeid %d", nodeid);
return;
}
@@ -206,7 +208,7 @@ static void node_history_fail(struct fd *fd, int nodeid)
node = get_node_history(fd, nodeid);
if (!node) {
- log_error("node_history_fail no nodeid %d", nodeid);
+ log_printf(LOG_ERR, "node_history_fail no nodeid %d", nodeid);
return;
}
@@ -225,7 +227,7 @@ void node_history_fence(struct fd *fd, int nodeid, int master, int how)
node = get_node_history(fd, nodeid);
if (!node) {
- log_error("node_history_fence no nodeid %d", nodeid);
+ log_printf(LOG_ERR, "node_history_fence no nodeid %d", nodeid);
return;
}
@@ -250,7 +252,7 @@ static void node_history_fence_external(struct fd *fd, int nodeid, int from)
node = get_node_history(fd, nodeid);
if (!node) {
- log_error("node_history_fence_external no nodeid %d", nodeid);
+ log_printf(LOG_ERR, "node_history_fence_external no nodeid %d", nodeid);
return;
}
@@ -278,7 +280,7 @@ void send_external(struct fd *fd, int victim)
hd->type = FD_MSG_EXTERNAL;
hd->msgdata = victim;
- log_debug("send_external %u", victim);
+ log_printf_debug("send_external %u", victim);
fd_send_message(fd, buf, len);
@@ -292,7 +294,7 @@ void send_external(struct fd *fd, int victim)
static void receive_external(struct fd *fd, struct fd_header *hd, int len)
{
- log_debug("receive_external from %d len %d victim %d",
+ log_printf_debug("receive_external from %d len %d victim %d",
hd->nodeid, len, hd->msgdata);
node_history_fence_external(fd, hd->msgdata, hd->nodeid);
@@ -304,7 +306,7 @@ int is_fenced_external(struct fd *fd, int nodeid)
node = get_node_history(fd, nodeid);
if (!node) {
- log_error("is_fenced_external no nodeid %d", nodeid);
+ log_printf(LOG_ERR, "is_fenced_external no nodeid %d", nodeid);
return 0;
}
@@ -346,7 +348,7 @@ void send_victim_done(struct fd *fd, int victim, int how)
p[1] = cpu_to_le32(how);
p[2] = cpu_to_le32(remaining);
- log_debug("send_victim_done %u flags %x victim %d how %d remaining %d",
+ log_printf_debug("send_victim_done %u flags %x victim %d how %d remaining %d",
cg->seq, hd->flags, victim, how, remaining);
fd_send_message(fd, buf, len);
@@ -361,7 +363,7 @@ static void receive_victim_done(struct fd *fd, struct fd_header *hd, int len)
int victim, how, remaining, found;
int *nums;
- log_debug("receive_victim_done %d:%u flags %x len %d", hd->nodeid, seq,
+ log_printf_debug("receive_victim_done %d:%u flags %x len %d", hd->nodeid, seq,
hd->flags, len);
/* check that hd->nodeids is fd->master ? */
@@ -383,7 +385,7 @@ static void receive_victim_done(struct fd *fd, struct fd_header *hd, int len)
list_for_each_entry(node, &fd->victims, list) {
if (node->nodeid == victim) {
- log_debug("receive_victim_done remove %d how %d rem %d",
+ log_printf_debug("receive_victim_done remove %d how %d rem %d",
victim, how, remaining);
node_history_fence(fd, victim, hd->nodeid, how);
list_del(&node->list);
@@ -394,7 +396,7 @@ static void receive_victim_done(struct fd *fd, struct fd_header *hd, int len)
}
if (!found)
- log_debug("receive_victim_done victim %d not found from %d",
+ log_printf_debug("receive_victim_done victim %d not found from %d",
victim, hd->nodeid);
}
@@ -434,7 +436,7 @@ static void send_complete(struct fd *fd)
list_for_each_entry(memb, &cg->members, list)
p[i++] = cpu_to_le32(memb->nodeid);
- log_debug("send_complete %u counts %d %d %d %d", cg->seq,
+ log_printf_debug("send_complete %u counts %d %d %d %d", cg->seq,
cg->member_count, cg->joined_count,
cg->remove_count, cg->failed_count);
@@ -450,7 +452,7 @@ static void receive_complete(struct fd *fd, struct fd_header *hd, int len)
uint32_t seq = hd->msgdata;
struct node *node, *safe;
- log_debug("receive_complete %d:%u len %d", hd->nodeid, seq, len);
+ log_printf_debug("receive_complete %d:%u len %d", hd->nodeid, seq, len);
if (fd->init_complete)
return;
@@ -464,7 +466,7 @@ static void receive_complete(struct fd *fd, struct fd_header *hd, int len)
n_ints = 4 + member_count;
if (len < (sizeof(struct fd_header) + (n_ints * sizeof(int)))) {
- log_debug("receive_complete %d:%u bad len %d nums %s",
+ log_printf_debug("receive_complete %d:%u bad len %d nums %s",
hd->nodeid, seq, len, str_nums(nums, n_ints));
return;
}
@@ -474,7 +476,7 @@ static void receive_complete(struct fd *fd, struct fd_header *hd, int len)
break;
}
if (i == member_count) {
- log_debug("receive_complete %d:%u we are not in members",
+ log_printf_debug("receive_complete %d:%u we are not in members",
hd->nodeid, seq);
return;
}
@@ -483,7 +485,7 @@ static void receive_complete(struct fd *fd, struct fd_header *hd, int len)
/* we may have victims from init which we can clear now */
list_for_each_entry_safe(node, safe, &fd->victims, list) {
- log_debug("receive_complete clear victim %d init %d",
+ log_printf_debug("receive_complete clear victim %d init %d",
node->nodeid, node->init_victim);
list_del(&node->list);
free(node);
@@ -496,7 +498,7 @@ static int check_quorum_done(struct fd *fd)
int wait_count = 0;
if (!cman_quorate) {
- log_debug("check_quorum %d", cman_quorate);
+ log_printf_debug("check_quorum %d", cman_quorate);
return 0;
}
@@ -507,7 +509,7 @@ static int check_quorum_done(struct fd *fd)
if (!is_cman_member(node->nodeid)) {
node->check_quorum = 0;
} else {
- log_debug("check_quorum %d is_cman_member",
+ log_printf_debug("check_quorum %d is_cman_member",
node->nodeid);
wait_count++;
}
@@ -516,7 +518,7 @@ static int check_quorum_done(struct fd *fd)
if (wait_count)
return 0;
- log_debug("check_quorum done");
+ log_printf_debug("check_quorum done");
return 1;
}
@@ -540,11 +542,11 @@ static int wait_messages_done(struct fd *fd)
}
if (need) {
- log_debug("wait_messages_done need %d of %d", need, total);
+ log_printf_debug("wait_messages_done need %d of %d", need, total);
return 0;
}
- log_debug("wait_messages_done got all %d", total);
+ log_printf_debug("wait_messages_done got all %d", total);
return 1;
}
@@ -581,7 +583,7 @@ static void set_master(struct fd *fd)
complete = memb->nodeid;
}
- log_debug("set_master from %d to %s node %d", fd->master,
+ log_printf_debug("set_master from %d to %s node %d", fd->master,
complete ? "complete" : "low",
complete ? complete : low);
@@ -607,7 +609,7 @@ static int match_change(struct fd *fd, struct change *cg,
n_ints = 4 + member_count;
if (len < (sizeof(struct fd_header) + (n_ints * sizeof(int)))) {
- log_debug("match_change fail %d:%u bad len %d nums %s",
+ log_printf_debug("match_change fail %d:%u bad len %d nums %s",
hd->nodeid, seq, len, str_nums(nums, n_ints));
return 0;
}
@@ -621,14 +623,14 @@ static int match_change(struct fd *fd, struct change *cg,
break;
}
if (i == member_count) {
- log_debug("match_change fail %d:%u we are not in members",
+ log_printf_debug("match_change fail %d:%u we are not in members",
hd->nodeid, seq);
return 0;
}
memb = find_memb(cg, hd->nodeid);
if (!memb) {
- log_debug("match_change fail %d:%u sender not member",
+ log_printf_debug("match_change fail %d:%u sender not member",
hd->nodeid, seq);
return 0;
}
@@ -640,7 +642,7 @@ static int match_change(struct fd *fd, struct change *cg,
joined_count != cg->joined_count ||
remove_count != cg->remove_count ||
failed_count != cg->failed_count) {
- log_debug("match_change fail %d:%u expect counts "
+ log_printf_debug("match_change fail %d:%u expect counts "
"%d %d %d %d nums %s",
hd->nodeid, seq,
cg->member_count, cg->joined_count,
@@ -655,7 +657,7 @@ static int match_change(struct fd *fd, struct change *cg,
memb = find_memb(cg, nodeid);
if (memb)
continue;
- log_debug("match_change fail %d:%u no memb %d",
+ log_printf_debug("match_change fail %d:%u no memb %d",
hd->nodeid, seq, nodeid);
members_mismatch = 1;
}
@@ -694,7 +696,7 @@ static struct change *find_change(struct fd *fd, struct fd_header *hd, int len)
return cg;
}
- log_debug("find_change %d:%u no match", hd->nodeid, hd->msgdata);
+ log_printf_debug("find_change %d:%u no match", hd->nodeid, hd->msgdata);
return NULL;
}
@@ -715,7 +717,7 @@ static void receive_start(struct fd *fd, struct fd_header *hd, int len)
int joining = 0;
uint32_t seq = hd->msgdata;
- log_debug("receive_start %d:%u flags %x len %d", hd->nodeid, seq,
+ log_printf_debug("receive_start %d:%u flags %x len %d", hd->nodeid, seq,
hd->flags, len);
cg = find_change(fd, hd, len);
@@ -725,7 +727,7 @@ static void receive_start(struct fd *fd, struct fd_header *hd, int len)
memb = find_memb(cg, hd->nodeid);
if (!memb) {
/* this should never happen since match_change checks it */
- log_error("receive_start no member %d", hd->nodeid);
+ log_printf(LOG_ERR, "receive_start no member %d", hd->nodeid);
return;
}
@@ -735,7 +737,7 @@ static void receive_start(struct fd *fd, struct fd_header *hd, int len)
joining = 1;
if ((memb->added && !joining) || (!memb->added && joining)) {
- log_error("receive_start %d:%u disallowed added %d joining %d",
+ log_printf(LOG_ERR, "receive_start %d:%u disallowed added %d joining %d",
hd->nodeid, seq, memb->added, joining);
memb->disallowed = 1;
} else {
@@ -785,7 +787,7 @@ static void send_start(struct fd *fd)
list_for_each_entry(memb, &cg->members, list)
p[i++] = cpu_to_le32(memb->nodeid);
- log_debug("send_start %u flags %x counts %d %d %d %d", cg->seq,
+ log_printf_debug("send_start %u flags %x counts %d %d %d %d", cg->seq,
hd->flags, cg->member_count, cg->joined_count,
cg->remove_count, cg->failed_count);
@@ -826,7 +828,7 @@ static void add_victims(struct fd *fd, struct change *cg)
if (!node)
return;
list_add(&node->list, &fd->victims);
- log_debug("add node %d to victims", node->nodeid);
+ log_printf_debug("add node %d to victims", node->nodeid);
}
}
@@ -881,7 +883,7 @@ static void apply_changes(struct fd *fd)
break;
default:
- log_error("apply_changes invalid state %d", cg->state);
+ log_printf(LOG_ERR, "apply_changes invalid state %d", cg->state);
}
}
@@ -945,14 +947,14 @@ static int add_change(struct fd *fd,
else
node_history_left(fd, memb->nodeid);
- log_debug("add_change %u nodeid %d remove reason %d",
+ log_printf_debug("add_change %u nodeid %d remove reason %d",
cg->seq, memb->nodeid, left_list[i].reason);
}
for (i = 0; i < joined_list_entries; i++) {
memb = find_memb(cg, joined_list[i].nodeid);
if (!memb) {
- log_error("no member %d", joined_list[i].nodeid);
+ log_printf(LOG_ERR, "no member %d", joined_list[i].nodeid);
error = -ENOENT;
goto fail;
}
@@ -963,7 +965,7 @@ static int add_change(struct fd *fd,
else
node_history_init(fd, memb->nodeid);
- log_debug("add_change %u nodeid %d joined", cg->seq,
+ log_printf_debug("add_change %u nodeid %d joined", cg->seq,
memb->nodeid);
}
@@ -971,7 +973,7 @@ static int add_change(struct fd *fd,
list_for_each_entry(memb, &cg->members, list)
node_history_init(fd, memb->nodeid);
- log_debug("add_change %u member %d joined %d remove %d failed %d",
+ log_printf_debug("add_change %u member %d joined %d remove %d failed %d",
cg->seq, cg->member_count, cg->joined_count, cg->remove_count,
cg->failed_count);
@@ -980,7 +982,7 @@ static int add_change(struct fd *fd,
return 0;
fail_nomem:
- log_error("no memory");
+ log_printf(LOG_ERR, "no memory");
error = -ENOMEM;
fail:
free_cg(cg);
@@ -1002,7 +1004,7 @@ static void add_victims_init(struct fd *fd, struct change *cg)
!is_victim(fd, node->nodeid)) {
node->init_victim = 1;
list_add(&node->list, &fd->victims);
- log_debug("add_victims_init %d", node->nodeid);
+ log_printf_debug("add_victims_init %d", node->nodeid);
} else {
free(node);
}
@@ -1031,7 +1033,7 @@ static void confchg_cb(cpg_handle_t handle, struct cpg_name *group_name,
fd = find_fd_handle(handle);
if (!fd) {
- log_error("confchg_cb no fence domain for cpg %s",
+ log_printf(LOG_ERR, "confchg_cb no fence domain for cpg %s",
group_name->value);
return;
}
@@ -1039,7 +1041,7 @@ static void confchg_cb(cpg_handle_t handle, struct cpg_name *group_name,
if (fd->leaving_group && we_left(left_list, left_list_entries)) {
/* we called cpg_leave(), and this should be the final
cpg callback we receive */
- log_debug("confchg for our leave");
+ log_printf_debug("confchg for our leave");
cpg_finalize(fd->cpg_handle);
client_dead(fd->cpg_client);
list_del(&fd->list);
@@ -1074,7 +1076,7 @@ static void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name,
fd = find_fd_handle(handle);
if (!fd) {
- log_error("deliver_cb no fd for cpg %s", group_name->value);
+ log_printf(LOG_ERR, "deliver_cb no fd for cpg %s", group_name->value);
return;
}
@@ -1091,7 +1093,7 @@ static void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name,
hd->msgdata = le32_to_cpu(hd->msgdata);
if (hd->version[0] != protocol_active[0]) {
- log_error("reject message from %d version %u.%u.%u vs %u.%u.%u",
+ log_printf(LOG_ERR, "reject message from %d version %u.%u.%u vs %u.%u.%u",
nodeid, hd->version[0], hd->version[1],
hd->version[2], protocol_active[0],
protocol_active[1], protocol_active[2]);
@@ -1099,7 +1101,7 @@ static void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name,
}
if (hd->nodeid != nodeid) {
- log_error("bad msg nodeid %d %d", hd->nodeid, nodeid);
+ log_printf(LOG_ERR, "bad msg nodeid %d %d", hd->nodeid, nodeid);
return;
}
@@ -1117,7 +1119,7 @@ static void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name,
receive_external(fd, hd, len);
break;
default:
- log_error("unknown msg type %d", hd->type);
+ log_printf(LOG_ERR, "unknown msg type %d", hd->type);
}
}
@@ -1133,13 +1135,13 @@ static void process_fd_cpg(int ci)
fd = find_fd_ci(ci);
if (!fd) {
- log_error("process_fd_cpg no fence domain for ci %d", ci);
+ log_printf(LOG_ERR, "process_fd_cpg no fence domain for ci %d", ci);
return;
}
error = cpg_dispatch(fd->cpg_handle, CPG_DISPATCH_ALL);
if (error != CPG_OK) {
- log_error("cpg_dispatch error %d", error);
+ log_printf(LOG_ERR, "cpg_dispatch error %d", error);
return;
}
@@ -1155,7 +1157,7 @@ int fd_join(struct fd *fd)
error = cpg_initialize(&h, &cpg_callbacks);
if (error != CPG_OK) {
- log_error("cpg_initialize error %d", error);
+ log_printf(LOG_ERR, "cpg_initialize error %d", error);
goto fail_free;
}
@@ -1178,11 +1180,11 @@ int fd_join(struct fd *fd)
if (error == CPG_ERR_TRY_AGAIN) {
sleep(1);
if (!(++i % 10))
- log_error("cpg_join error retrying");
+ log_printf(LOG_ERR, "cpg_join error retrying");
goto retry;
}
if (error != CPG_OK) {
- log_error("cpg_join error %d", error);
+ log_printf(LOG_ERR, "cpg_join error %d", error);
cpg_finalize(h);
goto fail;
}
@@ -1215,11 +1217,11 @@ int fd_leave(struct fd *fd)
if (error == CPG_ERR_TRY_AGAIN) {
sleep(1);
if (!(++i % 10))
- log_error("cpg_leave error retrying");
+ log_printf(LOG_ERR, "cpg_leave error retrying");
goto retry;
}
if (error != CPG_OK)
- log_error("cpg_leave error %d", error);
+ log_printf(LOG_ERR, "cpg_leave error %d", error);
return 0;
}
diff --git a/fence/fenced/fd.h b/fence/fenced/fd.h
index 5ef1756..802d29c 100644
--- a/fence/fenced/fd.h
+++ b/fence/fenced/fd.h
@@ -10,7 +10,6 @@
#include <errno.h>
#include <string.h>
#include <stdint.h>
-#include <syslog.h>
#include <time.h>
#include <sched.h>
#include <sys/ioctl.h>
@@ -24,6 +23,7 @@
#include <openais/saAis.h>
#include <openais/cpg.h>
+#include <openais/service/logsys.h>
#include "list.h"
#include "linux_endian.h"
@@ -58,6 +58,7 @@
#define GROUP_LIBCPG 3
extern int daemon_debug_opt;
+extern int daemon_fork;
extern int daemon_quit;
extern struct list_head domains;
extern int cman_quorate;
@@ -68,20 +69,15 @@ extern char dump_buf[FENCED_DUMP_SIZE];
extern int dump_point;
extern int dump_wrap;
extern int group_mode;
+extern int trylater;
extern void daemon_dump_save(void);
-#define log_debug(fmt, args...) \
+#define log_printf_debug(fmt, args...) \
do { \
snprintf(daemon_debug_buf, 255, "%ld " fmt "\n", time(NULL), ##args); \
- if (daemon_debug_opt) fprintf(stderr, "%s", daemon_debug_buf); \
daemon_dump_save(); \
-} while (0)
-
-#define log_error(fmt, args...) \
-do { \
- log_debug(fmt, ##args); \
- syslog(LOG_ERR, fmt, ##args); \
+ log_printf(LOG_DEBUG, fmt, ##args); \
} while (0)
/* config option defaults */
@@ -246,6 +242,7 @@ void free_fd(struct fd *fd);
struct fd *find_fd(char *name);
void query_lock(void);
void query_unlock(void);
+int get_logsys_config_data(void);
/* member_cman.c */
diff --git a/fence/fenced/group.c b/fence/fenced/group.c
index 5f8f08a..eb43bd5 100644
--- a/fence/fenced/group.c
+++ b/fence/fenced/group.c
@@ -21,6 +21,7 @@ static int cb_type;
static int cb_member_count;
static int cb_members[MAX_NODES];
+LOGSYS_DECLARE_SUBSYS ("FENCED", LOG_LEVEL_INFO);
static void stop_cbfn(group_handle_t h, void *private, char *name)
{
@@ -169,13 +170,13 @@ static void _add_first_victims(struct fd *fd)
/* complete list initialised in init_nodes() to all nodes from ccs */
if (list_empty(&fd->complete))
- log_debug("first complete list empty warning");
+ log_printf_debug("first complete list empty warning");
list_for_each_entry_safe(prev_node, safe, &fd->complete, list) {
if (!is_cman_member(prev_node->nodeid)) {
list_del(&prev_node->list);
list_add(&prev_node->list, &fd->victims);
- log_debug("add first victim %s", prev_node->name);
+ log_printf_debug("add first victim %s", prev_node->name);
prev_node->init_victim = 1;
}
}
@@ -196,7 +197,7 @@ static void _add_victims(struct fd *fd, int start_type, int member_count,
list_add(&node->list, &fd->complete);
else {
list_add(&node->list, &fd->victims);
- log_debug("add victim %u, was leaving",
+ log_printf_debug("add victim %u, was leaving",
node->nodeid);
}
}
@@ -206,7 +207,7 @@ static void _add_victims(struct fd *fd, int start_type, int member_count,
* to victims list or leaving list, depending on the type of start. */
if (list_empty(&fd->complete))
- log_debug("complete list empty warning");
+ log_printf_debug("complete list empty warning");
list_for_each_entry_safe(node, safe, &fd->complete, list) {
if (!id_in_nodeids(node->nodeid, member_count, nodeids)) {
@@ -217,7 +218,7 @@ static void _add_victims(struct fd *fd, int start_type, int member_count,
else
list_add(&node->list, &fd->leaving);
- log_debug("add node %u to list %u", node->nodeid,
+ log_printf_debug("add node %u to list %u", node->nodeid,
start_type);
}
}
@@ -231,7 +232,7 @@ static void add_victims(struct fd *fd, int start_type, int member_count,
* start/stop/start immediately upon joining. */
if (!fd->last_finish && fd->last_stop) {
- log_debug("revert aborted first start");
+ log_printf_debug("revert aborted first start");
fd->last_stop = 0;
fd->first_recovery = 0;
free_node_list(&fd->prev);
@@ -239,7 +240,7 @@ static void add_victims(struct fd *fd, int start_type, int member_count,
free_node_list(&fd->leaving);
}
- log_debug("add_victims stop %d start %d finish %d",
+ log_printf_debug("add_victims stop %d start %d finish %d",
fd->last_stop, fd->last_start, fd->last_finish);
if (!fd->first_recovery) {
@@ -294,13 +295,13 @@ void process_groupd(int ci)
switch (cb_action) {
case DO_STOP:
- log_debug("stop %s", cb_name);
+ log_printf_debug("stop %s", cb_name);
fd->last_stop = fd->last_start;
group_stop_done(gh, cb_name);
break;
case DO_START:
- log_debug("start %s %d members %s", cb_name, cb_event_nr,
+ log_printf_debug("start %s %d members %s", cb_name, cb_event_nr,
str_members());
fd->last_start = cb_event_nr;
@@ -320,7 +321,7 @@ void process_groupd(int ci)
break;
case DO_FINISH:
- log_debug("finish %s %d", cb_name, cb_event_nr);
+ log_printf_debug("finish %s %d", cb_name, cb_event_nr);
fd->last_finish = cb_event_nr;
/* we get terminate callback when all have started, which means
@@ -330,9 +331,9 @@ void process_groupd(int ci)
break;
case DO_TERMINATE:
- log_debug("terminate %s", cb_name);
+ log_printf_debug("terminate %s", cb_name);
if (!fd->leaving_group)
- log_error("process_groupd terminate not leaving");
+ log_printf(LOG_ERR, "process_groupd terminate not leaving");
list_del(&fd->list);
free_fd(fd);
break;
@@ -354,12 +355,12 @@ int setup_groupd(void)
gh = group_init(NULL, "fence", 0, &callbacks, GROUPD_TIMEOUT);
if (!gh) {
- log_error("group_init error %p %d", gh, errno);
+ log_printf(LOG_ERR, "group_init error %p %d", gh, errno);
return -ENOTCONN;
}
rv = group_get_fd(gh);
if (rv < 0)
- log_error("group_get_fd error %d %d", rv, errno);
+ log_printf(LOG_ERR, "group_get_fd error %d %d", rv, errno);
return rv;
}
@@ -379,7 +380,7 @@ int fd_join_group(struct fd *fd)
rv = group_join(gh, fd->name);
if (rv) {
- log_error("group_join error %d", rv);
+ log_printf(LOG_ERR, "group_join error %d", rv);
list_del(&fd->list);
free(fd);
}
@@ -394,7 +395,7 @@ int fd_leave_group(struct fd *fd)
rv = group_leave(gh, fd->name);
if (rv)
- log_error("group_leave error %d", rv);
+ log_printf(LOG_ERR, "group_leave error %d", rv);
return rv;
}
diff --git a/fence/fenced/main.c b/fence/fenced/main.c
index 83ca075..7048afa 100644
--- a/fence/fenced/main.c
+++ b/fence/fenced/main.c
@@ -18,6 +18,13 @@ struct client {
void *deadfn;
};
+LOGSYS_DECLARE_SYSTEM (NULL,
+ LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_OUTPUT_FILE | LOG_MODE_BUFFER_BEFORE_CONFIG,
+ LOGDIR "/fenced.log",
+ SYSLOGFACILITY);
+
+LOGSYS_DECLARE_SUBSYS ("FENCED", LOG_LEVEL_INFO);
+
static int do_read(int fd, void *buf, size_t count)
{
int rv, off = 0;
@@ -68,10 +75,10 @@ static void client_alloc(void)
pollfd = realloc(pollfd, (client_size + CLIENT_NALLOC) *
sizeof(struct pollfd));
if (!pollfd)
- log_error("can't alloc for pollfd");
+ log_printf(LOG_ERR, "can't alloc for pollfd");
}
if (!client || !pollfd)
- log_error("can't alloc for client array");
+ log_printf(LOG_ERR, "can't alloc for client array");
for (i = client_size; i < client_size + CLIENT_NALLOC; i++) {
client[i].workfn = NULL;
@@ -191,7 +198,7 @@ static int do_join(char *name)
fd = find_fd(name);
if (fd) {
- log_debug("join error: domain %s exists", name);
+ log_printf_debug("join error: domain %s exists", name);
rv = -EEXIST;
goto out;
}
@@ -406,17 +413,17 @@ static void process_connection(int ci)
rv = do_read(client[ci].fd, &h, sizeof(h));
if (rv < 0) {
- log_debug("connection %d read error %d", ci, rv);
+ log_printf_debug("connection %d read error %d", ci, rv);
goto out;
}
if (h.magic != FENCED_MAGIC) {
- log_debug("connection %d magic error %x", ci, h.magic);
+ log_printf_debug("connection %d magic error %x", ci, h.magic);
goto out;
}
if ((h.version & 0xFFFF0000) != (FENCED_VERSION & 0xFFFF0000)) {
- log_debug("connection %d version error %x", ci, h.version);
+ log_printf_debug("connection %d version error %x", ci, h.version);
goto out;
}
@@ -424,14 +431,14 @@ static void process_connection(int ci)
extra_len = h.len - sizeof(h);
extra = malloc(extra_len);
if (!extra) {
- log_error("process_connection no mem %d", extra_len);
+ log_printf(LOG_ERR, "process_connection no mem %d", extra_len);
goto out;
}
memset(extra, 0, extra_len);
rv = do_read(client[ci].fd, extra, extra_len);
if (rv < 0) {
- log_debug("connection %d extra read error %d", ci, rv);
+ log_printf_debug("connection %d extra read error %d", ci, rv);
goto out;
}
}
@@ -450,10 +457,10 @@ static void process_connection(int ci)
case FENCED_CMD_NODE_INFO:
case FENCED_CMD_DOMAIN_INFO:
case FENCED_CMD_DOMAIN_NODES:
- log_error("process_connection query on wrong socket");
+ log_printf(LOG_ERR, "process_connection query on wrong socket");
break;
default:
- log_error("process_connection %d unknown command %d",
+ log_printf(LOG_ERR, "process_connection %d unknown command %d",
ci, h.command);
}
out:
@@ -468,13 +475,13 @@ static void process_listener(int ci)
fd = accept(client[ci].fd, NULL, NULL);
if (fd < 0) {
- log_error("process_listener: accept error %d %d", fd, errno);
+ log_printf(LOG_ERR, "process_listener: accept error %d %d", fd, errno);
return;
}
i = client_add(fd, process_connection, NULL);
- log_debug("client connection %d fd %d", i, fd);
+ log_printf_debug("client connection %d fd %d", i, fd);
}
static int setup_listener(char *sock_path)
@@ -487,7 +494,7 @@ static int setup_listener(char *sock_path)
s = socket(AF_LOCAL, SOCK_STREAM, 0);
if (s < 0) {
- log_error("socket error %d %d", s, errno);
+ log_printf(LOG_ERR, "socket error %d %d", s, errno);
return s;
}
@@ -498,14 +505,14 @@ static int setup_listener(char *sock_path)
rv = bind(s, (struct sockaddr *) &addr, addrlen);
if (rv < 0) {
- log_error("bind error %d %d", rv, errno);
+ log_printf(LOG_ERR, "bind error %d %d", rv, errno);
close(s);
return rv;
}
rv = listen(s, 5);
if (rv < 0) {
- log_error("listen error %d %d", rv, errno);
+ log_printf(LOG_ERR, "listen error %d %d", rv, errno);
close(s);
return rv;
}
@@ -586,7 +593,7 @@ static int setup_queries(void)
rv = pthread_create(&query_thread, NULL, process_queries, &s);
if (rv < 0) {
- log_error("can't create query thread");
+ log_printf(LOG_ERR, "can't create query thread");
close(s);
return rv;
}
@@ -595,7 +602,7 @@ static int setup_queries(void)
static void cluster_dead(int ci)
{
- log_error("cluster is down, exiting");
+ log_printf(LOG_ERR, "cluster is down, exiting");
exit(1);
}
@@ -654,7 +661,7 @@ static int loop(void)
continue;
}
if (rv < 0) {
- log_error("poll errno %d", errno);
+ log_printf(LOG_ERR, "poll errno %d", errno);
goto out;
}
@@ -763,6 +770,7 @@ static void read_arguments(int argc, char **argv)
case 'D':
daemon_debug_opt = 1;
+ daemon_fork = 1;
break;
case 'g':
@@ -854,16 +862,24 @@ int main(int argc, char **argv)
read_arguments(argc, argv);
+ if (daemon_debug_opt)
+ logsys_config_priority_set (LOG_LEVEL_DEBUG);
+
+ trylater = get_logsys_config_data();
+
+ if (trylater)
+ logsys_config_mode_set (LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_OUTPUT_FILE | LOG_MODE_FLUSH_AFTER_CONFIG);
+
lockfile();
- if (!daemon_debug_opt) {
+ if (!daemon_fork) {
if (daemon(0, 0) < 0) {
- perror("main: cannot fork");
+ log_printf(LOG_ERR, "main: cannot fork");
exit(EXIT_FAILURE);
}
umask(0);
}
- openlog("fenced", LOG_PID, LOG_DAEMON);
+
signal(SIGTERM, sigterm_handler);
set_oom_adj(-16);
@@ -888,6 +904,7 @@ void daemon_dump_save(void)
}
int daemon_debug_opt;
+int daemon_fork = 0;
int daemon_quit;
struct list_head domains;
int cman_quorate;
@@ -899,4 +916,4 @@ int dump_point;
int dump_wrap;
int group_mode;
struct commandline comline;
-
+int trylater = 0;
diff --git a/fence/fenced/member_cman.c b/fence/fenced/member_cman.c
index e85fcb6..6ac6e1e 100644
--- a/fence/fenced/member_cman.c
+++ b/fence/fenced/member_cman.c
@@ -7,6 +7,7 @@ static cman_handle_t ch;
static cman_node_t cman_nodes[MAX_NODES];
static int cman_node_count;
+LOGSYS_DECLARE_SUBSYS ("FENCED", LOG_LEVEL_INFO);
static int name_equal(char *name1, char *name2)
{
@@ -99,7 +100,7 @@ static void statechange(void)
rv = cman_get_nodes(ch, MAX_NODES, &cman_node_count, cman_nodes);
if (rv < 0)
- log_error("cman_get_nodes error %d %d", rv, errno);
+ log_printf(LOG_ERR, "cman_get_nodes error %d %d", rv, errno);
}
static void cman_callback(cman_handle_t h, void *private, int reason, int arg)
@@ -111,7 +112,7 @@ static void cman_callback(cman_handle_t h, void *private, int reason, int arg)
if (list_empty(&domains))
cman_replyto_shutdown(ch, 1);
else {
- log_debug("no to cman shutdown");
+ log_printf_debug("no to cman shutdown");
cman_replyto_shutdown(ch, 0);
}
break;
@@ -131,7 +132,7 @@ void process_cman(int ci)
rv = cman_dispatch(ch, CMAN_DISPATCH_ALL);
if (rv == -1 && errno == EHOSTDOWN) {
- log_error("cluster is down, exiting");
+ log_printf(LOG_ERR, "cluster is down, exiting");
exit(1);
}
}
@@ -143,13 +144,13 @@ int setup_cman(void)
ch = cman_init(NULL);
if (!ch) {
- log_error("cman_init error %p %d", ch, errno);
+ log_printf(LOG_ERR, "cman_init error %p %d", ch, errno);
return -ENOTCONN;
}
rv = cman_start_notification(ch, cman_callback);
if (rv < 0) {
- log_error("cman_start_notification error %d %d", rv, errno);
+ log_printf(LOG_ERR, "cman_start_notification error %d %d", rv, errno);
cman_finish(ch);
return rv;
}
@@ -162,7 +163,7 @@ int setup_cman(void)
memset(&node, 0, sizeof(node));
rv = cman_get_node(ch, CMAN_NODEID_US, &node);
if (rv < 0) {
- log_error("cman_get_node us error %d %d", rv, errno);
+ log_printf(LOG_ERR, "cman_get_node us error %d %d", rv, errno);
cman_finish(ch);
fd = rv;
goto out;
@@ -172,7 +173,7 @@ int setup_cman(void)
strncpy(our_name, node.cn_name, CMAN_MAX_NODENAME_LEN);
our_nodeid = node.cn_nodeid;
- log_debug("our_nodeid %d our_name %s", our_nodeid, our_name);
+ log_printf_debug("our_nodeid %d our_name %s", our_nodeid, our_name);
out:
return fd;
}
@@ -196,7 +197,7 @@ int is_cman_member(int nodeid)
if (cn && cn->cn_member)
return 1;
- log_debug("node %d not a cman member, cn %d", nodeid, cn ? 1 : 0);
+ log_printf_debug("node %d not a cman member, cn %d", nodeid, cn ? 1 : 0);
return 0;
}
@@ -216,7 +217,7 @@ struct node *get_new_node(struct fd *fd, int nodeid)
memset(&cn, 0, sizeof(cn));
rv = cman_get_node(ch, nodeid, &cn);
if (rv < 0)
- log_debug("get_new_node %d no cman node %d", nodeid, rv);
+ log_printf_debug("get_new_node %d no cman node %d", nodeid, rv);
else
strncpy(node->name, cn.cn_name, MAX_NODENAME_LEN);
diff --git a/fence/fenced/recover.c b/fence/fenced/recover.c
index 21bf735..55d1a12 100644
--- a/fence/fenced/recover.c
+++ b/fence/fenced/recover.c
@@ -1,5 +1,7 @@
#include "fd.h"
+LOGSYS_DECLARE_SUBSYS ("FENCED", LOG_LEVEL_INFO);
+
void free_node_list(struct list_head *head)
{
struct node *node;
@@ -62,7 +64,7 @@ static int reduce_victims(struct fd *fd)
list_for_each_entry_safe(node, safe, &fd->victims, list) {
if (is_cman_member(node->nodeid)) {
- log_debug("reduce victim %s", node->name);
+ log_printf_debug("reduce victim %s", node->name);
victim_done(fd, node->nodeid, VIC_DONE_MEMBER);
list_del(&node->list);
free(node);
@@ -116,7 +118,7 @@ static int check_override(int ofd, char *nodename, int timeout)
ret = select(ofd + 1, &rfds, NULL, NULL, &tv);
if (ret < 0) {
- syslog(LOG_ERR, "select: %s\n", strerror(errno));
+ log_printf(LOG_ERR, "select: %s\n", strerror(errno));
return -1;
}
@@ -126,7 +128,7 @@ static int check_override(int ofd, char *nodename, int timeout)
memset(buf, 0, sizeof(buf));
ret = read(ofd, buf, sizeof(buf) - 1);
if (ret < 0) {
- syslog(LOG_ERR, "read: %s\n", strerror(errno));
+ log_printf(LOG_ERR, "read: %s\n", strerror(errno));
return -1;
}
@@ -208,11 +210,11 @@ void delay_fencing(struct fd *fd, int node_join)
gettimeofday(&last, NULL);
- log_debug("delay of %ds leaves %d victims",
+ log_printf_debug("delay of %ds leaves %d victims",
(int) (last.tv_sec - first.tv_sec), victim_count);
out:
list_for_each_entry(node, &fd->victims, list) {
- syslog(LOG_INFO, "%s not a cluster member after %d sec %s",
+ log_printf(LOG_INFO, "%s not a cluster member after %d sec %s",
node->name, delay, delay_type);
}
}
@@ -226,8 +228,8 @@ void defer_fencing(struct fd *fd)
master_name = nodeid_to_name(fd->master);
- log_debug("defer fencing to %d %s", fd->master, master_name);
- syslog(LOG_INFO, "fencing deferred to %s", master_name);
+ log_printf_debug("defer fencing to %d %s", fd->master, master_name);
+ log_printf(LOG_INFO, "fencing deferred to %s", master_name);
}
void fence_victims(struct fd *fd)
@@ -247,7 +249,7 @@ void fence_victims(struct fd *fd)
fenced = 0;
if (member || fenced) {
- log_debug("averting fence of node %s "
+ log_printf_debug("averting fence of node %s "
"member %d external %d",
node->name, member, fenced);
victim_done(fd, node->nodeid, member ? VIC_DONE_MEMBER :
@@ -257,14 +259,14 @@ void fence_victims(struct fd *fd)
continue;
}
- log_debug("fencing node %s", node->name);
- syslog(LOG_INFO, "fencing node \"%s\"", node->name);
+ log_printf_debug("fencing node %s", node->name);
+ log_printf(LOG_INFO, "fencing node \"%s\"", node->name);
query_unlock();
error = fence_node(node->name);
query_lock();
- syslog(LOG_INFO, "fence \"%s\" %s", node->name,
+ log_printf(LOG_INFO, "fence \"%s\" %s", node->name,
error ? "failed" : "success");
if (!error) {
@@ -286,7 +288,7 @@ void fence_victims(struct fd *fd)
override = open_override(comline.override_path);
if (check_override(override, node->name,
comline.override_time) > 0) {
- syslog(LOG_WARNING, "fence \"%s\" overridden by "
+ log_printf(LOG_WARNING, "fence \"%s\" overridden by "
"administrator intervention", node->name);
victim_done(fd, node->nodeid, VIC_DONE_OVERRIDE);
list_del(&node->list);
hooks/post-receive
--
Cluster Project
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Cluster-devel] logsys in fenced
2008-06-25 4:25 [Cluster-devel] Cluster Project branch, master, updated. cluster-2.99.05-9-g95a5c6b fabbione
@ 2008-06-25 14:43 ` David Teigland
2008-06-25 14:53 ` Christine Caulfield
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: David Teigland @ 2008-06-25 14:43 UTC (permalink / raw)
To: cluster-devel.redhat.com
> commit 95a5c6b13294742956b13070ebc4f4513278255f
> Author: Fabio M. Di Nitto <fdinitto@redhat.com>
> Date: Wed Jun 25 06:24:11 2008 +0200
>
> [FENCE] fenced: separate concept of fork and debugging
>
> allow fenced to fork when debugging is set from the configuration
> or the system will hang at boot.
>
> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
>
> commit da704715c606c9c01637ae53d79f8dec6a8b0389
> Author: Fabio M. Di Nitto <fdinitto@redhat.com>
> Date: Wed Jun 25 05:19:35 2008 +0200
>
> [FENCE] Allow fenced to configure logsys
>
> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
>
> commit 18e085596bb8844f74689a92662f2e5e9166836b
> Author: Fabio M. Di Nitto <fdinitto@redhat.com>
> Date: Wed Jun 25 04:49:41 2008 +0200
>
> [FENCE] Move logsys configuration calls where they belong
>
> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
>
> commit c54c56c5a09f98547ceda3bc5fa9afa28b354480
> Author: Fabio M. Di Nitto <fdinitto@redhat.com>
> Date: Wed Jun 25 04:23:20 2008 +0200
>
> [FENCE] Make fenced ready to load logsys config
>
> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
>
> commit cf4c7ebac813b0b607acf6cf74bbdddfc8cfb12a
> Author: Fabio M. Di Nitto <fdinitto@redhat.com>
> Date: Tue Jun 24 14:34:35 2008 +0200
>
> [FENCE] Start porting fenced to logsys
>
> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
OK, I'm fine with replacing the use of syslog with logsys, but this goes
beyond that. Here are the problems I see:
. Leave log_debug() unchanged, and leave the meaning/effect of -D unchanged.
syslog/logsys are about logging to files. The debug "logging" I use is
about logging to either an in-memory buffer or to stderr; syslog/logsys
are not relevant to that.
. Change log_error() to use logsys instead of syslog, i.e. don't change
the existing log_error() call sites.
#define log_error(fmt, args...) \
do { \
log_debug(fmt, ##args); \
- syslog(LOG_ERR, fmt, ##args); \
+ log_printf(LOG_ERR, fmt, ##args); \
} while (0)
. Finally, one gripe with logsys itself. Here's syslog initialization:
openlog("fenced", LOG_PID, LOG_DAEMON);
Compare with logsys initialization:
LOGSYS_DECLARE_SYSTEM (NULL,
LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED |
LOG_MODE_OUTPUT_FILE | LOG_MODE_BUFFER_BEFORE_CONFIG,
LOGDIR "/fenced.log",
SYSLOGFACILITY);
LOGSYS_DECLARE_SUBSYS ("FENCED", LOG_LEVEL_INFO);
...
logsys_config_mode_set(LOG_MODE_OUTPUT_STDERR |
LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_OUTPUT_FILE |
LOG_MODE_FLUSH_AFTER_CONFIG);
... and at the start of every other file:
LOGSYS_DECLARE_SUBSYS ("FENCED", LOG_LEVEL_INFO);
This really gets out of hand. I'd like to see the initialization wrapped
into a single function call, and the macros at the start of every file
unnecessary.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Cluster-devel] logsys in fenced
2008-06-25 14:43 ` [Cluster-devel] logsys in fenced David Teigland
@ 2008-06-25 14:53 ` Christine Caulfield
2008-06-25 15:55 ` David Teigland
2008-06-25 16:12 ` Steven Dake
2008-06-25 16:19 ` Fabio M. Di Nitto
2 siblings, 1 reply; 9+ messages in thread
From: Christine Caulfield @ 2008-06-25 14:53 UTC (permalink / raw)
To: cluster-devel.redhat.com
David Teigland wrote:
>> commit 95a5c6b13294742956b13070ebc4f4513278255f
>> Author: Fabio M. Di Nitto <fdinitto@redhat.com>
>> Date: Wed Jun 25 06:24:11 2008 +0200
>>
>> [FENCE] fenced: separate concept of fork and debugging
>>
>> allow fenced to fork when debugging is set from the configuration
>> or the system will hang at boot.
>>
>> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
>>
>> commit da704715c606c9c01637ae53d79f8dec6a8b0389
>> Author: Fabio M. Di Nitto <fdinitto@redhat.com>
>> Date: Wed Jun 25 05:19:35 2008 +0200
>>
>> [FENCE] Allow fenced to configure logsys
>>
>> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
>>
>> commit 18e085596bb8844f74689a92662f2e5e9166836b
>> Author: Fabio M. Di Nitto <fdinitto@redhat.com>
>> Date: Wed Jun 25 04:49:41 2008 +0200
>>
>> [FENCE] Move logsys configuration calls where they belong
>>
>> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
>>
>> commit c54c56c5a09f98547ceda3bc5fa9afa28b354480
>> Author: Fabio M. Di Nitto <fdinitto@redhat.com>
>> Date: Wed Jun 25 04:23:20 2008 +0200
>>
>> [FENCE] Make fenced ready to load logsys config
>>
>> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
>>
>> commit cf4c7ebac813b0b607acf6cf74bbdddfc8cfb12a
>> Author: Fabio M. Di Nitto <fdinitto@redhat.com>
>> Date: Tue Jun 24 14:34:35 2008 +0200
>>
>> [FENCE] Start porting fenced to logsys
>>
>> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
>
> OK, I'm fine with replacing the use of syslog with logsys, but this goes
> beyond that. Here are the problems I see:
>
>
> . Leave log_debug() unchanged, and leave the meaning/effect of -D unchanged.
> syslog/logsys are about logging to files. The debug "logging" I use is
> about logging to either an in-memory buffer or to stderr; syslog/logsys
> are not relevant to that.
But isn't the point of logsys to centralise all our logging so the user
can say whether it goes to stderr, a file or syslog. and that it all
uses the same code so it's easy to tell users how to redirect it as they
want.
Having a few exceptions that always log to stderr is just confusing and
defeats the point of having a common system.
>
> . Change log_error() to use logsys instead of syslog, i.e. don't change
> the existing log_error() call sites.
>
> #define log_error(fmt, args...) \
> do { \
> log_debug(fmt, ##args); \
> - syslog(LOG_ERR, fmt, ##args); \
> + log_printf(LOG_ERR, fmt, ##args); \
> } while (0)
So then we have a do {} while macro whose only purpose is to simply
change the name of a function call. Now THAT's surely ugly and pointless.
--
Chrissie
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Cluster-devel] logsys in fenced
2008-06-25 14:53 ` Christine Caulfield
@ 2008-06-25 15:55 ` David Teigland
0 siblings, 0 replies; 9+ messages in thread
From: David Teigland @ 2008-06-25 15:55 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Wed, Jun 25, 2008 at 03:53:58PM +0100, Christine Caulfield wrote:
> >. Leave log_debug() unchanged, and leave the meaning/effect of -D
> >unchanged.
> > syslog/logsys are about logging to files. The debug "logging" I use is
> > about logging to either an in-memory buffer or to stderr; syslog/logsys
> > are not relevant to that.
>
> But isn't the point of logsys to centralise all our logging so the user
> can say whether it goes to stderr, a file or syslog. and that it all
> uses the same code so it's easy to tell users how to redirect it as they
> want.
To a file or syslog yes. Re stderr, I don't think you understand how the
stderr output is used. When you run "fenced -D", the daemon is run in the
foreground and all debug output goes to stderr. foreground and
debug-to-stderr always go together, and it's always an inherently manual
process, always done explicitly from the command line, always done on the
individual programs you want to observe. This is the *manual debugging
process* we're talking about here.
> >. Change log_error() to use logsys instead of syslog, i.e. don't change
> > the existing log_error() call sites.
> >
> > #define log_error(fmt, args...) \
> > do { \
> > log_debug(fmt, ##args); \
> > - syslog(LOG_ERR, fmt, ##args); \
> > + log_printf(LOG_ERR, fmt, ##args); \
> > } while (0)
>
> So then we have a do {} while macro whose only purpose is to simply
> change the name of a function call. Now THAT's surely ugly and pointless.
No, I count four separate things the log_error macro does (including the
name change).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Cluster-devel] logsys in fenced
2008-06-25 14:43 ` [Cluster-devel] logsys in fenced David Teigland
2008-06-25 14:53 ` Christine Caulfield
@ 2008-06-25 16:12 ` Steven Dake
2008-06-25 16:19 ` Fabio M. Di Nitto
2 siblings, 0 replies; 9+ messages in thread
From: Steven Dake @ 2008-06-25 16:12 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Wed, 2008-06-25 at 09:43 -0500, David Teigland wrote:
> > commit 95a5c6b13294742956b13070ebc4f4513278255f
> > Author: Fabio M. Di Nitto <fdinitto@redhat.com>
> > Date: Wed Jun 25 06:24:11 2008 +0200
> >
> > [FENCE] fenced: separate concept of fork and debugging
> >
> > allow fenced to fork when debugging is set from the configuration
> > or the system will hang at boot.
> >
> > Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
> >
> > commit da704715c606c9c01637ae53d79f8dec6a8b0389
> > Author: Fabio M. Di Nitto <fdinitto@redhat.com>
> > Date: Wed Jun 25 05:19:35 2008 +0200
> >
> > [FENCE] Allow fenced to configure logsys
> >
> > Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
> >
> > commit 18e085596bb8844f74689a92662f2e5e9166836b
> > Author: Fabio M. Di Nitto <fdinitto@redhat.com>
> > Date: Wed Jun 25 04:49:41 2008 +0200
> >
> > [FENCE] Move logsys configuration calls where they belong
> >
> > Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
> >
> > commit c54c56c5a09f98547ceda3bc5fa9afa28b354480
> > Author: Fabio M. Di Nitto <fdinitto@redhat.com>
> > Date: Wed Jun 25 04:23:20 2008 +0200
> >
> > [FENCE] Make fenced ready to load logsys config
> >
> > Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
> >
> > commit cf4c7ebac813b0b607acf6cf74bbdddfc8cfb12a
> > Author: Fabio M. Di Nitto <fdinitto@redhat.com>
> > Date: Tue Jun 24 14:34:35 2008 +0200
> >
> > [FENCE] Start porting fenced to logsys
> >
> > Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
>
> OK, I'm fine with replacing the use of syslog with logsys, but this goes
> beyond that. Here are the problems I see:
>
>
> . Leave log_debug() unchanged, and leave the meaning/effect of -D unchanged.
> syslog/logsys are about logging to files. The debug "logging" I use is
> about logging to either an in-memory buffer or to stderr; syslog/logsys
> are not relevant to that.
>
>
> . Change log_error() to use logsys instead of syslog, i.e. don't change
> the existing log_error() call sites.
>
> #define log_error(fmt, args...) \
> do { \
> log_debug(fmt, ##args); \
> - syslog(LOG_ERR, fmt, ##args); \
> + log_printf(LOG_ERR, fmt, ##args); \
> } while (0)
>
>
> . Finally, one gripe with logsys itself. Here's syslog initialization:
>
> openlog("fenced", LOG_PID, LOG_DAEMON);
>
> Compare with logsys initialization:
>
> LOGSYS_DECLARE_SYSTEM (NULL,
> LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED |
> LOG_MODE_OUTPUT_FILE | LOG_MODE_BUFFER_BEFORE_CONFIG,
> LOGDIR "/fenced.log",
> SYSLOGFACILITY);
> LOGSYS_DECLARE_SUBSYS ("FENCED", LOG_LEVEL_INFO);
>
> ...
>
> logsys_config_mode_set(LOG_MODE_OUTPUT_STDERR |
> LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_OUTPUT_FILE |
> LOG_MODE_FLUSH_AFTER_CONFIG);
>
The declaration of the logging system is up to individual choice. If we
were to make it one macro "LOGSYS_DECLARE_SYSTEM()" without any
arguments, the user of logsys would have no choice. While openlog may
be simple, it also offers very little functionality. It simply "opens a
log". It doesn't let you declare whether you want to output to stderr,
or also if you want threaded mode of operation, or whether you should
wait for fork to execute your first logging output. Because it doesn't
support these features, it can be a simple little api "start logging to
file X". Logsys offers a variety of features and isn't simply an api to
log to syslog, but a full blown logging system to support a variety of
goals all with nonblocking operation.
I suggest reading the man page to understand what each of those options
mean. I think once you do, you will see that none of them can be
removed, and there is no way to have an "openlog" api that also supports
the features of logsys.
> ... and at the start of every other file:
>
> LOGSYS_DECLARE_SUBSYS ("FENCED", LOG_LEVEL_INFO);
>
> This really gets out of hand. I'd like to see the initialization wrapped
> into a single function call, and the macros at the start of every file
> unnecessary.
>
>
The necessity for the DECLARE_SUBSYS macro is to support subsystems.
Looking at the macro we see how this is implemented:
#define LOGSYS_DECLARE_SUBSYS(subsys,priority) \
static unsigned int logsys_subsys_id __attribute__((unused)); \
__attribute__ ((constructor)) static void logsys_subsys_init (void) \
{ \
logsys_subsys_id = \
_logsys_subsys_create ((subsys), (priority)); \
}
So what exactly does this macro do? It creates a local static variable that any logging
function can use to tell the logsys system which subsystem it belongs to. This is absolutely
required. The _logsys_subsys_create maps a character string to this 32 bit identifier.
There is no other way to support subsystem logging in a particular file. The reason is
log_printf needs to know which subsystem it should log under for the particular invocation.
This is done via the logsys_subsys_id static variable in each file.
If you can propose an alternative that would do exactly the same thing, I'm all ears.
I really don't see the big issue with adding one line of code to each
file to support subsystem logging.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Cluster-devel] logsys in fenced
2008-06-25 14:43 ` [Cluster-devel] logsys in fenced David Teigland
2008-06-25 14:53 ` Christine Caulfield
2008-06-25 16:12 ` Steven Dake
@ 2008-06-25 16:19 ` Fabio M. Di Nitto
2008-06-25 16:50 ` David Teigland
2 siblings, 1 reply; 9+ messages in thread
From: Fabio M. Di Nitto @ 2008-06-25 16:19 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Wed, 25 Jun 2008, David Teigland wrote:
>> commit 95a5c6b13294742956b13070ebc4f4513278255f
>> Author: Fabio M. Di Nitto <fdinitto@redhat.com>
>> Date: Wed Jun 25 06:24:11 2008 +0200
>>
>> [FENCE] fenced: separate concept of fork and debugging
>>
>> allow fenced to fork when debugging is set from the configuration
>> or the system will hang at boot.
>>
>> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
>>
>> commit da704715c606c9c01637ae53d79f8dec6a8b0389
>> Author: Fabio M. Di Nitto <fdinitto@redhat.com>
>> Date: Wed Jun 25 05:19:35 2008 +0200
>>
>> [FENCE] Allow fenced to configure logsys
>>
>> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
>>
>> commit 18e085596bb8844f74689a92662f2e5e9166836b
>> Author: Fabio M. Di Nitto <fdinitto@redhat.com>
>> Date: Wed Jun 25 04:49:41 2008 +0200
>>
>> [FENCE] Move logsys configuration calls where they belong
>>
>> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
>>
>> commit c54c56c5a09f98547ceda3bc5fa9afa28b354480
>> Author: Fabio M. Di Nitto <fdinitto@redhat.com>
>> Date: Wed Jun 25 04:23:20 2008 +0200
>>
>> [FENCE] Make fenced ready to load logsys config
>>
>> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
>>
>> commit cf4c7ebac813b0b607acf6cf74bbdddfc8cfb12a
>> Author: Fabio M. Di Nitto <fdinitto@redhat.com>
>> Date: Tue Jun 24 14:34:35 2008 +0200
>>
>> [FENCE] Start porting fenced to logsys
>>
>> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
>
> OK, I'm fine with replacing the use of syslog with logsys, but this goes
> beyond that. Here are the problems I see:
>
>
> . Leave log_debug() unchanged,
The only change is that it uses logsys to print instead fprintf to stderr.
Like Christine already pointed out, the change to logsys is to have log
output the same across the whole system. No exceptions. Debug is no
different from that, and with logsys you can set debug logs at runtime
instead of having to do manual things.
> and leave the meaning/effect of -D unchanged.
This is unchanged. Read carefully what I did. By setting debug_daemon_opt
to 1, (also set by debug=on config option) you can theoretically halt the
machine boot (if you need to debug that early in the process).
Invoking with -D will also avoid forking of the daemon (fork_daemon_opt or
whatever i called it).
Original behaviour preserverd. Add more flexibility to debug.
> syslog/logsys are about logging to files.
this is an assumption. logsys allows you to log to file, syslog and stderr
according to what you need.
> The debug "logging" I use is
> about logging to either an in-memory buffer or to stderr; syslog/logsys
> are not relevant to that.
What is wrong with collecting debugging info in a standard way?
>
>
> . Change log_error() to use logsys instead of syslog, i.e. don't change
> the existing log_error() call sites.
>
> #define log_error(fmt, args...) \
> do { \
> log_debug(fmt, ##args); \
> - syslog(LOG_ERR, fmt, ##args); \
> + log_printf(LOG_ERR, fmt, ##args); \
> } while (0)
and what's the gain to keep around a macro that does nothing vs calling
directly log_printf?
>
>
> . Finally, one gripe with logsys itself. Here's syslog initialization:
>
Discuss this with Steven.
Fabio
--
I'm going to make him an offer he can't refuse.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Cluster-devel] logsys in fenced
2008-06-25 16:19 ` Fabio M. Di Nitto
@ 2008-06-25 16:50 ` David Teigland
2008-06-25 17:04 ` Fabio M. Di Nitto
0 siblings, 1 reply; 9+ messages in thread
From: David Teigland @ 2008-06-25 16:50 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Wed, Jun 25, 2008 at 06:19:00PM +0200, Fabio M. Di Nitto wrote:
> >. Leave log_debug() unchanged,
>
> The only change is that it uses logsys to print instead fprintf to stderr.
> Like Christine already pointed out, the change to logsys is to have log
> output the same across the whole system. No exceptions. Debug is no
> different from that,
I'm saying it is different. My debugging capabilities are completely
separate from logging. You're trying to redefine them for me, and I'm
declining.
> and with logsys you can set debug logs at runtime
> instead of having to do manual things.
Sorry, that's not what I want.
> > syslog/logsys are about logging to files.
>
> this is an assumption. logsys allows you to log to file, syslog and stderr
> according to what you need.
That's fine for the log_error statements, not for debugging statements.
> What is wrong with collecting debugging info in a standard way?
For now, my only interest in logsys is as a replacement for syslog. Once
that works, I'll consider changes to the debug system.
> and what's the gain to keep around a macro that does nothing vs calling
> directly log_printf?
See my other mail, and you're venturing into coding style preferences that
are not relevant to logsys.
> >. Finally, one gripe with logsys itself. Here's syslog initialization:
> >
>
> Discuss this with Steven.
Yes, I'll be studying the gory logsys details in an effort to propose some
more concrete api suggestions.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Cluster-devel] logsys in fenced
2008-06-25 16:50 ` David Teigland
@ 2008-06-25 17:04 ` Fabio M. Di Nitto
2008-06-25 17:30 ` David Teigland
0 siblings, 1 reply; 9+ messages in thread
From: Fabio M. Di Nitto @ 2008-06-25 17:04 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Wed, 25 Jun 2008, David Teigland wrote:
> On Wed, Jun 25, 2008 at 06:19:00PM +0200, Fabio M. Di Nitto wrote:
>>> . Leave log_debug() unchanged,
>>
>> The only change is that it uses logsys to print instead fprintf to stderr.
>> Like Christine already pointed out, the change to logsys is to have log
>> output the same across the whole system. No exceptions. Debug is no
>> different from that,
>
> I'm saying it is different. My debugging capabilities are completely
> separate from logging. You're trying to redefine them for me, and I'm
> declining.
>
>> and with logsys you can set debug logs at runtime
>> instead of having to do manual things.
>
> Sorry, that's not what I want.
Our stack is absolutely impossible to debug as it is. There is a different
debugging method and system for every single piece of code in the stack.
It is a nightmare for people that wants to gather debugging output for us
and send us logs.
Your way:
- learn every single debugging options for every single subsystem and
command and maybe you will be able to find the data we need to help you
because they are spreaded across logging files, syslogs and maybe stderr.
My way:
- add debug=on on the logging system. tar /var/log/cluster. done.
While I respect that your idea of debugging is different, can you at least
see the benefits for a one line change in a macro?
>>> syslog/logsys are about logging to files.
>>
>> this is an assumption. logsys allows you to log to file, syslog and stderr
>> according to what you need.
>
> That's fine for the log_error statements, not for debugging statements.
>
>> What is wrong with collecting debugging info in a standard way?
>
> For now, my only interest in logsys is as a replacement for syslog. Once
> that works, I'll consider changes to the debug system.
It works already. We have been fixing bugs in logsys at a constant rate
before starting the transition.
Fabio
--
I'm going to make him an offer he can't refuse.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Cluster-devel] logsys in fenced
2008-06-25 17:04 ` Fabio M. Di Nitto
@ 2008-06-25 17:30 ` David Teigland
0 siblings, 0 replies; 9+ messages in thread
From: David Teigland @ 2008-06-25 17:30 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Wed, Jun 25, 2008 at 07:04:15PM +0200, Fabio M. Di Nitto wrote:
> Our stack is absolutely impossible to debug as it is. There is a different
> debugging method and system for every single piece of code in the stack.
> It is a nightmare for people that wants to gather debugging output for us
> and send us logs.
>
> Your way:
>
> - learn every single debugging options for every single subsystem and
> command and maybe you will be able to find the data we need to help you
> because they are spreaded across logging files, syslogs and maybe stderr.
>
> My way:
>
> - add debug=on on the logging system. tar /var/log/cluster. done.
>
> While I respect that your idea of debugging is different, can you at least
> see the benefits for a one line change in a macro?
OK, once log_debug is back to the way it was, then I'll look into how to
direct debug statements to logsys in a way that's acceptable to me.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-06-25 17:30 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-25 4:25 [Cluster-devel] Cluster Project branch, master, updated. cluster-2.99.05-9-g95a5c6b fabbione
2008-06-25 14:43 ` [Cluster-devel] logsys in fenced David Teigland
2008-06-25 14:53 ` Christine Caulfield
2008-06-25 15:55 ` David Teigland
2008-06-25 16:12 ` Steven Dake
2008-06-25 16:19 ` Fabio M. Di Nitto
2008-06-25 16:50 ` David Teigland
2008-06-25 17:04 ` Fabio M. Di Nitto
2008-06-25 17:30 ` David Teigland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).