Skip to contentSkip to conversation

Cluster Project branch, master, updated. cluster-2.99.05-9-g95a5c6b

Cluster-devel [email protected] 5 participants 9 messages Jun 25, 2008

lore
Share & tools
lore
#0 lore raw

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 <[email protected]>
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.

commit da704715c606c9c01637ae53d79f8dec6a8b0389

Author: Fabio M. Di Nitto <[email protected]>
Date:   Wed Jun 25 05:19:35 2008 +0200

[FENCE] Allow fenced to configure logsys

commit 4906d99305537dd4629b78caf6426c603d2a2e11

Author: Fabio M. Di Nitto <[email protected]>
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.

commit db2b176d89bcdf549189cdf686dcdffd7793ec98

Author: Fabio M. Di Nitto <[email protected]>
Date:   Wed Jun 25 05:15:07 2008 +0200

[CCS] Set debug from syslog_level only when requested

commit 18e085596bb8844f74689a92662f2e5e9166836b

Author: Fabio M. Di Nitto <[email protected]>
Date:   Wed Jun 25 04:49:41 2008 +0200

[FENCE] Move logsys configuration calls where they belong

commit c54c56c5a09f98547ceda3bc5fa9afa28b354480

Author: Fabio M. Di Nitto <[email protected]>
Date:   Wed Jun 25 04:23:20 2008 +0200

[FENCE] Make fenced ready to load logsys config

commit cf4c7ebac813b0b607acf6cf74bbdddfc8cfb12a

Author: Fabio M. Di Nitto <[email protected]>
Date:   Tue Jun 24 14:34:35 2008 +0200

[FENCE] Start porting fenced to logsys

-----------------------------------------------------------------------

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(-)
ccs/daemon/misc.c +6 -2
index 76f63de..96a7867 100644
@@ -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);
cman/qdisk/main.c +10 -3
index 4202508..75ccafe 100644
@@ -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);
fence/fenced/Makefile +2 -2
index 1e9bbc9..b2b1e04 100644
@@ -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
 
 
fence/fenced/config.c +141 -6

196 lines not on this page · raw message

fence/fenced/cpg.c +59 -57

451 lines not on this page · raw message

fence/fenced/fd.h +6 -9
index 5ef1756..802d29c 100644
@@ -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 */
 
fence/fenced/group.c +17 -16
index 5f8f08a..eb43bd5 100644
@@ -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;
 }
fence/fenced/main.c +39 -22

190 lines not on this page · raw message

fence/fenced/member_cman.c +10 -9
index e85fcb6..6ac6e1e 100644
@@ -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);
 
fence/fenced/recover.c +14 -12
index 21bf735..55d1a12 100644
@@ -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

#1 lore raw

[Cluster-devel] logsys in fenced

Quoted 35 lines

commit 95a5c6b13294742956b13070ebc4f4513278255f

Author: Fabio M. Di Nitto <[email protected]>
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.

commit da704715c606c9c01637ae53d79f8dec6a8b0389

Author: Fabio M. Di Nitto <[email protected]>
Date:   Wed Jun 25 05:19:35 2008 +0200

[FENCE] Allow fenced to configure logsys

commit 18e085596bb8844f74689a92662f2e5e9166836b

Author: Fabio M. Di Nitto <[email protected]>
Date:   Wed Jun 25 04:49:41 2008 +0200

[FENCE] Move logsys configuration calls where they belong

commit c54c56c5a09f98547ceda3bc5fa9afa28b354480

Author: Fabio M. Di Nitto <[email protected]>
Date:   Wed Jun 25 04:23:20 2008 +0200

[FENCE] Make fenced ready to load logsys config

Quoted 7 lines

commit cf4c7ebac813b0b607acf6cf74bbdddfc8cfb12a

Author: Fabio M. Di Nitto <[email protected]>
Date:   Tue Jun 24 14:34:35 2008 +0200

[FENCE] Start porting fenced to logsys

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.

#2 lore raw

[Cluster-devel] logsys in fenced

Quoted 43 lines · David Teigland
Quoted 35 lines

commit 95a5c6b13294742956b13070ebc4f4513278255f

Author: Fabio M. Di Nitto <[email protected]>
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.

commit da704715c606c9c01637ae53d79f8dec6a8b0389

Author: Fabio M. Di Nitto <[email protected]>
Date:   Wed Jun 25 05:19:35 2008 +0200

[FENCE] Allow fenced to configure logsys

commit 18e085596bb8844f74689a92662f2e5e9166836b

Author: Fabio M. Di Nitto <[email protected]>
Date:   Wed Jun 25 04:49:41 2008 +0200

[FENCE] Move logsys configuration calls where they belong

commit c54c56c5a09f98547ceda3bc5fa9afa28b354480

