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

[Cluster-devel] Cluster Project branch, master, updated. cluster-2.99.05-47-gcfbf8e8



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=cfbf8e8fd634667de2b02344fadb6452080556af

The branch, master has been updated
       via  cfbf8e8fd634667de2b02344fadb6452080556af (commit)
      from  58302ba8a4b0da965f0827f048070b8c514070c2 (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 cfbf8e8fd634667de2b02344fadb6452080556af
Author: Christine Caulfield <ccaulfie redhat com>
Date:   Thu Jul 3 14:11:43 2008 +0100

    [CMAN] Fix logging options
    
    Fix up the logging for the cman plugin so that it consistently
    honours both settings in cluster.conf and 'cman_tool join -d'.
    
    This has exposed a couple of bugs in openais which should be
    addressed shortly.
    
    Signed-off-by: Christine Caulfield <ccaulfie redhat com>

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

Summary of changes:
 cman/daemon/ais.c            |   28 +++---------
 cman/daemon/barrier.c        |    1 +
 cman/daemon/cman-preconfig.c |   98 ++++++++++++++++++++++++++++++-----------
 cman/daemon/cman.h           |    3 +
 cman/daemon/cmanconfig.c     |    3 +-
 cman/daemon/cnxman-private.h |    3 -
 cman/daemon/commands.c       |    1 +
 cman/daemon/logging.c        |    1 +
 cman/daemon/logging.h        |    4 +-
 9 files changed, 88 insertions(+), 54 deletions(-)

diff --git a/cman/daemon/ais.c b/cman/daemon/ais.c
index 6c05397..65ebc2e 100644
--- a/cman/daemon/ais.c
+++ b/cman/daemon/ais.c
@@ -145,42 +145,28 @@ static int cman_exec_init_fn(struct objdb_iface_ver0 *objdb)
 	unsigned int object_handle;
 	char pipe_msg[256];
 
-	if (getenv("CMAN_DEBUGLOG"))
-		debug_mask = atoi(getenv("CMAN_DEBUGLOG"));
-
-	set_debuglog(debug_mask);
-
-	/* We need to set this up to internal defaults too early */
-	openlog("openais", LOG_CONS|LOG_PID, SYSLOGFACILITY);
-
-	/* Enable stderr logging if requested by cman_tool */
-	if (debug_mask) {
-		logsys_config_subsys_set("CMAN", LOGSYS_TAG_LOG, LOG_DEBUG);
-	}
-
 	if (getenv("CMAN_PIPE"))
                 startup_pipe = atoi(getenv("CMAN_PIPE"));
 
-	P_DAEMON("CMAN starting");
-
         /* Get our config variables */
 	objdb->object_find_reset(OBJECT_PARENT_HANDLE);
 	objdb->object_find(OBJECT_PARENT_HANDLE,
 		"cluster", strlen("cluster"), &cluster_parent_handle);
 
+	objdb->object_find_reset(cluster_parent_handle);
 	if (objdb->object_find(cluster_parent_handle, "cman", strlen("cman"), &object_handle) == 0)
 	{
 		objdb_get_int(objdb, object_handle, "quorum_dev_poll", &quorumdev_poll);
 		objdb_get_int(objdb, object_handle, "shutdown_timeout", &shutdown_timeout);
 		objdb_get_int(objdb, object_handle, "ccsd_poll", &ccsd_poll_interval);
+		objdb_get_int(objdb, object_handle, "debug_mask", &debug_mask);
 
-		/* Only use the CCS version of this if it was not overridden on the command-line */
-		if (!getenv("CMAN_DEBUGLOG"))
-		{
-			objdb_get_int(objdb, object_handle, "debug_mask", &debug_mask);
-			set_debuglog(debug_mask);
-		}
+		/* All other debugging options should already have been set in preconfig */
+		set_debuglog(debug_mask);
 	}
+	log_printf(LOG_DEBUG, "CC: debug message");
+	log_printf(LOG_INFO, "CC: info message");
+	P_DAEMON(CMAN_NAME " starting");
 
 	/* Open local sockets and initialise I/O queues */
 	read_cman_config(objdb, &config_version);
diff --git a/cman/daemon/barrier.c b/cman/daemon/barrier.c
index 3242e03..63c2c64 100644
--- a/cman/daemon/barrier.c
+++ b/cman/daemon/barrier.c
@@ -27,6 +27,7 @@
 #include "commands.h"
 #include "logging.h"
 #include "barrier.h"
+#include "cman.h"
 #include "ais.h"
 
 extern int we_are_a_cluster_member;
diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index 9467168..26adf55 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -170,6 +170,38 @@ static int address_family(char *addr, struct sockaddr_storage *ssaddr)
 }
 
 
