public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: Chris Feist <cfeist@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: cluster: the tag cman_2_0_102 has been created Date: Fri, 22 May 2009 20:32:00 -0000 [thread overview] Message-ID: <20090522203142.73908120278@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=fd47fd5c3395467b517090f11d676bc52dba77ab Commit: fd47fd5c3395467b517090f11d676bc52dba77ab Parent: a4502a9c90a518fc121de2a3d62ae36a44b92468 Author: Fabio M. Di Nitto <fdinitto@redhat.com> AuthorDate: Wed May 20 15:22:56 2009 +0200 Committer: Fabio M. Di Nitto <fdinitto@redhat.com> CommitterDate: Wed May 20 15:22:56 2009 +0200 cman: fix logging config forward port ed02ac5f4275e1a8e26c8639880e928b747b44f1 from stable3 to master Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com> --- cman/config/cman-preconfig.c | 103 ++++++++++++++++++++++---------------- cman/services/cman/lib/libcman.h | 14 ++---- 2 files changed, 63 insertions(+), 54 deletions(-) diff --git a/cman/config/cman-preconfig.c b/cman/config/cman-preconfig.c index e4facb1..91a914b 100644 --- a/cman/config/cman-preconfig.c +++ b/cman/config/cman-preconfig.c @@ -26,7 +26,7 @@ #define MAX_PATH_LEN PATH_MAX -static unsigned int debug_mask; +static unsigned int debug; static int cmanpre_readconfig(struct objdb_iface_ver0 *objdb, const char **error_string); static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, const char **error_string); @@ -203,25 +203,17 @@ static unsigned int find_cman_logger(struct objdb_iface_ver0 *objdb, hdb_handle_ char *str; objdb->object_find_create(object_handle, "logger_subsys", strlen("logger_subsys"), &find_handle); - while (!objdb->object_find_next(object_handle, &subsys_handle)) { - - if (objdb_get_string(objdb, subsys_handle, "subsys", &str)) { - continue; + while (!objdb->object_find_next(find_handle, &subsys_handle)) { + if (!objdb_get_string(objdb, subsys_handle, "subsys", &str)) { + if (strncmp(str, CMAN_NAME, 4) == 0) { + objdb->object_find_destroy(find_handle); + return subsys_handle; + } } - if (strcmp(str, CMAN_NAME) == 0) - return subsys_handle; } objdb->object_find_destroy(find_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; + return -1; } @@ -523,7 +515,9 @@ static int get_env_overrides() node_votes = 1; } if (getenv("CMAN_DEBUGLOG")) { - debug_mask = atoi(getenv("CMAN_DEBUGLOG")); + debug = atoi(getenv("CMAN_DEBUGLOG")); + if (debug > 0) + debug = 1; } return 0; @@ -663,9 +657,9 @@ out: /* These are basically cman overrides to the totem config bits */ static void add_cman_overrides(struct objdb_iface_ver0 *objdb) { - hdb_handle_t logger_object_handle; char *logstr; char *logfacility; + char *loglevel; hdb_handle_t object_handle; hdb_handle_t find_handle; char tmp[256]; @@ -764,16 +758,17 @@ static void add_cman_overrides(struct objdb_iface_ver0 *objdb) objdb->object_find_destroy(find_handle); logfacility = facility_name_get(SYSLOGFACILITY); + loglevel = priority_name_get(SYSLOGLEVEL); - 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); + /* enable timestamps on logging */ + if (objdb_get_string(objdb, object_handle, "timestamp", &logstr)) { + objdb->object_key_create(object_handle, "timestamp", strlen("timestamp"), + "on", strlen("on")+1); } - if (objdb_get_string(objdb, object_handle, "to_file", &logstr)) { - objdb->object_key_create(object_handle, "to_file", strlen("to_file"), + /* configure logfile */ + if (objdb_get_string(objdb, object_handle, "to_logfile", &logstr)) { + objdb->object_key_create(object_handle, "to_logfile", strlen("to_logfile"), "yes", strlen("yes")+1); } @@ -782,27 +777,53 @@ static void add_cman_overrides(struct objdb_iface_ver0 *objdb) LOGDIR "/corosync.log", strlen(LOGDIR "/corosync.log")+1); } - if (objdb_get_string(objdb, object_handle, "timestamp", &logstr)) { - objdb->object_key_create(object_handle, "timestamp", strlen("timestamp"), - "on", strlen("on")+1); + if (objdb_get_string(objdb, object_handle, "logfile_priority", &logstr)) { + objdb->object_key_create(object_handle, "logfile_priority", strlen("logfile_priority"), + loglevel, strlen(loglevel)+1); } - if (debug_mask) { - objdb->object_key_create(object_handle, "to_stderr", strlen("to_stderr"), + /* syslog */ + if (objdb_get_string(objdb, object_handle, "to_syslog", &logstr)) { + objdb->object_key_create(object_handle, "to_syslog", strlen("to_syslog"), "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); + } + 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); } - else { - char *loglevel; - loglevel = priority_name_get(SYSLOGLEVEL); - objdb->object_key_create(logger_object_handle, "syslog_level", strlen("syslog_level"), + + if (objdb_get_string(objdb, object_handle, "syslog_priority", &logstr)) { + objdb->object_key_create(object_handle, "syslog_priority", strlen("syslog_priority"), loglevel, strlen(loglevel)+1); } + if (!debug) { + hdb_handle_t logger_object_handle; + + if (!objdb_get_string(objdb, object_handle, "debug", &logstr)) { + if (!strncmp(logstr, "on", 2)) { + debug=1; + } + } + + logger_object_handle = find_cman_logger(objdb, object_handle); + if (logger_object_handle > -1) { + if (!objdb_get_string(objdb, logger_object_handle, "debug", &logstr)) { + if (!strncmp(logstr, "on", 2)) { + debug=1; + } + if (!strncmp(logstr, "off", 3)) { + debug=0; + } + } + } + } + + if (debug) { + objdb->object_key_create(object_handle, "to_stderr", strlen("to_stderr"), + "yes", strlen("yes")+1); + } /* Make sure we allow connections from user/group "ais" */ objdb->object_find_create(OBJECT_PARENT_HANDLE, "aisexec", strlen("aisexec"), &find_handle); @@ -825,12 +846,6 @@ static void add_cman_overrides(struct objdb_iface_ver0 *objdb) objdb->object_key_create(object_handle, "cluster_id", strlen("cluster_id"), 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); - } } objdb->object_find_destroy(find_handle); diff --git a/cman/services/cman/lib/libcman.h b/cman/services/cman/lib/libcman.h index 404af07..3489025 100644 --- a/cman/services/cman/lib/libcman.h +++ b/cman/services/cman/lib/libcman.h @@ -408,17 +408,11 @@ int cman_get_quorum_device(cman_handle_t handle, struct cman_qdev_info *info); */ int cman_set_dirty(cman_handle_t handle); - /* - * Changes the debug logging level inside cman. - * subsystems is a bitmask of: + * From STABLE3 branch this call tells corosync to execute: + * logsys_config_debug_set(CMAN_NAME, value); + * and debugging for all CMAN subsystems is on. */ -#define CMAN_DEBUGLOG_NONE 0 -#define CMAN_DEBUGLOG_BARRIER 2 -#define CMAN_DEBUGLOG_MEMBERSHIP 4 -#define CMAN_DEBUGLOG_DAEMON 8 -#define CMAN_DEBUGLOG_AIS 16 - -int cman_set_debuglog(cman_handle_t handle, int subsystems); +int cman_set_debuglog(cman_handle_t handle, int value); #endif
reply other threads:[~2009-05-22 20:32 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20090522203142.73908120278@lists.fedorahosted.org \ --to=cfeist@fedoraproject.org \ --cc=cluster-cvs-relay@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).