Author: Fabio M. Di Nitto <[email protected]>
Date:   Wed Jun 25 04:23:20 2008 +0200

[FENCE] Make fenced ready to load logsys config

Quoted 7 lines

commit cf4c7ebac813b0b607acf6cf74bbdddfc8cfb12a

Author: Fabio M. Di Nitto <[email protected]>
Date:   Tue Jun 24 14:34:35 2008 +0200

[FENCE] Start porting fenced to logsys

Quoted 8 lines

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.

Quoted 10 lines

. 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.

Signature · 1 line
Chrissie
#3 lore raw

[Cluster-devel] logsys in fenced

Quoted 10 lines · Christine Caulfield
Quoted 5 lines

. 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.

Quoted 10 lines
Quoted 9 lines

. 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)

Quoted 2 lines

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).

#4 lore raw

[Cluster-devel] logsys in fenced

In reply to David Teigland
Quoted 75 lines · David Teigland
Quoted 35 lines

commit 95a5c6b13294742956b13070ebc4f4513278255f

Author: Fabio M. Di Nitto <[email protected]>
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.

commit da704715c606c9c01637ae53d79f8dec6a8b0389

Author: Fabio M. Di Nitto <[email protected]>
Date:   Wed Jun 25 05:19:35 2008 +0200

[FENCE] Allow fenced to configure logsys

commit 18e085596bb8844f74689a92662f2e5e9166836b

Author: Fabio M. Di Nitto <[email protected]>
Date:   Wed Jun 25 04:49:41 2008 +0200

[FENCE] Move logsys configuration calls where they belong

commit c54c56c5a09f98547ceda3bc5fa9afa28b354480

Author: Fabio M. Di Nitto <[email protected]>
Date:   Wed Jun 25 04:23:20 2008 +0200

[FENCE] Make fenced ready to load logsys config

Quoted 7 lines

commit cf4c7ebac813b0b607acf6cf74bbdddfc8cfb12a

Author: Fabio M. Di Nitto <[email protected]>
Date:   Tue Jun 24 14:34:35 2008 +0200

[FENCE] Start porting fenced to logsys

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);
Quoted 8 lines

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.

Quoted 9 lines

... 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.

#5 lore raw

[Cluster-devel] logsys in fenced

In reply to David Teigland
Quoted 41 lines · David Teigland
Quoted 41 lines

commit 95a5c6b13294742956b13070ebc4f4513278255f

Author: Fabio M. Di Nitto <[email protected]>
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.

commit da704715c606c9c01637ae53d79f8dec6a8b0389

Author: Fabio M. Di Nitto <[email protected]>
Date:   Wed Jun 25 05:19:35 2008 +0200

[FENCE] Allow fenced to configure logsys

commit 18e085596bb8844f74689a92662f2e5e9166836b

Author: Fabio M. Di Nitto <[email protected]>
Date:   Wed Jun 25 04:49:41 2008 +0200

[FENCE] Move logsys configuration calls where they belong

commit c54c56c5a09f98547ceda3bc5fa9afa28b354480

Author: Fabio M. Di Nitto <[email protected]>
Date:   Wed Jun 25 04:23:20 2008 +0200

[FENCE] Make fenced ready to load logsys config

commit cf4c7ebac813b0b607acf6cf74bbdddfc8cfb12a

Author: Fabio M. Di Nitto <[email protected]>
Date:   Tue Jun 24 14:34:35 2008 +0200

[FENCE] Start porting fenced to logsys

Quoted 7 lines
Quoted 1 line

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.

Quoted 1 line

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.

Quoted 1 line

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.

Quoted 3 lines

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?

Quoted 11 lines

. 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?

Quoted 4 lines

. 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.

#6 lore raw

[Cluster-devel] logsys in fenced

Quoted 6 lines · Fabio M. Di Nitto
Quoted 1 line

. 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.

Quoted 2 lines

and with logsys you can set debug logs at runtime
instead of having to do manual things.

Sorry, that's not what I want.

Quoted 4 lines
Quoted 1 line

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.

Quoted 1 line

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.

Quoted 2 lines

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.

Quoted 4 lines
Quoted 2 lines

. 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.

#7 lore raw

[Cluster-devel] logsys in fenced

Quoted 8 lines · David Teigland
Quoted 6 lines · Fabio M. Di Nitto
Quoted 1 line

. 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,

Quoted 8 lines

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.

Quoted 2 lines

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?

Quoted 11 lines
Quoted 4 lines
Quoted 1 line

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.

Quoted 1 line

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.

#8 lore raw

[Cluster-devel] logsys in fenced

Quoted 11 lines · Fabio M. Di Nitto

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.

Quoted 6 lines

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.