+/* Find the "CMAN" logger_subsys object. Or create one if it does not
+   exist
+*/
+static unsigned int find_cman_logger(struct objdb_iface_ver0 *objdb, unsigned int object_handle)
+{
+	unsigned int subsys_handle;
+	char *str;
+
+	objdb->object_find_reset(object_handle);
+	while (!objdb->object_find(object_handle,
+				  "logger_subsys", strlen("logger_subsys"), &subsys_handle)) {
+
+		if (objdb_get_string(objdb, subsys_handle, "subsys", &str)) {
+			continue;
+		}
+		if (strcmp(str, CMAN_NAME) == 0)
+			return subsys_handle;
+	}
+
+	/* We can't find it ... create one */
+	if (objdb->object_create(object_handle, &subsys_handle,
+				 "logger_subsys", strlen("logger_subsys")) == 0) {
+
+		objdb->object_key_create(subsys_handle, "subsys", strlen("subsys"),
+					 CMAN_NAME, strlen(CMAN_NAME)+1);
+	}
+
+	return subsys_handle;
+
+}
+
+
 static int add_ifaddr(struct objdb_iface_ver0 *objdb, char *mcast, char *ifaddr, int portnum)
 {
 	unsigned int totem_object_handle;
@@ -200,29 +232,24 @@ static int add_ifaddr(struct objdb_iface_ver0 *objdb, char *mcast, char *ifaddr,
 				     "totem", strlen("totem"));
         }
 
-	objdb->object_find_reset(OBJECT_PARENT_HANDLE);
-	if (objdb->object_find(OBJECT_PARENT_HANDLE,
-			       "totem", strlen("totem"), &totem_object_handle) == 0) {
-
-		if (objdb->object_create(totem_object_handle, &interface_object_handle,
-					 "interface", strlen("interface")) == 0) {
+	if (objdb->object_create(totem_object_handle, &interface_object_handle,
+				 "interface", strlen("interface")) == 0) {
 
-			sprintf(tmp, "%d", num_interfaces);
-			objdb->object_key_create(interface_object_handle, "ringnumber", strlen("ringnumber"),
-							tmp, strlen(tmp)+1);
+		sprintf(tmp, "%d", num_interfaces);
+		objdb->object_key_create(interface_object_handle, "ringnumber", strlen("ringnumber"),
+					 tmp, strlen(tmp)+1);
 
-			objdb->object_key_create(interface_object_handle, "bindnetaddr", strlen("bindnetaddr"),
-							ifaddr, strlen(ifaddr)+1);
+		objdb->object_key_create(interface_object_handle, "bindnetaddr", strlen("bindnetaddr"),
+					 ifaddr, strlen(ifaddr)+1);
 
-			objdb->object_key_create(interface_object_handle, "mcastaddr", strlen("mcastaddr"),
-							mcast, strlen(mcast)+1);
+		objdb->object_key_create(interface_object_handle, "mcastaddr", strlen("mcastaddr"),
+					 mcast, strlen(mcast)+1);
 
-			sprintf(tmp, "%d", portnum);
-			objdb->object_key_create(interface_object_handle, "mcastport", strlen("mcastport"),
-							tmp, strlen(tmp)+1);
+		sprintf(tmp, "%d", portnum);
+		objdb->object_key_create(interface_object_handle, "mcastport", strlen("mcastport"),
+					 tmp, strlen(tmp)+1);
 
-			num_interfaces++;
-		}
+		num_interfaces++;
 	}
 	return ret;
 }
