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

[Cluster-devel] Cluster Project branch, master, updated. cluster-2.99.04-37-gccdb6bd



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

The branch, master has been updated
       via  ccdb6bd23d58be30082e0a4f5686fdbfc4ac92b0 (commit)
       via  813813756fa090966e0bc40bde967f217762ee38 (commit)
       via  3cdaeb33c185424c6a378986557ae5b5d07b7628 (commit)
       via  09dca04d07e4a7ce2c907195d299266a3f38f53b (commit)
       via  1aa37f995993981be76bea388e5d2b7b5741ebcf (commit)
       via  64ac4abd0c8ae5f0c4716f2d4d57da6f2a61b60b (commit)
      from  4f32341cc111bd6e8dc888b483db2e7951b96c2a (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 ccdb6bd23d58be30082e0a4f5686fdbfc4ac92b0
Author: Fabio M. Di Nitto <fdinitto redhat com>
Date:   Fri Jun 20 06:54:02 2008 +0200

    [CCS] Init logsys as early as possible
    
    If we have an on-disk copy of cluster.conf we will use it
    as early as possible to configure logsys.
    
    If you are unlucky to have none, logsys will use built-in
    defaults and then switch to configured setting after we
    will get one from the network.
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto redhat com>

commit 813813756fa090966e0bc40bde967f217762ee38
Author: Fabio M. Di Nitto <fdinitto redhat com>
Date:   Fri Jun 20 06:51:33 2008 +0200

    [CCS] Remove LOG_MODE_DISPLAY_DEBUG from logsys settings
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto redhat com>

commit 3cdaeb33c185424c6a378986557ae5b5d07b7628
Author: Fabio M. Di Nitto <fdinitto redhat com>
Date:   Fri Jun 20 06:45:59 2008 +0200

    [CCS] Remove duplicate code and make it common
    
    We are about to perform many queries to configure logging.
    
    Collect common code in one static function and switch
    set_ccs_logging to use it, by sharing the same XML context.
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto redhat com>

commit 09dca04d07e4a7ce2c907195d299266a3f38f53b
Author: Fabio M. Di Nitto <fdinitto redhat com>
Date:   Fri Jun 20 06:28:57 2008 +0200

    [CCS] Fix a few logsys configuration bits
    
    Make sure to set debug = 1 when debugging is enabled via envvar.
    
    Delay logsys flush to catch a few more bits and allow us to
    configure properly.
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto redhat com>

commit 1aa37f995993981be76bea388e5d2b7b5741ebcf
Author: Fabio M. Di Nitto <fdinitto redhat com>
Date:   Fri Jun 20 06:25:50 2008 +0200

    [CCS] Fix priority setting
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto redhat com>

commit 64ac4abd0c8ae5f0c4716f2d4d57da6f2a61b60b
Author: Fabio M. Di Nitto <fdinitto redhat com>
Date:   Fri Jun 20 06:24:06 2008 +0200

    [CCS] Add missing CCSEXIT call
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto redhat com>

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

Summary of changes:
 ccs/daemon/ccsd.c |   12 ++++-
 ccs/daemon/misc.c |  109 ++++++++++++++++++++++++++---------------------------
 2 files changed, 62 insertions(+), 59 deletions(-)

diff --git a/ccs/daemon/ccsd.c b/ccs/daemon/ccsd.c
index d1c7447..c4d36b8 100644
--- a/ccs/daemon/ccsd.c
+++ b/ccs/daemon/ccsd.c
@@ -20,6 +20,7 @@
 #include "cluster_mgr.h"
 #include "globals.h"
 #include "comm_headers.h"
+#include "misc.h"
 
 #include "copyright.cf"
 
@@ -41,7 +42,7 @@ static int setup_local_socket(int backlog);
 static inline void process_signals(void);
 
 LOGSYS_DECLARE_SYSTEM (NULL,
-	LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_OUTPUT_FILE | LOG_MODE_DISPLAY_DEBUG | LOG_MODE_BUFFER_BEFORE_CONFIG,
+	LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_OUTPUT_FILE | LOG_MODE_BUFFER_BEFORE_CONFIG,
 	LOGDIR "/ccs.log",
 	SYSLOGFACILITY);
 
@@ -60,9 +61,10 @@ int main(int argc, char *argv[]){
 
   msg = parse_cli_args(argc, argv);
 
-  logsys_config_mode_set (LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_OUTPUT_FILE | LOG_MODE_DISPLAY_DEBUG | LOG_MODE_FLUSH_AFTER_CONFIG);
+  if(getenv("CCS_DEBUGLOG"))
+    debug = 1;
 
-  if(debug || getenv("CCS_DEBUGLOG"))
+  if(debug)
     logsys_config_priority_set (LOG_LEVEL_DEBUG);
 
   if(check_cluster_conf()){
@@ -70,6 +72,8 @@ int main(int argc, char *argv[]){
     exit(EXIT_FAILURE);
   }
 
+  logsys_config_mode_set (LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_OUTPUT_FILE | LOG_MODE_FLUSH_AFTER_CONFIG);
+
   daemonize();
 
   print_start_msg(msg);
@@ -528,6 +532,7 @@ static int check_cluster_conf(void){
 	      "valid copy from the network.\n", config_file_location);
       return -1;
     }
+    set_ccs_logging(doc);
     xmlFreeDoc(doc);
   } else {
     /* no cluster.conf file.  This is fine, just need to get it from the network */
@@ -537,6 +542,7 @@ static int check_cluster_conf(void){
     }
   }
 
+  CCSEXIT("check_cluster_conf");
   return 0;
 }
 
