diff --git a/conf/lenses/corosync.aug b/conf/lenses/corosync.aug index 1f0b054e..98cd2686 100644 --- a/conf/lenses/corosync.aug +++ b/conf/lenses/corosync.aug @@ -1,181 +1,181 @@ (* Process /etc/corosync/corosync.conf *) (* The lens is based on the corosync.conf(5) man page *) module Corosync = autoload xfm let comment = Util.comment let empty = Util.empty let dels = Util.del_str let eol = Util.eol let ws = del /[ \t]+/ " " let wsc = del /:[ \t]+/ ": " let indent = del /[ \t]*/ "" (* We require that braces are always followed by a newline *) let obr = del /\{([ \t]*)\n/ "{\n" let cbr = del /[ \t]*}[ \t]*\n/ "}\n" let ikey (k:regexp) = indent . key k let section (n:regexp) (b:lens) = [ ikey n . ws . obr . (b|empty|comment)* . cbr ] let kv (k:regexp) (v:regexp) = [ ikey k . wsc . store v . eol ] (* FIXME: it would be much more concise to write *) (* [ key k . ws . (bare | quoted) ] *) (* but the typechecker trips over that *) let qstr (k:regexp) = let delq = del /['"]/ "\"" in let bare = del /["']?/ "" . store /[^"' \t\n]+/ . del /["']?/ "" in let quoted = delq . store /.*[ \t].*/ . delq in [ ikey k . wsc . bare . eol ] |[ ikey k . wsc . quoted . eol ] (* A integer subsection *) let interface = let setting = kv "ringnumber" Rx.integer |kv "mcastport" Rx.integer |kv "ttl" Rx.integer |qstr /bindnetaddr|mcastaddr/ in section "interface" setting (* The totem section *) let totem = let setting = kv "clear_node_high_bit" /yes|no/ |kv "rrp_mode" /none|active|passive/ |kv "vsftype" /none|ykd/ |kv "secauth" /on|off/ |kv "crypto_type" /nss|aes256/ |kv "crypto_cipher" /none|nss|aes256/ |kv "crypto_hash" /none|md5|sha1|sha256|sha384|sha512/ |kv "transport" /udp|iba/ |kv "version" Rx.integer |kv "nodeid" Rx.integer |kv "threads" Rx.integer |kv "netmtu" Rx.integer |kv "token" Rx.integer |kv "token_retransmit" Rx.integer |kv "hold" Rx.integer |kv "token_retransmits_before_loss_const" Rx.integer |kv "join" Rx.integer |kv "send_join" Rx.integer |kv "consensus" Rx.integer |kv "merge" Rx.integer |kv "downcheck" Rx.integer |kv "fail_to_recv_const" Rx.integer |kv "seqno_unchanged_const" Rx.integer |kv "heartbeat_failures_allowed" Rx.integer |kv "max_network_delay" Rx.integer |kv "max_messages" Rx.integer |kv "window_size" Rx.integer |kv "rrp_problem_count_timeout" Rx.integer |kv "rrp_problem_count_threshold" Rx.integer |kv "rrp_token_expired_timeout" Rx.integer |interface in section "totem" setting let common_logging = kv "to_syslog" /yes|no|on|off/ |kv "to_stderr" /yes|no|on|off/ |kv "to_logfile" /yes|no|on|off/ - |kv "debug" /yes|no|on|off/ + |kv "debug" /yes|no|on|off|trace/ |kv "logfile_priority" /alert|crit|debug|emerg|err|info|notice|warning/ |kv "syslog_priority" /alert|crit|debug|emerg|err|info|notice|warning/ |kv "syslog_facility" /daemon|local0|local1|local2|local3|local4|local5|local6|local7/ |qstr /logfile|tags/ (* A logger_subsys subsection *) let logger_subsys = let setting = qstr /subsys/ |common_logging in section "logger_subsys" setting (* The logging section *) let logging = let setting = kv "fileline" /yes|no|on|off/ |kv "function_name" /yes|no|on|off/ |kv "timestamp" /yes|no|on|off/ |common_logging |logger_subsys in section "logging" setting (* The resource section *) let common_resource = kv "max" Rx.decimal |kv "poll_period" Rx.integer |kv "recovery" /reboot|shutdown|watchdog|none/ let memory_used = let setting = common_resource in section "memory_used" setting let load_15min = let setting = common_resource in section "load_15min" setting let system = let setting = load_15min |memory_used in section "system" setting (* The resources section *) let resources = let setting = system in section "resources" setting (* The quorum section *) let quorum = let setting = qstr /provider/ |kv "expected_votes" Rx.integer |kv "votes" Rx.integer |kv "wait_for_all" Rx.integer |kv "last_man_standing" Rx.integer |kv "last_man_standing_window" Rx.integer |kv "auto_tie_breaker" Rx.integer |kv "two_node" Rx.integer in section "quorum" setting (* The service section *) let service = let setting = qstr /name|ver/ in section "service" setting (* The uidgid section *) let uidgid = let setting = qstr /uid|gid/ in section "uidgid" setting (* The node section *) let node = let setting = qstr /ring[0-9]_addr/ |kv "nodeid" Rx.integer |kv "quorum_votes" Rx.integer in section "node" setting (* The nodelist section *) let nodelist = let setting = node in section "nodelist" setting let lns = (comment|empty|totem|quorum|logging|resources|service|uidgid|nodelist)* let xfm = transform lns (incl "/etc/corosync/corosync.conf") diff --git a/exec/logconfig.c b/exec/logconfig.c index 36082333..cbfb7ee5 100644 --- a/exec/logconfig.c +++ b/exec/logconfig.c @@ -1,603 +1,609 @@ /* * Copyright (c) 2002-2005 MontaVista Software, Inc. * Copyright (c) 2006-2011 Red Hat, Inc. * * All rights reserved. * * Author: Steven Dake (sdake@redhat.com) * Jan Friesse (jfriesse@redhat.com) * * This software licensed under BSD license, the text of which follows: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * - Neither the name of the MontaVista Software, Inc. nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #include #include #ifdef LOGCONFIG_USE_ICMAP #include #define MAP_KEYNAME_MAXLEN ICMAP_KEYNAME_MAXLEN #define map_get_string(key_name, value) icmap_get_string(key_name, value) #else #include static cmap_handle_t cmap_handle; static const char *main_logfile; #define MAP_KEYNAME_MAXLEN CMAP_KEYNAME_MAXLEN #define map_get_string(key_name, value) cmap_get_string(cmap_handle, key_name, value) #endif #include "util.h" #include "logconfig.h" static char error_string_response[512]; /** * insert_into_buffer * @target_buffer: a buffer where to write results * @bufferlen: tell us the size of the buffer to avoid overflows * @entry: entry that needs to be added to the buffer * @after: can either be NULL or set to a string. * if NULL, @entry is prependend to logsys_format_get buffer. * if set, @entry is added immediately after @after. * * Since the function is specific to logsys_format_get handling, it is implicit * that source is logsys_format_get(); * * In case of failure, target_buffer could be left dirty. So don't trust * any data leftover in it. * * Searching for "after" assumes that there is only entry of "after" * in the source. Afterall we control the string here and for logging format * it makes little to no sense to have duplicate format entries. * * Returns: 0 on success, -1 on failure **/ static int insert_into_buffer( char *target_buffer, size_t bufferlen, const char *entry, const char *after) { const char *current_format = NULL; current_format = logsys_format_get(); /* if the entry is already in the format we don't add it again */ if (strstr(current_format, entry) != NULL) { return -1; } /* if there is no "after", simply prepend the requested entry * otherwise go for beautiful string manipulation.... */ if (!after) { if (snprintf(target_buffer, bufferlen - 1, "%s%s", entry, current_format) >= bufferlen - 1) { return -1; } } else { const char *afterpos; size_t afterlen; size_t templen; /* check if after is contained in the format * and afterlen has a meaning or return an error */ afterpos = strstr(current_format, after); afterlen = strlen(after); if ((!afterpos) || (!afterlen)) { return -1; } templen = afterpos - current_format + afterlen; if (snprintf(target_buffer, templen + 1, "%s", current_format) >= bufferlen - 1) { return -1; } if (snprintf(target_buffer + templen, bufferlen - ( templen + 1 ), "%s%s", entry, current_format + templen) >= bufferlen - ( templen + 1 )) { return -1; } } return 0; } /* * format set is the only global specific option that * doesn't apply at system/subsystem level. */ static int corosync_main_config_format_set ( const char **error_string) { const char *error_reason; char new_format_buffer[PATH_MAX]; char *value = NULL; int err = 0; if (map_get_string("logging.fileline", &value) == CS_OK) { if (strcmp (value, "on") == 0) { if (!insert_into_buffer(new_format_buffer, sizeof(new_format_buffer), " %f:%l", "g]")) { err = logsys_format_set(new_format_buffer); } else if (!insert_into_buffer(new_format_buffer, sizeof(new_format_buffer), "%f:%l", NULL)) { err = logsys_format_set(new_format_buffer); } } else if (strcmp (value, "off") == 0) { /* nothing to do here */ } else { error_reason = "unknown value for fileline"; goto parse_error; } free(value); } if (err) { error_reason = "not enough memory to set logging format buffer"; goto parse_error; } if (map_get_string("logging.function_name", &value) == CS_OK) { if (strcmp (value, "on") == 0) { if (!insert_into_buffer(new_format_buffer, sizeof(new_format_buffer), "%n:", "f:")) { err = logsys_format_set(new_format_buffer); } else if (!insert_into_buffer(new_format_buffer, sizeof(new_format_buffer), " %n", "g]")) { err = logsys_format_set(new_format_buffer); } } else if (strcmp (value, "off") == 0) { /* nothing to do here */ } else { error_reason = "unknown value for function_name"; goto parse_error; } free(value); } if (err) { error_reason = "not enough memory to set logging format buffer"; goto parse_error; } if (map_get_string("logging.timestamp", &value) == CS_OK) { if (strcmp (value, "on") == 0) { if(!insert_into_buffer(new_format_buffer, sizeof(new_format_buffer), "%t ", NULL)) { err = logsys_format_set(new_format_buffer); } } else if (strcmp (value, "off") == 0) { /* nothing to do here */ } else { error_reason = "unknown value for timestamp"; goto parse_error; } free(value); } if (err) { error_reason = "not enough memory to set logging format buffer"; goto parse_error; } return (0); parse_error: *error_string = error_reason; return (-1); } static int corosync_main_config_log_destination_set ( const char *path, const char *key, const char *subsys, const char **error_string, unsigned int mode_mask, char deprecated, const char *replacement) { static char formatted_error_reason[128]; char *value = NULL; unsigned int mode; char key_name[MAP_KEYNAME_MAXLEN]; snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, key); if (map_get_string(key_name, &value) == CS_OK) { if (deprecated) { log_printf(LOGSYS_LEVEL_WARNING, "Warning: the %s config paramater has been obsoleted." " See corosync.conf man page %s directive.", key, replacement); } mode = logsys_config_mode_get (subsys); if (strcmp (value, "yes") == 0 || strcmp (value, "on") == 0) { mode |= mode_mask; if (logsys_config_mode_set(subsys, mode) < 0) { sprintf (formatted_error_reason, "unable to set mode %s", key); goto parse_error; } } else if (strcmp (value, "no") == 0 || strcmp (value, "off") == 0) { mode &= ~mode_mask; if (logsys_config_mode_set(subsys, mode) < 0) { sprintf (formatted_error_reason, "unable to unset mode %s", key); goto parse_error; } } else { sprintf (formatted_error_reason, "unknown value for %s", key); goto parse_error; } } free(value); return (0); parse_error: *error_string = formatted_error_reason; free(value); return (-1); } static int corosync_main_config_set ( const char *path, const char *subsys, const char **error_string) { const char *error_reason = error_string_response; char *value = NULL; int mode; char key_name[MAP_KEYNAME_MAXLEN]; /* * this bit abuses the internal logsys exported API * to guarantee that all configured subsystems are * initialized too. * * using this approach avoids some headaches caused * by IPC and TOTEM that have a special logging * handling requirements */ if (subsys != NULL) { if (_logsys_subsys_create(subsys, NULL) < 0) { error_reason = "unable to create new logging subsystem"; goto parse_error; } } mode = logsys_config_mode_get(subsys); if (mode < 0) { error_reason = "unable to get mode"; goto parse_error; } if (corosync_main_config_log_destination_set (path, "to_stderr", subsys, &error_reason, LOGSYS_MODE_OUTPUT_STDERR, 0, NULL) != 0) goto parse_error; if (corosync_main_config_log_destination_set (path, "to_syslog", subsys, &error_reason, LOGSYS_MODE_OUTPUT_SYSLOG, 0, NULL) != 0) goto parse_error; snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "syslog_facility"); if (map_get_string(key_name, &value) == CS_OK) { int syslog_facility; syslog_facility = qb_log_facility2int(value); if (syslog_facility < 0) { error_reason = "unknown syslog facility specified"; goto parse_error; } if (logsys_config_syslog_facility_set(subsys, syslog_facility) < 0) { error_reason = "unable to set syslog facility"; goto parse_error; } free(value); } snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "syslog_level"); if (map_get_string(key_name, &value) == CS_OK) { int syslog_priority; log_printf(LOGSYS_LEVEL_WARNING, "Warning: the syslog_level config paramater has been obsoleted." " See corosync.conf man page syslog_priority directive."); syslog_priority = logsys_priority_id_get(value); if (syslog_priority < 0) { error_reason = "unknown syslog level specified"; goto parse_error; } if (logsys_config_syslog_priority_set(subsys, syslog_priority) < 0) { error_reason = "unable to set syslog level"; goto parse_error; } free(value); } snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "syslog_priority"); if (map_get_string(key_name, &value) == CS_OK) { int syslog_priority; syslog_priority = logsys_priority_id_get(value); if (syslog_priority < 0) { error_reason = "unknown syslog priority specified"; goto parse_error; } if (logsys_config_syslog_priority_set(subsys, syslog_priority) < 0) { error_reason = "unable to set syslog priority"; goto parse_error; } free(value); } #ifdef LOGCONFIG_USE_ICMAP snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "logfile"); if (map_get_string(key_name, &value) == CS_OK) { if (logsys_config_file_set (subsys, &error_reason, value) < 0) { goto parse_error; } free(value); } #else if (!subsys) { if (logsys_config_file_set (subsys, &error_reason, main_logfile) < 0) { goto parse_error; } } #endif if (corosync_main_config_log_destination_set (path, "to_file", subsys, &error_reason, LOGSYS_MODE_OUTPUT_FILE, 1, "to_logfile") != 0) goto parse_error; if (corosync_main_config_log_destination_set (path, "to_logfile", subsys, &error_reason, LOGSYS_MODE_OUTPUT_FILE, 0, NULL) != 0) goto parse_error; snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "logfile_priority"); if (map_get_string(key_name, &value) == CS_OK) { int logfile_priority; logfile_priority = logsys_priority_id_get(value); if (logfile_priority < 0) { error_reason = "unknown logfile priority specified"; goto parse_error; } if (logsys_config_logfile_priority_set(subsys, logfile_priority) < 0) { error_reason = "unable to set logfile priority"; goto parse_error; } free(value); } snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "debug"); if (map_get_string(key_name, &value) == CS_OK) { + if (strcmp (value, "trace") == 0) { + if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_TRACE) < 0) { + error_reason = "unable to set debug trace"; + goto parse_error; + } + } else if (strcmp (value, "on") == 0) { - if (logsys_config_debug_set (subsys, 1) < 0) { + if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_ON) < 0) { error_reason = "unable to set debug on"; goto parse_error; } } else if (strcmp (value, "off") == 0) { - if (logsys_config_debug_set (subsys, 0) < 0) { + if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_OFF) < 0) { error_reason = "unable to set debug off"; goto parse_error; } } else { error_reason = "unknown value for debug"; goto parse_error; } free(value); } return (0); parse_error: *error_string = error_reason; return (-1); } static int corosync_main_config_read_logging ( const char **error_string) { const char *error_reason; #ifdef LOGCONFIG_USE_ICMAP icmap_iter_t iter; const char *key_name; #else cmap_iter_handle_t iter; char key_name[CMAP_KEYNAME_MAXLEN]; #endif char key_subsys[MAP_KEYNAME_MAXLEN]; char key_item[MAP_KEYNAME_MAXLEN]; int res; /* format set is supported only for toplevel */ if (corosync_main_config_format_set(&error_reason) < 0) { goto parse_error; } if (corosync_main_config_set ("logging", NULL, &error_reason) < 0) { goto parse_error; } /* * we will need 2 of these to compensate for new logging * config format */ #ifdef LOGCONFIG_USE_ICMAP iter = icmap_iter_init("logging.logger_subsys."); while ((key_name = icmap_iter_next(iter, NULL, NULL)) != NULL) { #else cmap_iter_init(cmap_handle, "logging.logger_subsys.", &iter); while ((cmap_iter_next(cmap_handle, iter, key_name, NULL, NULL)) == CS_OK) { #endif res = sscanf(key_name, "logging.logger_subsys.%[^.].%s", key_subsys, key_item); if (res != 2) { continue ; } if (strcmp(key_item, "subsys") != 0) { continue ; } snprintf(key_item, MAP_KEYNAME_MAXLEN, "logging.logger_subsys.%s", key_subsys); if (corosync_main_config_set(key_item, key_subsys, &error_reason) < 0) { goto parse_error; } } #ifdef LOGCONFIG_USE_ICMAP icmap_iter_finalize(iter); #else cmap_iter_finalize(cmap_handle, iter); #endif logsys_config_apply(); return 0; parse_error: *error_string = error_reason; return (-1); } #ifdef LOGCONFIG_USE_ICMAP static void main_logging_notify( int32_t event, const char *key_name, struct icmap_notify_value new_val, struct icmap_notify_value old_val, void *user_data) #else static void main_logging_notify( cmap_handle_t cmap_handle_unused, cmap_handle_t cmap_track_handle_unused, int32_t event, const char *key_name, struct cmap_notify_value new_val, struct cmap_notify_value old_val, void *user_data) #endif { const char *error_string; /* * Reload the logsys configuration */ if (logsys_format_set(NULL) == -1) { fprintf (stderr, "Unable to setup logging format.\n"); } corosync_main_config_read_logging(&error_string); } #ifdef LOGCONFIG_USE_ICMAP static void add_logsys_config_notification(void) { icmap_track_t icmap_track = NULL; icmap_track_add("logging.", ICMAP_TRACK_ADD | ICMAP_TRACK_DELETE | ICMAP_TRACK_MODIFY | ICMAP_TRACK_PREFIX, main_logging_notify, NULL, &icmap_track); } #else static void add_logsys_config_notification(void) { cmap_track_handle_t cmap_track; cmap_track_add(cmap_handle, "logging.", CMAP_TRACK_ADD | CMAP_TRACK_DELETE | CMAP_TRACK_MODIFY | CMAP_TRACK_PREFIX, main_logging_notify, NULL, &cmap_track); } #endif int corosync_log_config_read ( #ifndef LOGCONFIG_USE_ICMAP cmap_handle_t cmap_h, const char *default_logfile, #endif const char **error_string) { const char *error_reason = error_string_response; #ifndef LOGCONFIG_USE_ICMAP if (!cmap_h) { error_reason = "No cmap handle"; return (-1); } if (!default_logfile) { error_reason = "No default logfile"; return (-1); } cmap_handle = cmap_h; main_logfile = default_logfile; #endif if (corosync_main_config_read_logging(error_string) < 0) { error_reason = *error_string; goto parse_error; } add_logsys_config_notification(); return 0; parse_error: snprintf (error_string_response, sizeof(error_string_response), "parse error in config: %s.\n", error_reason); *error_string = error_string_response; return (-1); } diff --git a/exec/logsys.c b/exec/logsys.c index c7a3b8bf..3b944199 100644 --- a/exec/logsys.c +++ b/exec/logsys.c @@ -1,814 +1,824 @@ /* * Copyright (c) 2002-2004 MontaVista Software, Inc. * Copyright (c) 2006-2012 Red Hat, Inc. * * Author: Steven Dake (sdake@redhat.com) * Author: Lon Hohberger (lhh@redhat.com) * Author: Fabio M. Di Nitto (fdinitto@redhat.com) * * All rights reserved. * * This software licensed under BSD license, the text of which follows: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * - Neither the name of the MontaVista Software, Inc. nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #include #include #include #include #include #include #include #include #include #include #include /* * syslog prioritynames, facility names to value mapping * Some C libraries build this in to their headers, but it is non-portable * so logsys supplies its own version. */ struct syslog_names { const char *c_name; int c_val; }; static struct syslog_names prioritynames[] = { { "alert", LOG_ALERT }, { "crit", LOG_CRIT }, { "debug", LOG_DEBUG }, { "emerg", LOG_EMERG }, { "err", LOG_ERR }, { "error", LOG_ERR }, { "info", LOG_INFO }, { "notice", LOG_NOTICE }, { "warning", LOG_WARNING }, { NULL, -1 } }; #define MAX_FILES_PER_SUBSYS 32 #ifdef HAVE_SMALL_MEMORY_FOOTPRINT #define IPC_LOGSYS_SIZE 8192*64 #else #define IPC_LOGSYS_SIZE 8192*1024 #endif /* * need unlogical order to preserve 64bit alignment */ struct logsys_logger { char subsys[LOGSYS_MAX_SUBSYS_NAMELEN]; /* subsystem name */ char *logfile; /* log to file */ unsigned int mode; /* subsystem mode */ - unsigned int debug; /* debug on|off */ + unsigned int debug; /* debug on|off|trace */ int syslog_priority; /* priority */ int logfile_priority; /* priority to file */ int init_status; /* internal field to handle init queues for subsystems */ int32_t target_id; char *files[MAX_FILES_PER_SUBSYS]; int32_t file_idx; int32_t dirty; }; /* values for logsys_logger init_status */ #define LOGSYS_LOGGER_INIT_DONE 0 #define LOGSYS_LOGGER_NEEDS_INIT 1 static int logsys_system_needs_init = LOGSYS_LOGGER_NEEDS_INIT; static struct logsys_logger logsys_loggers[LOGSYS_MAX_SUBSYS_COUNT + 1]; static pthread_mutex_t logsys_config_mutex = PTHREAD_MUTEX_INITIALIZER; static int32_t _logsys_config_mode_set_unlocked(int32_t subsysid, uint32_t new_mode); static void _logsys_config_apply_per_file(int32_t s, const char *filename); static void _logsys_config_apply_per_subsys(int32_t s); static void _logsys_subsys_filename_add (int32_t s, const char *filename); static void logsys_file_format_get(char* file_format, int buf_len); static char *format_buffer=NULL; static int logsys_thread_started = 0; static int _logsys_config_subsys_get_unlocked (const char *subsys) { unsigned int i; if (!subsys) { return LOGSYS_MAX_SUBSYS_COUNT; } for (i = 0; i <= LOGSYS_MAX_SUBSYS_COUNT; i++) { if (strcmp (logsys_loggers[i].subsys, subsys) == 0) { return i; } } return (-1); } /* * we need a version that can work when somebody else is already * holding a config mutex lock or we will never get out of here */ static int logsys_config_file_set_unlocked ( int subsysid, const char **error_string, const char *file) { static char error_string_response[512]; int i; char file_format[128]; if (logsys_loggers[subsysid].target_id > 0) { int32_t f; for (f = 0; f < logsys_loggers[subsysid].file_idx; f++) { qb_log_filter_ctl(logsys_loggers[subsysid].target_id, QB_LOG_FILTER_REMOVE, QB_LOG_FILTER_FILE, logsys_loggers[subsysid].files[f], LOG_TRACE); } } logsys_loggers[subsysid].dirty = QB_TRUE; if (file == NULL) { return (0); } if (strlen(file) >= PATH_MAX) { snprintf (error_string_response, sizeof(error_string_response), "%s: logfile name exceed maximum system filename lenght", logsys_loggers[subsysid].subsys); *error_string = error_string_response; return (-1); } for (i = 0; i <= LOGSYS_MAX_SUBSYS_COUNT; i++) { if ((logsys_loggers[i].logfile != NULL) && (strcmp (logsys_loggers[i].logfile, file) == 0) && (i != subsysid)) { /* we have found another subsys with this config file * so add a filter */ logsys_loggers[subsysid].target_id = logsys_loggers[i].target_id; return (0); } } logsys_loggers[subsysid].logfile = strdup(file); if (logsys_loggers[subsysid].logfile == NULL) { snprintf (error_string_response, sizeof(error_string_response), "Unable to allocate memory for logfile '%s'", file); *error_string = error_string_response; return (-1); } if (logsys_loggers[subsysid].target_id > 0) { int num_using_current = 0; for (i = 0; i <= LOGSYS_MAX_SUBSYS_COUNT; i++) { if (logsys_loggers[subsysid].target_id == logsys_loggers[i].target_id) { num_using_current++; } } if (num_using_current == 1) { /* no one else is using this close it */ qb_log_file_close(logsys_loggers[subsysid].target_id); } } logsys_loggers[subsysid].target_id = qb_log_file_open(file); if (logsys_loggers[subsysid].target_id < 0) { int err = -logsys_loggers[subsysid].target_id; char error_str[LOGSYS_MAX_PERROR_MSG_LEN]; const char *error_ptr; error_ptr = qb_strerror_r(err, error_str, sizeof(error_str)); free(logsys_loggers[subsysid].logfile); logsys_loggers[subsysid].logfile = NULL; snprintf (error_string_response, sizeof(error_string_response), "Can't open logfile '%s' for reason: %s (%d)", file, error_ptr, err); *error_string = error_string_response; return (-1); } logsys_file_format_get(file_format, 128); qb_log_format_set(logsys_loggers[subsysid].target_id, file_format); qb_log_ctl(logsys_loggers[subsysid].target_id, QB_LOG_CONF_ENABLED, (logsys_loggers[subsysid].mode & LOGSYS_MODE_OUTPUT_FILE)); if (logsys_thread_started) { qb_log_ctl(logsys_loggers[subsysid].target_id, QB_LOG_CONF_THREADED, QB_TRUE); } return (0); } static void logsys_subsys_init ( const char *subsys, int subsysid) { if (logsys_system_needs_init == LOGSYS_LOGGER_NEEDS_INIT) { logsys_loggers[subsysid].init_status = LOGSYS_LOGGER_NEEDS_INIT; } else { logsys_loggers[subsysid].mode = logsys_loggers[LOGSYS_MAX_SUBSYS_COUNT].mode; logsys_loggers[subsysid].debug = logsys_loggers[LOGSYS_MAX_SUBSYS_COUNT].debug; logsys_loggers[subsysid].syslog_priority = logsys_loggers[LOGSYS_MAX_SUBSYS_COUNT].syslog_priority; logsys_loggers[subsysid].logfile_priority = logsys_loggers[LOGSYS_MAX_SUBSYS_COUNT].logfile_priority; logsys_loggers[subsysid].init_status = LOGSYS_LOGGER_INIT_DONE; } strncpy (logsys_loggers[subsysid].subsys, subsys, sizeof (logsys_loggers[subsysid].subsys)); logsys_loggers[subsysid].subsys[ sizeof (logsys_loggers[subsysid].subsys) - 1] = '\0'; logsys_loggers[subsysid].file_idx = 0; } static const char *_logsys_tags_stringify(uint32_t tags) { if (tags == QB_LOG_TAG_LIBQB_MSG) { return "QB"; } else { return logsys_loggers[tags].subsys; } } void logsys_system_fini (void) { int i; int f; for (i = 0; i < LOGSYS_MAX_SUBSYS_COUNT; i++) { free(logsys_loggers[i].logfile); for (f = 0; f < logsys_loggers[i].file_idx; f++) { free(logsys_loggers[i].files[f]); } } qb_log_fini (); } /* * Internal API - exported */ int _logsys_system_setup( const char *mainsystem, unsigned int mode, int syslog_facility, int syslog_priority) { int i; int32_t fidx; char tempsubsys[LOGSYS_MAX_SUBSYS_NAMELEN]; if ((mainsystem == NULL) || (strlen(mainsystem) >= LOGSYS_MAX_SUBSYS_NAMELEN)) { return -1; } /* * Setup libqb as a subsys */ i = _logsys_subsys_create ("QB", "array.c"); _logsys_subsys_filename_add (i, "log.c"); _logsys_subsys_filename_add (i, "log_syslog.c"); _logsys_subsys_filename_add (i, "log_blackbox.c"); _logsys_subsys_filename_add (i, "log_format.c"); _logsys_subsys_filename_add (i, "log_file.c"); _logsys_subsys_filename_add (i, "log_dcs.c"); _logsys_subsys_filename_add (i, "log_thread.c"); _logsys_subsys_filename_add (i, "ipc_shm.c"); _logsys_subsys_filename_add (i, "ipcs.c"); _logsys_subsys_filename_add (i, "ipc_us.c"); _logsys_subsys_filename_add (i, "loop.c"); _logsys_subsys_filename_add (i, "loop_poll_epoll.c"); _logsys_subsys_filename_add (i, "loop_job.c"); _logsys_subsys_filename_add (i, "loop_poll_poll.c"); _logsys_subsys_filename_add (i, "loop_poll_kqueue.c"); _logsys_subsys_filename_add (i, "loop_timerlist.c"); _logsys_subsys_filename_add (i, "loop_poll.c"); _logsys_subsys_filename_add (i, "ringbuffer.c"); _logsys_subsys_filename_add (i, "ringbuffer_helper.c"); _logsys_subsys_filename_add (i, "trie.c"); _logsys_subsys_filename_add (i, "map.c"); _logsys_subsys_filename_add (i, "skiplist.c"); _logsys_subsys_filename_add (i, "rpl_sem.c"); _logsys_subsys_filename_add (i, "hdb.c"); _logsys_subsys_filename_add (i, "unix.c"); /* * name clash * _logsys_subsys_filename_add (i, "util.c"); */ i = LOGSYS_MAX_SUBSYS_COUNT; pthread_mutex_lock (&logsys_config_mutex); snprintf(logsys_loggers[i].subsys, LOGSYS_MAX_SUBSYS_NAMELEN, "%s", mainsystem); logsys_loggers[i].mode = mode; - logsys_loggers[i].debug = 0; + logsys_loggers[i].debug = LOGSYS_DEBUG_OFF; logsys_loggers[i].file_idx = 0; logsys_loggers[i].logfile_priority = syslog_priority; logsys_loggers[i].syslog_priority = syslog_priority; qb_log_init(mainsystem, syslog_facility, syslog_priority); if (logsys_loggers[i].mode & LOGSYS_MODE_OUTPUT_STDERR) { qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, QB_TRUE); } else { qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, QB_FALSE); } if (logsys_loggers[i].mode & LOGSYS_MODE_OUTPUT_SYSLOG) { qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, QB_TRUE); } else { qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, QB_FALSE); } qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_PRIORITY_BUMP, LOG_INFO - LOG_DEBUG); qb_log_filter_ctl(QB_LOG_BLACKBOX, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, "*", LOG_TRACE); qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_SIZE, IPC_LOGSYS_SIZE); qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_THREADED, QB_FALSE); qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_ENABLED, QB_TRUE); logsys_format_set(NULL); qb_log_tags_stringify_fn_set(_logsys_tags_stringify); logsys_loggers[i].init_status = LOGSYS_LOGGER_INIT_DONE; logsys_system_needs_init = LOGSYS_LOGGER_INIT_DONE; for (i = 0; i < LOGSYS_MAX_SUBSYS_COUNT; i++) { if ((strcmp (logsys_loggers[i].subsys, "") != 0) && (logsys_loggers[i].init_status == LOGSYS_LOGGER_NEEDS_INIT)) { fidx = logsys_loggers[i].file_idx; strncpy (tempsubsys, logsys_loggers[i].subsys, sizeof (tempsubsys)); tempsubsys[sizeof (tempsubsys) - 1] = '\0'; logsys_subsys_init(tempsubsys, i); logsys_loggers[i].file_idx = fidx; _logsys_config_mode_set_unlocked(i, logsys_loggers[i].mode); _logsys_config_apply_per_subsys(i); } } pthread_mutex_unlock (&logsys_config_mutex); return (0); } static void _logsys_subsys_filename_add (int32_t s, const char *filename) { int i; if (filename == NULL) { return; } assert(logsys_loggers[s].file_idx < MAX_FILES_PER_SUBSYS); assert(logsys_loggers[s].file_idx >= 0); for (i = 0; i < logsys_loggers[s].file_idx; i++) { if (strcmp(logsys_loggers[s].files[i], filename) == 0) { return; } } logsys_loggers[s].files[logsys_loggers[s].file_idx++] = strdup(filename); if (logsys_system_needs_init == LOGSYS_LOGGER_INIT_DONE) { _logsys_config_apply_per_file(s, filename); } } int _logsys_subsys_create (const char *subsys, const char *filename) { int i; if ((subsys == NULL) || (strlen(subsys) >= LOGSYS_MAX_SUBSYS_NAMELEN)) { return -1; } pthread_mutex_lock (&logsys_config_mutex); i = _logsys_config_subsys_get_unlocked (subsys); if ((i > -1) && (i < LOGSYS_MAX_SUBSYS_COUNT)) { _logsys_subsys_filename_add(i, filename); pthread_mutex_unlock (&logsys_config_mutex); return i; } for (i = 0; i < LOGSYS_MAX_SUBSYS_COUNT; i++) { if (strcmp (logsys_loggers[i].subsys, "") == 0) { logsys_subsys_init(subsys, i); _logsys_subsys_filename_add(i, filename); break; } } if (i >= LOGSYS_MAX_SUBSYS_COUNT) { i = -1; } pthread_mutex_unlock (&logsys_config_mutex); return i; } int _logsys_config_subsys_get (const char *subsys) { unsigned int i; pthread_mutex_lock (&logsys_config_mutex); i = _logsys_config_subsys_get_unlocked (subsys); pthread_mutex_unlock (&logsys_config_mutex); return i; } static int32_t _logsys_config_mode_set_unlocked(int32_t subsysid, uint32_t new_mode) { if ( logsys_loggers[subsysid].mode == new_mode) { return 0; } if (logsys_loggers[subsysid].target_id > 0) { qb_log_ctl(logsys_loggers[subsysid].target_id, QB_LOG_CONF_ENABLED, (new_mode & LOGSYS_MODE_OUTPUT_FILE)); } if (subsysid == LOGSYS_MAX_SUBSYS_COUNT) { qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, (new_mode & LOGSYS_MODE_OUTPUT_STDERR)); qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, (new_mode & LOGSYS_MODE_OUTPUT_SYSLOG)); } logsys_loggers[subsysid].mode = new_mode; return 0; } int logsys_config_mode_set (const char *subsys, unsigned int mode) { int i; pthread_mutex_lock (&logsys_config_mutex); if (subsys != NULL) { i = _logsys_config_subsys_get_unlocked (subsys); if (i >= 0) { i = _logsys_config_mode_set_unlocked(i, mode); } } else { for (i = 0; i <= LOGSYS_MAX_SUBSYS_COUNT; i++) { _logsys_config_mode_set_unlocked(i, mode); } i = 0; } pthread_mutex_unlock (&logsys_config_mutex); return i; } unsigned int logsys_config_mode_get (const char *subsys) { int i; i = _logsys_config_subsys_get (subsys); if (i < 0) { return i; } return logsys_loggers[i].mode; } int logsys_config_file_set ( const char *subsys, const char **error_string, const char *file) { int i; int res; pthread_mutex_lock (&logsys_config_mutex); if (subsys != NULL) { i = _logsys_config_subsys_get_unlocked (subsys); if (i < 0) { res = i; } else { res = logsys_config_file_set_unlocked(i, error_string, file); } } else { for (i = 0; i <= LOGSYS_MAX_SUBSYS_COUNT; i++) { res = logsys_config_file_set_unlocked(i, error_string, file); if (res < 0) { break; } } } pthread_mutex_unlock (&logsys_config_mutex); return res; } static void logsys_file_format_get(char* file_format, int buf_len) { char *per_t; file_format[0] = '\0'; per_t = strstr(format_buffer, "%t"); if (per_t) { strcpy(file_format, "%t [%P] %H %N"); per_t += 2; strncat(file_format, per_t, buf_len - strlen("%t [%P] %H %N")); } else { strcpy(file_format, "[%P] %H %N"); strncat(file_format, format_buffer, buf_len - strlen("[%P] %H %N")); } } int logsys_format_set (const char *format) { int ret = 0; int i; int c; int w; int reminder; char syslog_format[128]; char file_format[128]; if (format_buffer) { free(format_buffer); format_buffer = NULL; } format_buffer = strdup(format ? format : "%7p [%6g] %b"); if (format_buffer == NULL) { ret = -1; } qb_log_format_set(QB_LOG_STDERR, format_buffer); logsys_file_format_get(file_format, 128); for (i = 0; i <= LOGSYS_MAX_SUBSYS_COUNT; i++) { if (logsys_loggers[i].target_id > 0) { qb_log_format_set(logsys_loggers[i].target_id, file_format); } } /* * This just goes through and remove %t and %p from * the format string for syslog. */ w = 0; memset(syslog_format, '\0', sizeof(syslog_format)); for (c = 0; c < strlen(format_buffer); c++) { if (format_buffer[c] == '%') { reminder = c; for (c++; c < strlen(format_buffer); c++) { if (isdigit(format_buffer[c])) { continue; } if (format_buffer[c] == 't' || format_buffer[c] == 'p') { c++; } else { c = reminder; } break; } } syslog_format[w] = format_buffer[c]; w++; } qb_log_format_set(QB_LOG_SYSLOG, syslog_format); return ret; } char *logsys_format_get (void) { return format_buffer; } int logsys_config_syslog_facility_set ( const char *subsys, unsigned int facility) { return qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_FACILITY, facility); } int logsys_config_syslog_priority_set ( const char *subsys, unsigned int priority) { int i; pthread_mutex_lock (&logsys_config_mutex); if (subsys != NULL) { i = _logsys_config_subsys_get_unlocked (subsys); if (i >= 0) { logsys_loggers[i].syslog_priority = priority; logsys_loggers[i].dirty = QB_TRUE; i = 0; } } else { for (i = 0; i <= LOGSYS_MAX_SUBSYS_COUNT; i++) { logsys_loggers[i].syslog_priority = priority; logsys_loggers[i].dirty = QB_TRUE; } i = 0; } pthread_mutex_unlock (&logsys_config_mutex); return i; } int logsys_config_logfile_priority_set ( const char *subsys, unsigned int priority) { int i; pthread_mutex_lock (&logsys_config_mutex); if (subsys != NULL) { i = _logsys_config_subsys_get_unlocked (subsys); if (i >= 0) { logsys_loggers[i].logfile_priority = priority; logsys_loggers[i].dirty = QB_TRUE; i = 0; } } else { for (i = 0; i <= LOGSYS_MAX_SUBSYS_COUNT; i++) { logsys_loggers[i].logfile_priority = priority; logsys_loggers[i].dirty = QB_TRUE; } i = 0; } pthread_mutex_unlock (&logsys_config_mutex); return i; } static void _logsys_config_apply_per_file(int32_t s, const char *filename) { uint32_t syslog_priority = logsys_loggers[s].syslog_priority; uint32_t logfile_priority = logsys_loggers[s].logfile_priority; qb_log_filter_ctl(s, QB_LOG_TAG_SET, QB_LOG_FILTER_FILE, filename, LOG_TRACE); qb_log_filter_ctl(QB_LOG_SYSLOG, QB_LOG_FILTER_REMOVE, QB_LOG_FILTER_FILE, filename, LOG_TRACE); qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_REMOVE, QB_LOG_FILTER_FILE, filename, LOG_TRACE); if (logsys_loggers[s].target_id > 0) { qb_log_filter_ctl(logsys_loggers[s].target_id, QB_LOG_FILTER_REMOVE, QB_LOG_FILTER_FILE, filename, LOG_TRACE); } - if (logsys_loggers[s].debug) { - syslog_priority = LOG_DEBUG; - logfile_priority = LOG_DEBUG; + if (logsys_loggers[s].debug != LOGSYS_DEBUG_OFF) { + switch (logsys_loggers[s].debug) { + case LOGSYS_DEBUG_ON: + syslog_priority = LOG_DEBUG; + logfile_priority = LOG_DEBUG; + break; + case LOGSYS_DEBUG_TRACE: + syslog_priority = LOG_TRACE; + logfile_priority = LOG_TRACE; + break; + default: + assert(0); + } } qb_log_filter_ctl(QB_LOG_SYSLOG, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, filename, syslog_priority); qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, filename, logfile_priority); if (logsys_loggers[s].target_id > 0) { qb_log_filter_ctl(logsys_loggers[s].target_id, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, filename, logfile_priority); } } static void _logsys_config_apply_per_subsys(int32_t s) { int32_t f; for (f = 0; f < logsys_loggers[s].file_idx; f++) { _logsys_config_apply_per_file(s, logsys_loggers[s].files[f]); } if (logsys_loggers[s].target_id > 0) { qb_log_ctl(logsys_loggers[s].target_id, QB_LOG_CONF_ENABLED, (logsys_loggers[s].mode & LOGSYS_MODE_OUTPUT_FILE)); } logsys_loggers[s].dirty = QB_FALSE; } void logsys_config_apply(void) { int32_t s; for (s = 0; s <= LOGSYS_MAX_SUBSYS_COUNT; s++) { if (strcmp(logsys_loggers[s].subsys, "") == 0) { continue; } _logsys_config_apply_per_subsys(s); } } int logsys_config_debug_set ( const char *subsys, unsigned int debug) { int i; pthread_mutex_lock (&logsys_config_mutex); if (subsys != NULL) { i = _logsys_config_subsys_get_unlocked (subsys); if (i >= 0) { logsys_loggers[i].dirty = QB_TRUE; logsys_loggers[i].debug = debug; i = 0; } } else { for (i = 0; i <= LOGSYS_MAX_SUBSYS_COUNT; i++) { logsys_loggers[i].debug = debug; logsys_loggers[i].dirty = QB_TRUE; } i = 0; } pthread_mutex_unlock (&logsys_config_mutex); return i; } int logsys_priority_id_get (const char *name) { unsigned int i; for (i = 0; prioritynames[i].c_name != NULL; i++) { if (strcasecmp(name, prioritynames[i].c_name) == 0) { return (prioritynames[i].c_val); } } return (-1); } int logsys_thread_start (void) { int i; int err; err = qb_log_thread_start(); if (err != 0) { return (err); } qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_THREADED, QB_TRUE); for (i = 0; i <= LOGSYS_MAX_SUBSYS_COUNT; i++) { if (logsys_loggers[i].target_id > 0) { qb_log_ctl(logsys_loggers[i].target_id, QB_LOG_CONF_THREADED, QB_TRUE); } } logsys_thread_started = 1; return (0); } diff --git a/include/corosync/logsys.h b/include/corosync/logsys.h index fcce049c..f636e7cb 100644 --- a/include/corosync/logsys.h +++ b/include/corosync/logsys.h @@ -1,227 +1,235 @@ /* * Copyright (c) 2002-2004 MontaVista Software, Inc. * Copyright (c) 2006-2012 Red Hat, Inc. * * Author: Steven Dake (sdake@redhat.com) * Author: Lon Hohberger (lhh@redhat.com) * Author: Fabio M. Di Nitto (fdinitto@redhat.com) * * All rights reserved. * * This software licensed under BSD license, the text of which follows: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * - Neither the name of the MontaVista Software, Inc. nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef LOGSYS_H_DEFINED #define LOGSYS_H_DEFINED #include #include #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif /* * All of the LOGSYS_MODE's can be ORed together for combined behavior * * FORK and THREADED are ignored for SUBSYSTEMS */ #define LOGSYS_MODE_OUTPUT_FILE (1<<0) #define LOGSYS_MODE_OUTPUT_STDERR (1<<1) #define LOGSYS_MODE_OUTPUT_SYSLOG (1<<2) #define LOGSYS_MODE_FORK (1<<3) #define LOGSYS_MODE_THREADED (1<<4) /* * Log priorities, compliant with syslog and SA Forum Log spec. */ #define LOGSYS_LEVEL_EMERG LOG_EMERG #define LOGSYS_LEVEL_ALERT LOG_ALERT #define LOGSYS_LEVEL_CRIT LOG_CRIT #define LOGSYS_LEVEL_ERROR LOG_ERR #define LOGSYS_LEVEL_WARNING LOG_WARNING #define LOGSYS_LEVEL_NOTICE LOG_NOTICE #define LOGSYS_LEVEL_INFO LOG_INFO #define LOGSYS_LEVEL_DEBUG LOG_DEBUG +#define LOGSYS_LEVEL_TRACE LOG_TRACE /* * logsys_logger bits * * SUBSYS_COUNT defines the maximum number of subsystems * SUBSYS_NAMELEN defines the maximum len of a subsystem name */ #define LOGSYS_MAX_SUBSYS_COUNT 32 #define LOGSYS_MAX_SUBSYS_NAMELEN 64 #define LOGSYS_MAX_PERROR_MSG_LEN 128 +/* + * Debug levels + */ +#define LOGSYS_DEBUG_OFF 0 +#define LOGSYS_DEBUG_ON 1 +#define LOGSYS_DEBUG_TRACE 2 + #ifndef LOGSYS_UTILS_ONLY /* * configuration bits that can only be done for the whole system */ extern int logsys_format_set ( const char *format); extern char *logsys_format_get (void); /* * per system/subsystem settings. * * NOTE: once a subsystem is created and configured, changing * the default does NOT affect the subsystems. * * Pass a NULL subsystem to change them all */ extern int logsys_config_syslog_facility_set ( const char *subsys, unsigned int facility); extern int logsys_config_syslog_priority_set ( const char *subsys, unsigned int priority); extern int logsys_config_mode_set ( const char *subsys, unsigned int mode); extern unsigned int logsys_config_mode_get ( const char *subsys); void logsys_config_apply(void); /* * to close a logfile, just invoke this function with a NULL * file or if you want to change logfile, the old one will * be closed for you. */ extern int logsys_config_file_set ( const char *subsys, const char **error_string, const char *file); extern int logsys_config_logfile_priority_set ( const char *subsys, unsigned int priority); /* * enabling debug, disable message priority filtering. * everything is sent everywhere. priority values * for file and syslog are not overwritten. */ extern int logsys_config_debug_set ( const char *subsys, unsigned int value); /* * External API - helpers * * convert facility/priority to/from name/values */ extern int logsys_priority_id_get ( const char *name); extern const char *logsys_priority_name_get ( unsigned int priority); extern int _logsys_system_setup( const char *mainsystem, unsigned int mode, int syslog_facility, int syslog_priority); extern void logsys_system_fini (void); extern int _logsys_config_subsys_get ( const char *subsys); extern int _logsys_subsys_create (const char *subsys, const char *filename); extern int logsys_thread_start (void); static int logsys_subsys_id __attribute__((unused)) = LOGSYS_MAX_SUBSYS_COUNT; #define LOGSYS_DECLARE_SYSTEM(name,mode,syslog_facility,syslog_priority)\ __attribute__ ((constructor)) \ static void logsys_system_init (void) \ { \ if (_logsys_system_setup (name,mode,syslog_facility,syslog_priority) < 0) { \ fprintf (stderr, \ "Unable to setup logging system: %s.\n", name); \ exit (-1); \ } \ } #ifdef QB_HAVE_ATTRIBUTE_SECTION #define LOGSYS_DECLARE_SECTION assert(__start___verbose != __stop___verbose) #else #define LOGSYS_DECLARE_SECTION #endif #define LOGSYS_DECLARE_SUBSYS(subsys) \ __attribute__ ((constructor)) \ static void logsys_subsys_init (void) \ { \ LOGSYS_DECLARE_SECTION; \ logsys_subsys_id = \ _logsys_subsys_create ((subsys), __FILE__); \ if (logsys_subsys_id == -1) { \ fprintf (stderr, \ "Unable to create logging subsystem: %s.\n", subsys); \ exit (-1); \ } \ } #define LOGSYS_PERROR(err_num, level, fmt, args...) do { \ char _error_str[LOGSYS_MAX_PERROR_MSG_LEN]; \ const char *_error_ptr = qb_strerror_r(err_num, _error_str, sizeof(_error_str)); \ qb_log(level, fmt ": %s (%d)", ##args, _error_ptr, err_num); \ } while(0) #define log_printf(level, format, args...) qb_log(level, format, ##args) #define ENTER qb_enter #define LEAVE qb_leave #define TRACE1(format, args...) qb_log(LOG_TRACE, "TRACE1:" #format, ##args) #define TRACE2(format, args...) qb_log(LOG_TRACE, "TRACE2:" #format, ##args) #define TRACE3(format, args...) qb_log(LOG_TRACE, "TRACE3:" #format, ##args) #define TRACE4(format, args...) qb_log(LOG_TRACE, "TRACE4:" #format, ##args) #define TRACE5(format, args...) qb_log(LOG_TRACE, "TRACE5:" #format, ##args) #define TRACE6(format, args...) qb_log(LOG_TRACE, "TRACE6:" #format, ##args) #define TRACE7(format, args...) qb_log(LOG_TRACE, "TRACE7:" #format, ##args) #define TRACE8(format, args...) qb_log(LOG_TRACE, "TRACE8:" #format, ##args) #endif /* LOGSYS_UTILS_ONLY */ #ifdef __cplusplus } #endif #endif /* LOGSYS_H_DEFINED */ diff --git a/man/corosync.conf.5 b/man/corosync.conf.5 index 48acfcd8..31cb9f76 100644 --- a/man/corosync.conf.5 +++ b/man/corosync.conf.5 @@ -1,650 +1,651 @@ .\"/* .\" * Copyright (c) 2005 MontaVista Software, Inc. .\" * Copyright (c) 2006-2012 Red Hat, Inc. .\" * .\" * All rights reserved. .\" * .\" * Author: Steven Dake (sdake@redhat.com) .\" * .\" * This software licensed under BSD license, the text of which follows: .\" * .\" * Redistribution and use in source and binary forms, with or without .\" * modification, are permitted provided that the following conditions are met: .\" * .\" * - Redistributions of source code must retain the above copyright notice, .\" * this list of conditions and the following disclaimer. .\" * - Redistributions in binary form must reproduce the above copyright notice, .\" * this list of conditions and the following disclaimer in the documentation .\" * and/or other materials provided with the distribution. .\" * - Neither the name of the MontaVista Software, Inc. nor the names of its .\" * contributors may be used to endorse or promote products derived from this .\" * software without specific prior written permission. .\" * .\" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" .\" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE .\" * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS .\" * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN .\" * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) .\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF .\" * THE POSSIBILITY OF SUCH DAMAGE. .\" */ .TH COROSYNC_CONF 5 2012-01-12 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" .SH NAME corosync.conf - corosync executive configuration file .SH SYNOPSIS /etc/corosync/corosync.conf .SH DESCRIPTION The corosync.conf instructs the corosync executive about various parameters needed to control the corosync executive. Empty lines and lines starting with # character are ignored. The configuration file consists of bracketed top level directives. The possible directive choices are: .TP totem { } This top level directive contains configuration options for the totem protocol. .TP logging { } This top level directive contains configuration options for logging. .TP quorum { } This top level directive contains configuration options for quorum. .TP nodelist { } This top level directive contains configuration options for nodes in cluster. .PP .PP Within the .B totem directive, an interface directive is required. There is also one configuration option which is required: .PP .PP Within the .B interface sub-directive of totem there are four parameters which are required. There is one parameter which is optional. .TP ringnumber This specifies the ring number for the interface. When using the redundant ring protocol, each interface should specify separate ring numbers to uniquely identify to the membership protocol which interface to use for which redundant ring. The ringnumber must start at 0. .TP bindnetaddr This specifies the network address the corosync executive should bind to. bindnetaddr should be an IP address configured on the system, or a network address. For example, if the local interface is 192.168.5.92 with netmask 255.255.255.0, you should set bindnetaddr to 192.168.5.92 or 192.168.5.0. If the local interface is 192.168.5.92 with netmask 255.255.255.192, set bindnetaddr to 192.168.5.92 or 192.168.5.64, and so forth. This may also be an IPV6 address, in which case IPV6 networking will be used. In this case, the exact address must be specified and there is no automatic selection of the network interface within a specific subnet as with IPv4. If IPv6 networking is used, the nodeid field in nodelist must be specified. .TP broadcast This is optional and can be set to yes. If it is set to yes, the broadcast address will be used for communication. If this option is set, mcastaddr should not be set. .TP mcastaddr This is the multicast address used by corosync executive. The default should work for most networks, but the network administrator should be queried about a multicast address to use. Avoid 224.x.x.x because this is a "config" multicast address. This may also be an IPV6 multicast address, in which case IPV6 networking will be used. If IPv6 networking is used, the nodeid field in nodelist must be specified. It's not needed to use this option if cluster_name option is used. If both options are used, mcastaddr has higher priority. .TP mcastport This specifies the UDP port number. It is possible to use the same multicast address on a network with the corosync services configured for different UDP ports. Please note corosync uses two UDP ports mcastport (for mcast receives) and mcastport - 1 (for mcast sends). If you have multiple clusters on the same network using the same mcastaddr please configure the mcastports with a gap. .TP ttl This specifies the Time To Live (TTL). If you run your cluster on a routed network then the default of "1" will be too small. This option provides a way to increase this up to 255. The valid range is 0..255. Note that this is only valid on multicast transport types. .PP .PP Within the .B totem directive, there are seven configuration options of which one is required, five are optional, and one is required when IPV6 is configured in the interface subdirective. The required directive controls the version of the totem configuration. The optional option unless using IPV6 directive controls identification of the processor. The optional options control secrecy and authentication, the redundant ring mode of operation and maximum network MTU field. .TP version This specifies the version of the configuration file. Currently the only valid version for this directive is 2. .PP clear_node_high_bit This configuration option is optional and is only relevant when no nodeid is specified. Some corosync clients require a signed 32 bit nodeid that is greater than zero however by default corosync uses all 32 bits of the IPv4 address space when generating a nodeid. Set this option to yes to force the high bit to be zero and therefor ensure the nodeid is a positive signed 32 bit integer. WARNING: The clusters behavior is undefined if this option is enabled on only a subset of the cluster (for example during a rolling upgrade). .TP crypto_hash This specifies which HMAC authentication should be used to authenticate all messages. Valid values are none (no authentication), md5, sha1, sha256, sha384 and sha512. The default is sha1. .TP crypto_cipher This specifies which cipher should be used to encrypt all messages. Valid values are none (no encryption) and aes256. The default is aes256. .TP secauth This specifies that HMAC/SHA1 authentication should be used to authenticate all messages. It further specifies that all data should be encrypted with the nss library and aes256 encryption algorithm to protect data from eavesdropping. Enabling this option adds a encryption header to every message sent by totem which reduces total throughput. Also encryption and authentication consume extra CPU cycles in corosync. The default is on. WARNING: This parameter is deprecated. It's recomended to use combination of crypto_cipher and crypto_hash. .TP rrp_mode This specifies the mode of redundant ring, which may be none, active, or passive. Active replication offers slightly lower latency from transmit to delivery in faulty network environments but with less performance. Passive replication may nearly double the speed of the totem protocol if the protocol doesn't become cpu bound. The final option is none, in which case only one network interface will be used to operate the totem protocol. If only one interface directive is specified, none is automatically chosen. If multiple interface directives are specified, only active or passive may be chosen. .TP netmtu This specifies the network maximum transmit unit. To set this value beyond 1500, the regular frame MTU, requires ethernet devices that support large, or also called jumbo, frames. If any device in the network doesn't support large frames, the protocol will not operate properly. The hosts must also have their mtu size set from 1500 to whatever frame size is specified here. Please note while some NICs or switches claim large frame support, they support 9000 MTU as the maximum frame size including the IP header. Setting the netmtu and host MTUs to 9000 will cause totem to use the full 9000 bytes of the frame. Then Linux will add a 18 byte header moving the full frame size to 9018. As a result some hardware will not operate properly with this size of data. A netmtu of 8982 seems to work for the few large frame devices that have been tested. Some manufacturers claim large frame support when in fact they support frame sizes of 4500 bytes. When sending multicast traffic, if the network frequently reconfigures, chances are that some device in the network doesn't support large frames. Choose hardware carefully if intending to use large frame support. The default is 1500. .TP vsftype This directive controls the virtual synchrony filter type used to identify a primary component. The preferred choice is YKD dynamic linear voting, however, for clusters larger then 32 nodes YKD consumes alot of memory. For large scale clusters that are created by changing the MAX_PROCESSORS_COUNT #define in the C code totem.h file, the virtual synchrony filter "none" is recommended but then AMF and DLCK services (which are currently experimental) are not safe for use. The default is ykd. The vsftype can also be set to none. .TP transport This directive controls the transport mechanism used. If the interface to which corosync is binding is an RDMA interface such as RoCEE or Infiniband, the "iba" parameter may be specified. To avoid the use of multicast entirely, a unicast transport parameter "udpu" can be specified. This requires specifying the list of members in nodelist directive, that could potentially make up the membership before deployment. The default is udp. The transport type can also be set to udpu or iba. .TP cluster_name This specifies the name of cluster and it's used for automatic generating of multicast address. Within the .B totem directive, there are several configuration options which are used to control the operation of the protocol. It is generally not recommended to change any of these values without proper guidance and sufficient testing. Some networks may require larger values if suffering from frequent reconfigurations. Some applications may require faster failure detection times which can be achieved by reducing the token timeout. .TP token This timeout specifies in milliseconds until a token loss is declared after not receiving a token. This is the time spent detecting a failure of a processor in the current configuration. Reforming a new configuration takes about 50 milliseconds in addition to this timeout. The default is 1000 milliseconds. .TP token_retransmit This timeout specifies in milliseconds after how long before receiving a token the token is retransmitted. This will be automatically calculated if token is modified. It is not recommended to alter this value without guidance from the corosync community. The default is 238 milliseconds. .TP hold This timeout specifies in milliseconds how long the token should be held by the representative when the protocol is under low utilization. It is not recommended to alter this value without guidance from the corosync community. The default is 180 milliseconds. .TP token_retransmits_before_loss_const This value identifies how many token retransmits should be attempted before forming a new configuration. If this value is set, retransmit and hold will be automatically calculated from retransmits_before_loss and token. The default is 4 retransmissions. .TP join This timeout specifies in milliseconds how long to wait for join messages in the membership protocol. The default is 50 milliseconds. .TP send_join This timeout specifies in milliseconds an upper range between 0 and send_join to wait before sending a join message. For configurations with less then 32 nodes, this parameter is not necessary. For larger rings, this parameter is necessary to ensure the NIC is not overflowed with join messages on formation of a new ring. A reasonable value for large rings (128 nodes) would be 80msec. Other timer values must also change if this value is changed. Seek advice from the corosync mailing list if trying to run larger configurations. The default is 0 milliseconds. .TP consensus This timeout specifies in milliseconds how long to wait for consensus to be achieved before starting a new round of membership configuration. The minimum value for consensus must be 1.2 * token. This value will be automatically calculated at 1.2 * token if the user doesn't specify a consensus value. For two node clusters, a consensus larger then the join timeout but less then token is safe. For three node or larger clusters, consensus should be larger then token. There is an increasing risk of odd membership changes, which stil guarantee virtual synchrony, as node count grows if consensus is less than token. The default is 1200 milliseconds. .TP merge This timeout specifies in milliseconds how long to wait before checking for a partition when no multicast traffic is being sent. If multicast traffic is being sent, the merge detection happens automatically as a function of the protocol. The default is 200 milliseconds. .TP downcheck This timeout specifies in milliseconds how long to wait before checking that a network interface is back up after it has been downed. The default is 1000 millseconds. .TP fail_recv_const This constant specifies how many rotations of the token without receiving any of the messages when messages should be received may occur before a new configuration is formed. The default is 2500 failures to receive a message. .TP seqno_unchanged_const This constant specifies how many rotations of the token without any multicast traffic should occur before the hold timer is started. The default is 30 rotations. .TP heartbeat_failures_allowed [HeartBeating mechanism] Configures the optional HeartBeating mechanism for faster failure detection. Keep in mind that engaging this mechanism in lossy networks could cause faulty loss declaration as the mechanism relies on the network for heartbeating. So as a rule of thumb use this mechanism if you require improved failure in low to medium utilized networks. This constant specifies the number of heartbeat failures the system should tolerate before declaring heartbeat failure e.g 3. Also if this value is not set or is 0 then the heartbeat mechanism is not engaged in the system and token rotation is the method of failure detection The default is 0 (disabled). .TP max_network_delay [HeartBeating mechanism] This constant specifies in milliseconds the approximate delay that your network takes to transport one packet from one machine to another. This value is to be set by system engineers and please dont change if not sure as this effects the failure detection mechanism using heartbeat. The default is 50 milliseconds. .TP window_size This constant specifies the maximum number of messages that may be sent on one token rotation. If all processors perform equally well, this value could be large (300), which would introduce higher latency from origination to delivery for very large rings. To reduce latency in large rings(16+), the defaults are a safe compromise. If 1 or more slow processor(s) are present among fast processors, window_size should be no larger then 256000 / netmtu to avoid overflow of the kernel receive buffers. The user is notified of this by the display of a retransmit list in the notification logs. There is no loss of data, but performance is reduced when these errors occur. The default is 50 messages. .TP max_messages This constant specifies the maximum number of messages that may be sent by one processor on receipt of the token. The max_messages parameter is limited to 256000 / netmtu to prevent overflow of the kernel transmit buffers. The default is 17 messages. .TP miss_count_const This constant defines the maximum number of times on receipt of a token a message is checked for retransmission before a retransmission occurs. This parameter is useful to modify for switches that delay multicast packets compared to unicast packets. The default setting works well for nearly all modern switches. The default is 5 messages. .TP rrp_problem_count_timeout This specifies the time in milliseconds to wait before decrementing the problem count by 1 for a particular ring to ensure a link is not marked faulty for transient network failures. The default is 2000 milliseconds. .TP rrp_problem_count_threshold This specifies the number of times a problem is detected with a link before setting the link faulty. Once a link is set faulty, no more data is transmitted upon it. Also, the problem counter is no longer decremented when the problem count timeout expires. A problem is detected whenever all tokens from the proceeding processor have not been received within the rrp_token_expired_timeout. The rrp_problem_count_threshold * rrp_token_expired_timeout should be atleast 50 milliseconds less then the token timeout, or a complete reconfiguration may occur. The default is 10 problem counts. .TP rrp_problem_count_mcast_threshold This specifies the number of times a problem is detected with multicast before setting the link faulty for passive rrp mode. This variable is unused in active rrp mode. The default is 10 times rrp_problem_count_threshold. .TP rrp_token_expired_timeout This specifies the time in milliseconds to increment the problem counter for the redundant ring protocol after not having received a token from all rings for a particular processor. This value will automatically be calculated from the token timeout and problem_count_threshold but may be overridden. It is not recommended to override this value without guidance from the corosync community. The default is 47 milliseconds. .TP rrp_autorecovery_check_timeout This specifies the time in milliseconds to check if the failed ring can be auto-recovered. The default is 1000 milliseconds. .PP Within the .B logging directive, there are several configuration options which are all optional. .PP The following 3 options are valid only for the top level logging directive: .TP timestamp This specifies that a timestamp is placed on all log messages. The default is off. .TP fileline This specifies that file and line should be printed. The default is off. .TP function_name This specifies that the code function name should be printed. The default is off. .PP The following options are valid both for top level logging directive and they can be overriden in logger_subsys entries. .TP to_stderr .TP to_logfile .TP to_syslog These specify the destination of logging output. Any combination of these options may be specified. Valid options are .B yes and .B no. The default is syslog and stderr. Please note, if you are using to_logfile and want to rotate the file, use logrotate(8) with the option .B copytruncate. eg. .IP .RS .ne 18 .nf .ta 4n 30n 33n /var/log/corosync.log { missingok compress notifempty daily rotate 7 copytruncate } .ta .fi .RE .IP .PP .TP logfile If the .B to_logfile directive is set to .B yes , this option specifies the pathname of the log file. No default. .TP logfile_priority This specifies the logfile priority for this particular subsystem. Ignored if debug is on. Possible values are: alert, crit, debug (same as debug = on), emerg, err, info, notice, warning. The default is: info. .TP syslog_facility This specifies the syslog facility type that will be used for any messages sent to syslog. options are daemon, local0, local1, local2, local3, local4, local5, local6 & local7. The default is daemon. .TP syslog_priority This specifies the syslog level for this particular subsystem. Ignored if debug is on. Possible values are: alert, crit, debug (same as debug = on), emerg, err, info, notice, warning. The default is: info. .TP debug -This specifies whether debug output is logged for this particular logger. +This specifies whether debug output is logged for this particular logger. Also can contain +value trace, what is highest level of debug informations. The default is off. .PP Within the .B logging directive, logger_subsys directives are optional. .PP Within the .B logger_subsys sub-directive, all of the above logging configuration options are valid and can be used to override the default settings. The subsys entry, described below, is mandatory to identify the subsystem. .TP subsys This specifies the subsystem identity (name) for which logging is specified. This is the name used by a service in the log_init () call. E.g. 'CPG'. This directive is required. .PP Within the .B quorum directive it is possible to specify the quorum algorithm to use with the .TP provider directive. At the time of writing only corosync_votequorum is supported. Please refer to quorum modules man pages (8) for specific config options. .PP Within the .B nodelist directive it is possible to specify specific informations about nodes in cluster. Directive can contain only .B node sub-directive, which specifies every node that should be a member of the membership, and where non-default options are needed. Every node must have at least ring0_addr field filled. For UDPU, every node that should be a member of the membership must be specified. Possible options are: .TP ringX_addr This specifies ip address of one of the nodes. X is ring number. .TP nodeid This configuration option is optional when using IPv4 and required when using IPv6. This is a 32 bit value specifying the node identifier delivered to the cluster membership service. If this is not specified with IPv4, the node id will be determined from the 32 bit IP address the system to which the system is bound with ring identifier of 0. The node identifier value of zero is reserved and should not be used. .TP quorum_votes .SH "FILES" .TP /etc/corosync/corosync.conf The corosync executive configuration file. .SH "SEE ALSO" .BR corosync_overview (8), .BR votequorum (5), .BR logrotate (8) .PP