@@ -432,6 +459,10 @@ static int get_env_overrides()
 		expected_votes = 1;
 		votes = 1;
 	}
+	if (getenv("CMAN_DEBUGLOG")) {
+		debug_mask = atoi(getenv("CMAN_DEBUGLOG"));
+	}
+
 	return 0;
 }
 
@@ -680,19 +711,15 @@ static void add_cman_overrides(struct objdb_iface_ver0 *objdb)
 		char *logstr;
 		char *logfacility;
 
-
 		logfacility = logsys_facility_name_get(SYSLOGFACILITY);
 
+		logger_object_handle = find_cman_logger(objdb, object_handle);
+
 		if (objdb_get_string(objdb, object_handle, "syslog_facility", &logstr)) {
 			objdb->object_key_create(object_handle, "syslog_facility", strlen("syslog_facility"),
 						 logfacility, strlen(logfacility)+1);
 		}
 
-		objdb->object_create(object_handle, &logger_object_handle,
-				      "logger_subsys", strlen("logger_subsys"));
-		objdb->object_key_create(logger_object_handle, "subsys", strlen("subsys"),
-					 "CMAN", strlen("CMAN")+1);
-
 		if (objdb_get_string(objdb, object_handle, "to_file", &logstr)) {
 			objdb->object_key_create(object_handle, "to_file", strlen("to_file"),
 						 "yes", strlen("yes")+1);
@@ -703,11 +730,24 @@ static void add_cman_overrides(struct objdb_iface_ver0 *objdb)
 						 LOGDIR "/cman.log", strlen(LOGDIR "/cman.log")+1);
 		}
 
+		objdb->object_key_create(object_handle, "syslog_facility", strlen("syslog_facility"),
+					 "local4", strlen("local4")+1);
+
+
 		if (debug_mask) {
-			objdb->object_key_create(logger_object_handle, "debug", strlen("debug"),
-						 "on", strlen("on")+1);
 			objdb->object_key_create(object_handle, "to_stderr", strlen("to_stderr"),
 						 "yes", strlen("yes")+1);
+			objdb->object_key_create(logger_object_handle, "debug", strlen("debug"),
+						 "on", strlen("on")+1);
+			objdb->object_key_create(logger_object_handle, "syslog_level", strlen("syslog_level"),
+						 "debug", strlen("debug")+1);
+
+		}
+		else {
+			char *loglevel;
+			loglevel = logsys_priority_name_get(SYSLOGLEVEL);
+			objdb->object_key_create(logger_object_handle, "syslog_level", strlen("syslog_level"),
+						 loglevel, strlen(loglevel)+1);
 		}
 	}
 
@@ -742,7 +782,11 @@ static void add_cman_overrides(struct objdb_iface_ver0 *objdb)
 			objdb->object_key_create(object_handle, "two_node", strlen("two_node"),
 						 str, strlen(str) + 1);
 		}
-
+		if (debug_mask) {
+			sprintf(str, "%d", debug_mask);
+			objdb->object_key_create(object_handle, "debug_mask", strlen("debug_mask"),
+						 str, strlen(str) + 1);
+		}
 	}
 
 	/* Make sure we load our alter-ego - the main cman module */
diff --git a/cman/daemon/cman.h b/cman/daemon/cman.h
index e0203a4..748602a 100644
--- a/cman/daemon/cman.h
+++ b/cman/daemon/cman.h
@@ -1,3 +1,6 @@
 /* General cman bits */
 extern int write_cman_pipe(char *message);
 extern void close_cman_pipe(void);
