[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/group/daemon app.c cman.c cpg.c gd_int ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	teigland sourceware org	2006-06-20 20:26:08

Modified files:
	group/daemon   : app.c cman.c cpg.c gd_internal.h joinleave.c 
	                 main.c 

Log message:
	- sort out which messages should be log_debug/log_group vs
	log_print/log_error
	- put log_print/log_error messages in syslog

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/app.c.diff?cvsroot=cluster&r1=1.28&r2=1.29
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/cman.c.diff?cvsroot=cluster&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/cpg.c.diff?cvsroot=cluster&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/gd_internal.h.diff?cvsroot=cluster&r1=1.31&r2=1.32
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/joinleave.c.diff?cvsroot=cluster&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/main.c.diff?cvsroot=cluster&r1=1.34&r2=1.35

--- cluster/group/daemon/app.c	2006/05/17 17:29:34	1.28
+++ cluster/group/daemon/app.c	2006/06/20 20:26:08	1.29
@@ -252,13 +252,13 @@
 		}
 
 		if (entries_not_recovered) {
-			log_print("recovery set %d has %d entries not done",
+			log_debug("recovery set %d has %d entries not done",
 				  rs->nodeid, entries_not_recovered);
 			continue;
 		}
 
 		/* all entries in this rs are recovered, free it */
-		log_print("recovery set %d is all done", rs->nodeid);
+		log_debug("recovery set %d is all done", rs->nodeid);
 
 		list_for_each_entry_safe(re, re2, &rs->entries, list) {
 			list_del(&re->list);
@@ -305,7 +305,7 @@
 	list_for_each_entry(rs, &recovery_sets, list) {
 		if (rs->cman_update)
 			continue;
-		log_print("no cman update for recovery_set %d quorate %d",
+		log_debug("no cman update for recovery_set %d quorate %d",
 			  rs->nodeid, cman_quorate, cman_quorate);
 		return 0;
 	}
--- cluster/group/daemon/cman.c	2006/06/20 18:09:12	1.23
+++ cluster/group/daemon/cman.c	2006/06/20 20:26:08	1.24
@@ -85,14 +85,14 @@
 	*/
 
 	if (old_quorate && !cman_quorate)
-		log_print("cman: lost quorum");
+		log_debug("cman: lost quorum");
 	if (!old_quorate && cman_quorate)
-		log_print("cman: have quorum");
+		log_debug("cman: have quorum");
 
 	for (i = 0; i < old_node_count; i++) {
 		if (old_nodes[i].cn_member &&
 		    !is_cman_member(old_nodes[i].cn_nodeid)) {
-			log_print("cman: node %d removed",
+			log_debug("cman: node %d removed",
 				  old_nodes[i].cn_nodeid);
 			rs = get_recovery_set(old_nodes[i].cn_nodeid);
 			rs->cman_update = 1;
@@ -109,7 +109,7 @@
 	for (i = 0; i < cman_node_count; i++) {
 		if (cman_nodes[i].cn_member &&
 		    !is_old_member(cman_nodes[i].cn_nodeid))
-			log_print("cman: node %d added",
+			log_debug("cman: node %d added",
 				  cman_nodes[i].cn_nodeid);
 	}
 }
@@ -136,7 +136,7 @@
 
 static void close_cman(int ci)
 {
-	log_print("cluster is down, exiting");
+	log_debug("cluster is down, exiting");
 	exit(1);
 }
 
--- cluster/group/daemon/cpg.c	2006/06/20 18:09:12	1.23
+++ cluster/group/daemon/cpg.c	2006/06/20 20:26:08	1.24
@@ -148,7 +148,7 @@
 {
 	int i, found = 0;
 
-	log_print("process_groupd_confchg members %d -%d +%d",
+	log_debug("process_groupd_confchg members %d -%d +%d",
 		  saved_member_count, saved_left_count, saved_joined_count);
 
 	memcpy(&groupd_cpg_member, &saved_member, sizeof(saved_member));
@@ -265,7 +265,7 @@
 
 	g = find_group_by_handle(saved_handle);
 	if (!g) {
-		log_print("process_confchg: no group for handle %u name %s",
+		log_debug("process_confchg: no group for handle %u name %s",
 			  saved_handle, saved_name.value);
 		return;
 	}
@@ -306,21 +306,21 @@
 		}
 	}
 
-	log_print("%d:%s confchg members %d -%d +%d", level, name,
+	log_debug("%d:%s confchg members %d -%d +%d", level, name,
 		  member_list_entries, left_list_entries, joined_list_entries);
 
 	saved_handle = handle;
 
 	if (left_list_entries > MAX_GROUP_MEMBERS) {
-		log_print("left_list_entries %d", left_list_entries);
+		log_debug("left_list_entries %d", left_list_entries);
 		left_list_entries = MAX_GROUP_MEMBERS;
 	}
 	if (joined_list_entries > MAX_GROUP_MEMBERS) {
-		log_print("joined_list_entries %d", joined_list_entries);
+		log_debug("joined_list_entries %d", joined_list_entries);
 		joined_list_entries = MAX_GROUP_MEMBERS;
 	}
 	if (member_list_entries > MAX_GROUP_MEMBERS) {
-		log_print("member_list_entries %d", joined_list_entries);
+		log_debug("member_list_entries %d", joined_list_entries);
 		member_list_entries = MAX_GROUP_MEMBERS;
 	}
 
--- cluster/group/daemon/gd_internal.h	2006/06/20 18:09:12	1.31
+++ cluster/group/daemon/gd_internal.h	2006/06/20 20:26:08	1.32
@@ -24,6 +24,7 @@
 #include <strings.h>
 #include <ctype.h>
 #include <dirent.h>
+#include <syslog.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/types.h>
@@ -71,21 +72,26 @@
 	groupd_dump_save(); \
 } while (0)
 
+#define log_print(fmt, args...) \
+do { \
+	log_debug(fmt, ##args); \
+	syslog(LOG_ERR, fmt, ##args); \
+} while (0)
 
-/* FIXME: these should do log_debug/log_group plus syslog */
-
-#define log_print log_debug
-#define log_error log_group
+#define log_error(g, fmt, args...) \
+do { \
+	log_group(g, fmt, ##args); \
+	syslog(LOG_ERR, fmt, ##args); \
+} while (0)
 
 
 #define ASSERT(x) \
-{ \
+do { \
 	if (!(x)) { \
-		fprintf(stderr, "Assertion failed on line %d of file %s\n" \
-				"Assertion:  \"%s\"\n", \
-				__LINE__, __FILE__, #x); \
+		log_print("Assertion failed on line %d of file %s\n" \
+			  "Assertion:  \"%s\"\n", __LINE__, __FILE__, #x); \
 	} \
-}
+} while (0)
 
 #ifndef TRUE
 #define TRUE (1)
--- cluster/group/daemon/joinleave.c	2006/02/16 22:21:49	1.14
+++ cluster/group/daemon/joinleave.c	2006/06/20 20:26:08	1.15
@@ -92,7 +92,7 @@
 
 	a->client = ci;
 
-	log_print("%d:%s got join", level, name);
+	log_debug("%d:%s got join", level, name);
 
 	rv = do_cpg_join(g);
  out:
@@ -113,7 +113,7 @@
 		return -EINVAL;
 	}
 
-	log_print("%d:%s got leave", level, name);
+	log_debug("%d:%s got leave", level, name);
 
 	rv = do_cpg_leave(g);
  out:
--- cluster/group/daemon/main.c	2006/06/20 18:09:12	1.34
+++ cluster/group/daemon/main.c	2006/06/20 20:26:08	1.35
@@ -103,7 +103,6 @@
 	if (!rv)
 		return 0;
 
-	/* FIXME: make sure this is going into syslog */
 	log_print("local node must be reset to clear %d uncontrolled "
 		  "instances of gfs and/or dlm", rv);
 
@@ -350,7 +349,6 @@
 
 void client_dead(int ci)
 {
-	log_print("client %d fd %d dead", ci, client[ci].fd);
 	close(client[ci].fd);
 	client[ci].workfn = NULL;
 	client[ci].fd = -1;
@@ -525,7 +523,7 @@
 	msg->ms_type = MSG_APP_INTERNAL;
 	msg->ms_global_id = g->global_id;
 
-	log_print("%d:%s do_send %d bytes", level, name, total);
+	log_debug("%d:%s do_send %d bytes", level, name, total);
 
 	send_message(g, msg, total);
 
@@ -618,7 +616,7 @@
 	
 	i = client_add(fd, process_connection, NULL);
 
-	log_print("client connection %d", i);
+	log_debug("client connection %d", i);
 }
 
 static int setup_listener(void)
@@ -684,7 +682,7 @@
 	while (1) {
 		rv = poll(pollfd, client_maxi + 1, timeout);
 		if (rv < 0)
-			log_print("poll error %d %d", rv, errno);
+			log_debug("poll error %d %d", rv, errno);
 
 		for (i = 0; i <= client_maxi; i++) {
 			if (client[i].fd < 0)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]