diff --git a/ccs/daemon/misc.c b/ccs/daemon/misc.c
index 5717b27..1c738d9 100644
--- a/ccs/daemon/misc.c
+++ b/ccs/daemon/misc.c
@@ -149,6 +149,38 @@ fail:
 }
 
 /**
+ * do_simple_xml_query
+ * @ctx: xml context
+ * @query: "/cluster/@name"
+ *
+ * it only handles this kind of query
+ */
+static char *do_simple_xml_query(xmlXPathContextPtr ctx, char *query) {
+  xmlXPathObjectPtr  obj = NULL;
+  xmlNodePtr        node = NULL;
+
+  obj = xmlXPathEvalExpression((xmlChar *)query, ctx);
+  if(!obj || !obj->nodesetval || (obj->nodesetval->nodeNr != 1))
+    log_printf(LOG_DEBUG, "Error processing query: %s.\n", query);
+  else {
+    node = obj->nodesetval->nodeTab[0];
+    if(node->type != XML_ATTRIBUTE_NODE)
+      log_printf(LOG_DEBUG, "Object returned is not of attribute type.\n");
+    else {
+      if(!node->children->content || !strlen((char *)node->children->content))
+	log_printf(LOG_DEBUG, "No content found.\n");
+      else
+	return strdup((char *)node->children->content);
+    }
+  }
+
+  if(obj)
+    xmlXPathFreeObject(obj);
+
+  return NULL;
+}
+
+/**
  * set_ccs_logging
  * @ldoc:
  *
@@ -157,9 +189,7 @@ fail:
 int set_ccs_logging(xmlDocPtr ldoc){
   int facility = SYSLOGFACILITY, loglevel = LOG_LEVEL_INFO;
   char *res = NULL;
-  xmlXPathObjectPtr  obj = NULL;
   xmlXPathContextPtr ctx = NULL;
-  xmlNodePtr        node = NULL;
 
   CCSENTER("set_ccs_logging");
 
@@ -169,69 +199,36 @@ int set_ccs_logging(xmlDocPtr ldoc){
     return -1;
   }
 
-  obj = xmlXPathEvalExpression((xmlChar *)"/cluster/ccs/@log_facility", ctx);
-  if(!obj || !obj->nodesetval || (obj->nodesetval->nodeNr != 1)){
-    log_printf(LOG_DEBUG, "Error while retrieving log_facility.\n");
-  } else {
-    node = obj->nodesetval->nodeTab[0];
-    if(node->type != XML_ATTRIBUTE_NODE){
-      log_printf(LOG_DEBUG, "Object returned is not of attribute type.\n");
-    } else {
-      if(!node->children->content || !strlen((char *)node->children->content)){
-	log_printf(LOG_DEBUG, "No content found.\n");
-      } else {
-	res = strdup((char *)node->children->content);
-	facility = logsys_facility_id_get (res);
-	if (facility < 0)
-		facility = SYSLOGFACILITY;
-
-	logsys_config_facility_set ("CCS", facility);
-	log_printf(LOG_DEBUG, "log_facility: %s (%d).\n", res, facility);
-	free(res);
-	res=NULL;
-      }
-    }
-  }
+  res = do_simple_xml_query(ctx, "/cluster/ccs/@log_facility");
+  if(res) {
+    facility = logsys_facility_id_get (res);
+    if (facility < 0)
+      facility = SYSLOGFACILITY;
 
-  if(obj){
-    xmlXPathFreeObject(obj);
-    obj = NULL;
+    logsys_config_facility_set ("CCS", facility);
+    log_printf(LOG_DEBUG, "log_facility: %s (%d).\n", res, facility);
+    free(res);
+    res=NULL;
   }
 
-  obj = xmlXPathEvalExpression((xmlChar *)"/cluster/ccs/@log_level", ctx);
-  if(!obj || !obj->nodesetval || (obj->nodesetval->nodeNr != 1)){
-    log_printf(LOG_DEBUG, "Error while retrieving log_level.\n");
-  } else {
-    node = obj->nodesetval->nodeTab[0];
-    if(node->type != XML_ATTRIBUTE_NODE){
-      log_printf(LOG_DEBUG, "Object returned is not of attribute type.\n");
-    } else {
-      if(!node->children->content || !strlen((char *)node->children->content)){
-	log_printf(LOG_DEBUG, "No content found.\n");
-      } else {
-	res = strdup((char *)node->children->content);
-	loglevel = atoi(res);
-	if (loglevel < 0)
-	  loglevel = LOG_LEVEL_INFO;
-
-	if (!debug)
-	  logsys_config_priority_set (loglevel);
-
-	log_printf(LOG_DEBUG, "log_level: %s (%d).\n", res, loglevel);
-	free(res);
-	res=NULL;
-      }
-    }
+  res = do_simple_xml_query(ctx, "/cluster/ccs/@log_level");
+  if(res) {
+    loglevel = logsys_priority_id_get (res);
+    if (loglevel < 0)
+      loglevel = LOG_LEVEL_INFO;
+
+    if (!debug)
+      logsys_config_priority_set (loglevel);
+
+    log_printf(LOG_DEBUG, "log_level: %s (%d).\n", res, loglevel);
+    free(res);
+    res=NULL;
   }
 
   if(ctx){
     xmlXPathFreeContext(ctx);
   }
-  if(obj){
-    xmlXPathFreeObject(obj);
-  }
 
   CCSEXIT("set_ccs_logging");
   return 0;
 }
-


hooks/post-receive
--
Cluster Project


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