+
+/* How we announce ourself in syslog */
+#define CMAN_NAME "CMAN"
diff --git a/cman/daemon/cmanconfig.c b/cman/daemon/cmanconfig.c
index 294724e..98b615b 100644
--- a/cman/daemon/cmanconfig.c
+++ b/cman/daemon/cmanconfig.c
@@ -16,11 +16,12 @@
 #include "cnxman-private.h"
 #include "logging.h"
 #include "commands.h"
+#include "cman.h"
 #include "cmanconfig.h"
 LOGSYS_DECLARE_SUBSYS (CMAN_NAME, LOG_INFO);
 #include "nodelist.h"
 #include "ais.h"
-#include "cman.h"
+
 
 /* Local vars - things we get from ccs */
        int two_node;
diff --git a/cman/daemon/cnxman-private.h b/cman/daemon/cnxman-private.h
index 83d40de..aa012bb 100644
--- a/cman/daemon/cnxman-private.h
+++ b/cman/daemon/cnxman-private.h
@@ -8,9 +8,6 @@
 #define CNXMAN_MINOR_VERSION 1
 #define CNXMAN_PATCH_VERSION 0
 
-/* How we announce ourself in syslog */
-#define CMAN_NAME "CMAN"
-
 struct cman_timer
 {
 	struct list list;
diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c
index 7b9fd75..ebc0253 100644
--- a/cman/daemon/commands.c
+++ b/cman/daemon/commands.c
@@ -28,6 +28,7 @@
 #include <openais/service/timer.h>
 #include <openais/totem/aispoll.h>
 #include "list.h"
+#include "cman.h"
 #include "cnxman-socket.h"
 #include "cnxman-private.h"
 #include "daemon.h"
diff --git a/cman/daemon/logging.c b/cman/daemon/logging.c
index eb488d7..727c4ad 100644
--- a/cman/daemon/logging.c
+++ b/cman/daemon/logging.c
@@ -10,6 +10,7 @@
 
 #include <openais/service/logsys.h>
 #include "list.h"
+#include "cman.h"
 #include "cnxman-socket.h"
 #include "cnxman-private.h"
 #include "logging.h"
diff --git a/cman/daemon/logging.h b/cman/daemon/logging.h
index 6a25e76..f2d84cd 100644
--- a/cman/daemon/logging.h
+++ b/cman/daemon/logging.h
@@ -11,7 +11,7 @@ extern void set_debuglog(int subsystems);
 
 extern int subsys_mask;
 
-#define P_BARRIER(fmt, args...) if (subsys_mask & CMAN_DEBUG_BARRIER) log_printf(logsys_mkpri(LOG_LEVEL_DEBUG, logsys_subsys_id), "barrier: " fmt, ## args)
-#define P_MEMB(fmt, args...)    if (subsys_mask & CMAN_DEBUG_MEMB) log_printf(LOG_LEVEL_DEBUG , "memb: " fmt, ## args)
+#define P_BARRIER(fmt, args...) if (subsys_mask & CMAN_DEBUG_BARRIER) log_printf(LOG_LEVEL_DEBUG, "barrier: " fmt, ## args)
+#define P_MEMB(fmt, args...)    if (subsys_mask & CMAN_DEBUG_MEMB) log_printf(LOG_LEVEL_DEBUG, "memb: " fmt, ## args)
 #define P_DAEMON(fmt, args...)  if (subsys_mask & CMAN_DEBUG_DAEMON) log_printf(LOG_LEVEL_DEBUG , "daemon: " fmt, ## args)
 #define P_AIS(fmt, args...)     if (subsys_mask & CMAN_DEBUG_AIS) log_printf(LOG_LEVEL_DEBUG, "ais " fmt, ## args)


hooks/post-receive
--
Cluster Project


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