From bb9dabf9458b712d93a980cb88511cc7b17bc6a7 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Mon, 12 Aug 2019 13:19:02 +0200 Subject: [PATCH] qnetd: Rename qnetd-log.c to log.c And remove qnetd_ prefix from function names. Signed-off-by: Jan Friesse --- qdevices/Makefile.am | 2 +- qdevices/corosync-qnetd.c | 52 +++++----- qdevices/{qnetd-log.c => log.c} | 79 ++++++++------- qdevices/{qnetd-log.h => log.h} | 32 +++---- qdevices/qnetd-algo-2nodelms.c | 44 ++++----- qdevices/qnetd-algo-ffsplit.c | 40 ++++---- qdevices/qnetd-algo-lms.c | 64 ++++++------- qdevices/qnetd-algo-test.c | 26 ++--- qdevices/qnetd-algo-utils.c | 10 +- qdevices/qnetd-algorithm.c | 32 +++---- qdevices/qnetd-client-algo-timer.c | 12 +-- qdevices/qnetd-client-msg-received.c | 138 +++++++++++++-------------- qdevices/qnetd-client-net.c | 40 ++++---- qdevices/qnetd-client-send.c | 12 +-- qdevices/qnetd-dpd-timer.c | 6 +- qdevices/qnetd-instance.c | 2 +- qdevices/qnetd-ipc-cmd.c | 4 +- qdevices/qnetd-ipc.c | 48 +++++----- qdevices/qnetd-log-debug.c | 70 +++++++------- 19 files changed, 361 insertions(+), 352 deletions(-) rename qdevices/{qnetd-log.c => log.c} (63%) rename qdevices/{qnetd-log.h => log.h} (72%) diff --git a/qdevices/Makefile.am b/qdevices/Makefile.am index 69a0cc6..6b9fce4 100644 --- a/qdevices/Makefile.am +++ b/qdevices/Makefile.am @@ -48,7 +48,7 @@ bin_SCRIPTS += corosync-qnetd-certutil corosync_qnetd_SOURCES = corosync-qnetd.c \ dynar.c dynar.h msg.c msg.h msgio.c msgio.h \ nss-sock.c nss-sock.h qnetd-client.c qnetd-client.h \ - qnetd-client-list.c qnetd-client-list.h qnetd-log.c qnetd-log.h \ + qnetd-client-list.c qnetd-client-list.h log.c log.h \ pr-poll-array.c pr-poll-array.h timer-list.c timer-list.h tlv.c tlv.h \ send-buffer-list.c send-buffer-list.h node-list.c node-list.h \ qnetd-algo-test.c qnetd-algo-test.h qnetd-algorithm.c qnetd-algorithm.h \ diff --git a/qdevices/corosync-qnetd.c b/qdevices/corosync-qnetd.c index 9ba1975..3bc67fa 100644 --- a/qdevices/corosync-qnetd.c +++ b/qdevices/corosync-qnetd.c @@ -44,13 +44,13 @@ #include "dynar.h" #include "dynar-str.h" #include "dynar-getopt-lex.h" +#include "log.h" #include "nss-sock.h" #include "pr-poll-array.h" #include "qnetd-advanced-settings.h" #include "qnetd-algorithm.h" #include "qnetd-instance.h" #include "qnetd-ipc.h" -#include "qnetd-log.h" #include "qnetd-client-net.h" #include "qnetd-client-msg-received.h" #include "qnetd-poll-array-user-data.h" @@ -78,7 +78,7 @@ static void qnetd_err_nss(void) { - qnetd_log_nss(LOG_CRIT, "NSS error"); + log_nss(LOG_CRIT, "NSS error"); exit(1); } @@ -87,7 +87,7 @@ static void qnetd_warn_nss(void) { - qnetd_log_nss(LOG_WARNING, "NSS warning"); + log_nss(LOG_WARNING, "NSS warning"); } static PRPollDesc * @@ -117,7 +117,7 @@ qnetd_pr_poll_array_create(struct qnetd_instance *instance) user_data->type = QNETD_POLL_ARRAY_USER_DATA_TYPE_SOCKET; if (qnetd_ipc_is_closed(instance)) { - qnetd_log(LOG_DEBUG, "Listening socket is closed"); + log(LOG_DEBUG, "Listening socket is closed"); return (NULL); } @@ -246,7 +246,7 @@ qnetd_poll(struct qnetd_instance *instance) /* * Poll write on listen socket -> fatal error */ - qnetd_log(LOG_CRIT, "POLL_WRITE on listening socket"); + log(LOG_CRIT, "POLL_WRITE on listening socket"); return (-1); break; @@ -256,7 +256,7 @@ qnetd_poll(struct qnetd_instance *instance) } break; case QNETD_POLL_ARRAY_USER_DATA_TYPE_IPC_SOCKET: - qnetd_log(LOG_CRIT, "POLL_WRITE on listening IPC socket"); + log(LOG_CRIT, "POLL_WRITE on listening IPC socket"); return (-1); break; case QNETD_POLL_ARRAY_USER_DATA_TYPE_IPC_CLIENT: @@ -276,22 +276,22 @@ qnetd_poll(struct qnetd_instance *instance) * Poll ERR on listening socket is fatal error. * POLL_NVAL is used as a signal to quit poll loop. */ - qnetd_log(LOG_CRIT, "POLL_ERR (%u) on listening " + log(LOG_CRIT, "POLL_ERR (%u) on listening " "socket", pfds[i].out_flags); } else { - qnetd_log(LOG_DEBUG, "Listening socket is closed"); + log(LOG_DEBUG, "Listening socket is closed"); } return (-1); break; case QNETD_POLL_ARRAY_USER_DATA_TYPE_CLIENT: - qnetd_log(LOG_DEBUG, "POLL_ERR (%u) on client socket. " + log(LOG_DEBUG, "POLL_ERR (%u) on client socket. " "Disconnecting.", pfds[i].out_flags); client_disconnect = 1; break; case QNETD_POLL_ARRAY_USER_DATA_TYPE_IPC_CLIENT: - qnetd_log(LOG_DEBUG, "POLL_ERR (%u) on ipc client socket." + log(LOG_DEBUG, "POLL_ERR (%u) on ipc client socket." " Disconnecting.", pfds[i].out_flags); client_disconnect = 1; @@ -320,7 +320,7 @@ static void signal_int_handler(int sig) { - qnetd_log(LOG_DEBUG, "SIGINT received - closing server IPC socket"); + log(LOG_DEBUG, "SIGINT received - closing server IPC socket"); qnetd_ipc_close(global_instance); } @@ -329,7 +329,7 @@ static void signal_term_handler(int sig) { - qnetd_log(LOG_DEBUG, "SIGTERM received - closing server IPC socket"); + log(LOG_DEBUG, "SIGTERM received - closing server IPC socket"); qnetd_ipc_close(global_instance); } @@ -538,20 +538,20 @@ main(int argc, char * const argv[]) &tls_supported, &client_cert_required, &max_clients, &address_family, &advanced_settings); if (foreground) { - qnetd_log_init(QNETD_LOG_TARGET_STDERR); + log_init(QNETD_PROGRAM_NAME, LOG_TARGET_STDERR); } else { - qnetd_log_init(QNETD_LOG_TARGET_SYSLOG); + log_init(QNETD_PROGRAM_NAME, LOG_TARGET_SYSLOG); } - qnetd_log_set_debug(debug_log); - qnetd_log_set_priority_bump(bump_log_priority); + log_set_debug(debug_log); + log_set_priority_bump(bump_log_priority); /* * Check that it's possible to open NSS dir if needed */ if (nss_sock_check_db_dir((tls_supported != TLV_TLS_UNSUPPORTED ? advanced_settings.nss_db_dir : NULL)) != 0) { - qnetd_log_err(LOG_ERR, "Can't open NSS DB directory"); + log_err(LOG_ERR, "Can't open NSS DB directory"); exit (1); } @@ -566,15 +566,15 @@ main(int argc, char * const argv[]) if ((lock_file = utils_flock(advanced_settings.lock_file, getpid(), &another_instance_running)) == -1) { if (another_instance_running) { - qnetd_log(LOG_ERR, "Another instance is running"); + log(LOG_ERR, "Another instance is running"); } else { - qnetd_log_err(LOG_ERR, "Can't acquire lock"); + log_err(LOG_ERR, "Can't acquire lock"); } exit(1); } - qnetd_log(LOG_DEBUG, "Initializing nss"); + log(LOG_DEBUG, "Initializing nss"); if (nss_sock_init_nss((tls_supported != TLV_TLS_UNSUPPORTED ? advanced_settings.nss_db_dir : NULL)) != 0) { qnetd_err_nss(); @@ -586,7 +586,7 @@ main(int argc, char * const argv[]) if (qnetd_instance_init(&instance, tls_supported, client_cert_required, max_clients, &advanced_settings) == -1) { - qnetd_log(LOG_ERR, "Can't initialize qnetd"); + log(LOG_ERR, "Can't initialize qnetd"); exit(1); } instance.host_addr = host_addr; @@ -596,12 +596,12 @@ main(int argc, char * const argv[]) qnetd_err_nss(); } - qnetd_log(LOG_DEBUG, "Initializing local socket"); + log(LOG_DEBUG, "Initializing local socket"); if (qnetd_ipc_init(&instance) != 0) { return (1); } - qnetd_log(LOG_DEBUG, "Creating listening socket"); + log(LOG_DEBUG, "Creating listening socket"); instance.server.socket = nss_sock_create_listen_socket(instance.host_addr, instance.host_port, address_family); if (instance.server.socket == NULL) { @@ -620,12 +620,12 @@ main(int argc, char * const argv[]) global_instance = &instance; signal_handlers_register(); - qnetd_log(LOG_DEBUG, "Registering algorithms"); + log(LOG_DEBUG, "Registering algorithms"); if (qnetd_algorithm_register_all() != 0) { exit(1); } - qnetd_log(LOG_DEBUG, "QNetd ready to provide service"); + log(LOG_DEBUG, "QNetd ready to provide service"); #ifdef HAVE_LIBSYSTEMD sd_notify(0, "READY=1"); @@ -665,7 +665,7 @@ main(int argc, char * const argv[]) qnetd_warn_nss(); } - qnetd_log_close(); + log_close(); return (0); } diff --git a/qdevices/qnetd-log.c b/qdevices/log.c similarity index 63% rename from qdevices/qnetd-log.c rename to qdevices/log.c index 6f225ae..47ca167 100644 --- a/qdevices/qnetd-log.c +++ b/qdevices/log.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Red Hat, Inc. + * Copyright (c) 2015-2019 Red Hat, Inc. * * All rights reserved. * @@ -34,26 +34,28 @@ #include #include +#include #include #include "qnet-config.h" -#include "qnetd-log.h" +#include "log.h" -static int qnetd_log_config_target = 0; -static int qnetd_log_config_debug = 0; -static int qnetd_log_config_priority_bump = 0; +static int log_config_target = 0; +static int log_config_debug = 0; +static int log_config_priority_bump = 0; +static char *log_config_ident = NULL; -static const char qnetd_log_month_str[][4] = { +static const char log_month_str[][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; -struct qnetd_log_syslog_prio_to_str_item { +struct log_syslog_prio_to_str_item { int priority; const char *priority_str; }; -static struct qnetd_log_syslog_prio_to_str_item qnetd_syslog_prio_to_str_array[] = { +static struct log_syslog_prio_to_str_item syslog_prio_to_str_array[] = { {LOG_EMERG, "emerg"}, {LOG_ALERT, "alert"}, {LOG_CRIT, "crit"}, @@ -64,46 +66,53 @@ static struct qnetd_log_syslog_prio_to_str_item qnetd_syslog_prio_to_str_array[] {LOG_DEBUG, "debug"}, {-1, NULL}}; -void -qnetd_log_init(int target) +int +log_init(const char *ident, int target) { - qnetd_log_config_target = target; + log_config_target = target; + log_config_ident = strdup(ident); - if (qnetd_log_config_target & QNETD_LOG_TARGET_SYSLOG) { + if (log_config_ident == NULL) { + return (-1); + } + + if (log_config_target & LOG_TARGET_SYSLOG) { openlog(QNETD_PROGRAM_NAME, LOG_PID, LOG_DAEMON); } + + return (0); } static const char * -qnetd_log_syslog_prio_to_str(int priority) +log_syslog_prio_to_str(int priority) { if (priority >= LOG_EMERG && priority <= LOG_DEBUG) { - return (qnetd_syslog_prio_to_str_array[priority].priority_str); + return (syslog_prio_to_str_array[priority].priority_str); } else { return ("none"); } } void -qnetd_log_vprintf(int priority, const char *format, va_list ap) +log_vprintf(int priority, const char *format, va_list ap) { time_t current_time; struct tm tm_res; int final_priority; va_list ap_copy; - if (priority != LOG_DEBUG || (qnetd_log_config_debug)) { - if (qnetd_log_config_target & QNETD_LOG_TARGET_STDERR) { + if (priority != LOG_DEBUG || (log_config_debug)) { + if (log_config_target & LOG_TARGET_STDERR) { current_time = time(NULL); localtime_r(¤t_time, &tm_res); fprintf(stderr, "%s %02d %02d:%02d:%02d ", - qnetd_log_month_str[tm_res.tm_mon], tm_res.tm_mday, tm_res.tm_hour, + log_month_str[tm_res.tm_mon], tm_res.tm_mday, tm_res.tm_hour, tm_res.tm_min, tm_res.tm_sec); - fprintf(stderr, "%-7s ", qnetd_log_syslog_prio_to_str(priority)); + fprintf(stderr, "%-7s ", log_syslog_prio_to_str(priority)); va_copy(ap_copy, ap); vfprintf(stderr, format, ap_copy); @@ -111,9 +120,9 @@ qnetd_log_vprintf(int priority, const char *format, va_list ap) fprintf(stderr, "\n"); } - if (qnetd_log_config_target & QNETD_LOG_TARGET_SYSLOG) { + if (log_config_target & LOG_TARGET_SYSLOG) { final_priority = priority; - if (qnetd_log_config_priority_bump && priority > LOG_INFO) { + if (log_config_priority_bump && priority > LOG_INFO) { final_priority = LOG_INFO; } @@ -125,59 +134,59 @@ qnetd_log_vprintf(int priority, const char *format, va_list ap) } void -qnetd_log_printf(int priority, const char *format, ...) +log_printf(int priority, const char *format, ...) { va_list ap; va_start(ap, format); - qnetd_log_vprintf(priority, format, ap); + log_vprintf(priority, format, ap); va_end(ap); } void -qnetd_log_close(void) +log_close(void) { - if (qnetd_log_config_target & QNETD_LOG_TARGET_SYSLOG) { + if (log_config_target & LOG_TARGET_SYSLOG) { closelog(); } } void -qnetd_log_set_debug(int enabled) +log_set_debug(int enabled) { - qnetd_log_config_debug = enabled; + log_config_debug = enabled; } void -qnetd_log_set_priority_bump(int enabled) +log_set_priority_bump(int enabled) { - qnetd_log_config_priority_bump = enabled; + log_config_priority_bump = enabled; } void -qnetd_log_msg_decode_error(int ret) +log_msg_decode_error(int ret) { switch (ret) { case -1: - qnetd_log(LOG_WARNING, "Received message with option with invalid length"); + log(LOG_WARNING, "Received message with option with invalid length"); break; case -2: - qnetd_log(LOG_CRIT, "Can't allocate memory"); + log(LOG_CRIT, "Can't allocate memory"); break; case -3: - qnetd_log(LOG_WARNING, "Received inconsistent msg (tlv len > msg size)"); + log(LOG_WARNING, "Received inconsistent msg (tlv len > msg size)"); break; case -4: - qnetd_log(LOG_WARNING, "Received message with option with invalid value"); + log(LOG_WARNING, "Received message with option with invalid value"); break; default: - qnetd_log(LOG_ERR, "Unknown error occurred when decoding message"); + log(LOG_ERR, "Unknown error occurred when decoding message"); break; } } diff --git a/qdevices/qnetd-log.h b/qdevices/log.h similarity index 72% rename from qdevices/qnetd-log.h rename to qdevices/log.h index 6d94775..c376a70 100644 --- a/qdevices/qnetd-log.h +++ b/qdevices/log.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Red Hat, Inc. + * Copyright (c) 2015-2019 Red Hat, Inc. * * All rights reserved. * @@ -32,8 +32,8 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _QNETD_LOG_H_ -#define _QNETD_LOG_H_ +#ifndef _LOG_H_ +#define _LOG_H_ #include #include @@ -43,34 +43,34 @@ extern "C" { #endif -#define QNETD_LOG_TARGET_STDERR 1 -#define QNETD_LOG_TARGET_SYSLOG 2 +#define LOG_TARGET_STDERR 1 +#define LOG_TARGET_SYSLOG 2 -#define qnetd_log(...) qnetd_log_printf(__VA_ARGS__) -#define qnetd_log_nss(priority, str) qnetd_log_printf(priority, "%s (%d): %s", \ +#define log(...) log_printf(__VA_ARGS__) +#define log_nss(priority, str) log_printf(priority, "%s (%d): %s", \ str, PR_GetError(), PR_ErrorToString(PR_GetError(), PR_LANGUAGE_I_DEFAULT)); -#define qnetd_log_err(priority, str) qnetd_log_printf(priority, "%s (%d): %s", \ +#define log_err(priority, str) log_printf(priority, "%s (%d): %s", \ str, errno, strerror(errno)) -extern void qnetd_log_init(int target); +extern int log_init(const char *ident, int target); -extern void qnetd_log_printf(int priority, const char *format, ...) +extern void log_printf(int priority, const char *format, ...) __attribute__((__format__(__printf__, 2, 3))); -extern void qnetd_log_vprintf(int priority, const char *format, va_list ap) +extern void log_vprintf(int priority, const char *format, va_list ap) __attribute__((__format__(__printf__, 2, 0))); -extern void qnetd_log_close(void); +extern void log_close(void); -extern void qnetd_log_set_debug(int enabled); +extern void log_set_debug(int enabled); -extern void qnetd_log_set_priority_bump(int enabled); +extern void log_set_priority_bump(int enabled); -extern void qnetd_log_msg_decode_error(int ret); +extern void log_msg_decode_error(int ret); #ifdef __cplusplus } #endif -#endif /* _QNETD_LOG_H_ */ +#endif /* __LOG_H_ */ diff --git a/qdevices/qnetd-algo-2nodelms.c b/qdevices/qnetd-algo-2nodelms.c index 079aca3..ad9f474 100644 --- a/qdevices/qnetd-algo-2nodelms.c +++ b/qdevices/qnetd-algo-2nodelms.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 Red Hat, Inc. + * Copyright (c) 2015-2019 Red Hat, Inc. * * All rights reserved. * @@ -51,8 +51,8 @@ #include #include +#include "log.h" #include "qnetd-algo-2nodelms.h" -#include "qnetd-log.h" #include "qnetd-cluster-list.h" #include "qnetd-algo-utils.h" #include "utils.h" @@ -103,10 +103,10 @@ qnetd_algo_2nodelms_config_node_list_received(struct qnetd_client *client, node_count++; } info->num_config_nodes = node_count; - qnetd_log(LOG_DEBUG, "algo-2nodelms: cluster %s config_list has %d nodes", client->cluster_name, node_count); + log(LOG_DEBUG, "algo-2nodelms: cluster %s config_list has %d nodes", client->cluster_name, node_count); if (node_count != 2) { - qnetd_log(LOG_INFO, "algo-2nodelms: cluster %s does not have 2 configured nodes, it has %d", client->cluster_name, node_count); + log(LOG_INFO, "algo-2nodelms: cluster %s does not have 2 configured nodes, it has %d", client->cluster_name, node_count); *result_vote = TLV_VOTE_NACK; return (TLV_REPLY_ERROR_CODE_UNSUPPORTED_DECISION_ALGORITHM); @@ -156,7 +156,7 @@ qnetd_algo_2nodelms_membership_node_list_received(struct qnetd_client *client, /* Don't save NACK, we need to know subsequently if we haven't been voting */ *result_vote = TLV_VOTE_NACK; - qnetd_log(LOG_DEBUG, "algo-2nodelms: we are a new partition and another active partition exists. NACK"); + log(LOG_DEBUG, "algo-2nodelms: we are a new partition and another active partition exists. NACK"); return (TLV_REPLY_ERROR_CODE_NO_ERROR); } } @@ -167,10 +167,10 @@ qnetd_algo_2nodelms_membership_node_list_received(struct qnetd_client *client, node_count++; } - qnetd_log(LOG_DEBUG, "algo-2nodelms: cluster %s (client %p nodeid "UTILS_PRI_NODE_ID") membership list has %d member nodes (ring ID "UTILS_PRI_RING_ID")", client->cluster_name, client, client->node_id, node_count, ring_id->node_id, ring_id->seq); + log(LOG_DEBUG, "algo-2nodelms: cluster %s (client %p nodeid "UTILS_PRI_NODE_ID") membership list has %d member nodes (ring ID "UTILS_PRI_RING_ID")", client->cluster_name, client, client->node_id, node_count, ring_id->node_id, ring_id->seq); if (node_count == 2) { - qnetd_log(LOG_DEBUG, "algo-2nodelms: cluster %s running normally. Both nodes active", client->cluster_name); + log(LOG_DEBUG, "algo-2nodelms: cluster %s running normally. Both nodes active", client->cluster_name); *result_vote = info->last_result = TLV_VOTE_ACK; return (TLV_REPLY_ERROR_CODE_NO_ERROR); } @@ -181,7 +181,7 @@ qnetd_algo_2nodelms_membership_node_list_received(struct qnetd_client *client, TAILQ_FOREACH(other_client, &client->cluster->client_list, cluster_entries) { node_count++; - qnetd_log(LOG_DEBUG, "algo-2nodelms: seen nodeid "UTILS_PRI_NODE_ID" on client %p (ring ID "UTILS_PRI_RING_ID")", other_client->node_id, other_client, other_client->last_ring_id.node_id, other_client->last_ring_id.seq); + log(LOG_DEBUG, "algo-2nodelms: seen nodeid "UTILS_PRI_NODE_ID" on client %p (ring ID "UTILS_PRI_RING_ID")", other_client->node_id, other_client, other_client->last_ring_id.node_id, other_client->last_ring_id.seq); if (other_client->node_id < low_node_id) { low_node_id = other_client->node_id; } @@ -192,11 +192,11 @@ qnetd_algo_2nodelms_membership_node_list_received(struct qnetd_client *client, other_node_heuristics = other_client->last_heuristics; } } - qnetd_log(LOG_DEBUG, "algo-2nodelms: cluster %s %d nodes running independently", client->cluster_name, node_count); + log(LOG_DEBUG, "algo-2nodelms: cluster %s %d nodes running independently", client->cluster_name, node_count); /* Only 1 node alive .. allow it to continue */ if (node_count == 1) { - qnetd_log(LOG_DEBUG, "algo-2nodelms: cluster %s running on 'last-man'", client->cluster_name); + log(LOG_DEBUG, "algo-2nodelms: cluster %s running on 'last-man'", client->cluster_name); *result_vote = info->last_result = TLV_VOTE_ACK; return (TLV_REPLY_ERROR_CODE_NO_ERROR); } @@ -220,36 +220,36 @@ qnetd_algo_2nodelms_membership_node_list_received(struct qnetd_client *client, case TLV_TIE_BREAKER_MODE_LOWEST: if (client->node_id == low_node_id) { - qnetd_log(LOG_DEBUG, "algo-2nodelms: cluster %s running on low node-id %d", client->cluster_name, low_node_id); + log(LOG_DEBUG, "algo-2nodelms: cluster %s running on low node-id %d", client->cluster_name, low_node_id); *result_vote = info->last_result = TLV_VOTE_ACK; } else { - qnetd_log(LOG_DEBUG, "algo-2nodelms: cluster %s node-id %d denied vote because low nodeid %d is active", client->cluster_name, client->node_id, low_node_id); + log(LOG_DEBUG, "algo-2nodelms: cluster %s node-id %d denied vote because low nodeid %d is active", client->cluster_name, client->node_id, low_node_id); *result_vote = info->last_result = TLV_VOTE_NACK; } break; case TLV_TIE_BREAKER_MODE_HIGHEST: if (client->node_id == high_node_id) { - qnetd_log(LOG_DEBUG, "algo-2nodelms: cluster %s running on high node-id %d", client->cluster_name, high_node_id); + log(LOG_DEBUG, "algo-2nodelms: cluster %s running on high node-id %d", client->cluster_name, high_node_id); *result_vote = info->last_result = TLV_VOTE_ACK; } else { - qnetd_log(LOG_DEBUG, "algo-2nodelms: cluster %s node-id %d denied vote because high nodeid %d is active", client->cluster_name, client->node_id, high_node_id); + log(LOG_DEBUG, "algo-2nodelms: cluster %s node-id %d denied vote because high nodeid %d is active", client->cluster_name, client->node_id, high_node_id); *result_vote = info->last_result = TLV_VOTE_NACK; } break; case TLV_TIE_BREAKER_MODE_NODE_ID: if (client->node_id == client->tie_breaker.node_id) { - qnetd_log(LOG_DEBUG, "algo-2nodelms: cluster %s running on nominated tie-breaker node %d", client->cluster_name, client->tie_breaker.node_id); + log(LOG_DEBUG, "algo-2nodelms: cluster %s running on nominated tie-breaker node %d", client->cluster_name, client->tie_breaker.node_id); *result_vote = info->last_result = TLV_VOTE_ACK; } else { - qnetd_log(LOG_DEBUG, "algo-2nodelms: cluster %s node-id %d denied vote because nominated tie-breaker nodeid %d is active", client->cluster_name, client->node_id, client->tie_breaker.node_id); + log(LOG_DEBUG, "algo-2nodelms: cluster %s node-id %d denied vote because nominated tie-breaker nodeid %d is active", client->cluster_name, client->node_id, client->tie_breaker.node_id); *result_vote = info->last_result = TLV_VOTE_NACK; } break; default: - qnetd_log(LOG_DEBUG, "algo-2nodelms: cluster %s node-id %d denied vote because tie-breaker option is invalid: %d", client->cluster_name, client->node_id, client->tie_breaker.mode); + log(LOG_DEBUG, "algo-2nodelms: cluster %s node-id %d denied vote because tie-breaker option is invalid: %d", client->cluster_name, client->node_id, client->tie_breaker.mode); *result_vote = info->last_result = TLV_VOTE_NACK; } @@ -275,10 +275,10 @@ qnetd_algo_2nodelms_quorum_node_list_received(struct qnetd_client *client, void qnetd_algo_2nodelms_client_disconnect(struct qnetd_client *client, int server_going_down) { - qnetd_log(LOG_INFO, "algo-2nodelms: Client %p (cluster %s, node_id "UTILS_PRI_NODE_ID") " + log(LOG_INFO, "algo-2nodelms: Client %p (cluster %s, node_id "UTILS_PRI_NODE_ID") " "disconnect", client, client->cluster_name, client->node_id); - qnetd_log(LOG_INFO, "algo-2nodelms: server going down %u", server_going_down); + log(LOG_INFO, "algo-2nodelms: server going down %u", server_going_down); free(client->algorithm_data); } @@ -293,7 +293,7 @@ qnetd_algo_2nodelms_ask_for_vote_received(struct qnetd_client *client, uint32_t { struct qnetd_algo_2nodelms_info *info = client->algorithm_data; - qnetd_log(LOG_INFO, "algo-2nodelms: Client %p (cluster %s, node_id "UTILS_PRI_NODE_ID") " + log(LOG_INFO, "algo-2nodelms: Client %p (cluster %s, node_id "UTILS_PRI_NODE_ID") " "asked for a vote", client, client->cluster_name, client->node_id); if (info->last_result == 0) { @@ -310,7 +310,7 @@ enum tlv_reply_error_code qnetd_algo_2nodelms_vote_info_reply_received(struct qnetd_client *client, uint32_t msg_seq_num) { - qnetd_log(LOG_INFO, "algo-2nodelms: Client %p (cluster %s, node_id "UTILS_PRI_NODE_ID") " + log(LOG_INFO, "algo-2nodelms: Client %p (cluster %s, node_id "UTILS_PRI_NODE_ID") " "replied back to vote info message", client, client->cluster_name, client->node_id); return (TLV_REPLY_ERROR_CODE_NO_ERROR); @@ -321,7 +321,7 @@ qnetd_algo_2nodelms_heuristics_change_received(struct qnetd_client *client, uint enum tlv_heuristics heuristics, enum tlv_vote *result_vote) { - qnetd_log(LOG_INFO, "algo-2nodelms: heuristics change is not supported."); + log(LOG_INFO, "algo-2nodelms: heuristics change is not supported."); *result_vote = TLV_VOTE_NO_CHANGE; diff --git a/qdevices/qnetd-algo-ffsplit.c b/qdevices/qnetd-algo-ffsplit.c index 3c8e6db..dbc5f85 100644 --- a/qdevices/qnetd-algo-ffsplit.c +++ b/qdevices/qnetd-algo-ffsplit.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 Red Hat, Inc. + * Copyright (c) 2015-2019 Red Hat, Inc. * * All rights reserved. * @@ -36,8 +36,8 @@ #include +#include "log.h" #include "qnetd-algo-ffsplit.h" -#include "qnetd-log.h" #include "qnetd-log-debug.h" #include "qnetd-cluster-list.h" #include "qnetd-cluster.h" @@ -75,7 +75,7 @@ qnetd_algo_ffsplit_client_init(struct qnetd_client *client) if (qnetd_cluster_size(client->cluster) == 1) { cluster_data = malloc(sizeof(*cluster_data)); if (cluster_data == NULL) { - qnetd_log(LOG_ERR, "ffsplit: Can't initialize cluster data for client %s", + log(LOG_ERR, "ffsplit: Can't initialize cluster data for client %s", client->addr_str); return (TLV_REPLY_ERROR_CODE_INTERNAL_ERROR); @@ -89,7 +89,7 @@ qnetd_algo_ffsplit_client_init(struct qnetd_client *client) client_data = malloc(sizeof(*client_data)); if (client_data == NULL) { - qnetd_log(LOG_ERR, "ffsplit: Can't initialize node data for client %s", + log(LOG_ERR, "ffsplit: Can't initialize node data for client %s", client->addr_str); return (TLV_REPLY_ERROR_CODE_INTERNAL_ERROR); @@ -144,7 +144,7 @@ qnetd_algo_ffsplit_is_preferred_partition(const struct qnetd_client *client, } if (!case_processed) { - qnetd_log(LOG_CRIT, "qnetd_algo_ffsplit_is_preferred_partition unprocessed " + log(LOG_CRIT, "qnetd_algo_ffsplit_is_preferred_partition unprocessed " "tie_breaker.mode"); exit(1); } @@ -420,7 +420,7 @@ qnetd_algo_ffsplit_partition_cmp(const struct qnetd_client *client1, exit_res: if (res == -1) { - qnetd_log(LOG_CRIT, "qnetd_algo_ffsplit_partition_cmp unhandled case"); + log(LOG_CRIT, "qnetd_algo_ffsplit_partition_cmp unhandled case"); exit(1); /* NOTREACHED */ } @@ -612,21 +612,21 @@ qnetd_algo_ffsplit_do(struct qnetd_client *client, int client_leaving, /* * Wait until membership is stable */ - qnetd_log(LOG_DEBUG, "ffsplit: Membership for cluster %s is not yet stable", client->cluster_name); + log(LOG_DEBUG, "ffsplit: Membership for cluster %s is not yet stable", client->cluster_name); return (TLV_VOTE_WAIT_FOR_REPLY); } - qnetd_log(LOG_DEBUG, "ffsplit: Membership for cluster %s is now stable", client->cluster_name); + log(LOG_DEBUG, "ffsplit: Membership for cluster %s is now stable", client->cluster_name); quorate_partition_node_list = qnetd_algo_ffsplit_select_partition(client, client_leaving, config_node_list, membership_node_list, client_heuristics); cluster_data->quorate_partition_node_list = quorate_partition_node_list; if (quorate_partition_node_list == NULL) { - qnetd_log(LOG_DEBUG, "ffsplit: No quorate partition was selected"); + log(LOG_DEBUG, "ffsplit: No quorate partition was selected"); } else { - qnetd_log(LOG_DEBUG, "ffsplit: Quorate partition selected"); + log(LOG_DEBUG, "ffsplit: Quorate partition selected"); qnetd_log_debug_dump_node_list(client, quorate_partition_node_list); } @@ -635,14 +635,14 @@ qnetd_algo_ffsplit_do(struct qnetd_client *client, int client_leaving, cluster_data->cluster_state = QNETD_ALGO_FFSPLIT_CLUSTER_STATE_SENDING_NACKS; if (qnetd_algo_ffsplit_send_votes(client, client_leaving, ring_id, 0) == 0) { - qnetd_log(LOG_DEBUG, "ffsplit: No client gets NACK"); + log(LOG_DEBUG, "ffsplit: No client gets NACK"); /* * No one gets nack -> send acks */ cluster_data->cluster_state = QNETD_ALGO_FFSPLIT_CLUSTER_STATE_SENDING_ACKS; if (qnetd_algo_ffsplit_send_votes(client, client_leaving, ring_id, 1) == 0) { - qnetd_log(LOG_DEBUG, "ffsplit: No client gets ACK"); + log(LOG_DEBUG, "ffsplit: No client gets ACK"); /* * No one gets acks -> finished */ @@ -663,7 +663,7 @@ qnetd_algo_ffsplit_config_node_list_received(struct qnetd_client *client, /* * Empty node list shouldn't happen */ - qnetd_log(LOG_ERR, "ffsplit: Received empty config node list for client %s", + log(LOG_ERR, "ffsplit: Received empty config node list for client %s", client->addr_str); return (TLV_REPLY_ERROR_CODE_INVALID_CONFIG_NODE_LIST); @@ -673,7 +673,7 @@ qnetd_algo_ffsplit_config_node_list_received(struct qnetd_client *client, /* * Current node is not in node list */ - qnetd_log(LOG_ERR, "ffsplit: Received config node list without client %s", + log(LOG_ERR, "ffsplit: Received config node list without client %s", client->addr_str); return (TLV_REPLY_ERROR_CODE_INVALID_CONFIG_NODE_LIST); @@ -716,7 +716,7 @@ qnetd_algo_ffsplit_membership_node_list_received(struct qnetd_client *client, /* * Empty node list shouldn't happen */ - qnetd_log(LOG_ERR, "ffsplit: Received empty membership node list for client %s", + log(LOG_ERR, "ffsplit: Received empty membership node list for client %s", client->addr_str); return (TLV_REPLY_ERROR_CODE_INVALID_MEMBERSHIP_NODE_LIST); @@ -726,7 +726,7 @@ qnetd_algo_ffsplit_membership_node_list_received(struct qnetd_client *client, /* * Current node is not in node list */ - qnetd_log(LOG_ERR, "ffsplit: Received membership node list without client %s", + log(LOG_ERR, "ffsplit: Received membership node list without client %s", client->addr_str); return (TLV_REPLY_ERROR_CODE_INVALID_MEMBERSHIP_NODE_LIST); @@ -798,7 +798,7 @@ qnetd_algo_ffsplit_vote_info_reply_received(struct qnetd_client *client, uint32_ client_data = (struct qnetd_algo_ffsplit_client_data *)client->algorithm_data; if (client_data->vote_info_expected_seq_num != msg_seq_num) { - qnetd_log(LOG_DEBUG, "ffsplit: Received old vote info reply from client %s", + log(LOG_DEBUG, "ffsplit: Received old vote info reply from client %s", client->addr_str); return (TLV_REPLY_ERROR_CODE_NO_ERROR); @@ -813,13 +813,13 @@ qnetd_algo_ffsplit_vote_info_reply_received(struct qnetd_client *client, uint32_ if (cluster_data->cluster_state == QNETD_ALGO_FFSPLIT_CLUSTER_STATE_SENDING_NACKS) { if (qnetd_algo_ffsplit_no_clients_in_sending_state(client, 0) == 0) { - qnetd_log(LOG_DEBUG, "ffsplit: All NACK votes sent for cluster %s", + log(LOG_DEBUG, "ffsplit: All NACK votes sent for cluster %s", client->cluster_name); cluster_data->cluster_state = QNETD_ALGO_FFSPLIT_CLUSTER_STATE_SENDING_ACKS; if (qnetd_algo_ffsplit_send_votes(client, 0, &client->last_ring_id, 1) == 0) { - qnetd_log(LOG_DEBUG, "ffsplit: No client gets ACK"); + log(LOG_DEBUG, "ffsplit: No client gets ACK"); /* * No one gets acks -> finished */ @@ -828,7 +828,7 @@ qnetd_algo_ffsplit_vote_info_reply_received(struct qnetd_client *client, uint32_ } } else { if (qnetd_algo_ffsplit_no_clients_in_sending_state(client, 1) == 0) { - qnetd_log(LOG_DEBUG, "ffsplit: All ACK votes sent for cluster %s", + log(LOG_DEBUG, "ffsplit: All ACK votes sent for cluster %s", client->cluster_name); cluster_data->cluster_state = QNETD_ALGO_FFSPLIT_CLUSTER_STATE_WAITING_FOR_CHANGE; diff --git a/qdevices/qnetd-algo-lms.c b/qdevices/qnetd-algo-lms.c index 47b5262..9e9385c 100644 --- a/qdevices/qnetd-algo-lms.c +++ b/qdevices/qnetd-algo-lms.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 Red Hat, Inc. + * Copyright (c) 2015-2019 Red Hat, Inc. * * All rights reserved. * @@ -52,8 +52,8 @@ #include #include +#include "log.h" #include "qnetd-algo-lms.h" -#include "qnetd-log.h" #include "qnetd-cluster-list.h" #include "qnetd-algo-utils.h" #include "qnetd-client-algo-timer.h" @@ -80,7 +80,7 @@ static enum tlv_reply_error_code do_lms_algorithm(struct qnetd_client *client, c qnetd_client_algo_timer_abort(client); if (qnetd_algo_all_ring_ids_match(client, ring_id) == -1) { - qnetd_log(LOG_DEBUG, "algo-lms: nodeid %d: ring ID (" UTILS_PRI_RING_ID ") not unique in this membership, waiting", + log(LOG_DEBUG, "algo-lms: nodeid %d: ring ID (" UTILS_PRI_RING_ID ") not unique in this membership, waiting", client->node_id, ring_id->node_id, ring_id->seq); qnetd_client_algo_timer_schedule(client); @@ -90,13 +90,13 @@ static enum tlv_reply_error_code do_lms_algorithm(struct qnetd_client *client, c /* Create and count the number of separate partitions */ if ( (num_partitions = qnetd_algo_create_partitions(client, &info->partition_list, ring_id)) == -1) { - qnetd_log(LOG_DEBUG, "algo-lms: Error creating partition list"); + log(LOG_DEBUG, "algo-lms: Error creating partition list"); return (TLV_REPLY_ERROR_CODE_INTERNAL_ERROR); } /* This can happen if we are first on the block */ if (num_partitions == 0) { - qnetd_log(LOG_DEBUG, "algo-lms: No partitions found"); + log(LOG_DEBUG, "algo-lms: No partitions found"); qnetd_client_algo_timer_schedule(client); *result_vote = info->last_result = TLV_VOTE_WAIT_FOR_REPLY; @@ -107,7 +107,7 @@ static enum tlv_reply_error_code do_lms_algorithm(struct qnetd_client *client, c /* Only 1 partition - let votequorum sort it out */ if (num_partitions == 1) { - qnetd_log(LOG_DEBUG, "algo-lms: Only 1 partition. This is votequorum's problem, not ours"); + log(LOG_DEBUG, "algo-lms: Only 1 partition. This is votequorum's problem, not ours"); qnetd_algo_free_partitions(&info->partition_list); *result_vote = info->last_result = TLV_VOTE_ACK; return (TLV_REPLY_ERROR_CODE_NO_ERROR); @@ -126,7 +126,7 @@ static enum tlv_reply_error_code do_lms_algorithm(struct qnetd_client *client, c /* Don't save NACK, we need to know subsequently if we haven't been voting */ *result_vote = TLV_VOTE_NACK; - qnetd_log(LOG_DEBUG, "algo-lms: we are a new partition and another active partition exists. NACK"); + log(LOG_DEBUG, "algo-lms: we are a new partition and another active partition exists. NACK"); return (TLV_REPLY_ERROR_CODE_NO_ERROR); } } @@ -142,7 +142,7 @@ static enum tlv_reply_error_code do_lms_algorithm(struct qnetd_client *client, c best_score_partition = cur_partition; } } - qnetd_log(LOG_DEBUG, "algo-lms: best score partition is (" UTILS_PRI_RING_ID ") with score %d", + log(LOG_DEBUG, "algo-lms: best score partition is (" UTILS_PRI_RING_ID ") with score %d", best_score_partition->ring_id.node_id, best_score_partition->ring_id.seq, best_score_partition->score); /* Now check if it's really the highest score, and not just the joint-highest */ @@ -157,11 +157,11 @@ static enum tlv_reply_error_code do_lms_algorithm(struct qnetd_client *client, c if (!joint_leader) { /* Partition with highest score is unique, allow us to run if we're in that partition. */ if (tlv_ring_id_eq(&best_score_partition->ring_id, ring_id)) { - qnetd_log(LOG_DEBUG, "algo-lms: We are in the best score partition. ACK"); + log(LOG_DEBUG, "algo-lms: We are in the best score partition. ACK"); *result_vote = info->last_result = TLV_VOTE_ACK; } else { - qnetd_log(LOG_DEBUG, "algo-lms: We are NOT in the best score partition. NACK"); + log(LOG_DEBUG, "algo-lms: We are NOT in the best score partition. NACK"); *result_vote = info->last_result = TLV_VOTE_NACK; } @@ -181,7 +181,7 @@ static enum tlv_reply_error_code do_lms_algorithm(struct qnetd_client *client, c } } - qnetd_log(LOG_DEBUG, "algo-lms: largest partition is (" UTILS_PRI_RING_ID ") with %d nodes", + log(LOG_DEBUG, "algo-lms: largest partition is (" UTILS_PRI_RING_ID ") with %d nodes", largest_partition->ring_id.node_id, largest_partition->ring_id.seq, largest_partition->num_nodes); /* Now check if it's really the largest, and not just the joint-largest */ @@ -196,11 +196,11 @@ static enum tlv_reply_error_code do_lms_algorithm(struct qnetd_client *client, c if (!joint_leader) { /* Largest partition is unique, allow us to run if we're in that partition. */ if (tlv_ring_id_eq(&largest_partition->ring_id, ring_id)) { - qnetd_log(LOG_DEBUG, "algo-lms: We are in the largest partition. ACK"); + log(LOG_DEBUG, "algo-lms: We are in the largest partition. ACK"); *result_vote = info->last_result = TLV_VOTE_ACK; } else { - qnetd_log(LOG_DEBUG, "algo-lms: We are NOT in the largest partition. NACK"); + log(LOG_DEBUG, "algo-lms: We are NOT in the largest partition. NACK"); *result_vote = info->last_result = TLV_VOTE_NACK; } } @@ -219,7 +219,7 @@ static enum tlv_reply_error_code do_lms_algorithm(struct qnetd_client *client, c tb_node_id = client->tie_breaker.node_id; } else { - qnetd_log(LOG_DEBUG, "algo-lms: denied vote because tie-breaker option is invalid: %d", + log(LOG_DEBUG, "algo-lms: denied vote because tie-breaker option is invalid: %d", client->tie_breaker.mode); tb_node_id = -1; } @@ -232,7 +232,7 @@ static enum tlv_reply_error_code do_lms_algorithm(struct qnetd_client *client, c if (other_client->node_id < tb_node_id) { tb_node_id = other_client->node_id; memcpy(&tb_node_ring_id, &other_client->last_ring_id, sizeof(struct tlv_ring_id)); - qnetd_log(LOG_DEBUG, "algo-lms: Looking for low node ID. found %d (" UTILS_PRI_RING_ID ")", + log(LOG_DEBUG, "algo-lms: Looking for low node ID. found %d (" UTILS_PRI_RING_ID ")", tb_node_id, tb_node_ring_id.node_id, tb_node_ring_id.seq); } break; @@ -241,32 +241,32 @@ static enum tlv_reply_error_code do_lms_algorithm(struct qnetd_client *client, c if (other_client->node_id > tb_node_id) { tb_node_id = other_client->node_id; memcpy(&tb_node_ring_id, &other_client->last_ring_id, sizeof(struct tlv_ring_id)); - qnetd_log(LOG_DEBUG, "algo-lms: Looking for high node ID. found %d (" UTILS_PRI_RING_ID ")", + log(LOG_DEBUG, "algo-lms: Looking for high node ID. found %d (" UTILS_PRI_RING_ID ")", tb_node_id, tb_node_ring_id.node_id, tb_node_ring_id.seq); } break; case TLV_TIE_BREAKER_MODE_NODE_ID: if (client->tie_breaker.node_id == client->node_id) { memcpy(&tb_node_ring_id, &other_client->last_ring_id, sizeof(struct tlv_ring_id)); - qnetd_log(LOG_DEBUG, "algo-lms: Looking for nominated node ID. found %d (" UTILS_PRI_RING_ID ")", + log(LOG_DEBUG, "algo-lms: Looking for nominated node ID. found %d (" UTILS_PRI_RING_ID ")", tb_node_id, tb_node_ring_id.node_id, tb_node_ring_id.seq); } break; default: - qnetd_log(LOG_DEBUG, "algo-lms: denied vote because tie-breaker option is invalid: %d", + log(LOG_DEBUG, "algo-lms: denied vote because tie-breaker option is invalid: %d", client->tie_breaker.mode); memset(&tb_node_ring_id, 0, sizeof(struct tlv_ring_id)); } } if (client->node_id == tb_node_id || tlv_ring_id_eq(&tb_node_ring_id, ring_id)) { - qnetd_log(LOG_DEBUG, "algo-lms: We are in the same partition (" UTILS_PRI_RING_ID ") as tie-breaker node id %d. ACK", + log(LOG_DEBUG, "algo-lms: We are in the same partition (" UTILS_PRI_RING_ID ") as tie-breaker node id %d. ACK", tb_node_ring_id.node_id, tb_node_ring_id.seq, tb_node_id); *result_vote = info->last_result = TLV_VOTE_ACK; } else { - qnetd_log(LOG_DEBUG, "algo-lms: We are NOT in the same partition (" UTILS_PRI_RING_ID ") as tie-breaker node id %d. NACK", + log(LOG_DEBUG, "algo-lms: We are NOT in the same partition (" UTILS_PRI_RING_ID ") as tie-breaker node id %d. NACK", tb_node_ring_id.node_id, tb_node_ring_id.seq, tb_node_id); *result_vote = info->last_result = TLV_VOTE_NACK; } @@ -310,7 +310,7 @@ qnetd_algo_lms_config_node_list_received(struct qnetd_client *client, node_count++; } info->num_config_nodes = node_count; - qnetd_log(LOG_DEBUG, "algo-lms: cluster %s config_list has %d nodes", client->cluster_name, node_count); + log(LOG_DEBUG, "algo-lms: cluster %s config_list has %d nodes", client->cluster_name, node_count); *result_vote = TLV_VOTE_NO_CHANGE; @@ -326,8 +326,8 @@ qnetd_algo_lms_membership_node_list_received(struct qnetd_client *client, uint32_t msg_seq_num, const struct tlv_ring_id *ring_id, const struct node_list *nodes, enum tlv_heuristics heuristics, enum tlv_vote *result_vote) { - qnetd_log(LOG_DEBUG, " "); - qnetd_log(LOG_DEBUG, "algo-lms: membership list from node %d partition (" UTILS_PRI_RING_ID ")", client->node_id, ring_id->node_id, ring_id->seq); + log(LOG_DEBUG, " "); + log(LOG_DEBUG, "algo-lms: membership list from node %d partition (" UTILS_PRI_RING_ID ")", client->node_id, ring_id->node_id, ring_id->seq); return do_lms_algorithm(client, ring_id, result_vote); } @@ -342,8 +342,8 @@ enum tlv_reply_error_code qnetd_algo_lms_quorum_node_list_received(struct qnetd_client *client, uint32_t msg_seq_num, enum tlv_quorate quorate, const struct node_list *nodes, enum tlv_vote *result_vote) { - qnetd_log(LOG_DEBUG, " "); - qnetd_log(LOG_DEBUG, "algo-lms: quorum node list from node %d partition (" UTILS_PRI_RING_ID ")", client->node_id, client->last_ring_id.node_id, client->last_ring_id.seq); + log(LOG_DEBUG, " "); + log(LOG_DEBUG, "algo-lms: quorum node list from node %d partition (" UTILS_PRI_RING_ID ")", client->node_id, client->last_ring_id.node_id, client->last_ring_id.seq); return do_lms_algorithm(client, &client->last_ring_id, result_vote); } @@ -355,10 +355,10 @@ qnetd_algo_lms_quorum_node_list_received(struct qnetd_client *client, void qnetd_algo_lms_client_disconnect(struct qnetd_client *client, int server_going_down) { - qnetd_log(LOG_DEBUG, "algo-lms: Client %p (cluster %s, node_id "UTILS_PRI_NODE_ID") " + log(LOG_DEBUG, "algo-lms: Client %p (cluster %s, node_id "UTILS_PRI_NODE_ID") " "disconnect", client, client->cluster_name, client->node_id); - qnetd_log(LOG_INFO, "algo-lms: server going down %u", server_going_down); + log(LOG_INFO, "algo-lms: server going down %u", server_going_down); free(client->algorithm_data); } @@ -371,8 +371,8 @@ enum tlv_reply_error_code qnetd_algo_lms_ask_for_vote_received(struct qnetd_client *client, uint32_t msg_seq_num, enum tlv_vote *result_vote) { - qnetd_log(LOG_DEBUG, " "); - qnetd_log(LOG_DEBUG, "algo-lms: Client %p (cluster %s, node_id "UTILS_PRI_NODE_ID") " + log(LOG_DEBUG, " "); + log(LOG_DEBUG, "algo-lms: Client %p (cluster %s, node_id "UTILS_PRI_NODE_ID") " "asked for a vote", client, client->cluster_name, client->node_id); return do_lms_algorithm(client, &client->last_ring_id, result_vote); @@ -381,7 +381,7 @@ qnetd_algo_lms_ask_for_vote_received(struct qnetd_client *client, uint32_t msg_s enum tlv_reply_error_code qnetd_algo_lms_vote_info_reply_received(struct qnetd_client *client, uint32_t msg_seq_num) { - qnetd_log(LOG_DEBUG, "algo-lms: Client %p (cluster %s, node_id "UTILS_PRI_NODE_ID") " + log(LOG_DEBUG, "algo-lms: Client %p (cluster %s, node_id "UTILS_PRI_NODE_ID") " "replied back to vote info message", client, client->cluster_name, client->node_id); return (TLV_REPLY_ERROR_CODE_NO_ERROR); @@ -392,7 +392,7 @@ qnetd_algo_lms_heuristics_change_received(struct qnetd_client *client, uint32_t enum tlv_heuristics heuristics, enum tlv_vote *result_vote) { - qnetd_log(LOG_INFO, "algo-lms: heuristics change is not supported."); + log(LOG_INFO, "algo-lms: heuristics change is not supported."); *result_vote = TLV_VOTE_NO_CHANGE; @@ -405,7 +405,7 @@ qnetd_algo_lms_timer_callback(struct qnetd_client *client, int *reschedule_timer { enum tlv_reply_error_code ret; - qnetd_log(LOG_DEBUG, "algo-lms: Client %p (cluster %s, node_id "UTILS_PRI_NODE_ID") " + log(LOG_DEBUG, "algo-lms: Client %p (cluster %s, node_id "UTILS_PRI_NODE_ID") " "Timer callback", client, client->cluster_name, client->node_id); ret = do_lms_algorithm(client, &client->last_ring_id, result_vote); diff --git a/qdevices/qnetd-algo-test.c b/qdevices/qnetd-algo-test.c index 4276cf7..e31fb94 100644 --- a/qdevices/qnetd-algo-test.c +++ b/qdevices/qnetd-algo-test.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 Red Hat, Inc. + * Copyright (c) 2015-2019 Red Hat, Inc. * * All rights reserved. * @@ -36,8 +36,8 @@ #include +#include "log.h" #include "qnetd-algo-test.h" -#include "qnetd-log.h" #include "qnetd-cluster-list.h" #include "qnetd-client-send.h" #include "qnetd-log-debug.h" @@ -67,12 +67,12 @@ qnetd_algo_test_client_init(struct qnetd_client *client) { int *algo_data; - qnetd_log(LOG_WARNING, "algo-test: Client %s (cluster = '%s', node_id = " + log(LOG_WARNING, "algo-test: Client %s (cluster = '%s', node_id = " UTILS_PRI_NODE_ID") initiated test algorithm. It's not recommended to use test " "algorithm because it can create multiple quorate partitions!", client->addr_str, client->cluster_name, client->node_id); - qnetd_log(LOG_INFO, "algo-test: client_init"); + log(LOG_INFO, "algo-test: client_init"); client->algorithm_data = malloc(sizeof(int)); if (client->algorithm_data == NULL) { @@ -86,7 +86,7 @@ qnetd_algo_test_client_init(struct qnetd_client *client) /* * First client in the cluster */ - qnetd_log(LOG_INFO, "algo-test: Initializing cluster->algorithm data"); + log(LOG_INFO, "algo-test: Initializing cluster->algorithm data"); client->cluster->algorithm_data = malloc(sizeof(int)); if (client->cluster->algorithm_data == NULL) { @@ -120,7 +120,7 @@ qnetd_algo_test_config_node_list_received(struct qnetd_client *client, const struct node_list *nodes, int initial, enum tlv_vote *result_vote) { - qnetd_log(LOG_INFO, "algo-test: node_list_received"); + log(LOG_INFO, "algo-test: node_list_received"); *result_vote = TLV_VOTE_NO_CHANGE; @@ -148,7 +148,7 @@ qnetd_algo_test_membership_node_list_received(struct qnetd_client *client, const struct node_list *nodes, enum tlv_heuristics heuristics, enum tlv_vote *result_vote) { - qnetd_log(LOG_INFO, "algo-test: membership_node_list_received"); + log(LOG_INFO, "algo-test: membership_node_list_received"); *result_vote = TLV_VOTE_ACK; @@ -172,7 +172,7 @@ qnetd_algo_test_quorum_node_list_received(struct qnetd_client *client, enum tlv_vote *result_vote) { - qnetd_log(LOG_INFO, "algo-test: quorum_node_list_received"); + log(LOG_INFO, "algo-test: quorum_node_list_received"); *result_vote = TLV_VOTE_NO_CHANGE; @@ -188,7 +188,7 @@ void qnetd_algo_test_client_disconnect(struct qnetd_client *client, int server_going_down) { - qnetd_log(LOG_INFO, "algo-test: client_disconnect"); + log(LOG_INFO, "algo-test: client_disconnect"); free(client->algorithm_data); @@ -196,7 +196,7 @@ qnetd_algo_test_client_disconnect(struct qnetd_client *client, int server_going_ /* * Last client in the cluster */ - qnetd_log(LOG_INFO, "algo-test: Finalizing cluster->algorithm data"); + log(LOG_INFO, "algo-test: Finalizing cluster->algorithm data"); free(client->cluster->algorithm_data); } @@ -211,7 +211,7 @@ qnetd_algo_test_ask_for_vote_received(struct qnetd_client *client, uint32_t msg_ enum tlv_vote *result_vote) { - qnetd_log(LOG_INFO, "algo-test: ask_for_vote_received"); + log(LOG_INFO, "algo-test: ask_for_vote_received"); *result_vote = TLV_VOTE_ACK; @@ -222,7 +222,7 @@ enum tlv_reply_error_code qnetd_algo_test_vote_info_reply_received(struct qnetd_client *client, uint32_t msg_seq_num) { - qnetd_log(LOG_INFO, "algo-test: vote_info_reply_received"); + log(LOG_INFO, "algo-test: vote_info_reply_received"); return (TLV_REPLY_ERROR_CODE_NO_ERROR); } @@ -238,7 +238,7 @@ qnetd_algo_test_heuristics_change_received(struct qnetd_client *client, uint32_t enum tlv_heuristics heuristics, enum tlv_vote *result_vote) { - qnetd_log(LOG_INFO, "algo-test: heuristics_change_received"); + log(LOG_INFO, "algo-test: heuristics_change_received"); *result_vote = TLV_VOTE_NO_CHANGE; diff --git a/qdevices/qnetd-algo-utils.c b/qdevices/qnetd-algo-utils.c index b4c8d92..5f27dff 100644 --- a/qdevices/qnetd-algo-utils.c +++ b/qdevices/qnetd-algo-utils.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Red Hat, Inc. + * Copyright (c) 2016-2019 Red Hat, Inc. * * All rights reserved. * @@ -34,7 +34,7 @@ #include #include -#include "qnetd-log.h" +#include "log.h" #include "qnetd-cluster-list.h" #include "qnetd-algo-utils.h" #include "utils.h" @@ -57,7 +57,7 @@ qnetd_algo_all_ring_ids_match(struct qnetd_client *client, const struct tlv_ring if (other_client == client) { continue; /* We've seen our membership list */ } - qnetd_log(LOG_DEBUG, "algo-util: all_ring_ids_match: seen nodeid %d (client %p) ring_id (" UTILS_PRI_RING_ID ")", other_client->node_id, other_client, other_client->last_ring_id.node_id, other_client->last_ring_id.seq); + log(LOG_DEBUG, "algo-util: all_ring_ids_match: seen nodeid %d (client %p) ring_id (" UTILS_PRI_RING_ID ")", other_client->node_id, other_client, other_client->last_ring_id.node_id, other_client->last_ring_id.seq); /* Look down our node list and see if this client is known to us */ TAILQ_FOREACH(node_info, &client->last_membership_node_list, entries) { @@ -84,7 +84,7 @@ qnetd_algo_all_ring_ids_match(struct qnetd_client *client, const struct tlv_ring * we need to wait until they have all caught up before making a decision */ if (in_our_partition && !tlv_ring_id_eq(ring_id, &other_client->last_ring_id)) { - qnetd_log(LOG_DEBUG, "algo-util: nodeid %d in our partition has different ring_id (" UTILS_PRI_RING_ID ") to us (" UTILS_PRI_RING_ID ")", other_client->node_id, other_client->last_ring_id.node_id, other_client->last_ring_id.seq, ring_id->node_id, ring_id->seq); + log(LOG_DEBUG, "algo-util: nodeid %d in our partition has different ring_id (" UTILS_PRI_RING_ID ") to us (" UTILS_PRI_RING_ID ")", other_client->node_id, other_client->last_ring_id.node_id, other_client->last_ring_id.seq, ring_id->node_id, ring_id->seq); return (-1); /* ring IDs don't match */ } } @@ -173,7 +173,7 @@ qnetd_algo_dump_partitions(partitions_list_t *partitions_list) struct qnetd_algo_partition *partition; TAILQ_FOREACH(partition, partitions_list, entries) { - qnetd_log(LOG_DEBUG, "algo-util: partition (" UTILS_PRI_RING_ID ") (%p) has %d nodes", + log(LOG_DEBUG, "algo-util: partition (" UTILS_PRI_RING_ID ") (%p) has %d nodes", partition->ring_id.node_id, partition->ring_id.seq, partition, partition->num_nodes); } } diff --git a/qdevices/qnetd-algorithm.c b/qdevices/qnetd-algorithm.c index e88d44d..c52b73b 100644 --- a/qdevices/qnetd-algorithm.c +++ b/qdevices/qnetd-algorithm.c @@ -34,13 +34,13 @@ #include +#include "log.h" #include "qnet-config.h" #include "qnetd-algorithm.h" #include "qnetd-algo-test.h" #include "qnetd-algo-ffsplit.h" #include "qnetd-algo-2nodelms.h" #include "qnetd-algo-lms.h" -#include "qnetd-log.h" static struct qnetd_algorithm *qnetd_algorithm_array[QNETD_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE]; @@ -49,7 +49,7 @@ qnetd_algorithm_client_init(struct qnetd_client *client) { if (client->decision_algorithm >= QNETD_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE || qnetd_algorithm_array[client->decision_algorithm] == NULL) { - qnetd_log(LOG_CRIT, "qnetd_algorithm_client_init unhandled decision algorithm"); + log(LOG_CRIT, "qnetd_algorithm_client_init unhandled decision algorithm"); return (TLV_REPLY_ERROR_CODE_INTERNAL_ERROR); } @@ -64,7 +64,7 @@ qnetd_algorithm_config_node_list_received(struct qnetd_client *client, { if (client->decision_algorithm >= QNETD_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE || qnetd_algorithm_array[client->decision_algorithm] == NULL) { - qnetd_log(LOG_CRIT, "qnetd_algorithm_config_node_list_received unhandled " + log(LOG_CRIT, "qnetd_algorithm_config_node_list_received unhandled " "decision algorithm"); return (TLV_REPLY_ERROR_CODE_INTERNAL_ERROR); } @@ -82,7 +82,7 @@ qnetd_algorithm_membership_node_list_received(struct qnetd_client *client, if (client->decision_algorithm >= QNETD_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE || qnetd_algorithm_array[client->decision_algorithm] == NULL) { - qnetd_log(LOG_CRIT, "qnetd_algorithm_membership_node_list_received unhandled " + log(LOG_CRIT, "qnetd_algorithm_membership_node_list_received unhandled " "decision algorithm"); return (TLV_REPLY_ERROR_CODE_INTERNAL_ERROR); } @@ -100,7 +100,7 @@ qnetd_algorithm_quorum_node_list_received(struct qnetd_client *client, if (client->decision_algorithm >= QNETD_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE || qnetd_algorithm_array[client->decision_algorithm] == NULL) { - qnetd_log(LOG_CRIT, "algorithm_quorum_node_list_received unhandled " + log(LOG_CRIT, "algorithm_quorum_node_list_received unhandled " "decision algorithm"); return (TLV_REPLY_ERROR_CODE_INTERNAL_ERROR); } @@ -115,7 +115,7 @@ qnetd_algorithm_client_disconnect(struct qnetd_client *client, int server_going_ if (client->decision_algorithm >= QNETD_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE || qnetd_algorithm_array[client->decision_algorithm] == NULL) { - qnetd_log(LOG_CRIT, "qnetd_algorithm_client_disconnect unhandled decision " + log(LOG_CRIT, "qnetd_algorithm_client_disconnect unhandled decision " "algorithm"); return; } @@ -130,7 +130,7 @@ qnetd_algorithm_ask_for_vote_received(struct qnetd_client *client, uint32_t msg_ if (client->decision_algorithm >= QNETD_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE || qnetd_algorithm_array[client->decision_algorithm] == NULL) { - qnetd_log(LOG_CRIT, "qnetd_algorithm_ask_for_vote_received unhandled " + log(LOG_CRIT, "qnetd_algorithm_ask_for_vote_received unhandled " "decision algorithm"); return (TLV_REPLY_ERROR_CODE_INTERNAL_ERROR); } @@ -145,7 +145,7 @@ qnetd_algorithm_vote_info_reply_received(struct qnetd_client *client, uint32_t m if (client->decision_algorithm >= QNETD_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE || qnetd_algorithm_array[client->decision_algorithm] == NULL) { - qnetd_log(LOG_CRIT, "qnetd_algorithm_vote_info_reply_received unhandled decision algorithm"); + log(LOG_CRIT, "qnetd_algorithm_vote_info_reply_received unhandled decision algorithm"); return (TLV_REPLY_ERROR_CODE_INTERNAL_ERROR); } @@ -161,7 +161,7 @@ qnetd_algorithm_heuristics_change_received(struct qnetd_client *client, uint32_t if (client->decision_algorithm >= QNETD_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE || qnetd_algorithm_array[client->decision_algorithm] == NULL) { - qnetd_log(LOG_CRIT, "qnetd_algorithm_ask_for_vote_received unhandled " + log(LOG_CRIT, "qnetd_algorithm_ask_for_vote_received unhandled " "decision algorithm"); return (TLV_REPLY_ERROR_CODE_INTERNAL_ERROR); } @@ -177,7 +177,7 @@ qnetd_algorithm_timer_callback(struct qnetd_client *client, int *reschedule_time if (client->decision_algorithm >= QNETD_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE || qnetd_algorithm_array[client->decision_algorithm] == NULL) { - qnetd_log(LOG_CRIT, "qnetd_algorithm_timer_callback unhandled decision algorithm"); + log(LOG_CRIT, "qnetd_algorithm_timer_callback unhandled decision algorithm"); return (TLV_REPLY_ERROR_CODE_INTERNAL_ERROR); } @@ -191,13 +191,13 @@ qnetd_algorithm_register(enum tlv_decision_algorithm_type algorithm_number, { if (algorithm_number >= QNETD_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE) { - qnetd_log(LOG_CRIT, "Failed to register unsupported decision algorithm %u", + log(LOG_CRIT, "Failed to register unsupported decision algorithm %u", algorithm_number); return (-1); } if (qnetd_algorithm_array[algorithm_number] != NULL) { - qnetd_log(LOG_CRIT, "Failed to register decision algorithm %u, " + log(LOG_CRIT, "Failed to register decision algorithm %u, " "it's already registered.", algorithm_number); return (-1); } @@ -212,19 +212,19 @@ qnetd_algorithm_register_all(void) { if (qnetd_algo_test_register() != 0) { - qnetd_log(LOG_CRIT, "Failed to register decision algorithm 'test'"); + log(LOG_CRIT, "Failed to register decision algorithm 'test'"); return (-1); } if (qnetd_algo_ffsplit_register() != 0) { - qnetd_log(LOG_CRIT, "Failed to register decision algorithm 'ffsplit'"); + log(LOG_CRIT, "Failed to register decision algorithm 'ffsplit'"); return (-1); } if (qnetd_algo_2nodelms_register() != 0) { - qnetd_log(LOG_CRIT, "Failed to register decision algorithm '2nodelms'"); + log(LOG_CRIT, "Failed to register decision algorithm '2nodelms'"); return (-1); } if (qnetd_algo_lms_register() != 0) { - qnetd_log(LOG_CRIT, "Failed to register decision algorithm 'lms'"); + log(LOG_CRIT, "Failed to register decision algorithm 'lms'"); return (-1); } diff --git a/qdevices/qnetd-client-algo-timer.c b/qdevices/qnetd-client-algo-timer.c index 35336f0..d9ffbd2 100644 --- a/qdevices/qnetd-client-algo-timer.c +++ b/qdevices/qnetd-client-algo-timer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Red Hat, Inc. + * Copyright (c) 2015-2019 Red Hat, Inc. * * All rights reserved. * @@ -32,7 +32,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "qnetd-log.h" +#include "log.h" #include "qnetd-client-algo-timer.h" #include "qnetd-client-send.h" #include "qnetd-algorithm.h" @@ -57,7 +57,7 @@ qnetd_client_algo_timer_callback(void *data1, void *data2) &send_vote, &result_vote); if (reply_error_code != TLV_REPLY_ERROR_CODE_NO_ERROR) { - qnetd_log(LOG_ERR, "Algorithm for client %s returned error code. " + log(LOG_ERR, "Algorithm for client %s returned error code. " "Sending error reply.", client->addr_str); if (qnetd_client_send_err(client, 0, 0, reply_error_code) != 0) { @@ -67,7 +67,7 @@ qnetd_client_algo_timer_callback(void *data1, void *data2) return (0); } else { - qnetd_log(LOG_DEBUG, "Algorithm for client %s decided to %s timer and %s vote " + log(LOG_DEBUG, "Algorithm for client %s decided to %s timer and %s vote " "with value %s", client->addr_str, (reschedule_timer ? "reschedule" : "not reschedule"), (send_vote ? "send" : "not send"), @@ -109,7 +109,7 @@ qnetd_client_algo_timer_schedule_timeout(struct qnetd_client *client, uint32_t t if (qnetd_client_algo_timer_is_scheduled(client)) { if (qnetd_client_algo_timer_abort(client) != 0) { - qnetd_log(LOG_ERR, "Can't abort algo timer"); + log(LOG_ERR, "Can't abort algo timer"); return (-1); } @@ -118,7 +118,7 @@ qnetd_client_algo_timer_schedule_timeout(struct qnetd_client *client, uint32_t t client->algo_timer = timer_list_add(client->main_timer_list, timeout, qnetd_client_algo_timer_callback, (void *)client, NULL); if (client->algo_timer == NULL) { - qnetd_log(LOG_ERR, "Can't schedule algo timer"); + log(LOG_ERR, "Can't schedule algo timer"); return (-1); } diff --git a/qdevices/qnetd-client-msg-received.c b/qdevices/qnetd-client-msg-received.c index 65711e1..1cc1763 100644 --- a/qdevices/qnetd-client-msg-received.c +++ b/qdevices/qnetd-client-msg-received.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 Red Hat, Inc. + * Copyright (c) 2015-2019 Red Hat, Inc. * * All rights reserved. * @@ -34,9 +34,9 @@ #include +#include "log.h" #include "qnetd-algorithm.h" #include "qnetd-instance.h" -#include "qnetd-log.h" #include "qnetd-log-debug.h" #include "qnetd-client-send.h" #include "msg.h" @@ -93,12 +93,12 @@ qnetd_client_msg_received_check_tls(struct qnetd_instance *instance, struct qnet } if (!case_processed) { - qnetd_log(LOG_ERR, "Unhandled instance tls supported %u", instance->tls_supported); + log(LOG_ERR, "Unhandled instance tls supported %u", instance->tls_supported); exit(1); } if (tls_required && !client->tls_started) { - qnetd_log(LOG_ERR, "TLS is required but doesn't started yet. " + log(LOG_ERR, "TLS is required but doesn't started yet. " "Sending back error message"); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -113,14 +113,14 @@ qnetd_client_msg_received_check_tls(struct qnetd_instance *instance, struct qnet peer_cert = SSL_PeerCertificate(client->socket); if (peer_cert == NULL) { - qnetd_log(LOG_ERR, "Client doesn't sent valid certificate. " + log(LOG_ERR, "Client doesn't sent valid certificate. " "Disconnecting client"); return (-1); } if (CERT_VerifyCertName(peer_cert, client->cluster_name) != SECSuccess) { - qnetd_log(LOG_ERR, "Client doesn't sent certificate with valid CN. " + log(LOG_ERR, "Client doesn't sent certificate with valid CN. " "Disconnecting client"); CERT_DestroyCertificate(peer_cert); @@ -143,7 +143,7 @@ qnetd_client_msg_received_preinit(struct qnetd_instance *instance, struct qnetd_ struct send_buffer_list_entry *send_buffer; if (msg->cluster_name == NULL) { - qnetd_log(LOG_ERR, "Received preinit message without cluster name. " + log(LOG_ERR, "Received preinit message without cluster name. " "Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -156,7 +156,7 @@ qnetd_client_msg_received_preinit(struct qnetd_instance *instance, struct qnetd_ client->cluster_name = malloc(msg->cluster_name_len + 1); if (client->cluster_name == NULL) { - qnetd_log(LOG_ERR, "Can't allocate cluster name. Sending error reply."); + log(LOG_ERR, "Can't allocate cluster name. Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, TLV_REPLY_ERROR_CODE_INTERNAL_ERROR) != 0) { @@ -173,7 +173,7 @@ qnetd_client_msg_received_preinit(struct qnetd_instance *instance, struct qnetd_ send_buffer = send_buffer_list_get_new(&client->send_buffer_list); if (send_buffer == NULL) { - qnetd_log(LOG_ERR, "Can't alloc preinit reply msg from list. " + log(LOG_ERR, "Can't alloc preinit reply msg from list. " "Disconnecting client connection."); return (-1); @@ -181,7 +181,7 @@ qnetd_client_msg_received_preinit(struct qnetd_instance *instance, struct qnetd_ if (msg_create_preinit_reply(&send_buffer->buffer, msg->seq_number_set, msg->seq_number, instance->tls_supported, instance->tls_client_cert_required) == 0) { - qnetd_log(LOG_ERR, "Can't alloc preinit reply msg. " + log(LOG_ERR, "Can't alloc preinit reply msg. " "Disconnecting client connection."); send_buffer_list_discard_new(&client->send_buffer_list, send_buffer); @@ -199,7 +199,7 @@ qnetd_client_msg_received_unexpected_msg(struct qnetd_client *client, const struct msg_decoded *msg, const char *msg_str) { - qnetd_log(LOG_ERR, "Received %s message. Sending back error message", msg_str); + log(LOG_ERR, "Received %s message. Sending back error message", msg_str); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, TLV_REPLY_ERROR_CODE_UNEXPECTED_MESSAGE) != 0) { @@ -224,7 +224,7 @@ qnetd_client_msg_received_starttls(struct qnetd_instance *instance, struct qnetd PRFileDesc *new_pr_fd; if (!client->preinit_received) { - qnetd_log(LOG_ERR, "Received starttls before preinit message. " + log(LOG_ERR, "Received starttls before preinit message. " "Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -237,7 +237,7 @@ qnetd_client_msg_received_starttls(struct qnetd_instance *instance, struct qnetd if ((new_pr_fd = nss_sock_start_ssl_as_server(client->socket, instance->server.cert, instance->server.private_key, instance->tls_client_cert_required, 0, NULL)) == NULL) { - qnetd_log_nss(LOG_ERR, "Can't start TLS. Disconnecting client."); + log_nss(LOG_ERR, "Can't start TLS. Disconnecting client."); return (-1); } @@ -279,21 +279,21 @@ qnetd_client_msg_received_init_check_new_client(struct qnetd_instance *instance, TAILQ_FOREACH(client, &cluster->client_list, cluster_entries) { if (!tlv_tie_breaker_eq(&new_client->tie_breaker, &client->tie_breaker)) { - qnetd_log(LOG_ERR, "Received init message contains tie-breaker which " + log(LOG_ERR, "Received init message contains tie-breaker which " "differs from rest of cluster. Sending error reply"); return (TLV_REPLY_ERROR_CODE_TIE_BREAKER_DIFFERS_FROM_OTHER_NODES); } if (new_client->decision_algorithm != client->decision_algorithm) { - qnetd_log(LOG_ERR, "Received init message contains algorithm which " + log(LOG_ERR, "Received init message contains algorithm which " "differs from rest of cluster. Sending error reply"); return (TLV_REPLY_ERROR_CODE_ALGORITHM_DIFFERS_FROM_OTHER_NODES); } if (new_client->node_id == client->node_id) { - qnetd_log(LOG_ERR, "Received init message contains node id which is " + log(LOG_ERR, "Received init message contains node id which is " "duplicate of other node in cluster. Sending error reply"); return (TLV_REPLY_ERROR_CODE_DUPLICATE_NODE_ID); @@ -329,13 +329,13 @@ qnetd_client_msg_received_init(struct qnetd_instance *instance, struct qnetd_cli } if (!client->preinit_received) { - qnetd_log(LOG_ERR, "Received init before preinit message. Sending error reply."); + log(LOG_ERR, "Received init before preinit message. Sending error reply."); reply_error_code = TLV_REPLY_ERROR_CODE_PREINIT_REQUIRED; } if (reply_error_code == TLV_REPLY_ERROR_CODE_NO_ERROR && !msg->node_id_set) { - qnetd_log(LOG_ERR, "Received init message without node id set. " + log(LOG_ERR, "Received init message without node id set. " "Sending error reply."); reply_error_code = TLV_REPLY_ERROR_CODE_DOESNT_CONTAIN_REQUIRED_OPTION; @@ -345,7 +345,7 @@ qnetd_client_msg_received_init(struct qnetd_instance *instance, struct qnetd_cli } if (reply_error_code == TLV_REPLY_ERROR_CODE_NO_ERROR && !msg->ring_id_set) { - qnetd_log(LOG_ERR, "Received init message without ring id set. " + log(LOG_ERR, "Received init message without ring id set. " "Sending error reply."); reply_error_code = TLV_REPLY_ERROR_CODE_DOESNT_CONTAIN_REQUIRED_OPTION; @@ -354,14 +354,14 @@ qnetd_client_msg_received_init(struct qnetd_instance *instance, struct qnetd_cli } if (reply_error_code == TLV_REPLY_ERROR_CODE_NO_ERROR && !msg->heartbeat_interval_set) { - qnetd_log(LOG_ERR, "Received init message without heartbeat interval set. " + log(LOG_ERR, "Received init message without heartbeat interval set. " "Sending error reply."); reply_error_code = TLV_REPLY_ERROR_CODE_DOESNT_CONTAIN_REQUIRED_OPTION; } else { if (msg->heartbeat_interval < instance->advanced_settings->heartbeat_interval_min || msg->heartbeat_interval > instance->advanced_settings->heartbeat_interval_max) { - qnetd_log(LOG_ERR, "Client requested invalid heartbeat interval %u. " + log(LOG_ERR, "Client requested invalid heartbeat interval %u. " "Sending error reply.", msg->heartbeat_interval); reply_error_code = TLV_REPLY_ERROR_CODE_INVALID_HEARTBEAT_INTERVAL; @@ -371,7 +371,7 @@ qnetd_client_msg_received_init(struct qnetd_instance *instance, struct qnetd_cli } if (reply_error_code == TLV_REPLY_ERROR_CODE_NO_ERROR && !msg->tie_breaker_set) { - qnetd_log(LOG_ERR, "Received init message without tie-breaker set. " + log(LOG_ERR, "Received init message without tie-breaker set. " "Sending error reply."); reply_error_code = TLV_REPLY_ERROR_CODE_DOESNT_CONTAIN_REQUIRED_OPTION; @@ -386,7 +386,7 @@ qnetd_client_msg_received_init(struct qnetd_instance *instance, struct qnetd_cli */ /* for (i = 0; i < msg->no_supported_messages; i++) { - qnetd_log(LOG_DEBUG, "Client supports %u message", + log(LOG_DEBUG, "Client supports %u message", (int)msg->supported_messages[i]); } */ @@ -404,7 +404,7 @@ qnetd_client_msg_received_init(struct qnetd_instance *instance, struct qnetd_cli */ /* for (i = 0; i < msg->no_supported_options; i++) { - qnetd_log(LOG_DEBUG, "Client supports %u option", + log(LOG_DEBUG, "Client supports %u option", (int)msg->supported_messages[i]); } */ @@ -416,7 +416,7 @@ qnetd_client_msg_received_init(struct qnetd_instance *instance, struct qnetd_cli } if (reply_error_code == TLV_REPLY_ERROR_CODE_NO_ERROR && !msg->decision_algorithm_set) { - qnetd_log(LOG_ERR, "Received init message without decision algorithm. " + log(LOG_ERR, "Received init message without decision algorithm. " "Sending error reply."); reply_error_code = TLV_REPLY_ERROR_CODE_DOESNT_CONTAIN_REQUIRED_OPTION; @@ -434,7 +434,7 @@ qnetd_client_msg_received_init(struct qnetd_instance *instance, struct qnetd_cli } if (!res) { - qnetd_log(LOG_ERR, "Client requested unsupported decision algorithm %u. " + log(LOG_ERR, "Client requested unsupported decision algorithm %u. " "Sending error reply.", msg->decision_algorithm); reply_error_code = TLV_REPLY_ERROR_CODE_UNSUPPORTED_DECISION_ALGORITHM; @@ -451,7 +451,7 @@ qnetd_client_msg_received_init(struct qnetd_instance *instance, struct qnetd_cli if (reply_error_code == TLV_REPLY_ERROR_CODE_NO_ERROR) { cluster = qnetd_cluster_list_add_client(&instance->clusters, client); if (cluster == NULL) { - qnetd_log(LOG_ERR, "Can't add client to cluster list. " + log(LOG_ERR, "Can't add client to cluster list. " "Sending error reply."); reply_error_code = TLV_REPLY_ERROR_CODE_INTERNAL_ERROR; @@ -473,12 +473,12 @@ qnetd_client_msg_received_init(struct qnetd_instance *instance, struct qnetd_cli */ client->init_received = 1; } else { - qnetd_log(LOG_ERR, "Algorithm returned error code. Sending error reply."); + log(LOG_ERR, "Algorithm returned error code. Sending error reply."); } send_buffer = send_buffer_list_get_new(&client->send_buffer_list); if (send_buffer == NULL) { - qnetd_log(LOG_ERR, "Can't alloc init reply msg from list. " + log(LOG_ERR, "Can't alloc init reply msg from list. " "Disconnecting client connection."); return (-1); @@ -491,7 +491,7 @@ qnetd_client_msg_received_init(struct qnetd_instance *instance, struct qnetd_cli instance->advanced_settings->max_client_send_size, qnetd_static_supported_decision_algorithms, QNETD_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE) == 0) { - qnetd_log(LOG_ERR, "Can't alloc init reply msg. Disconnecting client connection."); + log(LOG_ERR, "Can't alloc init reply msg. Disconnecting client connection."); send_buffer_list_discard_new(&client->send_buffer_list, send_buffer); @@ -531,7 +531,7 @@ qnetd_client_msg_received_set_option(struct qnetd_instance *instance, struct qne } if (!client->init_received) { - qnetd_log(LOG_ERR, "Received set option message before init message. " + log(LOG_ERR, "Received set option message before init message. " "Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -548,7 +548,7 @@ qnetd_client_msg_received_set_option(struct qnetd_instance *instance, struct qne */ if (msg->heartbeat_interval < instance->advanced_settings->heartbeat_interval_min || msg->heartbeat_interval > instance->advanced_settings->heartbeat_interval_max) { - qnetd_log(LOG_ERR, "Client requested invalid heartbeat interval %u. " + log(LOG_ERR, "Client requested invalid heartbeat interval %u. " "Sending error reply.", msg->heartbeat_interval); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -564,7 +564,7 @@ qnetd_client_msg_received_set_option(struct qnetd_instance *instance, struct qne send_buffer = send_buffer_list_get_new(&client->send_buffer_list); if (send_buffer == NULL) { - qnetd_log(LOG_ERR, "Can't alloc set option reply msg from list. " + log(LOG_ERR, "Can't alloc set option reply msg from list. " "Disconnecting client connection."); return (-1); @@ -572,7 +572,7 @@ qnetd_client_msg_received_set_option(struct qnetd_instance *instance, struct qne if (msg_create_set_option_reply(&send_buffer->buffer, msg->seq_number_set, msg->seq_number, client->heartbeat_interval) == 0) { - qnetd_log(LOG_ERR, "Can't alloc set option reply msg. " + log(LOG_ERR, "Can't alloc set option reply msg. " "Disconnecting client connection."); send_buffer_list_discard_new(&client->send_buffer_list, send_buffer); @@ -605,7 +605,7 @@ qnetd_client_msg_received_echo_request(struct qnetd_instance *instance, struct q } if (!client->init_received) { - qnetd_log(LOG_ERR, "Received echo request before init message. " + log(LOG_ERR, "Received echo request before init message. " "Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -618,14 +618,14 @@ qnetd_client_msg_received_echo_request(struct qnetd_instance *instance, struct q send_buffer = send_buffer_list_get_new(&client->send_buffer_list); if (send_buffer == NULL) { - qnetd_log(LOG_ERR, "Can't alloc echo reply msg from list. " + log(LOG_ERR, "Can't alloc echo reply msg from list. " "Disconnecting client connection."); return (-1); } if (msg_create_echo_reply(&send_buffer->buffer, msg_orig) == 0) { - qnetd_log(LOG_ERR, "Can't alloc echo reply msg. Disconnecting client connection."); + log(LOG_ERR, "Can't alloc echo reply msg. Disconnecting client connection."); send_buffer_list_discard_new(&client->send_buffer_list, send_buffer); @@ -654,7 +654,7 @@ qnetd_client_msg_received_node_list(struct qnetd_instance *instance, struct qnet } if (!client->init_received) { - qnetd_log(LOG_ERR, "Received node list message before init message. " + log(LOG_ERR, "Received node list message before init message. " "Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -666,7 +666,7 @@ qnetd_client_msg_received_node_list(struct qnetd_instance *instance, struct qnet } if (!msg->node_list_type_set) { - qnetd_log(LOG_ERR, "Received node list message without node list type set. " + log(LOG_ERR, "Received node list message without node list type set. " "Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -678,7 +678,7 @@ qnetd_client_msg_received_node_list(struct qnetd_instance *instance, struct qnet } if (!msg->seq_number_set) { - qnetd_log(LOG_ERR, "Received node list message without seq number set. " + log(LOG_ERR, "Received node list message without seq number set. " "Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -709,7 +709,7 @@ qnetd_client_msg_received_node_list(struct qnetd_instance *instance, struct qnet case TLV_NODE_LIST_TYPE_MEMBERSHIP: case_processed = 1; if (!msg->ring_id_set) { - qnetd_log(LOG_ERR, "Received node list message without ring id number set. " + log(LOG_ERR, "Received node list message without ring id number set. " "Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -729,7 +729,7 @@ qnetd_client_msg_received_node_list(struct qnetd_instance *instance, struct qnet case TLV_NODE_LIST_TYPE_QUORUM: case_processed = 1; if (!msg->quorate_set) { - qnetd_log(LOG_ERR, "Received quorum list message without quorate set. " + log(LOG_ERR, "Received quorum list message without quorate set. " "Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -753,13 +753,13 @@ qnetd_client_msg_received_node_list(struct qnetd_instance *instance, struct qnet } if (!case_processed) { - qnetd_log(LOG_ERR, "qnetd_client_msg_received_node_list fatal error. " + log(LOG_ERR, "qnetd_client_msg_received_node_list fatal error. " "Unhandled node_list_type"); exit(1); } if (reply_error_code != TLV_REPLY_ERROR_CODE_NO_ERROR) { - qnetd_log(LOG_ERR, "Algorithm returned error code. " + log(LOG_ERR, "Algorithm returned error code. " "Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -769,7 +769,7 @@ qnetd_client_msg_received_node_list(struct qnetd_instance *instance, struct qnet return (0); } else { - qnetd_log(LOG_DEBUG, "Algorithm result vote is %s", tlv_vote_to_str(result_vote)); + log(LOG_DEBUG, "Algorithm result vote is %s", tlv_vote_to_str(result_vote)); } /* @@ -782,7 +782,7 @@ qnetd_client_msg_received_node_list(struct qnetd_instance *instance, struct qnet case_processed = 1; node_list_free(&client->configuration_node_list); if (node_list_clone(&client->configuration_node_list, &msg->nodes) == -1) { - qnetd_log(LOG_ERR, "Can't alloc config node list clone. " + log(LOG_ERR, "Can't alloc config node list clone. " "Disconnecting client connection."); return (-1); @@ -795,7 +795,7 @@ qnetd_client_msg_received_node_list(struct qnetd_instance *instance, struct qnet case_processed = 1; node_list_free(&client->last_membership_node_list); if (node_list_clone(&client->last_membership_node_list, &msg->nodes) == -1) { - qnetd_log(LOG_ERR, "Can't alloc membership node list clone. " + log(LOG_ERR, "Can't alloc membership node list clone. " "Disconnecting client connection."); return (-1); @@ -808,7 +808,7 @@ qnetd_client_msg_received_node_list(struct qnetd_instance *instance, struct qnet case_processed = 1; node_list_free(&client->last_quorum_node_list); if (node_list_clone(&client->last_quorum_node_list, &msg->nodes) == -1) { - qnetd_log(LOG_ERR, "Can't alloc quorum node list clone. " + log(LOG_ERR, "Can't alloc quorum node list clone. " "Disconnecting client connection."); return (-1); @@ -821,7 +821,7 @@ qnetd_client_msg_received_node_list(struct qnetd_instance *instance, struct qnet } if (!case_processed) { - qnetd_log(LOG_ERR, "qnetd_client_msg_received_node_list fatal error. " + log(LOG_ERR, "qnetd_client_msg_received_node_list fatal error. " "Unhandled node_list_type"); exit(1); } @@ -836,7 +836,7 @@ qnetd_client_msg_received_node_list(struct qnetd_instance *instance, struct qnet send_buffer = send_buffer_list_get_new(&client->send_buffer_list); if (send_buffer == NULL) { - qnetd_log(LOG_ERR, "Can't alloc node list reply msg from list. " + log(LOG_ERR, "Can't alloc node list reply msg from list. " "Disconnecting client connection."); return (-1); @@ -844,7 +844,7 @@ qnetd_client_msg_received_node_list(struct qnetd_instance *instance, struct qnet if (msg_create_node_list_reply(&send_buffer->buffer, msg->seq_number, msg->node_list_type, &client->last_ring_id, result_vote) == 0) { - qnetd_log(LOG_ERR, "Can't alloc node list reply msg. " + log(LOG_ERR, "Can't alloc node list reply msg. " "Disconnecting client connection."); send_buffer_list_discard_new(&client->send_buffer_list, send_buffer); @@ -881,7 +881,7 @@ qnetd_client_msg_received_ask_for_vote(struct qnetd_instance *instance, struct q } if (!client->init_received) { - qnetd_log(LOG_ERR, "Received ask for vote message before init message. " + log(LOG_ERR, "Received ask for vote message before init message. " "Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -893,7 +893,7 @@ qnetd_client_msg_received_ask_for_vote(struct qnetd_instance *instance, struct q } if (!msg->seq_number_set) { - qnetd_log(LOG_ERR, "Received ask for vote message without seq number set. " + log(LOG_ERR, "Received ask for vote message without seq number set. " "Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -910,7 +910,7 @@ qnetd_client_msg_received_ask_for_vote(struct qnetd_instance *instance, struct q &result_vote); if (reply_error_code != TLV_REPLY_ERROR_CODE_NO_ERROR) { - qnetd_log(LOG_ERR, "Algorithm returned error code. " + log(LOG_ERR, "Algorithm returned error code. " "Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -920,7 +920,7 @@ qnetd_client_msg_received_ask_for_vote(struct qnetd_instance *instance, struct q return (0); } else { - qnetd_log(LOG_DEBUG, "Algorithm result vote is %s", tlv_vote_to_str(result_vote)); + log(LOG_DEBUG, "Algorithm result vote is %s", tlv_vote_to_str(result_vote)); } /* @@ -933,7 +933,7 @@ qnetd_client_msg_received_ask_for_vote(struct qnetd_instance *instance, struct q send_buffer = send_buffer_list_get_new(&client->send_buffer_list); if (send_buffer == NULL) { - qnetd_log(LOG_ERR, "Can't alloc ask for vote reply msg from list. " + log(LOG_ERR, "Can't alloc ask for vote reply msg from list. " "Disconnecting client connection."); return (-1); @@ -941,7 +941,7 @@ qnetd_client_msg_received_ask_for_vote(struct qnetd_instance *instance, struct q if (msg_create_ask_for_vote_reply(&send_buffer->buffer, msg->seq_number, &client->last_ring_id, result_vote) == 0) { - qnetd_log(LOG_ERR, "Can't alloc ask for vote reply msg. " + log(LOG_ERR, "Can't alloc ask for vote reply msg. " "Disconnecting client connection."); send_buffer_list_discard_new(&client->send_buffer_list, send_buffer); @@ -984,7 +984,7 @@ qnetd_client_msg_received_vote_info_reply(struct qnetd_instance *instance, } if (!client->init_received) { - qnetd_log(LOG_ERR, "Received vote info reply before init message. " + log(LOG_ERR, "Received vote info reply before init message. " "Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -996,7 +996,7 @@ qnetd_client_msg_received_vote_info_reply(struct qnetd_instance *instance, } if (!msg->seq_number_set) { - qnetd_log(LOG_ERR, "Received vote info reply message without seq number set. " + log(LOG_ERR, "Received vote info reply message without seq number set. " "Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -1012,7 +1012,7 @@ qnetd_client_msg_received_vote_info_reply(struct qnetd_instance *instance, reply_error_code = qnetd_algorithm_vote_info_reply_received(client, msg->seq_number); if (reply_error_code != TLV_REPLY_ERROR_CODE_NO_ERROR) { - qnetd_log(LOG_ERR, "Algorithm returned error code. " + log(LOG_ERR, "Algorithm returned error code. " "Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -1042,7 +1042,7 @@ qnetd_client_msg_received_heuristics_change(struct qnetd_instance *instance, str } if (!client->init_received) { - qnetd_log(LOG_ERR, "Received heuristics change message before init message. " + log(LOG_ERR, "Received heuristics change message before init message. " "Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -1054,7 +1054,7 @@ qnetd_client_msg_received_heuristics_change(struct qnetd_instance *instance, str } if (!msg->seq_number_set || msg->heuristics == TLV_HEURISTICS_UNDEFINED) { - qnetd_log(LOG_ERR, "Received heuristics change message without seq number set or " + log(LOG_ERR, "Received heuristics change message without seq number set or " "with undefined heuristics. Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -1071,7 +1071,7 @@ qnetd_client_msg_received_heuristics_change(struct qnetd_instance *instance, str msg->heuristics, &result_vote); if (reply_error_code != TLV_REPLY_ERROR_CODE_NO_ERROR) { - qnetd_log(LOG_ERR, "Algorithm returned error code. " + log(LOG_ERR, "Algorithm returned error code. " "Sending error reply."); if (qnetd_client_send_err(client, msg->seq_number_set, msg->seq_number, @@ -1081,7 +1081,7 @@ qnetd_client_msg_received_heuristics_change(struct qnetd_instance *instance, str return (0); } else { - qnetd_log(LOG_DEBUG, "Algorithm result vote is %s", tlv_vote_to_str(result_vote)); + log(LOG_DEBUG, "Algorithm result vote is %s", tlv_vote_to_str(result_vote)); } /* @@ -1096,7 +1096,7 @@ qnetd_client_msg_received_heuristics_change(struct qnetd_instance *instance, str send_buffer = send_buffer_list_get_new(&client->send_buffer_list); if (send_buffer == NULL) { - qnetd_log(LOG_ERR, "Can't alloc heuristics change reply msg from list. " + log(LOG_ERR, "Can't alloc heuristics change reply msg from list. " "Disconnecting client connection."); return (-1); @@ -1104,7 +1104,7 @@ qnetd_client_msg_received_heuristics_change(struct qnetd_instance *instance, str if (msg_create_heuristics_change_reply(&send_buffer->buffer, msg->seq_number, &client->last_ring_id, msg->heuristics, result_vote) == 0) { - qnetd_log(LOG_ERR, "Can't alloc heuristics change reply msg. " + log(LOG_ERR, "Can't alloc heuristics change reply msg. " "Disconnecting client connection."); send_buffer_list_discard_new(&client->send_buffer_list, send_buffer); @@ -1142,8 +1142,8 @@ qnetd_client_msg_received(struct qnetd_instance *instance, struct qnetd_client * /* * Error occurred. Send server error. */ - qnetd_log_msg_decode_error(res); - qnetd_log(LOG_INFO, "Sending back error message"); + log_msg_decode_error(res); + log(LOG_INFO, "Sending back error message"); if (qnetd_client_send_err(client, msg.seq_number_set, msg.seq_number, TLV_REPLY_ERROR_CODE_ERROR_DECODING_MSG) != 0) { @@ -1238,7 +1238,7 @@ qnetd_client_msg_received(struct qnetd_instance *instance, struct qnetd_client * } if (!msg_processed) { - qnetd_log(LOG_ERR, "Unsupported message %u received from client. " + log(LOG_ERR, "Unsupported message %u received from client. " "Sending back error message", msg.type); if (qnetd_client_send_err(client, msg.seq_number_set, msg.seq_number, diff --git a/qdevices/qnetd-client-net.c b/qdevices/qnetd-client-net.c index 93ee50e..9a91ac6 100644 --- a/qdevices/qnetd-client-net.c +++ b/qdevices/qnetd-client-net.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Red Hat, Inc. + * Copyright (c) 2015-2019 Red Hat, Inc. * * All rights reserved. * @@ -34,10 +34,10 @@ #include +#include "log.h" #include "msgio.h" #include "msg.h" #include "nss-sock.h" -#include "qnetd-log.h" #include "qnetd-client-net.h" #include "qnetd-client-send.h" #include "qnetd-client-msg-received.h" @@ -64,7 +64,7 @@ qnetd_client_net_write(struct qnetd_instance *instance, struct qnetd_client *cli send_buffer = send_buffer_list_get_active(&client->send_buffer_list); if (send_buffer == NULL) { - qnetd_log_nss(LOG_CRIT, "send_buffer_list_get_active returned NULL"); + log_nss(LOG_CRIT, "send_buffer_list_get_active returned NULL"); return (-1); } @@ -81,13 +81,13 @@ qnetd_client_net_write(struct qnetd_instance *instance, struct qnetd_client *cli } if (res == -1) { - qnetd_log_nss(LOG_CRIT, "PR_Send returned 0"); + log_nss(LOG_CRIT, "PR_Send returned 0"); return (-1); } if (res == -2) { - qnetd_log_nss(LOG_ERR, "Unhandled error when sending message to client"); + log_nss(LOG_ERR, "Unhandled error when sending message to client"); return (-1); } @@ -112,7 +112,7 @@ qnetd_client_net_read(struct qnetd_instance *instance, struct qnetd_client *clie &client->msg_already_received_bytes, &client->skipping_msg); if (!orig_skipping_msg && client->skipping_msg) { - qnetd_log(LOG_DEBUG, "msgio_read set skipping_msg"); + log(LOG_DEBUG, "msgio_read set skipping_msg"); } ret_val = 0; @@ -124,29 +124,29 @@ qnetd_client_net_read(struct qnetd_instance *instance, struct qnetd_client *clie */ break; case -1: - qnetd_log(LOG_DEBUG, "Client closed connection"); + log(LOG_DEBUG, "Client closed connection"); ret_val = -1; break; case -2: - qnetd_log_nss(LOG_ERR, "Unhandled error when reading from client. " + log_nss(LOG_ERR, "Unhandled error when reading from client. " "Disconnecting client"); ret_val = -1; break; case -3: - qnetd_log(LOG_ERR, "Can't store message header from client. Disconnecting client"); + log(LOG_ERR, "Can't store message header from client. Disconnecting client"); ret_val = -1; break; case -4: - qnetd_log(LOG_ERR, "Can't store message from client. Skipping message"); + log(LOG_ERR, "Can't store message from client. Skipping message"); client->skipping_msg_reason = TLV_REPLY_ERROR_CODE_ERROR_DECODING_MSG; break; case -5: - qnetd_log(LOG_WARNING, "Client sent unsupported msg type %u. Skipping message", + log(LOG_WARNING, "Client sent unsupported msg type %u. Skipping message", msg_get_type(&client->receive_buffer)); client->skipping_msg_reason = TLV_REPLY_ERROR_CODE_UNSUPPORTED_MESSAGE; break; case -6: - qnetd_log(LOG_WARNING, + log(LOG_WARNING, "Client wants to send too long message %u bytes. Skipping message", msg_get_len(&client->receive_buffer)); client->skipping_msg_reason = TLV_REPLY_ERROR_CODE_MESSAGE_TOO_LONG; @@ -171,7 +171,7 @@ qnetd_client_net_read(struct qnetd_instance *instance, struct qnetd_client *clie dynar_clean(&client->receive_buffer); break; default: - qnetd_log(LOG_ERR, "Unhandled msgio_read error %d\n", res); + log(LOG_ERR, "Unhandled msgio_read error %d\n", res); exit(1); break; } @@ -194,36 +194,36 @@ qnetd_client_net_accept(struct qnetd_instance *instance) if ((client_socket = PR_Accept(instance->server.socket, &client_addr, PR_INTERVAL_NO_TIMEOUT)) == NULL) { - qnetd_log_nss(LOG_ERR, "Can't accept connection"); + log_nss(LOG_ERR, "Can't accept connection"); return (-1); } if (nss_sock_set_non_blocking(client_socket) != 0) { - qnetd_log_nss(LOG_ERR, "Can't set client socket to non blocking mode"); + log_nss(LOG_ERR, "Can't set client socket to non blocking mode"); goto exit_close; } if (instance->max_clients != 0 && qnetd_client_list_no_clients(&instance->clients) >= instance->max_clients) { - qnetd_log(LOG_ERR, "Maximum clients reached. Not accepting connection"); + log(LOG_ERR, "Maximum clients reached. Not accepting connection"); goto exit_close; } client_addr_str = malloc(CLIENT_ADDR_STR_LEN); if (client_addr_str == NULL) { - qnetd_log(LOG_ERR, "Can't alloc client addr str memory. Not accepting connection"); + log(LOG_ERR, "Can't alloc client addr str memory. Not accepting connection"); goto exit_close; } if (PR_NetAddrToString(&client_addr, client_addr_str, CLIENT_ADDR_STR_LEN) != PR_SUCCESS) { - qnetd_log_nss(LOG_ERR, "Can't convert client address to string. Not accepting connection"); + log_nss(LOG_ERR, "Can't convert client address to string. Not accepting connection"); goto exit_close; } if (snprintf(client_addr_str + strlen(client_addr_str), CLIENT_ADDR_STR_LEN_COLON_PORT, ":%"PRIu16, ntohs(client_addr.ipv6.port)) >= CLIENT_ADDR_STR_LEN_COLON_PORT) { - qnetd_log(LOG_ERR, "Can't store port to client addr str. Not accepting connection"); + log(LOG_ERR, "Can't store port to client addr str. Not accepting connection"); goto exit_close; } @@ -233,7 +233,7 @@ qnetd_client_net_accept(struct qnetd_instance *instance) instance->advanced_settings->max_client_send_buffers, instance->advanced_settings->max_client_send_size, &instance->main_timer_list); if (client == NULL) { - qnetd_log(LOG_ERR, "Can't add client to list"); + log(LOG_ERR, "Can't add client to list"); res_err = -2; goto exit_close; } diff --git a/qdevices/qnetd-client-send.c b/qdevices/qnetd-client-send.c index 072e467..4ec2857 100644 --- a/qdevices/qnetd-client-send.c +++ b/qdevices/qnetd-client-send.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Red Hat, Inc. + * Copyright (c) 2015-2019 Red Hat, Inc. * * All rights reserved. * @@ -36,8 +36,8 @@ #include +#include "log.h" #include "qnetd-client-send.h" -#include "qnetd-log.h" #include "qnetd-log-debug.h" #include "msg.h" @@ -49,7 +49,7 @@ qnetd_client_send_err(struct qnetd_client *client, int add_msg_seq_number, uint3 send_buffer = send_buffer_list_get_new(&client->send_buffer_list); if (send_buffer == NULL) { - qnetd_log(LOG_ERR, "Can't alloc server error msg from list. " + log(LOG_ERR, "Can't alloc server error msg from list. " "Disconnecting client connection."); return (-1); @@ -57,7 +57,7 @@ qnetd_client_send_err(struct qnetd_client *client, int add_msg_seq_number, uint3 if (msg_create_server_error(&send_buffer->buffer, add_msg_seq_number, msg_seq_number, reply) == 0) { - qnetd_log(LOG_ERR, "Can't alloc server error msg. " + log(LOG_ERR, "Can't alloc server error msg. " "Disconnecting client connection."); send_buffer_list_discard_new(&client->send_buffer_list, send_buffer); @@ -87,14 +87,14 @@ qnetd_client_send_vote_info(struct qnetd_client *client, uint32_t msg_seq_number send_buffer = send_buffer_list_get_new(&client->send_buffer_list); if (send_buffer == NULL) { - qnetd_log(LOG_ERR, "Can't alloc vote info msg from list. " + log(LOG_ERR, "Can't alloc vote info msg from list. " "Disconnecting client connection."); return (-1); } if (msg_create_vote_info(&send_buffer->buffer, msg_seq_number, ring_id, vote) == 0) { - qnetd_log(LOG_ERR, "Can't alloc vote info msg. " + log(LOG_ERR, "Can't alloc vote info msg. " "Disconnecting client connection."); send_buffer_list_discard_new(&client->send_buffer_list, send_buffer); diff --git a/qdevices/qnetd-dpd-timer.c b/qdevices/qnetd-dpd-timer.c index 73d569a..c23aa2e 100644 --- a/qdevices/qnetd-dpd-timer.c +++ b/qdevices/qnetd-dpd-timer.c @@ -32,8 +32,8 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "log.h" #include "qnetd-dpd-timer.h" -#include "qnetd-log.h" static int qnetd_dpd_timer_cb(void *data1, void *data2) @@ -52,7 +52,7 @@ qnetd_dpd_timer_cb(void *data1, void *data2) if (client->dpd_time_since_last_check > (client->heartbeat_interval * 2)) { if (!client->dpd_msg_received_since_last_check) { - qnetd_log(LOG_WARNING, "Client %s doesn't sent any message during " + log(LOG_WARNING, "Client %s doesn't sent any message during " "%"PRIu32"ms. Disconnecting", client->addr_str, client->dpd_time_since_last_check); @@ -79,7 +79,7 @@ qnetd_dpd_timer_init(struct qnetd_instance *instance) instance->advanced_settings->dpd_interval, qnetd_dpd_timer_cb, (void *)instance, NULL); if (instance->dpd_timer == NULL) { - qnetd_log(LOG_ERR, "Can't initialize dpd timer"); + log(LOG_ERR, "Can't initialize dpd timer"); return (-1); } diff --git a/qdevices/qnetd-instance.c b/qdevices/qnetd-instance.c index 931b18a..331838c 100644 --- a/qdevices/qnetd-instance.c +++ b/qdevices/qnetd-instance.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Red Hat, Inc. + * Copyright (c) 2015-2019 Red Hat, Inc. * * All rights reserved. * diff --git a/qdevices/qnetd-ipc-cmd.c b/qdevices/qnetd-ipc-cmd.c index 3c44f34..5c37ecb 100644 --- a/qdevices/qnetd-ipc-cmd.c +++ b/qdevices/qnetd-ipc-cmd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Red Hat, Inc. + * Copyright (c) 2015-2019 Red Hat, Inc. * * All rights reserved. * @@ -32,9 +32,9 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "log.h" #include "dynar-str.h" #include "qnetd-ipc-cmd.h" -#include "qnetd-log.h" #include "utils.h" int diff --git a/qdevices/qnetd-ipc.c b/qdevices/qnetd-ipc.c index e522837..5672624 100644 --- a/qdevices/qnetd-ipc.c +++ b/qdevices/qnetd-ipc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Red Hat, Inc. + * Copyright (c) 2015-2019 Red Hat, Inc. * * All rights reserved. * @@ -32,10 +32,10 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "log.h" #include "qnet-config.h" #include "qnetd-ipc.h" #include "qnetd-ipc-cmd.h" -#include "qnetd-log.h" #include "unix-socket-ipc.h" #include "dynar-simple-lex.h" #include "dynar-str.h" @@ -55,13 +55,13 @@ qnetd_ipc_init(struct qnetd_instance *instance) instance->advanced_settings->ipc_max_clients, instance->advanced_settings->ipc_max_receive_size, instance->advanced_settings->ipc_max_send_size) != 0) { - qnetd_log_err(LOG_ERR, "Can't create unix socket"); + log_err(LOG_ERR, "Can't create unix socket"); return (-1); } if ((instance->ipc_socket_poll_fd = PR_CreateSocketPollFd(instance->local_ipc.socket)) == NULL) { - qnetd_log_nss(LOG_CRIT, "Can't create NSPR IPC socket poll fd"); + log_nss(LOG_CRIT, "Can't create NSPR IPC socket poll fd"); return (-1); } @@ -76,7 +76,7 @@ qnetd_ipc_close(struct qnetd_instance *instance) res = unix_socket_ipc_close(&instance->local_ipc); if (res != 0) { - qnetd_log_err(LOG_WARNING, "Can't close local IPC"); + log_err(LOG_WARNING, "Can't close local IPC"); } return (res); @@ -103,12 +103,12 @@ qnetd_ipc_destroy(struct qnetd_instance *instance) } if (PR_DestroySocketPollFd(instance->ipc_socket_poll_fd) != PR_SUCCESS) { - qnetd_log_nss(LOG_WARNING, "Unable to destroy IPC poll socket fd"); + log_nss(LOG_WARNING, "Unable to destroy IPC poll socket fd"); } res = unix_socket_ipc_destroy(&instance->local_ipc); if (res != 0) { - qnetd_log_err(LOG_WARNING, "Can't destroy local IPC"); + log_err(LOG_WARNING, "Can't destroy local IPC"); } return (res); @@ -125,17 +125,17 @@ qnetd_ipc_accept(struct qnetd_instance *instance, struct unix_socket_client **re switch (accept_res) { case -1: - qnetd_log_err(LOG_ERR, "Can't accept local IPC connection"); + log_err(LOG_ERR, "Can't accept local IPC connection"); res = -1; goto return_res; break; case -2: - qnetd_log(LOG_ERR, "Maximum IPC clients reached. Not accepting connection"); + log(LOG_ERR, "Maximum IPC clients reached. Not accepting connection"); res = -1; goto return_res; break; case -3: - qnetd_log(LOG_ERR, "Can't add client to list"); + log(LOG_ERR, "Can't add client to list"); res = -1; goto return_res; break; @@ -147,7 +147,7 @@ qnetd_ipc_accept(struct qnetd_instance *instance, struct unix_socket_client **re (*res_client)->user_data = malloc(sizeof(struct qnetd_ipc_user_data)); if ((*res_client)->user_data == NULL) { - qnetd_log(LOG_ERR, "Can't alloc IPC client user data"); + log(LOG_ERR, "Can't alloc IPC client user data"); res = -1; qnetd_ipc_client_disconnect(instance, *res_client); @@ -157,7 +157,7 @@ qnetd_ipc_accept(struct qnetd_instance *instance, struct unix_socket_client **re prfd = PR_CreateSocketPollFd((*res_client)->socket); if (prfd == NULL) { - qnetd_log_nss(LOG_CRIT, "Can't create NSPR poll fd for IPC client. Disconnecting client"); + log_nss(LOG_CRIT, "Can't create NSPR poll fd for IPC client. Disconnecting client"); qnetd_ipc_client_disconnect(instance, *res_client); res = -1; @@ -177,7 +177,7 @@ qnetd_ipc_client_disconnect(struct qnetd_instance *instance, struct unix_socket_ if ((struct qnetd_ipc_user_data *)(client)->user_data != NULL && PR_DestroySocketPollFd( ((struct qnetd_ipc_user_data *)(client)->user_data)->nspr_poll_fd) != PR_SUCCESS) { - qnetd_log_nss(LOG_WARNING, "Unable to destroy client IPC poll socket fd"); + log_nss(LOG_WARNING, "Unable to destroy client IPC poll socket fd"); } free(client->user_data); @@ -201,7 +201,7 @@ qnetd_ipc_send_error(struct qnetd_instance *instance, struct unix_socket_client if (res) { unix_socket_client_write_buffer(client, 1); } else { - qnetd_log(LOG_ERR, "Can't send ipc error to client (buffer too small)"); + log(LOG_ERR, "Can't send ipc error to client (buffer too small)"); } return (res ? 0 : -1); @@ -212,7 +212,7 @@ qnetd_ipc_send_buffer(struct qnetd_instance *instance, struct unix_socket_client { if (dynar_str_prepend(&client->send_buffer, "OK\n") != 0) { - qnetd_log(LOG_ERR, "Can't send ipc message to client (buffer too small)"); + log(LOG_ERR, "Can't send ipc message to client (buffer too small)"); if (qnetd_ipc_send_error(instance, client, "Internal IPC buffer too small") != 0) { return (-1); @@ -250,12 +250,12 @@ qnetd_ipc_parse_line(struct qnetd_instance *instance, struct unix_socket_client str = dynar_data(token); if (strcasecmp(str, "") == 0) { - qnetd_log(LOG_DEBUG, "IPC client doesn't send command"); + log(LOG_DEBUG, "IPC client doesn't send command"); if (qnetd_ipc_send_error(instance, client, "No command specified") != 0) { client->schedule_disconnect = 1; } } else if (strcasecmp(str, "shutdown") == 0) { - qnetd_log(LOG_DEBUG, "IPC client requested shutdown"); + log(LOG_DEBUG, "IPC client requested shutdown"); ipc_user_data->shutdown_requested = 1; @@ -317,7 +317,7 @@ qnetd_ipc_parse_line(struct qnetd_instance *instance, struct unix_socket_client free(cluster_name); cluster_name = NULL; } else { - qnetd_log(LOG_DEBUG, "IPC client sent unknown command"); + log(LOG_DEBUG, "IPC client sent unknown command"); if (qnetd_ipc_send_error(instance, client, "Unknown command '%s'", str) != 0) { client->schedule_disconnect = 1; } @@ -330,7 +330,7 @@ qnetd_ipc_parse_line(struct qnetd_instance *instance, struct unix_socket_client exit_err_low_mem: free(cluster_name); cluster_name = NULL; - qnetd_log(LOG_ERR, "Can't alloc memory for simple lex"); + log(LOG_ERR, "Can't alloc memory for simple lex"); if (qnetd_ipc_send_error(instance, client, "Command too long") != 0) { client->schedule_disconnect = 1; @@ -351,15 +351,15 @@ qnetd_ipc_io_read(struct qnetd_instance *instance, struct unix_socket_client *cl */ break; case -1: - qnetd_log(LOG_DEBUG, "IPC client closed connection"); + log(LOG_DEBUG, "IPC client closed connection"); client->schedule_disconnect = 1; break; case -2: - qnetd_log(LOG_ERR, "Can't store message from IPC client. Disconnecting client."); + log(LOG_ERR, "Can't store message from IPC client. Disconnecting client."); client->schedule_disconnect = 1; break; case -3: - qnetd_log_err(LOG_ERR, "Can't receive message from IPC client. Disconnecting client."); + log_err(LOG_ERR, "Can't receive message from IPC client. Disconnecting client."); client->schedule_disconnect = 1; break; case 1: @@ -390,11 +390,11 @@ qnetd_ipc_io_write(struct qnetd_instance *instance, struct unix_socket_client *c */ break; case -1: - qnetd_log(LOG_DEBUG, "IPC client closed connection"); + log(LOG_DEBUG, "IPC client closed connection"); client->schedule_disconnect = 1; break; case -2: - qnetd_log_err(LOG_ERR, "Can't send message to IPC client. Disconnecting client"); + log_err(LOG_ERR, "Can't send message to IPC client. Disconnecting client"); client->schedule_disconnect = 1; break; case 1: diff --git a/qdevices/qnetd-log-debug.c b/qdevices/qnetd-log-debug.c index 64b0bb5..926f3d4 100644 --- a/qdevices/qnetd-log-debug.c +++ b/qdevices/qnetd-log-debug.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 Red Hat, Inc. + * Copyright (c) 2015-2019 Red Hat, Inc. * * All rights reserved. * @@ -32,7 +32,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "qnetd-log.h" +#include "log.h" #include "qnetd-log-debug.h" #include "utils.h" @@ -41,9 +41,9 @@ qnetd_log_debug_dump_cluster(struct qnetd_cluster *cluster) { struct qnetd_client *client; - qnetd_log(LOG_DEBUG, " cluster dump:"); + log(LOG_DEBUG, " cluster dump:"); TAILQ_FOREACH(client, &cluster->client_list, cluster_entries) { - qnetd_log(LOG_DEBUG, " client = %s, node_id = "UTILS_PRI_NODE_ID, + log(LOG_DEBUG, " client = %s, node_id = "UTILS_PRI_NODE_ID, client->addr_str, client->node_id); } } @@ -52,15 +52,15 @@ void qnetd_log_debug_new_client_connected(struct qnetd_client *client) { - qnetd_log(LOG_DEBUG, "New client connected"); - qnetd_log(LOG_DEBUG, " cluster name = %s", client->cluster_name); - qnetd_log(LOG_DEBUG, " tls started = %u", client->tls_started); - qnetd_log(LOG_DEBUG, " tls peer certificate verified = %u", + log(LOG_DEBUG, "New client connected"); + log(LOG_DEBUG, " cluster name = %s", client->cluster_name); + log(LOG_DEBUG, " tls started = %u", client->tls_started); + log(LOG_DEBUG, " tls peer certificate verified = %u", client->tls_peer_certificate_verified); - qnetd_log(LOG_DEBUG, " node_id = "UTILS_PRI_NODE_ID, client->node_id); - qnetd_log(LOG_DEBUG, " pointer = %p", client); - qnetd_log(LOG_DEBUG, " addr_str = %s", client->addr_str); - qnetd_log(LOG_DEBUG, " ring id = (" UTILS_PRI_RING_ID ")", client->last_ring_id.node_id, + log(LOG_DEBUG, " node_id = "UTILS_PRI_NODE_ID, client->node_id); + log(LOG_DEBUG, " pointer = %p", client); + log(LOG_DEBUG, " addr_str = %s", client->addr_str); + log(LOG_DEBUG, " ring id = (" UTILS_PRI_RING_ID ")", client->last_ring_id.node_id, client->last_ring_id.seq); qnetd_log_debug_dump_cluster(client->cluster); @@ -71,9 +71,9 @@ qnetd_log_debug_dump_node_list(struct qnetd_client *client, const struct node_li { struct node_list_entry *node_info; - qnetd_log(LOG_DEBUG, " node list:"); + log(LOG_DEBUG, " node list:"); TAILQ_FOREACH(node_info, nodes, entries) { - qnetd_log(LOG_DEBUG, " node_id = "UTILS_PRI_NODE_ID", " + log(LOG_DEBUG, " node_id = "UTILS_PRI_NODE_ID", " "data_center_id = "UTILS_PRI_DATACENTER_ID", " "node_state = %s", node_info->node_id, node_info->data_center_id, tlv_node_state_to_str(node_info->node_state)); @@ -86,14 +86,14 @@ qnetd_log_debug_config_node_list_received(struct qnetd_client *client, const struct node_list *nodes, int initial) { - qnetd_log(LOG_DEBUG, "Client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") " + log(LOG_DEBUG, "Client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") " "sent %s node list.", client->addr_str, client->cluster_name, client->node_id, (initial ? "initial" : "changed")); - qnetd_log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); + log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); if (config_version_set) { - qnetd_log(LOG_DEBUG, " config version = " UTILS_PRI_CONFIG_VERSION, config_version); + log(LOG_DEBUG, " config version = " UTILS_PRI_CONFIG_VERSION, config_version); } qnetd_log_debug_dump_node_list(client, nodes); @@ -104,14 +104,14 @@ qnetd_log_debug_membership_node_list_received(struct qnetd_client *client, uint32_t msg_seq_num, const struct tlv_ring_id *ring_id, enum tlv_heuristics heuristics, const struct node_list *nodes) { - qnetd_log(LOG_DEBUG, "Client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") " + log(LOG_DEBUG, "Client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") " "sent membership node list.", client->addr_str, client->cluster_name, client->node_id); - qnetd_log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); + log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); - qnetd_log(LOG_DEBUG, " ring id = (" UTILS_PRI_RING_ID ")", ring_id->node_id, ring_id->seq); + log(LOG_DEBUG, " ring id = (" UTILS_PRI_RING_ID ")", ring_id->node_id, ring_id->seq); - qnetd_log(LOG_DEBUG, " heuristics = %s ", tlv_heuristics_to_str(heuristics)); + log(LOG_DEBUG, " heuristics = %s ", tlv_heuristics_to_str(heuristics)); qnetd_log_debug_dump_node_list(client, nodes); } @@ -121,11 +121,11 @@ qnetd_log_debug_quorum_node_list_received(struct qnetd_client *client, uint32_t msg_seq_num, enum tlv_quorate quorate, const struct node_list *nodes) { - qnetd_log(LOG_DEBUG, "Client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") " + log(LOG_DEBUG, "Client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") " "sent quorum node list.", client->addr_str, client->cluster_name, client->node_id); - qnetd_log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); - qnetd_log(LOG_DEBUG, " quorate = %u", quorate); + log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); + log(LOG_DEBUG, " quorate = %u", quorate); qnetd_log_debug_dump_node_list(client, nodes); } @@ -134,7 +134,7 @@ void qnetd_log_debug_client_disconnect(struct qnetd_client *client, int server_going_down) { - qnetd_log(LOG_DEBUG, "Client %s (init_received %u, cluster %s, node_id " + log(LOG_DEBUG, "Client %s (init_received %u, cluster %s, node_id " UTILS_PRI_NODE_ID") disconnect%s", client->addr_str, client->init_received, client->cluster_name, client->node_id, (server_going_down ? " (server is going down)" : "")); @@ -144,29 +144,29 @@ void qnetd_log_debug_ask_for_vote_received(struct qnetd_client *client, uint32_t msg_seq_num) { - qnetd_log(LOG_DEBUG, "Client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") " + log(LOG_DEBUG, "Client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") " "asked for a vote", client->addr_str, client->cluster_name, client->node_id); - qnetd_log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); + log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); } void qnetd_log_debug_vote_info_reply_received(struct qnetd_client *client, uint32_t msg_seq_num) { - qnetd_log(LOG_DEBUG, "Client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") " + log(LOG_DEBUG, "Client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") " "replied back to vote info message", client->addr_str, client->cluster_name, client->node_id); - qnetd_log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); + log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); } void qnetd_log_debug_send_vote_info(struct qnetd_client *client, uint32_t msg_seq_num, enum tlv_vote vote) { - qnetd_log(LOG_DEBUG, "Sending vote info to client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") ", + log(LOG_DEBUG, "Sending vote info to client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") ", client->addr_str, client->cluster_name, client->node_id); - qnetd_log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); - qnetd_log(LOG_DEBUG, " vote = %s", tlv_vote_to_str(vote)); + log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); + log(LOG_DEBUG, " vote = %s", tlv_vote_to_str(vote)); } void @@ -174,8 +174,8 @@ qnetd_log_debug_heuristics_change_received(struct qnetd_client *client, uint32_t enum tlv_heuristics heuristics) { - qnetd_log(LOG_DEBUG, "Client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") " + log(LOG_DEBUG, "Client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") " "sent heuristics change", client->addr_str, client->cluster_name, client->node_id); - qnetd_log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); - qnetd_log(LOG_DEBUG, " heuristics = %s", tlv_heuristics_to_str(heuristics)); + log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); + log(LOG_DEBUG, " heuristics = %s", tlv_heuristics_to_str(heuristics)); }