Ver código fonte

qdevice: Use log instead of libqb log

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Jan Friesse 6 anos atrás
pai
commit
c8d19612c2

+ 0 - 1
configure.ac

@@ -92,7 +92,6 @@ AC_TYPE_SSIZE_T
 
 # Checks for libraries.
 PKG_CHECK_MODULES([nss],[nss])
-PKG_CHECK_MODULES([qb], [libqb])
 PKG_CHECK_MODULES([corosync_common], [libcorosync_common])
 PKG_CHECK_MODULES([cmap], [libcmap])
 PKG_CHECK_MODULES([votequorum], [libvotequorum])

+ 4 - 6
man/corosync-qdevice.8

@@ -31,7 +31,7 @@
 .\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 .\" * THE POSSIBILITY OF SUCH DAMAGE.
 .\" */
-.TH COROSYNC-QDEVICE 8 2019-04-25
+.TH COROSYNC-QDEVICE 8 2019-08-12
 .SH NAME
 corosync-qdevice \- QDevice daemon
 .SH SYNOPSIS
@@ -231,11 +231,9 @@ Logging configuration is within the
 .B logging
 directive.
 .B corosync-qdevice
-parses and supports most of the options with exception of
-.BR to_logfile ", " logfile
-and
-.BR logfile_priority .
-The 
+parses and supports only
+.BR debug
+option. The
 .B logger_subsys
 sub-directive can be also used if
 .B subsys

+ 5 - 4
qdevices/Makefile.am

@@ -1,4 +1,4 @@
-# Copyright (c) 2012-2018 Red Hat, Inc.
+# Copyright (c) 2012-2019 Red Hat, Inc.
 #
 # Authors: Jan Friesse (jfriesse@redhat.com)
 #          Fabio M. Di Nitto (fdinitto@redhat.com)
@@ -140,15 +140,16 @@ corosync_qdevice_SOURCES = corosync-qdevice.c \
                            qdevice-heuristics-exec-result.c qdevice-heuristics-exec-result.h \
                            process-list.h process-list.c \
                            qdevice-net-heuristics.c qdevice-net-heuristics.h \
-                           qdevice-heuristics-result-notifier.c qdevice-heuristics-result-notifier.h
+                           qdevice-heuristics-result-notifier.c qdevice-heuristics-result-notifier.h \
+                           log.c log.h
 
 corosync_qdevice_tool_SOURCES = corosync-qdevice-tool.c unix-socket.c unix-socket.h dynar.c dynar.h \
                                 dynar-str.c dynar-str.h utils.c utils.h
 
 corosync_qdevice_CFLAGS = $(nss_CFLAGS) $(libsystemd_CFLAGS) $(cmap_CFLAGS) \
-                          $(qb_CFLAGS) $(votequorum_CFLAGS) $(corosync_common_CFLAGS)
+                          $(votequorum_CFLAGS) $(corosync_common_CFLAGS)
 corosync_qdevice_LDADD  = $(nss_LIBS) $(libsystemd_LIBS) $(cmap_LIBS) \
-                          $(qb_LIBS) $(votequorum_LIBS) $(corosync_common_LIBS)
+                          $(votequorum_LIBS) $(corosync_common_LIBS)
 
 corosync-qdevice-net-certutil: corosync-qdevice-net-certutil.sh
 	sed -e 's#@''DATADIR@#${datadir}#g' \

+ 26 - 23
qdevices/corosync-qdevice.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2018 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -34,6 +34,7 @@
 
 #include <err.h>
 #include <signal.h>
+#include <stdio.h>
 
 #include "dynar.h"
 #include "dynar-str.h"
@@ -57,14 +58,14 @@ struct qdevice_instance *global_instance;
 static void
 signal_int_handler(int sig)
 {
-	qdevice_log(LOG_DEBUG, "SIGINT received - closing local unix socket");
+	log(LOG_DEBUG, "SIGINT received - closing local unix socket");
 	qdevice_ipc_close(global_instance);
 }
 
 static void
 signal_term_handler(int sig)
 {
-	qdevice_log(LOG_DEBUG, "SIGTERM received - closing local unix socket");
+	log(LOG_DEBUG, "SIGTERM received - closing local unix socket");
 	qdevice_ipc_close(global_instance);
 }
 
@@ -192,7 +193,9 @@ main(int argc, char * const argv[])
 	instance.heuristics_instance.qdevice_instance_ptr = &instance;
 
 	qdevice_cmap_init(&instance);
-	qdevice_log_init(&instance, force_debug);
+	if (qdevice_log_init(&instance, foreground, force_debug) == -1) {
+		errx(1, "Can't initialize logging");
+	}
 
 	/*
 	 * Daemonize
@@ -204,57 +207,57 @@ main(int argc, char * const argv[])
 	if ((lock_file = utils_flock(advanced_settings.lock_file, getpid(),
 	    &another_instance_running)) == -1) {
 		if (another_instance_running) {
-			qdevice_log(LOG_ERR, "Another instance is running");
+			log(LOG_ERR, "Another instance is running");
 		} else {
-			qdevice_log_err(LOG_ERR, "Can't acquire lock");
+			log_err(LOG_ERR, "Can't acquire lock");
 		}
 
 		exit(1);
 	}
 
-	qdevice_log(LOG_DEBUG, "Initializing votequorum");
+	log(LOG_DEBUG, "Initializing votequorum");
 	qdevice_votequorum_init(&instance);
 
-	qdevice_log(LOG_DEBUG, "Initializing local socket");
+	log(LOG_DEBUG, "Initializing local socket");
 	if (qdevice_ipc_init(&instance) != 0) {
 		return (1);
 	}
 
-	qdevice_log(LOG_DEBUG, "Registering qdevice models");
+	log(LOG_DEBUG, "Registering qdevice models");
 	qdevice_model_register_all();
 
-	qdevice_log(LOG_DEBUG, "Configuring qdevice");
+	log(LOG_DEBUG, "Configuring qdevice");
 	if (qdevice_instance_configure_from_cmap(&instance) != 0) {
 		return (1);
 	}
 
-	qdevice_log(LOG_DEBUG, "Configuring master_wins");
+	log(LOG_DEBUG, "Configuring master_wins");
 	if (qdevice_votequorum_master_wins(&instance, (advanced_settings.master_wins ==
 	    QDEVICE_ADVANCED_SETTINGS_MASTER_WINS_FORCE_ON ? 1 : 0)) != 0) {
 		return (1);
 	}
 
-	qdevice_log(LOG_DEBUG, "Getting configuration node list");
+	log(LOG_DEBUG, "Getting configuration node list");
 	if (qdevice_cmap_store_config_node_list(&instance) != 0) {
 		return (1);
 	}
 
-	qdevice_log(LOG_DEBUG, "Initializing qdevice model");
+	log(LOG_DEBUG, "Initializing qdevice model");
 	if (qdevice_model_init(&instance) != 0) {
 		return (1);
 	}
 
-	qdevice_log(LOG_DEBUG, "Initializing cmap tracking");
+	log(LOG_DEBUG, "Initializing cmap tracking");
 	if (qdevice_cmap_add_track(&instance) != 0) {
 		return (1);
 	}
 
-	qdevice_log(LOG_DEBUG, "Waiting for ring id");
+	log(LOG_DEBUG, "Waiting for ring id");
 	if (qdevice_votequorum_wait_for_ring_id(&instance) != 0) {
 		return (1);
 	}
 
-	qdevice_log(LOG_DEBUG, "Waiting for initial heuristics exec result");
+	log(LOG_DEBUG, "Waiting for initial heuristics exec result");
 	if (qdevice_heuristics_wait_for_initial_exec_result(&instance.heuristics_instance) != 0) {
 		return (1);
 	}
@@ -262,32 +265,32 @@ main(int argc, char * const argv[])
 	global_instance = &instance;
 	signal_handlers_register();
 
-	qdevice_log(LOG_DEBUG, "Running qdevice model");
+	log(LOG_DEBUG, "Running qdevice model");
 #ifdef HAVE_LIBSYSTEMD
 	sd_notify (0, "READY=1");
 #endif
 	model_run_res = qdevice_model_run(&instance);
 
-	qdevice_log(LOG_DEBUG, "Removing cmap tracking");
+	log(LOG_DEBUG, "Removing cmap tracking");
 	/*
 	 * Ignore error intentionally
 	 */
 	(void)qdevice_cmap_del_track(&instance);
 
-	qdevice_log(LOG_DEBUG, "Destroying qdevice model");
+	log(LOG_DEBUG, "Destroying qdevice model");
 	qdevice_model_destroy(&instance);
 
-	qdevice_log(LOG_DEBUG, "Destroying qdevice ipc");
+	log(LOG_DEBUG, "Destroying qdevice ipc");
 	qdevice_ipc_destroy(&instance);
 
-	qdevice_log(LOG_DEBUG, "Destroying votequorum and cmap");
+	log(LOG_DEBUG, "Destroying votequorum and cmap");
 	qdevice_votequorum_destroy(&instance);
 	qdevice_cmap_destroy(&instance);
 
-	qdevice_log(LOG_DEBUG, "Destroying heuristics");
+	log(LOG_DEBUG, "Destroying heuristics");
 	qdevice_heuristics_destroy(&instance.heuristics_instance, foreground);
 
-	qdevice_log(LOG_DEBUG, "Closing log");
+	log(LOG_DEBUG, "Closing log");
 	qdevice_log_close(&instance);
 
 	qdevice_instance_destroy(&instance);

+ 1 - 3
qdevices/corosync-qnetd.c

@@ -529,7 +529,6 @@ main(int argc, char * const argv[])
 	PRIntn address_family;
 	int lock_file;
 	int another_instance_running;
-	int res;
 	int log_target;
 
 	if (qnetd_advanced_settings_init(&advanced_settings) != 0) {
@@ -544,8 +543,7 @@ main(int argc, char * const argv[])
 		log_target |= LOG_TARGET_STDERR;
 	}
 
-	res = log_init(QNETD_PROGRAM_NAME, log_target, LOG_DAEMON);
-	if (res == -1) {
+	if (log_init(QNETD_PROGRAM_NAME, log_target, LOG_DAEMON) == -1) {
 		errx(1, "Can't initialize logging");
 	}
 

+ 25 - 25
qdevices/qdevice-cmap.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -198,7 +198,7 @@ qdevice_cmap_store_config_node_list(struct qdevice_instance *instance)
 	node_list_free(&instance->config_node_list);
 
 	if (qdevice_cmap_get_nodelist(instance->cmap_handle, &instance->config_node_list) != 0) {
-		qdevice_log(LOG_ERR, "Can't get configuration node list.");
+		log(LOG_ERR, "Can't get configuration node list.");
 
 		return (-1);
 	}
@@ -240,12 +240,12 @@ qdevice_cmap_node_list_event(struct qdevice_instance *instance)
 	int config_version_set;
 	uint64_t config_version;
 
-	qdevice_log(LOG_DEBUG, "Node list configuration possibly changed");
+	log(LOG_DEBUG, "Node list configuration possibly changed");
 	if (qdevice_cmap_get_nodelist(instance->cmap_handle, &nlist) != 0) {
-		qdevice_log(LOG_ERR, "Can't get configuration node list.");
+		log(LOG_ERR, "Can't get configuration node list.");
 
 		if (qdevice_model_get_config_node_list_failed(instance) != 0) {
-			qdevice_log(LOG_DEBUG, "qdevice_model_get_config_node_list_failed returned error -> exit");
+			log(LOG_DEBUG, "qdevice_model_get_config_node_list_failed returned error -> exit");
 			exit(2);
 		}
 
@@ -259,26 +259,26 @@ qdevice_cmap_node_list_event(struct qdevice_instance *instance)
 		return ;
 	}
 
-	qdevice_log(LOG_DEBUG, "Node list changed");
+	log(LOG_DEBUG, "Node list changed");
 	if (config_version_set) {
-		qdevice_log(LOG_DEBUG, "  config_version = "UTILS_PRI_CONFIG_VERSION, config_version);
+		log(LOG_DEBUG, "  config_version = "UTILS_PRI_CONFIG_VERSION, config_version);
 	}
 	qdevice_log_debug_dump_node_list(&nlist);
 
 	if (qdevice_model_config_node_list_changed(instance, &nlist,
 	    config_version_set, config_version) != 0) {
-		qdevice_log(LOG_DEBUG, "qdevice_model_config_node_list_changed returned error -> exit");
+		log(LOG_DEBUG, "qdevice_model_config_node_list_changed returned error -> exit");
 		exit(2);
 	}
 
 	node_list_free(&instance->config_node_list);
 	if (node_list_clone(&instance->config_node_list, &nlist) != 0) {
-		qdevice_log(LOG_ERR, "Can't allocate instance->config_node_list clone");
+		log(LOG_ERR, "Can't allocate instance->config_node_list clone");
 
 		node_list_free(&nlist);
 
 		if (qdevice_model_get_config_node_list_failed(instance) != 0) {
-			qdevice_log(LOG_DEBUG, "qdevice_model_get_config_node_list_failed returned error -> exit");
+			log(LOG_DEBUG, "qdevice_model_get_config_node_list_failed returned error -> exit");
 			exit(2);
 		}
 
@@ -296,7 +296,7 @@ static void
 qdevice_cmap_logging_event(struct qdevice_instance *instance)
 {
 
-	qdevice_log(LOG_DEBUG, "Logging configuration possibly changed");
+	log(LOG_DEBUG, "Logging configuration possibly changed");
 	qdevice_log_configure(instance);
 }
 
@@ -304,9 +304,9 @@ static void
 qdevice_cmap_heuristics_event(struct qdevice_instance *instance)
 {
 
-	qdevice_log(LOG_DEBUG, "Heuristics configuration possibly changed");
+	log(LOG_DEBUG, "Heuristics configuration possibly changed");
 	if (qdevice_instance_configure_from_cmap_heuristics(instance) != 0) {
-		qdevice_log(LOG_DEBUG, "qdevice_instance_configure_from_cmap_heuristics returned error -> exit");
+		log(LOG_DEBUG, "qdevice_instance_configure_from_cmap_heuristics returned error -> exit");
 		exit(2);
 	}
 }
@@ -331,7 +331,7 @@ qdevice_cmap_reload_cb(cmap_handle_t cmap_handle, cmap_track_handle_t cmap_track
 	heuristics_prefix_str = "quorum.device.heuristics.";
 
 	if (cmap_context_get(cmap_handle, (const void **)&instance) != CS_OK) {
-		qdevice_log(LOG_ERR, "Fatal error. Can't get cmap context");
+		log(LOG_ERR, "Fatal error. Can't get cmap context");
 		exit(1);
 	}
 
@@ -392,7 +392,7 @@ qdevice_cmap_reload_cb(cmap_handle_t cmap_handle, cmap_track_handle_t cmap_track
 	 * Inform model about change
 	 */
 	if (qdevice_model_cmap_changed(instance, &events) != 0) {
-		qdevice_log(LOG_DEBUG, "qdevice_model_cmap_changed returned error -> exit");
+		log(LOG_DEBUG, "qdevice_model_cmap_changed returned error -> exit");
 		exit(2);
 	}
 }
@@ -407,7 +407,7 @@ qdevice_cmap_add_track(struct qdevice_instance *instance)
 	    NULL, &instance->cmap_reload_track_handle);
 
 	if (res != CS_OK) {
-		qdevice_log(LOG_ERR, "Can't initialize cmap totemconfig_reload_in_progress tracking");
+		log(LOG_ERR, "Can't initialize cmap totemconfig_reload_in_progress tracking");
 		return (-1);
 	}
 
@@ -417,7 +417,7 @@ qdevice_cmap_add_track(struct qdevice_instance *instance)
 	    NULL, &instance->cmap_nodelist_track_handle);
 
 	if (res != CS_OK) {
-		qdevice_log(LOG_ERR, "Can't initialize cmap nodelist tracking");
+		log(LOG_ERR, "Can't initialize cmap nodelist tracking");
 		return (-1);
 	}
 
@@ -427,7 +427,7 @@ qdevice_cmap_add_track(struct qdevice_instance *instance)
 	    NULL, &instance->cmap_logging_track_handle);
 
 	if (res != CS_OK) {
-		qdevice_log(LOG_ERR, "Can't initialize logging tracking");
+		log(LOG_ERR, "Can't initialize logging tracking");
 		return (-1);
 	}
 
@@ -437,7 +437,7 @@ qdevice_cmap_add_track(struct qdevice_instance *instance)
 	    NULL, &instance->cmap_heuristics_track_handle);
 
 	if (res != CS_OK) {
-		qdevice_log(LOG_ERR, "Can't initialize logging tracking");
+		log(LOG_ERR, "Can't initialize logging tracking");
 		return (-1);
 	}
 
@@ -451,22 +451,22 @@ qdevice_cmap_del_track(struct qdevice_instance *instance)
 
 	res = cmap_track_delete(instance->cmap_handle, instance->cmap_reload_track_handle);
 	if (res != CS_OK) {
-		qdevice_log(LOG_WARNING, "Can't delete cmap totemconfig_reload_in_progress tracking");
+		log(LOG_WARNING, "Can't delete cmap totemconfig_reload_in_progress tracking");
 	}
 
 	res = cmap_track_delete(instance->cmap_handle, instance->cmap_nodelist_track_handle);
 	if (res != CS_OK) {
-		qdevice_log(LOG_WARNING, "Can't delete cmap nodelist tracking");
+		log(LOG_WARNING, "Can't delete cmap nodelist tracking");
 	}
 
 	res = cmap_track_delete(instance->cmap_handle, instance->cmap_logging_track_handle);
 	if (res != CS_OK) {
-		qdevice_log(LOG_WARNING, "Can't delete cmap logging tracking");
+		log(LOG_WARNING, "Can't delete cmap logging tracking");
 	}
 
 	res = cmap_track_delete(instance->cmap_handle, instance->cmap_heuristics_track_handle);
 	if (res != CS_OK) {
-		qdevice_log(LOG_WARNING, "Can't delete cmap heuristics tracking");
+		log(LOG_WARNING, "Can't delete cmap heuristics tracking");
 	}
 
 	return (0);
@@ -480,7 +480,7 @@ qdevice_cmap_destroy(struct qdevice_instance *instance)
 	res = cmap_finalize(instance->cmap_handle);
 
 	if (res != CS_OK) {
-		qdevice_log(LOG_WARNING, "Can't finalize cmap. Error %s", cs_strerror(res));
+		log(LOG_WARNING, "Can't finalize cmap. Error %s", cs_strerror(res));
 	}
 }
 
@@ -499,7 +499,7 @@ qdevice_cmap_dispatch(struct qdevice_instance *instance)
 	res = cmap_dispatch(instance->cmap_handle, CS_DISPATCH_ALL);
 
 	if (res != CS_OK && res != CS_ERR_TRY_AGAIN) {
-		qdevice_log(LOG_ERR, "Can't dispatch cmap messages");
+		log(LOG_ERR, "Can't dispatch cmap messages");
 
 		return (-1);
 	}

+ 1 - 8
qdevices/qdevice-config.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2017 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -61,15 +61,8 @@ extern "C" {
 
 #define QDEVICE_PROGRAM_NAME			"corosync-qdevice"
 #define QDEVICE_LOG_SUBSYS			"QDEVICE"
-#define QDEVICE_LOG_DEFAULT_TO_STDERR		1
-#define QDEVICE_LOG_DEFAULT_TO_SYSLOG		1
-#define QDEVICE_LOG_DEFAULT_TO_LOGFILE		0
 #define QDEVICE_LOG_DEFAULT_SYSLOG_FACILITY	LOG_DAEMON
-#define QDEVICE_LOG_DEFAULT_SYSLOG_PRIORITY	LOG_INFO
 #define QDEVICE_LOG_DEFAULT_DEBUG		0
-#define QDEVICE_LOG_DEFAULT_FILELINE		0
-#define QDEVICE_LOG_DEFAULT_TIMESTAMP		0
-#define QDEVICE_LOG_DEFAULT_FUNCTION_NAME	0
 
 #define QDEVICE_DEFAULT_VOTEQUORUM_DEVICE_NAME	"Qdevice"
 

+ 21 - 20
qdevices/qdevice-heuristics-cmd.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2017 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -33,6 +33,7 @@
  */
 
 #include <stdlib.h>
+#include <stdio.h>
 
 #include "dynar.h"
 #include "dynar-str.h"
@@ -54,23 +55,23 @@ qdevice_heuristics_cmd_process_exec_result(struct qdevice_heuristics_instance *i
 
 	if (sscanf(str, QDEVICE_HEURISTICS_CMD_STR_EXEC_RESULT_ADD_SPACE "%"PRIu32" %u", &seq_number,
 	    &exec_result) != 2) {
-		qdevice_log(LOG_CRIT, "Can't parse exec result command (sscanf)");
+		log(LOG_CRIT, "Can't parse exec result command (sscanf)");
 
 		return (-1);
 	}
 
-	qdevice_log(LOG_DEBUG,
+	log(LOG_DEBUG,
 	    "Received heuristics exec result command with seq_no \"%"PRIu32"\" and result \"%s\"", seq_number,
 	    qdevice_heuristics_exec_result_to_str(exec_result));
 
 	if (!instance->waiting_for_result) {
-		qdevice_log(LOG_DEBUG, "Received exec result is not expected. Ignoring.");
+		log(LOG_DEBUG, "Received exec result is not expected. Ignoring.");
 
 		return (0);
 	}
 
 	if (seq_number != instance->expected_reply_seq_number) {
-		qdevice_log(LOG_DEBUG, "Received heuristics exec result seq number %"PRIu32
+		log(LOG_DEBUG, "Received heuristics exec result seq number %"PRIu32
 		    " is not expected one (expected %"PRIu32"). Ignoring.", seq_number,
 		    instance->expected_reply_seq_number);
 
@@ -81,7 +82,7 @@ qdevice_heuristics_cmd_process_exec_result(struct qdevice_heuristics_instance *i
 
 	if (qdevice_heuristics_result_notifier_notify(&instance->exec_result_notifier_list,
 	    (void *)instance, seq_number, exec_result) != 0) {
-		qdevice_log(LOG_DEBUG, "qdevice_heuristics_result_notifier_notify returned non-zero result");
+		log(LOG_DEBUG, "qdevice_heuristics_result_notifier_notify returned non-zero result");
 		return (-1);
 	}
 
@@ -127,7 +128,7 @@ qdevice_heuristics_cmd_process_one_line(struct qdevice_heuristics_instance *inst
 			return (-1);
 		}
 	} else {
-		qdevice_log(LOG_CRIT,
+		log(LOG_CRIT,
 		    "Heuristics worker sent unknown command \"%s\"", str);
 
 		    return (-1);
@@ -140,7 +141,7 @@ qdevice_heuristics_cmd_process_one_line(struct qdevice_heuristics_instance *inst
 
 	memmove(str, str + zi, str_len - zi);
 	if (dynar_set_size(data, str_len - zi) == -1) {
-		qdevice_log(LOG_CRIT,
+		log(LOG_CRIT,
 		    "qdevice_heuristics_cmd_process_one_line: Can't set dynar size");
 		return (-1);
 	}
@@ -184,15 +185,15 @@ qdevice_heuristics_cmd_read_from_pipe(struct qdevice_heuristics_instance *instan
 		 */
 		break;
 	case -1:
-		qdevice_log(LOG_ERR, "Lost connection with heuristics worker");
+		log(LOG_ERR, "Lost connection with heuristics worker");
 		ret = -1;
 		break;
 	case -2:
-		qdevice_log(LOG_ERR, "Heuristics worker sent too long cmd.");
+		log(LOG_ERR, "Heuristics worker sent too long cmd.");
 		ret = -1;
 		break;
 	case -3:
-		qdevice_log(LOG_ERR, "Unhandled error when reading from heuristics worker cmd fd");
+		log(LOG_ERR, "Unhandled error when reading from heuristics worker cmd fd");
 		ret = -1;
 		break;
 	case 1:
@@ -218,7 +219,7 @@ qdevice_heuristics_cmd_write(struct qdevice_heuristics_instance *instance)
 
 	send_buffer = send_buffer_list_get_active(&instance->cmd_out_buffer_list);
 	if (send_buffer == NULL) {
-		qdevice_log(LOG_CRIT, "send_buffer_list_get_active in qdevice_heuristics_cmd_write returned NULL");
+		log(LOG_CRIT, "send_buffer_list_get_active in qdevice_heuristics_cmd_write returned NULL");
 
 		return (-1);
 	}
@@ -231,13 +232,13 @@ qdevice_heuristics_cmd_write(struct qdevice_heuristics_instance *instance)
 	}
 
 	if (res == -1) {
-		qdevice_log(LOG_CRIT, "qdevice_heuristics_io_write returned -1 (write returned 0)");
+		log(LOG_CRIT, "qdevice_heuristics_io_write returned -1 (write returned 0)");
 
 		return (-1);
 	}
 
 	if (res == -2) {
-		qdevice_log(LOG_CRIT, "Unhandled error in during sending message to heuristics "
+		log(LOG_CRIT, "Unhandled error in during sending message to heuristics "
 		    "worker (qdevice_heuristics_io_write returned -2)");
 
 		return (-1);
@@ -274,14 +275,14 @@ qdevice_heuristics_cmd_write_exec_list(struct qdevice_heuristics_instance *insta
 
 	send_buffer = send_buffer_list_get_new(&instance->cmd_out_buffer_list);
 	if (send_buffer == NULL) {
-		qdevice_log(LOG_ERR, "Can't alloc send list for cmd change exec list");
+		log(LOG_ERR, "Can't alloc send list for cmd change exec list");
 
 		return (-1);
 	}
 
 	if (dynar_str_cpy(&send_buffer->buffer, QDEVICE_HEURISTICS_CMD_STR_EXEC_LIST_CLEAR) == -1 ||
 	    dynar_str_cat(&send_buffer->buffer, "\n") == -1) {
-		qdevice_log(LOG_ERR, "Can't alloc list clear message");
+		log(LOG_ERR, "Can't alloc list clear message");
 
 		send_buffer_list_discard_new(&instance->cmd_out_buffer_list, send_buffer);
 
@@ -300,7 +301,7 @@ qdevice_heuristics_cmd_write_exec_list(struct qdevice_heuristics_instance *insta
 	TAILQ_FOREACH(entry, new_exec_list, entries) {
 		send_buffer = send_buffer_list_get_new(&instance->cmd_out_buffer_list);
 		if (send_buffer == NULL) {
-			qdevice_log(LOG_ERR, "Can't alloc send list for cmd change exec list");
+			log(LOG_ERR, "Can't alloc send list for cmd change exec list");
 
 			return (-1);
 		}
@@ -312,7 +313,7 @@ qdevice_heuristics_cmd_write_exec_list(struct qdevice_heuristics_instance *insta
 		    dynar_str_cat(&send_buffer->buffer, entry->command) == -1 ||
 		    qdevice_heuristics_cmd_remove_newlines(&send_buffer->buffer) == -1 ||
 		    dynar_str_cat(&send_buffer->buffer, "\n") == -1) {
-			qdevice_log(LOG_ERR, "Can't alloc list add message");
+			log(LOG_ERR, "Can't alloc list add message");
 
 			send_buffer_list_discard_new(&instance->cmd_out_buffer_list, send_buffer);
 
@@ -333,14 +334,14 @@ qdevice_heuristics_cmd_write_exec(struct qdevice_heuristics_instance *instance,
 
 	send_buffer = send_buffer_list_get_new(&instance->cmd_out_buffer_list);
 	if (send_buffer == NULL) {
-		qdevice_log(LOG_ERR, "Can't alloc send list for cmd change exec list");
+		log(LOG_ERR, "Can't alloc send list for cmd change exec list");
 
 		return (-1);
 	}
 
 	if (dynar_str_cpy(&send_buffer->buffer, QDEVICE_HEURISTICS_CMD_STR_EXEC_ADD_SPACE) == -1 ||
 	    dynar_str_catf(&send_buffer->buffer, "%"PRIu32" %"PRIu32"\n", timeout, seq_number) == -1) {
-		qdevice_log(LOG_ERR, "Can't alloc exec message");
+		log(LOG_ERR, "Can't alloc exec message");
 
 		send_buffer_list_discard_new(&instance->cmd_out_buffer_list, send_buffer);
 

+ 7 - 7
qdevices/qdevice-heuristics-log.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2017 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -69,7 +69,7 @@ qdevice_heuristics_log_process_one_line(struct dynar *data)
 			} else if (str[zi] == ' ') {
 				status = 1;
 			} else {
-				qdevice_log(LOG_ERR, "Parsing of heuristics log line failed. "
+				log(LOG_ERR, "Parsing of heuristics log line failed. "
 				    "Unexpected char '%c'", str[zi]);
 				return (-1);
 			}
@@ -97,7 +97,7 @@ qdevice_heuristics_log_process_one_line(struct dynar *data)
 	/*
 	 * Do actual logging
 	 */
-	qb_log_from_external_source(__func__, __FILE__, "worker: %s", log_priority, __LINE__, 0, log_str_start);
+	log(log_priority, "worker: %s", log_str_start);
 
 	/*
 	 * Find place where is begining of new "valid" line
@@ -106,7 +106,7 @@ qdevice_heuristics_log_process_one_line(struct dynar *data)
 
 	memmove(str, str + zi, str_len - zi);
 	if (dynar_set_size(data, str_len - zi) == -1) {
-		qdevice_log(LOG_ERR, "qdevice_heuristics_log_process_one_line: Can't set dynar size");
+		log(LOG_ERR, "qdevice_heuristics_log_process_one_line: Can't set dynar size");
 		return (-1);
 	}
 
@@ -150,15 +150,15 @@ qdevice_heuristics_log_read_from_pipe(struct qdevice_heuristics_instance *instan
 		 */
 		break;
 	case -1:
-		qdevice_log(LOG_ERR, "Lost connection with heuristics worker");
+		log(LOG_ERR, "Lost connection with heuristics worker");
 		ret = -1;
 		break;
 	case -2:
-		qdevice_log(LOG_ERR, "Heuristics worker sent too long log. Ignoring line");
+		log(LOG_ERR, "Heuristics worker sent too long log. Ignoring line");
 		dynar_clean(&instance->log_in_buffer);
 		break;
 	case -3:
-		qdevice_log(LOG_ERR, "Unhandled error when reading from heuristics worker log fd");
+		log(LOG_ERR, "Unhandled error when reading from heuristics worker log fd");
 		ret = -1;
 		break;
 	case 1:

+ 13 - 11
qdevices/qdevice-heuristics.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2017 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -153,9 +153,9 @@ qdevice_heuristics_destroy(struct qdevice_heuristics_instance *instance, int wai
 	 * process any longer so it's not possible to wait for its exit.
 	 */
 	if (wait_for_worker_exit) {
-		qdevice_log(LOG_DEBUG, "Waiting for heuristics worker to finish");
+		log(LOG_DEBUG, "Waiting for heuristics worker to finish");
 		if (waitpid(instance->worker_pid, &status, 0) == -1) {
-			qdevice_log_err(LOG_ERR, "Heuristics worker waitpid failed");
+			log_err(LOG_ERR, "Heuristics worker waitpid failed");
 		} else {
 			/*
 			 * Log what left in worker log buffer. Errors can be ignored
@@ -212,7 +212,7 @@ qdevice_heuristics_change_exec_list(struct qdevice_heuristics_instance *instance
 
 	if (new_exec_list != NULL) {
 		if (qdevice_heuristics_exec_list_clone(&instance->exec_list, new_exec_list) != 0) {
-			qdevice_log(LOG_ERR, "Can't clone exec list");
+			log(LOG_ERR, "Can't clone exec list");
 
 			return (-1);
 		}
@@ -220,7 +220,7 @@ qdevice_heuristics_change_exec_list(struct qdevice_heuristics_instance *instance
 
 	if (qdevice_heuristics_waiting_for_result(instance)) {
 		if (qdevice_heuristics_exec(instance, sync_in_progress) != 0) {
-			qdevice_log(LOG_ERR, "Can't execute heuristics");
+			log(LOG_ERR, "Can't execute heuristics");
 
 			return (-1);
 		}
@@ -310,7 +310,7 @@ qdevice_heuristics_wait_for_initial_exec_result(struct qdevice_heuristics_instan
 					}
 
 					if (!case_processed) {
-						qdevice_log(LOG_CRIT, "Unhandled read on poll descriptor %u", i);
+						log(LOG_CRIT, "Unhandled read on poll descriptor %u", i);
 						exit(1);
 					}
 				}
@@ -335,7 +335,7 @@ qdevice_heuristics_wait_for_initial_exec_result(struct qdevice_heuristics_instan
 					}
 
 					if (!case_processed) {
-						qdevice_log(LOG_CRIT, "Unhandled write on poll descriptor %u", i);
+						log(LOG_CRIT, "Unhandled write on poll descriptor %u", i);
 						exit(1);
 					}
 				}
@@ -356,21 +356,23 @@ qdevice_heuristics_wait_for_initial_exec_result(struct qdevice_heuristics_instan
 							return (-1);
 						}
 
-						qdevice_log(LOG_ERR, "POLLERR (%u) on heuristics pipe. Exiting");
+						log(LOG_ERR, "POLLERR (%u) on heuristics pipe. Exiting",
+						    pfds[i].revents);
 						return (-1);
 						break;
 					case 2:
-						qdevice_log(LOG_ERR, "POLLERR (%u) on corosync socket. Exiting");
+						log(LOG_ERR, "POLLERR (%u) on corosync socket. Exiting",
+						    pfds[i].revents);
 						return (-1);
 						break;
 					}
 				}
 			}
 		} else if (poll_res == 0) {
-			qdevice_log(LOG_ERR, "Timeout waiting for initial heuristics exec result");
+			log(LOG_ERR, "Timeout waiting for initial heuristics exec result");
 			return (-1);
 		} else {
-			qdevice_log_err(LOG_ERR, "Initial heuristics exec result poll failed");
+			log_err(LOG_ERR, "Initial heuristics exec result poll failed");
 			return (-1);
 		}
 	}

+ 21 - 18
qdevices/qdevice-instance.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2017 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -32,6 +32,9 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <string.h>
+#include <stdio.h>
+
 #include "qdevice-config.h"
 #include "qdevice-instance.h"
 #include "qdevice-heuristics-exec-list.h"
@@ -88,7 +91,7 @@ qdevice_instance_configure_from_cmap_heuristics(struct qdevice_instance *instanc
 	    "quorum.device.heuristics.timeout", &str) == CS_OK) {
 		if (utils_strtonum(str, instance->advanced_settings->heuristics_min_timeout,
 		    instance->advanced_settings->heuristics_max_timeout, &lli) == -1) {
-			qdevice_log(LOG_ERR, "heuristics.timeout must be valid number in "
+			log(LOG_ERR, "heuristics.timeout must be valid number in "
 			    "range <%"PRIu32",%"PRIu32">",
 			    instance->advanced_settings->heuristics_min_timeout,
 			    instance->advanced_settings->heuristics_max_timeout);
@@ -107,7 +110,7 @@ qdevice_instance_configure_from_cmap_heuristics(struct qdevice_instance *instanc
 	    "quorum.device.heuristics.sync_timeout", &str) == CS_OK) {
 		if (utils_strtonum(str, instance->advanced_settings->heuristics_min_timeout,
 		    instance->advanced_settings->heuristics_max_timeout, &lli) == -1) {
-			qdevice_log(LOG_ERR, "heuristics.sync_timeout must be valid number in "
+			log(LOG_ERR, "heuristics.sync_timeout must be valid number in "
 			    "range <%"PRIu32",%"PRIu32">",
 			    instance->advanced_settings->heuristics_min_timeout,
 			    instance->advanced_settings->heuristics_max_timeout);
@@ -126,7 +129,7 @@ qdevice_instance_configure_from_cmap_heuristics(struct qdevice_instance *instanc
 	    "quorum.device.heuristics.interval", &str) == CS_OK) {
 		if (utils_strtonum(str, instance->advanced_settings->heuristics_min_interval,
 		    instance->advanced_settings->heuristics_max_interval, &lli) == -1) {
-			qdevice_log(LOG_ERR, "heuristics.interval must be valid number in "
+			log(LOG_ERR, "heuristics.interval must be valid number in "
 			    "range <%"PRIu32",%"PRIu32">",
 			    instance->advanced_settings->heuristics_min_interval,
 			    instance->advanced_settings->heuristics_max_interval);
@@ -145,7 +148,7 @@ qdevice_instance_configure_from_cmap_heuristics(struct qdevice_instance *instanc
 	if (cmap_get_string(instance->cmap_handle, "quorum.device.heuristics.mode", &str) == CS_OK) {
 		if ((i = utils_parse_bool_str(str)) == -1) {
 			if (strcasecmp(str, "sync") != 0) {
-				qdevice_log(LOG_ERR, "quorum.device.heuristics.mode value is not valid.");
+				log(LOG_ERR, "quorum.device.heuristics.mode value is not valid.");
 
 				free(str);
 				return (-1);
@@ -177,7 +180,7 @@ qdevice_instance_configure_from_cmap_heuristics(struct qdevice_instance *instanc
 		 */
 		cs_err = cmap_iter_init(instance->cmap_handle, "quorum.device.heuristics.exec_", &iter_handle);
 		if (cs_err != CS_OK) {
-			qdevice_log(LOG_ERR, "Can't iterate quorum.device.heuristics.exec_ keys. "
+			log(LOG_ERR, "Can't iterate quorum.device.heuristics.exec_ keys. "
 			    "Error %s", cs_strerror(cs_err));
 
 			return (-1);
@@ -186,24 +189,24 @@ qdevice_instance_configure_from_cmap_heuristics(struct qdevice_instance *instanc
 		while ((cs_err = cmap_iter_next(instance->cmap_handle, iter_handle, key_name,
 		    &value_len, &type)) == CS_OK) {
 			if (type != CMAP_VALUETYPE_STRING) {
-				qdevice_log(LOG_WARNING, "%s key is not of string type. Ignoring");
+				log(LOG_WARNING, "%s key is not of string type. Ignoring", key_name);
 				continue ;
 			}
 
 			res = sscanf(key_name, "quorum.device.heuristics.exec_%[^.]%s", exec_name, tmp_key);
 			if (res != 1) {
-				qdevice_log(LOG_WARNING, "%s key is not correct heuristics exec name. Ignoring");
+				log(LOG_WARNING, "%s key is not correct heuristics exec name. Ignoring", key_name);
 				continue ;
 			}
 
 			cs_err = cmap_get_string(instance->cmap_handle, key_name, &command);
 			if (cs_err != CS_OK) {
-				qdevice_log(LOG_WARNING, "Can't get value of %s key. Ignoring");
+				log(LOG_WARNING, "Can't get value of %s key. Ignoring", key_name);
 				continue ;
 			}
 
 			if (qdevice_heuristics_exec_list_add(&tmp_exec_list, exec_name, command) == NULL) {
-				qdevice_log(LOG_WARNING, "Can't store value of %s key into list. Ignoring");
+				log(LOG_WARNING, "Can't store value of %s key into list. Ignoring", key_name);
 			}
 
 			free(command);
@@ -212,12 +215,12 @@ qdevice_instance_configure_from_cmap_heuristics(struct qdevice_instance *instanc
 		no_execs = qdevice_heuristics_exec_list_size(&tmp_exec_list);
 
 		if (no_execs == 0) {
-			qdevice_log(LOG_INFO, "No valid heuristics execs defined. Disabling heuristics.");
+			log(LOG_INFO, "No valid heuristics execs defined. Disabling heuristics.");
 			instance->heuristics_instance.mode = QDEVICE_HEURISTICS_MODE_DISABLED;
 			exec_list = NULL;
 			send_exec_list = 1;
 		} else if (no_execs > instance->advanced_settings->heuristics_max_execs) {
-			qdevice_log(LOG_ERR, "Too much (%zu) heuristics execs defined (max is %zu)."
+			log(LOG_ERR, "Too much (%zu) heuristics execs defined (max is %zu)."
 			    " Disabling heuristics.", no_execs,
 			    instance->advanced_settings->heuristics_max_execs);
 			instance->heuristics_instance.mode = QDEVICE_HEURISTICS_MODE_DISABLED;
@@ -225,16 +228,16 @@ qdevice_instance_configure_from_cmap_heuristics(struct qdevice_instance *instanc
 			send_exec_list = 1;
 		} else if (qdevice_heuristics_exec_list_eq(&tmp_exec_list,
 		    &instance->heuristics_instance.exec_list) == 1) {
-			qdevice_log(LOG_DEBUG, "Heuristics list is unchanged");
+			log(LOG_DEBUG, "Heuristics list is unchanged");
 			send_exec_list = 0;
 		} else {
-			qdevice_log(LOG_DEBUG, "Heuristics list changed");
+			log(LOG_DEBUG, "Heuristics list changed");
 			exec_list = &tmp_exec_list;
 			send_exec_list = 1;
 		}
 
 	} else {
-		qdevice_log(LOG_CRIT, "Undefined heuristics mode");
+		log(LOG_CRIT, "Undefined heuristics mode");
 		exit(1);
 	}
 
@@ -256,13 +259,13 @@ qdevice_instance_configure_from_cmap(struct qdevice_instance *instance)
 	char *str;
 
 	if (cmap_get_string(instance->cmap_handle, "quorum.device.model", &str) != CS_OK) {
-		qdevice_log(LOG_ERR, "Can't read quorum.device.model cmap key.");
+		log(LOG_ERR, "Can't read quorum.device.model cmap key.");
 
 		return (-1);
 	}
 
 	if (qdevice_model_str_to_type(str, &instance->model_type) != 0) {
-		qdevice_log(LOG_ERR, "Configured device model %s is not supported.", str);
+		log(LOG_ERR, "Configured device model %s is not supported.", str);
 		free(str);
 
 		return (-1);
@@ -271,7 +274,7 @@ qdevice_instance_configure_from_cmap(struct qdevice_instance *instance)
 
 	if (cmap_get_uint32(instance->cmap_handle, "runtime.votequorum.this_node_id",
 	    &instance->node_id) != CS_OK) {
-		qdevice_log(LOG_ERR, "Unable to retrieve this node nodeid.");
+		log(LOG_ERR, "Unable to retrieve this node nodeid.");
 
 		return (-1);
 	}

+ 2 - 2
qdevices/qdevice-ipc-cmd.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -158,7 +158,7 @@ qdevice_ipc_cmd_vq_nodestate_to_str(uint32_t state)
 	case VOTEQUORUM_NODESTATE_DEAD: return ("dead"); break;
 	case VOTEQUORUM_NODESTATE_LEAVING: return ("leaving"); break;
 	default:
-		qdevice_log(LOG_ERR, "qdevice_ipc_cmd_vq_nodestate_to_str: Unhandled votequorum "
+		log(LOG_ERR, "qdevice_ipc_cmd_vq_nodestate_to_str: Unhandled votequorum "
 		    "node state %"PRIu32, state);
 		exit(1);
 		break;

+ 19 - 19
qdevices/qdevice-ipc.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -49,7 +49,7 @@ qdevice_ipc_init(struct qdevice_instance *instance)
 	    instance->advanced_settings->ipc_max_clients,
 	    instance->advanced_settings->ipc_max_receive_size,
 	    instance->advanced_settings->ipc_max_send_size) != 0) {
-		qdevice_log_err(LOG_ERR, "Can't create unix socket");
+		log_err(LOG_ERR, "Can't create unix socket");
 
 		return (-1);
 	}
@@ -64,7 +64,7 @@ qdevice_ipc_close(struct qdevice_instance *instance)
 
 	res = unix_socket_ipc_close(&instance->local_ipc);
 	if (res != 0) {
-		qdevice_log_err(LOG_WARNING, "Can't close local IPC");
+		log_err(LOG_WARNING, "Can't close local IPC");
 	}
 
 	return (res);
@@ -92,7 +92,7 @@ qdevice_ipc_destroy(struct qdevice_instance *instance)
 
 	res = unix_socket_ipc_destroy(&instance->local_ipc);
 	if (res != 0) {
-		qdevice_log_err(LOG_WARNING, "Can't destroy local IPC");
+		log_err(LOG_WARNING, "Can't destroy local IPC");
 	}
 
 	return (res);
@@ -108,17 +108,17 @@ qdevice_ipc_accept(struct qdevice_instance *instance, struct unix_socket_client
 
 	switch (accept_res) {
 	case -1:
-		qdevice_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:
-		qdevice_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:
-		qdevice_log(LOG_ERR, "Can't add client to list");
+		log(LOG_ERR, "Can't add client to list");
 		res = -1;
 		goto return_res;
 		break;
@@ -130,7 +130,7 @@ qdevice_ipc_accept(struct qdevice_instance *instance, struct unix_socket_client
 
 	(*res_client)->user_data = malloc(sizeof(struct qdevice_ipc_user_data));
 	if ((*res_client)->user_data == NULL) {
-		qdevice_log(LOG_ERR, "Can't alloc IPC client user data");
+		log(LOG_ERR, "Can't alloc IPC client user data");
 		res = -1;
 		qdevice_ipc_client_disconnect(instance, *res_client);
 	} else {
@@ -166,7 +166,7 @@ qdevice_ipc_send_error(struct qdevice_instance *instance, struct unix_socket_cli
 	if (res) {
 		unix_socket_client_write_buffer(client, 1);
 	} else {
-		qdevice_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);
@@ -177,7 +177,7 @@ qdevice_ipc_send_buffer(struct qdevice_instance *instance, struct unix_socket_cl
 {
 
 	if (dynar_str_prepend(&client->send_buffer, "OK\n") != 0) {
-		qdevice_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 (qdevice_ipc_send_error(instance, client, "Internal IPC buffer too small") != 0) {
 			return (-1);
@@ -208,7 +208,7 @@ qdevice_ipc_parse_line(struct qdevice_instance *instance, struct unix_socket_cli
 	verbose = 0;
 
 	if (token == NULL) {
-		qdevice_log(LOG_ERR, "Can't alloc memory for simple lex");
+		log(LOG_ERR, "Can't alloc memory for simple lex");
 
 		if (qdevice_ipc_send_error(instance, client, "Command too long") != 0) {
 			client->schedule_disconnect = 1;
@@ -219,12 +219,12 @@ qdevice_ipc_parse_line(struct qdevice_instance *instance, struct unix_socket_cli
 
 	str = dynar_data(token);
 	if (strcasecmp(str, "") == 0) {
-		qdevice_log(LOG_DEBUG, "IPC client doesn't send command");
+		log(LOG_DEBUG, "IPC client doesn't send command");
 		if (qdevice_ipc_send_error(instance, client, "No command specified") != 0) {
 			client->schedule_disconnect = 1;
 		}
 	} else if (strcasecmp(str, "shutdown") == 0) {
-		qdevice_log(LOG_DEBUG, "IPC client requested shutdown");
+		log(LOG_DEBUG, "IPC client requested shutdown");
 
 		ipc_user_data->shutdown_requested = 1;
 
@@ -250,7 +250,7 @@ qdevice_ipc_parse_line(struct qdevice_instance *instance, struct unix_socket_cli
 			}
 		}
 	} else {
-		qdevice_log(LOG_DEBUG, "IPC client sent unknown command");
+		log(LOG_DEBUG, "IPC client sent unknown command");
 		if (qdevice_ipc_send_error(instance, client, "Unknown command '%s'", str) != 0) {
 			client->schedule_disconnect = 1;
 		}
@@ -273,15 +273,15 @@ qdevice_ipc_io_read(struct qdevice_instance *instance, struct unix_socket_client
 		 */
 		break;
 	case -1:
-		qdevice_log(LOG_DEBUG, "IPC client closed connection");
+		log(LOG_DEBUG, "IPC client closed connection");
 		client->schedule_disconnect = 1;
 		break;
 	case -2:
-		qdevice_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:
-		qdevice_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:
@@ -312,11 +312,11 @@ qdevice_ipc_io_write(struct qdevice_instance *instance, struct unix_socket_clien
 		 */
 		break;
 	case -1:
-		qdevice_log(LOG_DEBUG, "IPC client closed connection");
+		log(LOG_DEBUG, "IPC client closed connection");
 		client->schedule_disconnect = 1;
 		break;
 	case -2:
-		qdevice_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:

+ 3 - 3
qdevices/qdevice-log-debug.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -42,12 +42,12 @@ qdevice_log_debug_dump_node_list(const struct node_list *nlist)
 	struct node_list_entry *node_info;
 	size_t zi;
 
-	qdevice_log(LOG_DEBUG, "  Node list:");
+	log(LOG_DEBUG, "  Node list:");
 
 	zi = 0;
 
 	TAILQ_FOREACH(node_info, nlist, entries) {
-		qdevice_log(LOG_DEBUG, "    %zu node_id = "UTILS_PRI_NODE_ID", "
+		log(LOG_DEBUG, "    %zu node_id = "UTILS_PRI_NODE_ID", "
 		    "data_center_id = "UTILS_PRI_DATACENTER_ID", node_state = %s",
 		    zi, node_info->node_id, node_info->data_center_id,
 		    tlv_node_state_to_str(node_info->node_state));

+ 21 - 231
qdevices/qdevice-log.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -38,161 +38,12 @@
 
 static int qdevice_log_global_force_debug;
 
-struct qdevice_log_syslog_names {
-	const char *prio_name;
-	int priority;
-};
-
-static struct qdevice_log_syslog_names qdevice_log_priority_names[] = {
-	{ "alert", LOG_ALERT },
-	{ "crit", LOG_CRIT },
-	{ "debug", LOG_DEBUG },
-	{ "emerg", LOG_EMERG },
-	{ "err", LOG_ERR },
-	{ "error", LOG_ERR },
-	{ "info", LOG_INFO },
-	{ "notice", LOG_NOTICE },
-	{ "warning", LOG_WARNING },
-	{ NULL, -1 }};
-
-static int
-qdevice_log_priority_str_to_int(const char *priority_str)
-{
-	unsigned int i;
-
-	for (i = 0; qdevice_log_priority_names[i].prio_name != NULL; i++) {
-		if (strcasecmp(priority_str, qdevice_log_priority_names[i].prio_name) == 0) {
-			return (qdevice_log_priority_names[i].priority);
-		}
-	}
-
-	return (-1);
-}
-
 void
 qdevice_log_configure(struct qdevice_instance *instance)
 {
-	int to_stderr;
-	int to_syslog;
-	int syslog_facility;
-	int syslog_priority;
-	int logfile_priority;
 	int debug;
 	char *str;
 	int i;
-	int fileline;
-	int timestamp;
-	int function_name;
-	char log_format_syslog[64];
-	char log_format_stderr[64];
-
-	to_stderr = QDEVICE_LOG_DEFAULT_TO_STDERR;
-	if (cmap_get_string(instance->cmap_handle, "logging.to_stderr", &str) == CS_OK) {
-		if ((i = utils_parse_bool_str(str)) == -1) {
-			qdevice_log(LOG_WARNING, "logging.to_stderr value is not valid");
-		} else {
-			to_stderr = i;
-		}
-		free(str);
-	}
-
-	if (cmap_get_string(instance->cmap_handle,
-	    "logging.logger_subsys." QDEVICE_LOG_SUBSYS ".to_stderr", &str) == CS_OK) {
-		if ((i = utils_parse_bool_str(str)) == -1) {
-			qdevice_log(LOG_WARNING,
-			    "logging.logger_subsys." QDEVICE_LOG_SUBSYS ".to_stderr value is not valid.");
-		} else {
-			to_stderr = i;
-		}
-		free(str);
-	}
-
-	to_syslog = QDEVICE_LOG_DEFAULT_TO_SYSLOG;
-	if (cmap_get_string(instance->cmap_handle, "logging.to_syslog", &str) == CS_OK) {
-		if ((i = utils_parse_bool_str(str)) == -1) {
-			qdevice_log(LOG_WARNING, "logging.to_syslog value is not valid");
-		} else {
-			to_syslog = i;
-		}
-		free(str);
-	}
-
-	if (cmap_get_string(instance->cmap_handle,
-	    "logging.logger_subsys." QDEVICE_LOG_SUBSYS ".to_syslog", &str) == CS_OK) {
-		if ((i = utils_parse_bool_str(str)) == -1) {
-			qdevice_log(LOG_WARNING,
-			    "logging.logger_subsys." QDEVICE_LOG_SUBSYS ".to_syslog value is not valid.");
-		} else {
-			to_syslog = i;
-		}
-		free(str);
-	}
-
-	syslog_facility = QDEVICE_LOG_DEFAULT_SYSLOG_FACILITY;
-	if (cmap_get_string(instance->cmap_handle, "logging.syslog_facility", &str) == CS_OK) {
-		if ((i = qb_log_facility2int(str)) < 0) {
-			qdevice_log(LOG_WARNING, "logging.syslog_facility value is not valid");
-		} else {
-			syslog_facility = i;
-		}
-
-		free(str);
-	}
-
-	if (cmap_get_string(instance->cmap_handle,
-	    "logging.logger_subsys." QDEVICE_LOG_SUBSYS ".syslog_facility", &str) == CS_OK) {
-		if ((i = qb_log_facility2int(str)) < 0) {
-			qdevice_log(LOG_WARNING,
-			    "logging.logger_subsys." QDEVICE_LOG_SUBSYS ".syslog_facility value is not valid.");
-		} else {
-			syslog_facility = i;
-		}
-		free(str);
-	}
-
-	syslog_priority = QDEVICE_LOG_DEFAULT_SYSLOG_PRIORITY;
-	if (cmap_get_string(instance->cmap_handle, "logging.syslog_priority", &str) == CS_OK) {
-		if ((i = qdevice_log_priority_str_to_int(str)) < 0) {
-			qdevice_log(LOG_WARNING, "logging.syslog_priority value is not valid");
-		} else {
-			syslog_priority = i;
-		}
-
-		free(str);
-	}
-
-	if (cmap_get_string(instance->cmap_handle,
-	    "logging.logger_subsys." QDEVICE_LOG_SUBSYS ".syslog_priority", &str) == CS_OK) {
-		if ((i = qdevice_log_priority_str_to_int(str)) < 0) {
-			qdevice_log(LOG_WARNING,
-			    "logging.logger_subsys." QDEVICE_LOG_SUBSYS ".syslog_priority value is not valid.");
-		} else {
-			syslog_priority = i;
-		}
-		free(str);
-	}
-
-	logfile_priority = QDEVICE_LOG_DEFAULT_SYSLOG_PRIORITY;
-	if (cmap_get_string(instance->cmap_handle, "logging.logfile_priority", &str) == CS_OK) {
-		if ((i = qdevice_log_priority_str_to_int(str)) < 0) {
-			qdevice_log(LOG_WARNING, "logging.logfile_priority value is not valid");
-		} else {
-			logfile_priority = i;
-		}
-
-		free(str);
-	}
-
-	if (cmap_get_string(instance->cmap_handle,
-	    "logging.logger_subsys." QDEVICE_LOG_SUBSYS ".logfile_priority", &str) == CS_OK) {
-		if ((i = qdevice_log_priority_str_to_int(str)) < 0) {
-			qdevice_log(LOG_WARNING,
-			    "logging.logger_subsys." QDEVICE_LOG_SUBSYS ".logfile_priority value is not valid.");
-		} else {
-			logfile_priority = i;
-		}
-		free(str);
-	}
 
 	debug = QDEVICE_LOG_DEFAULT_DEBUG;
 	if (cmap_get_string(instance->cmap_handle, "logging.debug", &str) == CS_OK) {
@@ -200,7 +51,7 @@ qdevice_log_configure(struct qdevice_instance *instance)
 			if (strcasecmp(str, "trace") == 0) {
 				debug = 1;
 			} else {
-				qdevice_log(LOG_WARNING, "logging.debug value is not valid");
+				log(LOG_WARNING, "logging.debug value is not valid");
 			}
 		} else {
 			debug = i;
@@ -214,7 +65,7 @@ qdevice_log_configure(struct qdevice_instance *instance)
 			if (strcasecmp(str, "trace") == 0) {
 				debug = 1;
 			} else {
-				qdevice_log(LOG_WARNING,
+				log(LOG_WARNING,
 				    "logging.logger_subsys." QDEVICE_LOG_SUBSYS ".debug value is not valid.");
 			}
 		} else {
@@ -223,101 +74,40 @@ qdevice_log_configure(struct qdevice_instance *instance)
 		free(str);
 	}
 
-	fileline = QDEVICE_LOG_DEFAULT_FILELINE;
-	if (cmap_get_string(instance->cmap_handle, "logging.fileline", &str) == CS_OK) {
-		if ((i = utils_parse_bool_str(str)) == -1) {
-			qdevice_log(LOG_WARNING, "logging.fileline value is not valid");
-		} else {
-			fileline = i;
-		}
-		free(str);
-	}
-
-	timestamp = QDEVICE_LOG_DEFAULT_TIMESTAMP;
-	if (cmap_get_string(instance->cmap_handle, "logging.timestamp", &str) == CS_OK) {
-		if ((i = utils_parse_bool_str(str)) == -1) {
-			qdevice_log(LOG_WARNING, "logging.timestamp value is not valid");
-		} else {
-			timestamp = i;
-		}
-		free(str);
-	}
-
-	function_name = QDEVICE_LOG_DEFAULT_FUNCTION_NAME;
-	if (cmap_get_string(instance->cmap_handle, "logging.function_name", &str) == CS_OK) {
-		if ((i = utils_parse_bool_str(str)) == -1) {
-			qdevice_log(LOG_WARNING, "logging.function_name value is not valid");
-		} else {
-			function_name = i;
-		}
-		free(str);
-	}
-
-	strcpy(log_format_syslog, "");
-
-	if (fileline) {
-		strcat(log_format_syslog, "%f:");
-
-		if (function_name) {
-			strcat(log_format_syslog, "%n:");
-		}
-
-		strcat(log_format_syslog, "%l ");
-	}
-
-	strcat(log_format_syslog, "%b");
-
-	strcpy(log_format_stderr, "");
-	if (timestamp) {
-		strcpy(log_format_stderr, "%t %7p ");
-	}
-	strcat(log_format_stderr, log_format_syslog);
-
 	if (qdevice_log_global_force_debug) {
 		debug = 1;
 	}
 
-	/*
-	 * Finally reconfigure log system
-	 */
-	qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, to_stderr);
-	qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, to_syslog);
-	qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_FACILITY, syslog_facility);
-	qb_log_filter_ctl(QB_LOG_SYSLOG, QB_LOG_FILTER_CLEAR_ALL, QB_LOG_FILTER_FILE, "*", LOG_TRACE);
-	qb_log_filter_ctl(QB_LOG_SYSLOG, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, "*",
-	    (debug ? LOG_DEBUG : syslog_priority));
-	qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_CLEAR_ALL, QB_LOG_FILTER_FILE, "*", LOG_TRACE);
-	qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, "*",
-	    (debug ? LOG_DEBUG : logfile_priority));
-
-	qb_log_format_set(QB_LOG_STDERR, log_format_stderr);
-	qb_log_format_set(QB_LOG_SYSLOG, log_format_syslog);
+	log_set_debug(debug);
 }
 
-void
-qdevice_log_init(struct qdevice_instance *instance, int force_debug)
+int
+qdevice_log_init(struct qdevice_instance *instance, int foreground, int force_debug)
 {
-	qdevice_log_global_force_debug = force_debug;
+	int res;
+	int log_target;
 
-	qb_log_init(QDEVICE_PROGRAM_NAME, QDEVICE_LOG_DEFAULT_SYSLOG_FACILITY,
-	    QDEVICE_LOG_DEFAULT_SYSLOG_PRIORITY);
+	qdevice_log_global_force_debug = force_debug;
 
-	qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, QB_FALSE);
-	qb_log_ctl(QB_LOG_STDOUT, QB_LOG_CONF_ENABLED, QB_FALSE);
-	qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_ENABLED, QB_FALSE);
-	qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, QB_TRUE);
+	log_target = LOG_TARGET_SYSLOG;
+	if (foreground) {
+		log_target |= LOG_TARGET_STDERR;
+	}
 
-	qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, "*", LOG_INFO);
-	qb_log_filter_ctl(QB_LOG_SYSLOG, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, "*", LOG_INFO);
-	qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_PRIORITY_BUMP, LOG_INFO - LOG_DEBUG);
-	qb_log_format_set(QB_LOG_STDERR, "%t %7p %b");
+	res = log_init(QDEVICE_PROGRAM_NAME, log_target, QDEVICE_LOG_DEFAULT_SYSLOG_FACILITY);
+	if (res == -1) {
+		return (res);
+	}
+	log_set_priority_bump(1);
 
 	qdevice_log_configure(instance);
+
+	return (0);
 }
 
 void
 qdevice_log_close(struct qdevice_instance *instance)
 {
 
-	qb_log_fini();
+	log_close();
 }

+ 4 - 13
qdevices/qdevice-log.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -35,24 +35,15 @@
 #ifndef _QDEVICE_LOG_H_
 #define _QDEVICE_LOG_H_
 
-#include <qb/qbdefs.h>
-#include <qb/qblog.h>
-#include <prerror.h>
-
 #include "qdevice-instance.h"
+#include "log.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#define qdevice_log	qb_log
-#define qdevice_log_nss(priority, str) qdevice_log(priority, "%s (%d): %s", \
-    str, PR_GetError(), PR_ErrorToString(PR_GetError(), PR_LANGUAGE_I_DEFAULT));
-
-#define qdevice_log_err(priority, str) qdevice_log(priority, "%s (%d): %s", \
-    str, errno, strerror(errno));
-
-extern void		qdevice_log_init(struct qdevice_instance *instance, int force_debug);
+extern int		qdevice_log_init(struct qdevice_instance *instance, int foreground,
+    int force_debug);
 
 extern void		qdevice_log_configure(struct qdevice_instance *instance);
 

+ 42 - 42
qdevices/qdevice-model-net.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2018 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -54,37 +54,37 @@ qdevice_model_net_init(struct qdevice_instance *instance)
 
 	struct qdevice_net_instance *net_instance;
 
-	qdevice_log(LOG_DEBUG, "Initializing qdevice_net_instance");
+	log(LOG_DEBUG, "Initializing qdevice_net_instance");
 	if (qdevice_net_instance_init_from_cmap(instance) != 0) {
 		return (-1);
 	}
 
 	net_instance = instance->model_data;
 
-	qdevice_log(LOG_DEBUG, "Registering algorithms");
+	log(LOG_DEBUG, "Registering algorithms");
 	if (qdevice_net_algorithm_register_all() != 0) {
 		return (-1);
 	}
 
-	qdevice_log(LOG_DEBUG, "Initializing NSS");
+	log(LOG_DEBUG, "Initializing NSS");
 	if (nss_sock_init_nss((net_instance->tls_supported != TLV_TLS_UNSUPPORTED ?
 	    instance->advanced_settings->net_nss_db_dir : NULL)) != 0) {
-		qdevice_log_nss(LOG_ERR, "Can't init nss");
+		log_nss(LOG_ERR, "Can't init nss");
 		return (-1);
 	}
 
 	if (qdevice_net_cast_vote_timer_update(net_instance, TLV_VOTE_ASK_LATER) != 0) {
-		qdevice_log(LOG_ERR, "Can't update cast vote timer");
+		log(LOG_ERR, "Can't update cast vote timer");
 		return (-1);
 	}
 
 	if (qdevice_net_algorithm_init(net_instance) != 0) {
-		qdevice_log(LOG_ERR, "Algorithm init failed");
+		log(LOG_ERR, "Algorithm init failed");
 		return (-1);
 	}
 
 	if (qdevice_net_heuristics_init(net_instance) != 0) {
-		qdevice_log(LOG_ERR, "Can't initialize net heuristics");
+		log(LOG_ERR, "Can't initialize net heuristics");
 		return (-1);
 	}
 
@@ -98,21 +98,21 @@ qdevice_model_net_destroy(struct qdevice_instance *instance)
 
 	net_instance = instance->model_data;
 
-	qdevice_log(LOG_DEBUG, "Destroying algorithm");
+	log(LOG_DEBUG, "Destroying algorithm");
 	qdevice_net_algorithm_destroy(net_instance);
 
-	qdevice_log(LOG_DEBUG, "Destroying qdevice_net_instance");
+	log(LOG_DEBUG, "Destroying qdevice_net_instance");
 	qdevice_net_instance_destroy(net_instance);
 
-	qdevice_log(LOG_DEBUG, "Shutting down NSS");
+	log(LOG_DEBUG, "Shutting down NSS");
 	SSL_ClearSessionCache();
 
 	if (NSS_Shutdown() != SECSuccess) {
-		qdevice_log_nss(LOG_WARNING, "Can't shutdown NSS");
+		log_nss(LOG_WARNING, "Can't shutdown NSS");
 	}
 
 	if (PR_Cleanup() != PR_SUCCESS) {
-		qdevice_log_nss(LOG_WARNING, "Can't shutdown NSPR");
+		log_nss(LOG_WARNING, "Can't shutdown NSPR");
 	}
 
 	free(net_instance);
@@ -127,7 +127,7 @@ qdevice_model_net_timer_connect_timeout(void *data1, void *data2)
 
 	instance = (struct qdevice_net_instance *)data1;
 
-	qdevice_log(LOG_ERR, "Connect timeout");
+	log(LOG_ERR, "Connect timeout");
 
 	instance->schedule_disconnect = 1;
 
@@ -166,7 +166,7 @@ qdevice_model_net_run(struct qdevice_instance *instance)
 
 	net_instance = instance->model_data;
 
-	qdevice_log(LOG_DEBUG, "Executing qdevice-net");
+	log(LOG_DEBUG, "Executing qdevice-net");
 
 	ret_val = -1;
 
@@ -180,25 +180,25 @@ qdevice_model_net_run(struct qdevice_instance *instance)
 			(void *)net_instance, NULL);
 
 		if (net_instance->connect_timer == NULL) {
-			qdevice_log(LOG_CRIT, "Can't schedule connect timer");
+			log(LOG_CRIT, "Can't schedule connect timer");
 
 			try_connect = 0;
 			break;
 		}
 
-		qdevice_log(LOG_DEBUG, "Trying connect to qnetd server %s:%u (timeout = %ums)",
+		log(LOG_DEBUG, "Trying connect to qnetd server %s:%u (timeout = %ums)",
 		    net_instance->host_addr, net_instance->host_port, net_instance->connect_timeout);
 
 		res = nss_sock_non_blocking_client_init(net_instance->host_addr,
 		    net_instance->host_port, qdevice_model_net_get_af(net_instance),
 		    &net_instance->non_blocking_client);
 		if (res == -1) {
-			qdevice_log_nss(LOG_ERR, "Can't initialize non blocking client connection");
+			log_nss(LOG_ERR, "Can't initialize non blocking client connection");
 		}
 
 		res = nss_sock_non_blocking_client_try_next(&net_instance->non_blocking_client);
 		if (res == -1) {
-			qdevice_log_nss(LOG_ERR, "Can't connect to qnetd host");
+			log_nss(LOG_ERR, "Can't connect to qnetd host");
 			nss_sock_non_blocking_client_destroy(&net_instance->non_blocking_client);
 		}
 
@@ -226,15 +226,15 @@ qdevice_model_net_run(struct qdevice_instance *instance)
 
 		if (qdevice_net_algorithm_disconnected(net_instance,
 		    net_instance->disconnect_reason, &try_connect, &vote) != 0) {
-			qdevice_log(LOG_ERR, "Algorithm returned error, force exit");
+			log(LOG_ERR, "Algorithm returned error, force exit");
 			return (-1);
 		} else {
-			qdevice_log(LOG_DEBUG, "Algorithm result vote is %s",
+			log(LOG_DEBUG, "Algorithm result vote is %s",
 			    tlv_vote_to_str(vote));
 		}
 
 		if (qdevice_net_cast_vote_timer_update(net_instance, vote) != 0) {
-			qdevice_log(LOG_ERR, "qdevice_model_net_run fatal error. "
+			log(LOG_ERR, "qdevice_model_net_run fatal error. "
 			    " Can't update cast vote timer vote");
 		}
 
@@ -251,7 +251,7 @@ qdevice_model_net_run(struct qdevice_instance *instance)
 
 		if (net_instance->socket != NULL) {
 			if (PR_Close(net_instance->socket) != PR_SUCCESS) {
-				qdevice_log_nss(LOG_WARNING, "Unable to close connection");
+				log_nss(LOG_WARNING, "Unable to close connection");
 			}
 			net_instance->socket = NULL;
 		}
@@ -262,7 +262,7 @@ qdevice_model_net_run(struct qdevice_instance *instance)
 
 		if (net_instance->non_blocking_client.socket != NULL) {
 			if (PR_Close(net_instance->non_blocking_client.socket) != PR_SUCCESS) {
-				qdevice_log_nss(LOG_WARNING, "Unable to close non-blocking client connection");
+				log_nss(LOG_WARNING, "Unable to close non-blocking client connection");
 			}
 			net_instance->non_blocking_client.socket = NULL;
 		}
@@ -275,7 +275,7 @@ qdevice_model_net_run(struct qdevice_instance *instance)
 			delay_before_reconnect = random() %
 			    (int)(net_instance->cast_vote_timer_interval * 0.9);
 
-			qdevice_log(LOG_DEBUG, "Sleeping for %u ms before reconnect",
+			log(LOG_DEBUG, "Sleeping for %u ms before reconnect",
 			    delay_before_reconnect);
 			(void)poll(NULL, 0, delay_before_reconnect);
 		}
@@ -323,19 +323,19 @@ qdevice_model_net_config_node_list_changed(struct qdevice_instance *instance,
 
 	if (qdevice_net_algorithm_config_node_list_changed(net_instance, nlist, config_version_set,
 	    config_version, &send_node_list, &vote) != 0) {
-		qdevice_log(LOG_ERR, "Algorithm returned error, Disconnecting");
+		log(LOG_ERR, "Algorithm returned error, Disconnecting");
 
 		net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_ALGO_CONFIG_NODE_LIST_CHANGED_ERR;
 		net_instance->schedule_disconnect = 1;
 
 		return (0);
 	} else {
-		qdevice_log(LOG_DEBUG, "Algorithm decided to %s node list and result vote is %s",
+		log(LOG_DEBUG, "Algorithm decided to %s node list and result vote is %s",
 		    (send_node_list ? "send" : "not send"), tlv_vote_to_str(vote));
 	}
 
 	if (qdevice_net_cast_vote_timer_update(net_instance, vote) != 0) {
-		qdevice_log(LOG_CRIT, "qdevice_model_net_config_node_list_changed fatal error. "
+		log(LOG_CRIT, "qdevice_model_net_config_node_list_changed fatal error. "
 				" Can't update cast vote timer vote");
 		net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_SCHEDULE_VOTING_TIMER;
 		net_instance->schedule_disconnect = 1;
@@ -403,19 +403,19 @@ qdevice_model_net_votequorum_quorum_notify(struct qdevice_instance *instance,
 
 	if (qdevice_net_algorithm_votequorum_quorum_notify(net_instance, quorate,
 	    node_list_entries, node_list, &send_node_list, &vote) != 0) {
-		qdevice_log(LOG_ERR, "Algorithm returned error. Disconnecting.");
+		log(LOG_ERR, "Algorithm returned error. Disconnecting.");
 
 		net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_ALGO_VOTEQUORUM_QUORUM_NOTIFY_ERR;
 		net_instance->schedule_disconnect = 1;
 
 		return (0);
 	} else {
-		qdevice_log(LOG_DEBUG, "Algorithm decided to %s list and result vote is %s",
+		log(LOG_DEBUG, "Algorithm decided to %s list and result vote is %s",
 		    (send_node_list ? "send" : "not send"), tlv_vote_to_str(vote));
 	}
 
 	if (qdevice_net_cast_vote_timer_update(net_instance, vote) != 0) {
-		qdevice_log(LOG_CRIT, "qdevice_model_net_votequorum_quorum_notify fatal error. "
+		log(LOG_CRIT, "qdevice_model_net_votequorum_quorum_notify fatal error. "
 				" Can't update cast vote timer vote");
 		net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_SCHEDULE_VOTING_TIMER;
 		net_instance->schedule_disconnect = 1;
@@ -474,7 +474,7 @@ qdevice_model_net_votequorum_node_list_heuristics_notify(struct qdevice_instance
 
 	if (qdevice_net_algorithm_votequorum_node_list_heuristics_notify(net_instance, &tlv_rid,
 	    node_list_entries, node_list, &send_node_list, &vote, &heuristics) != 0) {
-		qdevice_log(LOG_ERR, "Algorithm returned error. Disconnecting.");
+		log(LOG_ERR, "Algorithm returned error. Disconnecting.");
 
 		net_instance->disconnect_reason =
 		    QDEVICE_NET_DISCONNECT_REASON_ALGO_VOTEQUORUM_NODE_LIST_HEURISTICS_NOTIFY_ERR;
@@ -482,7 +482,7 @@ qdevice_model_net_votequorum_node_list_heuristics_notify(struct qdevice_instance
 
 		return (0);
 	} else {
-		qdevice_log(LOG_DEBUG, "Algorithm decided to %s list, result vote is %s and heuristics is %s",
+		log(LOG_DEBUG, "Algorithm decided to %s list, result vote is %s and heuristics is %s",
 		    (send_node_list ? "send" : "not send"), tlv_vote_to_str(vote),
 		    tlv_heuristics_to_str(heuristics));
 	}
@@ -506,7 +506,7 @@ qdevice_model_net_votequorum_node_list_heuristics_notify(struct qdevice_instance
 	qdevice_net_cast_vote_timer_set_paused(net_instance, 0);
 
 	if (qdevice_net_cast_vote_timer_update(net_instance, vote) != 0) {
-		qdevice_log(LOG_CRIT, "qdevice_model_net_votequorum_node_list_notify fatal error "
+		log(LOG_CRIT, "qdevice_model_net_votequorum_node_list_notify fatal error "
 		    "Can't update cast vote timer");
 		net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_SCHEDULE_VOTING_TIMER;
 		net_instance->schedule_disconnect = 1;
@@ -561,19 +561,19 @@ qdevice_model_net_votequorum_node_list_notify(struct qdevice_instance *instance,
 
 	if (qdevice_net_algorithm_votequorum_node_list_notify(net_instance, &tlv_rid,
 	    node_list_entries, node_list, &pause_cast_vote_timer, &vote) != 0) {
-		qdevice_log(LOG_ERR, "Algorithm returned error. Disconnecting.");
+		log(LOG_ERR, "Algorithm returned error. Disconnecting.");
 
 		net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_ALGO_VOTEQUORUM_NODE_LIST_NOTIFY_ERR;
 		net_instance->schedule_disconnect = 1;
 
 		return (0);
 	} else {
-		qdevice_log(LOG_DEBUG, "Algorithm decided to %s cast vote timer and result vote is %s ",
+		log(LOG_DEBUG, "Algorithm decided to %s cast vote timer and result vote is %s ",
 		    (pause_cast_vote_timer ? "pause" : "not pause"), tlv_vote_to_str(vote));
 	}
 
 	if (qdevice_net_cast_vote_timer_update(net_instance, vote) != 0) {
-		qdevice_log(LOG_CRIT, "qdevice_model_net_votequorum_node_list_notify fatal error "
+		log(LOG_CRIT, "qdevice_model_net_votequorum_node_list_notify fatal error "
 		    "Can't update cast vote timer");
 		net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_SCHEDULE_VOTING_TIMER;
 		net_instance->schedule_disconnect = 1;
@@ -595,7 +595,7 @@ qdevice_model_net_votequorum_expected_votes_notify(struct qdevice_instance *inst
 
 	net_instance = instance->model_data;
 
-	qdevice_log(LOG_DEBUG, "qdevice_model_net_votequorum_expected_votes_notify"
+	log(LOG_DEBUG, "qdevice_model_net_votequorum_expected_votes_notify"
 	    " (expected votes old=%"PRIu32" / new=%"PRIu32")",
 	    net_instance->qdevice_instance_ptr->vq_expected_votes, expected_votes);
 
@@ -603,18 +603,18 @@ qdevice_model_net_votequorum_expected_votes_notify(struct qdevice_instance *inst
 
 	if (qdevice_net_algorithm_votequorum_expected_votes_notify(net_instance, expected_votes,
 	    &vote) != 0) {
-		qdevice_log(LOG_DEBUG, "Algorithm returned error. Disconnecting.");
+		log(LOG_DEBUG, "Algorithm returned error. Disconnecting.");
 
 		net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_ALGO_VOTEQUORUM_EXPECTED_VOTES_NOTIFY_ERR;
 		net_instance->schedule_disconnect = 1;
 
 		return (0);
 	} else {
-		qdevice_log(LOG_DEBUG, "Algorithm result vote is %s", tlv_vote_to_str(vote));
+		log(LOG_DEBUG, "Algorithm result vote is %s", tlv_vote_to_str(vote));
 	}
 
 	if (qdevice_net_cast_vote_timer_update(net_instance, vote) != 0) {
-		qdevice_log(LOG_CRIT, "qdevice_model_net_votequorum_expected_votes_notify fatal error. "
+		log(LOG_CRIT, "qdevice_model_net_votequorum_expected_votes_notify fatal error. "
 				" Can't update cast vote timer vote");
 		net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_SCHEDULE_VOTING_TIMER;
 		net_instance->schedule_disconnect = 1;
@@ -642,7 +642,7 @@ qdevice_model_net_cmap_changed(struct qdevice_instance *instance,
 
 		if (net_instance->state == QDEVICE_NET_INSTANCE_STATE_WAITING_VOTEQUORUM_CMAP_EVENTS &&
 		    !net_instance->server_supports_heuristics && heuristics_enabled) {
-			qdevice_log(LOG_ERR, "Heuristics are enabled but not supported by the server");
+			log(LOG_ERR, "Heuristics are enabled but not supported by the server");
 
 			net_instance->disconnect_reason =
 			    QDEVICE_NET_DISCONNECT_REASON_SERVER_DOESNT_SUPPORT_REQUIRED_OPT;

+ 13 - 13
qdevices/qdevice-model.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -44,7 +44,7 @@ qdevice_model_init(struct qdevice_instance *instance)
 
 	if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
 	    qdevice_model_array[instance->model_type] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_model_init unhandled model");
+		log(LOG_CRIT, "qdevice_model_init unhandled model");
 		exit(1);
 	}
 
@@ -57,7 +57,7 @@ qdevice_model_destroy(struct qdevice_instance *instance)
 
 	if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
 	    qdevice_model_array[instance->model_type] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_model_destroy unhandled model");
+		log(LOG_CRIT, "qdevice_model_destroy unhandled model");
 		exit(1);
 	}
 
@@ -70,7 +70,7 @@ qdevice_model_run(struct qdevice_instance *instance)
 
 	if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
 	    qdevice_model_array[instance->model_type] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_model_run unhandled model");
+		log(LOG_CRIT, "qdevice_model_run unhandled model");
 		exit(1);
 	}
 
@@ -83,7 +83,7 @@ qdevice_model_get_config_node_list_failed(struct qdevice_instance *instance)
 
 	if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
 	    qdevice_model_array[instance->model_type] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_model_run unhandled model");
+		log(LOG_CRIT, "qdevice_model_run unhandled model");
 		exit(1);
 	}
 
@@ -97,7 +97,7 @@ qdevice_model_config_node_list_changed(struct qdevice_instance *instance,
 
 	if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
 	    qdevice_model_array[instance->model_type] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_model_run unhandled model");
+		log(LOG_CRIT, "qdevice_model_run unhandled model");
 		exit(1);
 	}
 
@@ -112,7 +112,7 @@ qdevice_model_votequorum_quorum_notify(struct qdevice_instance *instance,
 
 	if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
 	    qdevice_model_array[instance->model_type] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_model_votequorum_quorum_notify unhandled model");
+		log(LOG_CRIT, "qdevice_model_votequorum_quorum_notify unhandled model");
 		exit(1);
 	}
 
@@ -127,7 +127,7 @@ qdevice_model_votequorum_node_list_notify(struct qdevice_instance *instance,
 
 	if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
 	    qdevice_model_array[instance->model_type] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_model_votequorum_node_list_notify unhandled model");
+		log(LOG_CRIT, "qdevice_model_votequorum_node_list_notify unhandled model");
 		exit(1);
 	}
 
@@ -143,7 +143,7 @@ qdevice_model_votequorum_node_list_heuristics_notify(struct qdevice_instance *in
 
 	if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
 	    qdevice_model_array[instance->model_type] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_model_votequorum_node_list_heuristics_notify unhandled model");
+		log(LOG_CRIT, "qdevice_model_votequorum_node_list_heuristics_notify unhandled model");
 		exit(1);
 	}
 
@@ -159,7 +159,7 @@ qdevice_model_votequorum_expected_votes_notify(struct qdevice_instance *instance
 
 	if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
 	    qdevice_model_array[instance->model_type] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_model_votequorum_expected_votes_notify unhandled model");
+		log(LOG_CRIT, "qdevice_model_votequorum_expected_votes_notify unhandled model");
 		exit(1);
 	}
 
@@ -173,7 +173,7 @@ qdevice_model_ipc_cmd_status(struct qdevice_instance *instance, struct dynar *ou
 
 	if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
 	    qdevice_model_array[instance->model_type] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_model_ipc_cmd_status unhandled model");
+		log(LOG_CRIT, "qdevice_model_ipc_cmd_status unhandled model");
 		exit(1);
 	}
 
@@ -188,7 +188,7 @@ qdevice_model_cmap_changed(struct qdevice_instance *instance,
 
 	if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
 	    qdevice_model_array[instance->model_type] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_model_cmap_chaged unhandled model");
+		log(LOG_CRIT, "qdevice_model_cmap_chaged unhandled model");
 		exit(1);
 	}
 
@@ -219,7 +219,7 @@ qdevice_model_register_all(void)
 {
 
 	if (qdevice_model_net_register() != 0) {
-		qdevice_log(LOG_CRIT, "Failed to register model 'net' ");
+		log(LOG_CRIT, "Failed to register model 'net' ");
 		exit(1);
 	}
 }

+ 5 - 5
qdevices/qdevice-net-algo-ffsplit.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2017 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -62,14 +62,14 @@ check_vqinfo_validity(struct qdevice_net_instance *instance)
 		if (cs_res == CS_ERR_NOT_EXIST) {
 			continue;
 		} else if (cs_res != CS_OK) {
-			qdevice_log(LOG_CRIT, "Can't get votequorum information for node "
+			log(LOG_CRIT, "Can't get votequorum information for node "
 			    UTILS_PRI_NODE_ID ". Error %s", node_id, cs_strerror(cs_res));
 
 			return (-1);
 		}
 
 		if (vq_info.node_votes != 1) {
-			qdevice_log(LOG_CRIT, "50:50 split algorithm works only if all nodes have "
+			log(LOG_CRIT, "50:50 split algorithm works only if all nodes have "
 			    "exactly 1 vote. Node " UTILS_PRI_NODE_ID " has %u votes!",
 			    node_id, vq_info.node_votes);
 
@@ -77,7 +77,7 @@ check_vqinfo_validity(struct qdevice_net_instance *instance)
 		}
 
 		if (vq_info.qdevice_votes != 1) {
-			qdevice_log(LOG_CRIT, "50:50 split algorithm works only if qdevice has "
+			log(LOG_CRIT, "50:50 split algorithm works only if qdevice has "
 			    "exactly 1 vote. Node "UTILS_PRI_NODE_ID" has %u votes!",
 			    node_id, vq_info.qdevice_votes);
 
@@ -98,7 +98,7 @@ check_cmap_validity(struct qdevice_net_instance *instance)
 
 	if (cmap_get_uint32(qdev_instance->cmap_handle, "quorum.device.votes", &qdevice_votes) != CS_OK ||
 	    qdevice_votes != 1) {
-		qdevice_log(LOG_CRIT, "50:50 split algorithm works only if quorum.device.votes"
+		log(LOG_CRIT, "50:50 split algorithm works only if quorum.device.votes"
 		    " configuration key is set to 1!");
 
 		return (-1);

+ 7 - 7
qdevices/qdevice-net-algo-lms.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2017 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -63,11 +63,11 @@ qdevice_net_algo_lms_init(struct qdevice_net_instance *instance)
 	data->vote = TLV_VOTE_ASK_LATER;
 	res = cmap_get_uint8(instance->qdevice_instance_ptr->cmap_handle, "quorum.wait_for_all", &data->have_wfa);
 	if (res != CS_OK) {
-		qdevice_log(LOG_DEBUG, "algo-lms: Can't get WFA res = %d", res);
+		log(LOG_DEBUG, "algo-lms: Can't get WFA res = %d", res);
 		data->have_wfa = 0;
 	}
 
-	qdevice_log(LOG_DEBUG, "algo-lms: initialised. WFA = %d", data->have_wfa);
+	log(LOG_DEBUG, "algo-lms: initialised. WFA = %d", data->have_wfa);
 	return (0);
 }
 
@@ -116,7 +116,7 @@ qdevice_net_algo_lms_votequorum_quorum_notify(struct qdevice_net_instance *insta
 	struct algo_lms_instance_data *data = instance->algorithm_data;
 
 	data->quorate = quorate;
-	qdevice_log(LOG_DEBUG, "algo-lms: quorum_notify. quorate = %d", data->quorate);
+	log(LOG_DEBUG, "algo-lms: quorum_notify. quorate = %d", data->quorate);
 
 	return (0);
 }
@@ -207,7 +207,7 @@ qdevice_net_algo_lms_echo_reply_not_received(struct qdevice_net_instance *instan
 {
 	struct algo_lms_instance_data *data = instance->algorithm_data;
 
-	qdevice_log(LOG_DEBUG, "algo-lms: echo_not_recvd. quorate = %d, WFA = %d", data->quorate, data->have_wfa);
+	log(LOG_DEBUG, "algo-lms: echo_not_recvd. quorate = %d, WFA = %d", data->quorate, data->have_wfa);
 
 	/* qnetd server is disconnected, if we were already quorate AND WFA is enabled
 	   then we can continue to provide our vote.
@@ -247,8 +247,8 @@ qdevice_net_algo_lms_disconnected(struct qdevice_net_instance *instance,
 {
 	struct algo_lms_instance_data *data = instance->algorithm_data;
 
-	qdevice_log(LOG_DEBUG, "algo-lms: disconnected. quorate = %d, WFA = %d", data->quorate, data->have_wfa);
-	qdevice_log(LOG_DEBUG, "algo-lms: disconnected. reason = %d, WFA = %d", disconnect_reason, data->have_wfa);
+	log(LOG_DEBUG, "algo-lms: disconnected. quorate = %d, WFA = %d", data->quorate, data->have_wfa);
+	log(LOG_DEBUG, "algo-lms: disconnected. reason = %d, WFA = %d", disconnect_reason, data->have_wfa);
 
 	if (!data->quorate || !data->have_wfa) {
 		*vote = TLV_VOTE_NACK;

+ 19 - 19
qdevices/qdevice-net-algo-test.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2017 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -52,7 +52,7 @@ qdevice_net_algo_test_init(struct qdevice_net_instance *instance)
 {
 
 	instance->algorithm_data = NULL;
-	qdevice_log(LOG_INFO, "algo-test: Initialized");
+	log(LOG_INFO, "algo-test: Initialized");
 
 	return (0);
 }
@@ -71,7 +71,7 @@ qdevice_net_algo_test_connected(struct qdevice_net_instance *instance, enum tlv_
     int *send_config_node_list, int *send_membership_node_list, int *send_quorum_node_list, enum tlv_vote *vote)
 {
 
-	qdevice_log(LOG_INFO, "algo-test: Connected");
+	log(LOG_INFO, "algo-test: Connected");
 
 	return (0);
 }
@@ -96,7 +96,7 @@ qdevice_net_algo_test_config_node_list_changed(struct qdevice_net_instance *inst
     int *send_node_list, enum tlv_vote *vote)
 {
 
-	qdevice_log(LOG_INFO, "algo-test: Config node list changed");
+	log(LOG_INFO, "algo-test: Config node list changed");
 
 	return (0);
 }
@@ -124,7 +124,7 @@ qdevice_net_algo_test_votequorum_node_list_notify(struct qdevice_net_instance *i
     int *pause_cast_vote_timer, enum tlv_vote *vote)
 {
 
-	qdevice_log(LOG_INFO, "algo-test: Votequorum list notify");
+	log(LOG_INFO, "algo-test: Votequorum list notify");
 
 	return (0);
 }
@@ -150,7 +150,7 @@ qdevice_net_algo_test_votequorum_node_list_heuristics_notify(struct qdevice_net_
     int *send_node_list, enum tlv_vote *vote, enum tlv_heuristics *heuristics)
 {
 
-	qdevice_log(LOG_INFO, "algo-test: Votequorum heuristics list notify");
+	log(LOG_INFO, "algo-test: Votequorum heuristics list notify");
 
 	return (0);
 }
@@ -178,7 +178,7 @@ qdevice_net_algo_test_votequorum_quorum_notify(struct qdevice_net_instance *inst
     enum tlv_vote *vote)
 {
 
-	qdevice_log(LOG_INFO, "algo-test: Votequorum quorum notify");
+	log(LOG_INFO, "algo-test: Votequorum quorum notify");
 
 	return (0);
 }
@@ -194,7 +194,7 @@ qdevice_net_algo_test_votequorum_expected_votes_notify(struct qdevice_net_instan
     uint32_t expected_votes, enum tlv_vote *vote)
 {
 
-	qdevice_log(LOG_INFO, "algo-test: Votequorum expected votes notify");
+	log(LOG_INFO, "algo-test: Votequorum expected votes notify");
 
 	return (0);
 }
@@ -213,7 +213,7 @@ qdevice_net_algo_test_config_node_list_reply_received(struct qdevice_net_instanc
     enum tlv_vote *vote)
 {
 
-	qdevice_log(LOG_INFO, "algo-test: Config node list reply");
+	log(LOG_INFO, "algo-test: Config node list reply");
 
 	if (!ring_id_is_valid) {
 		*vote = TLV_VOTE_NO_CHANGE;
@@ -241,7 +241,7 @@ qdevice_net_algo_test_membership_node_list_reply_received(struct qdevice_net_ins
     enum tlv_vote *vote)
 {
 
-	qdevice_log(LOG_INFO, "algo-test: Membership node list reply");
+	log(LOG_INFO, "algo-test: Membership node list reply");
 
 	if (!ring_id_is_valid) {
 		*vote = TLV_VOTE_NO_CHANGE;
@@ -265,7 +265,7 @@ qdevice_net_algo_test_quorum_node_list_reply_received(struct qdevice_net_instanc
     enum tlv_vote *vote)
 {
 
-	qdevice_log(LOG_INFO, "algo-test: Quorum node list reply");
+	log(LOG_INFO, "algo-test: Quorum node list reply");
 
 	if (!ring_id_is_valid) {
 		*vote = TLV_VOTE_NO_CHANGE;
@@ -288,7 +288,7 @@ qdevice_net_algo_test_ask_for_vote_reply_received(struct qdevice_net_instance *i
     uint32_t seq_number, const struct tlv_ring_id *ring_id, int ring_id_is_valid, enum tlv_vote *vote)
 {
 
-	qdevice_log(LOG_INFO, "algo-test: Ask for vote reply received");
+	log(LOG_INFO, "algo-test: Ask for vote reply received");
 
 	if (!ring_id_is_valid) {
 		*vote = TLV_VOTE_NO_CHANGE;
@@ -311,7 +311,7 @@ qdevice_net_algo_test_vote_info_received(struct qdevice_net_instance *instance,
     uint32_t seq_number, const struct tlv_ring_id *ring_id, int ring_id_is_valid, enum tlv_vote *vote)
 {
 
-	qdevice_log(LOG_INFO, "algo-test: Vote info received");
+	log(LOG_INFO, "algo-test: Vote info received");
 
 	if (!ring_id_is_valid) {
 		*vote = TLV_VOTE_NO_CHANGE;
@@ -331,7 +331,7 @@ qdevice_net_algo_test_echo_reply_received(struct qdevice_net_instance *instance,
     uint32_t seq_number, int is_expected_seq_number)
 {
 
-	qdevice_log(LOG_INFO, "algo-test: Echo reply received");
+	log(LOG_INFO, "algo-test: Echo reply received");
 
 	return (is_expected_seq_number ? 0 : -1);
 }
@@ -347,7 +347,7 @@ int
 qdevice_net_algo_test_echo_reply_not_received(struct qdevice_net_instance *instance)
 {
 
-	qdevice_log(LOG_INFO, "algo-test: Echo reply not received");
+	log(LOG_INFO, "algo-test: Echo reply not received");
 
 	return (-1);
 }
@@ -369,7 +369,7 @@ qdevice_net_algo_test_heuristics_change(struct qdevice_net_instance *instance,
     enum tlv_heuristics *heuristics, int *send_msg, enum tlv_vote *vote)
 {
 
-	qdevice_log(LOG_INFO, "algo-test: Heuristics change");
+	log(LOG_INFO, "algo-test: Heuristics change");
 
 	return (0);
 }
@@ -391,7 +391,7 @@ qdevice_net_algo_test_heuristics_change_reply_received(struct qdevice_net_instan
     enum tlv_heuristics heuristics, enum tlv_vote *vote)
 {
 
-	qdevice_log(LOG_INFO, "algo-test: heuristics change reply received");
+	log(LOG_INFO, "algo-test: heuristics change reply received");
 
 	if (!ring_id_is_valid) {
 		*vote = TLV_VOTE_NO_CHANGE;
@@ -414,7 +414,7 @@ qdevice_net_algo_test_disconnected(struct qdevice_net_instance *instance,
     enum qdevice_net_disconnect_reason disconnect_reason, int *try_reconnect, enum tlv_vote *vote)
 {
 
-	qdevice_log(LOG_INFO, "algo-test: Disconnected");
+	log(LOG_INFO, "algo-test: Disconnected");
 
 	return (0);
 }
@@ -426,7 +426,7 @@ void
 qdevice_net_algo_test_destroy(struct qdevice_net_instance *instance)
 {
 
-	qdevice_log(LOG_INFO, "algo-test: Destroy");
+	log(LOG_INFO, "algo-test: Destroy");
 }
 
 static struct qdevice_net_algorithm qdevice_net_algo_test = {

+ 23 - 23
qdevices/qdevice-net-algorithm.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2017 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -51,7 +51,7 @@ qdevice_net_algorithm_init(struct qdevice_net_instance *instance)
 
 	if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
 	    qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_algorithm_init unhandled decision algorithm");
+		log(LOG_CRIT, "qdevice_net_algorithm_init unhandled decision algorithm");
 		exit(1);
 	}
 
@@ -65,7 +65,7 @@ qdevice_net_algorithm_connected(struct qdevice_net_instance *instance, enum tlv_
 
 	if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
 	    qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_algorithm_connected unhandled decision algorithm");
+		log(LOG_CRIT, "qdevice_net_algorithm_connected unhandled decision algorithm");
 		exit(1);
 	}
 
@@ -81,7 +81,7 @@ qdevice_net_algorithm_config_node_list_changed(struct qdevice_net_instance *inst
 
 	if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
 	    qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_algorithm_connected unhandled decision algorithm");
+		log(LOG_CRIT, "qdevice_net_algorithm_connected unhandled decision algorithm");
 		exit(1);
 	}
 
@@ -98,7 +98,7 @@ qdevice_net_algorithm_votequorum_node_list_notify(struct qdevice_net_instance *i
 
 	if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
 	    qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_algorithm_votequorum_node_list_notify "
+		log(LOG_CRIT, "qdevice_net_algorithm_votequorum_node_list_notify "
 		    "unhandled decision algorithm");
 		exit(1);
 	}
@@ -115,7 +115,7 @@ qdevice_net_algorithm_votequorum_node_list_heuristics_notify(struct qdevice_net_
 
 	if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
 	    qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_algorithm_votequorum_node_list_heuristics_notify "
+		log(LOG_CRIT, "qdevice_net_algorithm_votequorum_node_list_heuristics_notify "
 		    "unhandled decision algorithm");
 		exit(1);
 	}
@@ -133,7 +133,7 @@ qdevice_net_algorithm_votequorum_quorum_notify(struct qdevice_net_instance *inst
 
 	if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
 	    qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_algorithm_votequorum_quorum_notify "
+		log(LOG_CRIT, "qdevice_net_algorithm_votequorum_quorum_notify "
 		    "unhandled decision algorithm");
 		exit(1);
 	}
@@ -150,7 +150,7 @@ qdevice_net_algorithm_votequorum_expected_votes_notify(struct qdevice_net_instan
 
 	if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
 	    qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_algorithm_votequorum_expected_votes_notify "
+		log(LOG_CRIT, "qdevice_net_algorithm_votequorum_expected_votes_notify "
 		    "unhandled decision algorithm");
 		exit(1);
 	}
@@ -167,7 +167,7 @@ qdevice_net_algorithm_config_node_list_reply_received(struct qdevice_net_instanc
 
 	if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
 	    qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_algorithm_config_node_list_reply_received "
+		log(LOG_CRIT, "qdevice_net_algorithm_config_node_list_reply_received "
 		    "unhandled decision algorithm");
 		exit(1);
 	}
@@ -184,7 +184,7 @@ qdevice_net_algorithm_membership_node_list_reply_received(struct qdevice_net_ins
 
 	if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
 	    qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_algorithm_membership_node_list_reply_received "
+		log(LOG_CRIT, "qdevice_net_algorithm_membership_node_list_reply_received "
 		    "unhandled decision algorithm");
 		exit(1);
 	}
@@ -202,7 +202,7 @@ qdevice_net_algorithm_quorum_node_list_reply_received(struct qdevice_net_instanc
 
 	if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
 	    qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_algorithm_quorum_node_list_reply_received "
+		log(LOG_CRIT, "qdevice_net_algorithm_quorum_node_list_reply_received "
 		    "unhandled decision algorithm");
 		exit(1);
 	}
@@ -220,7 +220,7 @@ qdevice_net_algorithm_ask_for_vote_reply_received(struct qdevice_net_instance *i
 
 	if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
 	    qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_algorithm_ask_for_vote_reply_received "
+		log(LOG_CRIT, "qdevice_net_algorithm_ask_for_vote_reply_received "
 		    "unhandled decision algorithm");
 		exit(1);
 	}
@@ -237,7 +237,7 @@ qdevice_net_algorithm_vote_info_received(struct qdevice_net_instance *instance,
 
 	if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
 	    qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_algorithm_vote_info_received "
+		log(LOG_CRIT, "qdevice_net_algorithm_vote_info_received "
 		    "unhandled decision algorithm");
 		exit(1);
 	}
@@ -253,7 +253,7 @@ qdevice_net_algorithm_echo_reply_received(struct qdevice_net_instance *instance,
 
 	if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
 	    qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_algorithm_echo_reply_received "
+		log(LOG_CRIT, "qdevice_net_algorithm_echo_reply_received "
 		    "unhandled decision algorithm");
 		exit(1);
 	}
@@ -268,7 +268,7 @@ qdevice_net_algorithm_echo_reply_not_received(struct qdevice_net_instance *insta
 
 	if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
 	    qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_algorithm_echo_reply_not_received "
+		log(LOG_CRIT, "qdevice_net_algorithm_echo_reply_not_received "
 		    "unhandled decision algorithm");
 		exit(1);
 	}
@@ -284,7 +284,7 @@ qdevice_net_algorithm_heuristics_change(struct qdevice_net_instance *instance,
 
 	if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
 	    qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_algorithm_heuristics_change "
+		log(LOG_CRIT, "qdevice_net_algorithm_heuristics_change "
 		    "unhandled decision algorithm");
 		exit(1);
 	}
@@ -301,7 +301,7 @@ qdevice_net_algorithm_heuristics_change_reply_received(struct qdevice_net_instan
 
 	if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
 	    qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_algorithm_heuristics_change_reply_received "
+		log(LOG_CRIT, "qdevice_net_algorithm_heuristics_change_reply_received "
 		    "unhandled decision algorithm");
 		exit(1);
 	}
@@ -318,7 +318,7 @@ qdevice_net_algorithm_disconnected(struct qdevice_net_instance *instance,
 
 	if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
 	    qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_algorithm_disconnected "
+		log(LOG_CRIT, "qdevice_net_algorithm_disconnected "
 		    "unhandled decision algorithm");
 		exit(1);
 	}
@@ -333,7 +333,7 @@ qdevice_net_algorithm_destroy(struct qdevice_net_instance *instance)
 
 	if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
 	    qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_algorithm_destroy "
+		log(LOG_CRIT, "qdevice_net_algorithm_destroy "
 		    "unhandled decision algorithm");
 		exit(1);
 	}
@@ -365,22 +365,22 @@ qdevice_net_algorithm_register_all(void)
 {
 
 	if (qdevice_net_algo_test_register() != 0) {
-		qdevice_log(LOG_CRIT, "Failed to register decision algorithm 'test' ");
+		log(LOG_CRIT, "Failed to register decision algorithm 'test' ");
 		return (-1);
 	}
 
 	if (qdevice_net_algo_ffsplit_register() != 0) {
-		qdevice_log(LOG_CRIT, "Failed to register decision algorithm 'ffsplit' ");
+		log(LOG_CRIT, "Failed to register decision algorithm 'ffsplit' ");
 		return (-1);
 	}
 
 	if (qdevice_net_algo_2nodelms_register() != 0) {
-		qdevice_log(LOG_CRIT, "Failed to register decision algorithm '2nodelms' ");
+		log(LOG_CRIT, "Failed to register decision algorithm '2nodelms' ");
 		return (-1);
 	}
 
 	if (qdevice_net_algo_lms_register() != 0) {
-		qdevice_log(LOG_CRIT, "Failed to register decision algorithm 'lms' ");
+		log(LOG_CRIT, "Failed to register decision algorithm 'lms' ");
 		return (-1);
 	}
 

+ 10 - 10
qdevices/qdevice-net-cast-vote-timer.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2017 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -76,7 +76,7 @@ qdevice_net_cast_vote_timer_callback(void *data1, void *data2)
 	}
 
 	if (!case_processed) {
-		qdevice_log(LOG_CRIT, "qdevice_net_timer_cast_vote: Unhandled cast_vote_timer_vote %u\n",
+		log(LOG_CRIT, "qdevice_net_timer_cast_vote: Unhandled cast_vote_timer_vote %u\n",
 		    instance->cast_vote_timer_vote);
 		exit(1);
 	}
@@ -127,7 +127,7 @@ qdevice_net_cast_vote_timer_update(struct qdevice_net_instance *instance, enum t
 	}
 
 	if (!case_processed) {
-		qdevice_log(LOG_CRIT, "qdevice_net_cast_vote_timer_update_vote: Unhandled vote parameter %u\n",
+		log(LOG_CRIT, "qdevice_net_cast_vote_timer_update_vote: Unhandled vote parameter %u\n",
 		    vote);
 		exit(1);
 	}
@@ -141,17 +141,17 @@ qdevice_net_cast_vote_timer_update(struct qdevice_net_instance *instance, enum t
 			    qdevice_net_cast_vote_timer_callback, (void *)instance, NULL);
 
 			if (instance->cast_vote_timer == NULL) {
-				qdevice_log(LOG_ERR, "Can't schedule sending of "
+				log(LOG_ERR, "Can't schedule sending of "
 				    "votequorum poll");
 
 				return (-1);
 			} else {
-				qdevice_log(LOG_DEBUG, "Cast vote timer is now scheduled every "
+				log(LOG_DEBUG, "Cast vote timer is now scheduled every "
 				    "%"PRIu32"ms voting %s.", instance->cast_vote_timer_interval,
 				    tlv_vote_to_str(instance->cast_vote_timer_vote));
 			}
 		} else {
-			qdevice_log(LOG_DEBUG, "Cast vote timer remains scheduled every "
+			log(LOG_DEBUG, "Cast vote timer remains scheduled every "
 			    "%"PRIu32"ms voting %s.", instance->cast_vote_timer_interval,
 			    tlv_vote_to_str(instance->cast_vote_timer_vote));
 		}
@@ -163,9 +163,9 @@ qdevice_net_cast_vote_timer_update(struct qdevice_net_instance *instance, enum t
 		if (instance->cast_vote_timer != NULL) {
 			timer_list_delete(&instance->main_timer_list, instance->cast_vote_timer);
 			instance->cast_vote_timer = NULL;
-			qdevice_log(LOG_DEBUG, "Cast vote timer is now stopped.");
+			log(LOG_DEBUG, "Cast vote timer is now stopped.");
 		} else {
-			qdevice_log(LOG_DEBUG, "Cast vote timer remains stopped.");
+			log(LOG_DEBUG, "Cast vote timer remains stopped.");
 		}
 	}
 
@@ -180,9 +180,9 @@ qdevice_net_cast_vote_timer_set_paused(struct qdevice_net_instance *instance, in
 		instance->cast_vote_timer_paused = paused;
 
 		if (instance->cast_vote_timer_paused) {
-			qdevice_log(LOG_DEBUG, "Cast vote timer is now paused.");
+			log(LOG_DEBUG, "Cast vote timer is now paused.");
 		} else {
-			qdevice_log(LOG_DEBUG, "Cast vote timer is no longer paused.");
+			log(LOG_DEBUG, "Cast vote timer is no longer paused.");
 		}
 	}
 }

+ 6 - 6
qdevices/qdevice-net-echo-request-timer.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -46,10 +46,10 @@ qdevice_net_echo_request_timer_callback(void *data1, void *data2)
 
 	if (instance->echo_reply_received_msg_seq_num !=
 	    instance->echo_request_expected_msg_seq_num) {
-		qdevice_log(LOG_ERR, "Server didn't send echo reply message on time");
+		log(LOG_ERR, "Server didn't send echo reply message on time");
 
 		if (qdevice_net_algorithm_echo_reply_not_received(instance) != 0) {
-			qdevice_log(LOG_DEBUG, "Algorithm decided to disconnect");
+			log(LOG_DEBUG, "Algorithm decided to disconnect");
 
 			instance->schedule_disconnect = 1;
 			instance->disconnect_reason =
@@ -58,7 +58,7 @@ qdevice_net_echo_request_timer_callback(void *data1, void *data2)
 			instance->echo_request_timer = NULL;
 			return (0);
 		} else {
-			qdevice_log(LOG_DEBUG, "Algorithm decided to continue send heartbeat");
+			log(LOG_DEBUG, "Algorithm decided to continue send heartbeat");
 
 			return (-1);
 		}
@@ -89,13 +89,13 @@ qdevice_net_echo_request_timer_schedule(struct qdevice_net_instance *instance)
 		instance->echo_request_timer = NULL;
 	}
 
-	qdevice_log(LOG_DEBUG, "Scheduling send of heartbeat every %"PRIu32"ms", instance->heartbeat_interval);
+	log(LOG_DEBUG, "Scheduling send of heartbeat every %"PRIu32"ms", instance->heartbeat_interval);
 	instance->echo_request_timer = timer_list_add(&instance->main_timer_list,
 	    instance->heartbeat_interval, qdevice_net_echo_request_timer_callback,
 	    (void *)instance, NULL);
 
 	if (instance->echo_request_timer == NULL) {
-		qdevice_log(LOG_ERR, "Can't schedule regular sending of heartbeat.");
+		log(LOG_ERR, "Can't schedule regular sending of heartbeat.");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_SCHEDULE_HB_TIMER;
 

+ 28 - 28
qdevices/qdevice-net-heuristics.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Red Hat, Inc.
+ * Copyright (c) 2017-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -49,7 +49,7 @@ qdevice_net_heuristics_exec_result_to_tlv(enum qdevice_heuristics_exec_result ex
 	case QDEVICE_HEURISTICS_EXEC_RESULT_PASS: res = TLV_HEURISTICS_PASS; break;
 	case QDEVICE_HEURISTICS_EXEC_RESULT_FAIL: res = TLV_HEURISTICS_FAIL; break;
 	default:
-		qdevice_log(LOG_ERR, "qdevice_net_heuristics_exec_result_to_tlv: Unhandled "
+		log(LOG_ERR, "qdevice_net_heuristics_exec_result_to_tlv: Unhandled "
 		    "heuristics exec result %s",
 		    qdevice_heuristics_exec_result_to_str(exec_result));
 		exit(1);
@@ -76,7 +76,7 @@ qdevice_net_regular_heuristics_exec_result_callback(void *heuristics_instance_pt
 
 	if (qdevice_heuristics_result_notifier_list_set_active(&heuristics_instance->exec_result_notifier_list,
 	    qdevice_net_regular_heuristics_exec_result_callback, 0) != 0) {
-		qdevice_log(LOG_ERR, "Can't deactivate net regular heuristics exec callback notifier");
+		log(LOG_ERR, "Can't deactivate net regular heuristics exec callback notifier");
 
 		net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_ACTIVATE_HEURISTICS_RESULT_NOTIFIER;
 		net_instance->schedule_disconnect = 1;
@@ -94,7 +94,7 @@ qdevice_net_regular_heuristics_exec_result_callback(void *heuristics_instance_pt
 	}
 
 	if (net_instance->latest_heuristics_result != heuristics) {
-		qdevice_log(LOG_ERR, "Heuristics result changed from %s to %s",
+		log(LOG_ERR, "Heuristics result changed from %s to %s",
 		    tlv_heuristics_to_str(net_instance->latest_heuristics_result),
 		    tlv_heuristics_to_str(heuristics));
 
@@ -111,7 +111,7 @@ qdevice_net_regular_heuristics_exec_result_callback(void *heuristics_instance_pt
 
 		if (qdevice_net_algorithm_heuristics_change(net_instance, &heuristics, &send_msg,
 		    &vote) == -1) {
-			qdevice_log(LOG_ERR, "Algorithm returned error. Disconnecting.");
+			log(LOG_ERR, "Algorithm returned error. Disconnecting.");
 
 			net_instance->disconnect_reason =
 			    QDEVICE_NET_DISCONNECT_REASON_ALGO_HEURISTICS_CHANGE_ERR;
@@ -119,14 +119,14 @@ qdevice_net_regular_heuristics_exec_result_callback(void *heuristics_instance_pt
 
 			return (0);
 		} else {
-			qdevice_log(LOG_DEBUG, "Algorithm decided to %s message with heuristics result "
+			log(LOG_DEBUG, "Algorithm decided to %s message with heuristics result "
 			    "%s and result vote is %s", (send_msg ? "send" : "not send"),
 			    tlv_heuristics_to_str(heuristics), tlv_vote_to_str(vote));
 		}
 
 		if (send_msg) {
 			if (heuristics == TLV_HEURISTICS_UNDEFINED) {
-				qdevice_log(LOG_ERR, "Inconsistent algorithm result. "
+				log(LOG_ERR, "Inconsistent algorithm result. "
 				    "It's not possible to send message with undefined heuristics. "
 				    "Disconnecting.");
 
@@ -138,7 +138,7 @@ qdevice_net_regular_heuristics_exec_result_callback(void *heuristics_instance_pt
 			}
 
 			if (!net_instance->server_supports_heuristics) {
-				qdevice_log(LOG_ERR, "Server doesn't support heuristics. "
+				log(LOG_ERR, "Server doesn't support heuristics. "
 				    "Disconnecting.");
 
 				net_instance->disconnect_reason =
@@ -157,7 +157,7 @@ qdevice_net_regular_heuristics_exec_result_callback(void *heuristics_instance_pt
 		}
 
 		if (qdevice_net_cast_vote_timer_update(net_instance, vote) != 0) {
-			qdevice_log(LOG_CRIT, "qdevice_net_heuristics_exec_result_callback "
+			log(LOG_CRIT, "qdevice_net_heuristics_exec_result_callback "
 			    "Can't update cast vote timer");
 
 			net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_SCHEDULE_VOTING_TIMER;
@@ -199,7 +199,7 @@ qdevice_net_connect_heuristics_exec_result_callback(void *heuristics_instance_pt
 
 	if (qdevice_heuristics_result_notifier_list_set_active(&heuristics_instance->exec_result_notifier_list,
 	    qdevice_net_connect_heuristics_exec_result_callback, 0) != 0) {
-		qdevice_log(LOG_ERR, "Can't deactivate net connect heuristics exec callback notifier");
+		log(LOG_ERR, "Can't deactivate net connect heuristics exec callback notifier");
 
 		net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_ACTIVATE_HEURISTICS_RESULT_NOTIFIER;
 		net_instance->schedule_disconnect = 1;
@@ -216,11 +216,11 @@ qdevice_net_connect_heuristics_exec_result_callback(void *heuristics_instance_pt
 
 	if (qdevice_net_algorithm_connected(net_instance, &heuristics, &send_config_node_list,
 	    &send_membership_node_list, &send_quorum_node_list, &vote) != 0) {
-		qdevice_log(LOG_DEBUG, "Algorithm returned error. Disconnecting.");
+		log(LOG_DEBUG, "Algorithm returned error. Disconnecting.");
 		net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_ALGO_CONNECTED_ERR;
 		return (0);
 	} else {
-		qdevice_log(LOG_DEBUG, "Algorithm decided to %s config node list, %s membership "
+		log(LOG_DEBUG, "Algorithm decided to %s config node list, %s membership "
 		    "node list, %s quorum node list, heuristics is %s and result vote is %s",
 		    (send_config_node_list ? "send" : "not send"),
 		    (send_membership_node_list ? "send" : "not send"),
@@ -269,7 +269,7 @@ qdevice_net_connect_heuristics_exec_result_callback(void *heuristics_instance_pt
 	}
 
 	if (qdevice_net_cast_vote_timer_update(net_instance, vote) != 0) {
-		qdevice_log(LOG_CRIT, "qdevice_net_msg_received_set_option_reply fatal error. "
+		log(LOG_CRIT, "qdevice_net_msg_received_set_option_reply fatal error. "
 		    " Can't update cast vote timer vote");
 		net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_SCHEDULE_VOTING_TIMER;
 	}
@@ -293,18 +293,18 @@ qdevice_net_heuristics_timer_callback(void *data1, void *data2)
 	heuristics_instance = &net_instance->qdevice_instance_ptr->heuristics_instance;
 
 	if (qdevice_heuristics_waiting_for_result(heuristics_instance)) {
-		qdevice_log(LOG_DEBUG, "Not executing regular heuristics because other heuristics is already running.");
+		log(LOG_DEBUG, "Not executing regular heuristics because other heuristics is already running.");
 
 		return (1);
 	}
 
 	net_instance->regular_heuristics_timer = NULL;
 
-	qdevice_log(LOG_DEBUG, "Executing regular heuristics.");
+	log(LOG_DEBUG, "Executing regular heuristics.");
 
 	if (qdevice_heuristics_result_notifier_list_set_active(&heuristics_instance->exec_result_notifier_list,
 	    qdevice_net_regular_heuristics_exec_result_callback, 1) != 0) {
-		qdevice_log(LOG_ERR, "Can't activate net regular heuristics exec callback notifier");
+		log(LOG_ERR, "Can't activate net regular heuristics exec callback notifier");
 
 		net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_ACTIVATE_HEURISTICS_RESULT_NOTIFIER;
 		net_instance->schedule_disconnect = 1;
@@ -314,7 +314,7 @@ qdevice_net_heuristics_timer_callback(void *data1, void *data2)
 
 	if (qdevice_heuristics_exec(heuristics_instance,
 	    net_instance->qdevice_instance_ptr->sync_in_progress) != 0) {
-		qdevice_log(LOG_ERR, "Can't execute regular heuristics.");
+		log(LOG_ERR, "Can't execute regular heuristics.");
 
 		net_instance->schedule_disconnect = 1;
 		net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_START_HEURISTICS;
@@ -339,14 +339,14 @@ qdevice_net_heuristics_stop_timer(struct qdevice_net_instance *net_instance)
 	heuristics_instance = &instance->heuristics_instance;
 
 	if (net_instance->regular_heuristics_timer != NULL) {
-		qdevice_log(LOG_DEBUG, "Regular heuristics timer stopped");
+		log(LOG_DEBUG, "Regular heuristics timer stopped");
 
 		timer_list_delete(&net_instance->main_timer_list, net_instance->regular_heuristics_timer);
 		net_instance->regular_heuristics_timer = NULL;
 
 		if (qdevice_heuristics_result_notifier_list_set_active(&heuristics_instance->exec_result_notifier_list,
 		    qdevice_net_regular_heuristics_exec_result_callback, 0) != 0) {
-			qdevice_log(LOG_ERR, "Can't deactivate net regular heuristics exec callback notifier");
+			log(LOG_ERR, "Can't deactivate net regular heuristics exec callback notifier");
 
 			net_instance->disconnect_reason =
 			    QDEVICE_NET_DISCONNECT_REASON_CANT_ACTIVATE_HEURISTICS_RESULT_NOTIFIER;
@@ -369,7 +369,7 @@ qdevice_net_heuristics_schedule_timer(struct qdevice_net_instance *net_instance)
 	heuristics_instance = &instance->heuristics_instance;
 
         if (heuristics_instance->mode != QDEVICE_HEURISTICS_MODE_ENABLED) {
-		qdevice_log(LOG_DEBUG, "Not scheduling heuristics timer because mode is not enabled");
+		log(LOG_DEBUG, "Not scheduling heuristics timer because mode is not enabled");
 
 		if (qdevice_net_heuristics_stop_timer(net_instance) != 0) {
 			return (-1);
@@ -379,14 +379,14 @@ qdevice_net_heuristics_schedule_timer(struct qdevice_net_instance *net_instance)
         }
 
 	if (net_instance->regular_heuristics_timer != NULL) {
-		qdevice_log(LOG_DEBUG, "Not scheduling heuristics timer because it is already scheduled");
+		log(LOG_DEBUG, "Not scheduling heuristics timer because it is already scheduled");
 
 		return (0);
 	}
 
 	interval = heuristics_instance->interval;
 
-	qdevice_log(LOG_DEBUG, "Scheduling next regular heuristics in %"PRIu32"ms", interval);
+	log(LOG_DEBUG, "Scheduling next regular heuristics in %"PRIu32"ms", interval);
 
 	net_instance->regular_heuristics_timer = timer_list_add(&net_instance->main_timer_list,
 		interval,
@@ -394,7 +394,7 @@ qdevice_net_heuristics_schedule_timer(struct qdevice_net_instance *net_instance)
 	        (void *)net_instance, NULL);
 
 	if (net_instance->regular_heuristics_timer == NULL) {
-		qdevice_log(LOG_ERR, "Can't schedule regular heuristics.");
+		log(LOG_ERR, "Can't schedule regular heuristics.");
 
 		net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_SCHEDULE_HEURISTICS_TIMER;
 		net_instance->schedule_disconnect = 1;
@@ -411,7 +411,7 @@ qdevice_net_heuristics_init(struct qdevice_net_instance *net_instance)
 	if (qdevice_heuristics_result_notifier_list_add(
 	    &net_instance->qdevice_instance_ptr->heuristics_instance.exec_result_notifier_list,
 	    qdevice_net_regular_heuristics_exec_result_callback) == NULL) {
-		qdevice_log(LOG_ERR, "Can't add net regular heuristics exec callback into notifier");
+		log(LOG_ERR, "Can't add net regular heuristics exec callback into notifier");
 
 		return (-1);
 	}
@@ -419,7 +419,7 @@ qdevice_net_heuristics_init(struct qdevice_net_instance *net_instance)
 	if (qdevice_heuristics_result_notifier_list_add(
 	    &net_instance->qdevice_instance_ptr->heuristics_instance.exec_result_notifier_list,
 	    qdevice_net_connect_heuristics_exec_result_callback) == NULL) {
-		qdevice_log(LOG_ERR, "Can't add net connect heuristics exec callback into notifier");
+		log(LOG_ERR, "Can't add net connect heuristics exec callback into notifier");
 
 		return (-1);
 	}
@@ -436,11 +436,11 @@ qdevice_net_heuristics_exec_after_connect(struct qdevice_net_instance *net_insta
 	instance = net_instance->qdevice_instance_ptr;
 	heuristics_instance = &instance->heuristics_instance;
 
-	qdevice_log(LOG_DEBUG, "Executing after-connect heuristics.");
+	log(LOG_DEBUG, "Executing after-connect heuristics.");
 
 	if (qdevice_heuristics_result_notifier_list_set_active(&heuristics_instance->exec_result_notifier_list,
 	    qdevice_net_connect_heuristics_exec_result_callback, 1) != 0) {
-		qdevice_log(LOG_ERR, "Can't activate net connect heuristics exec callback notifier");
+		log(LOG_ERR, "Can't activate net connect heuristics exec callback notifier");
 
 		net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_ACTIVATE_HEURISTICS_RESULT_NOTIFIER;
 		net_instance->schedule_disconnect = 1;
@@ -450,7 +450,7 @@ qdevice_net_heuristics_exec_after_connect(struct qdevice_net_instance *net_insta
 
 	if (qdevice_heuristics_exec(heuristics_instance,
 	    instance->sync_in_progress) != 0) {
-		qdevice_log(LOG_ERR, "Can't execute connect heuristics.");
+		log(LOG_ERR, "Can't execute connect heuristics.");
 
 		net_instance->schedule_disconnect = 1;
 		net_instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_START_HEURISTICS;

+ 27 - 27
qdevices/qdevice-net-instance.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2017 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -93,35 +93,35 @@ qdevice_net_instance_init(struct qdevice_net_instance *instance,
 	instance->tls_supported = tls_supported;
 
 	if ((instance->cmap_poll_fd = PR_CreateSocketPollFd(cmap_fd)) == NULL) {
-		qdevice_log_nss(LOG_CRIT, "Can't create NSPR cmap poll fd");
+		log_nss(LOG_CRIT, "Can't create NSPR cmap poll fd");
 		return (-1);
 	}
 
 	if ((instance->votequorum_poll_fd = PR_CreateSocketPollFd(votequorum_fd)) == NULL) {
-		qdevice_log_nss(LOG_CRIT, "Can't create NSPR votequorum poll fd");
+		log_nss(LOG_CRIT, "Can't create NSPR votequorum poll fd");
 		return (-1);
 	}
 
 	if ((instance->ipc_socket_poll_fd = PR_CreateSocketPollFd(local_socket_fd)) == NULL) {
-		qdevice_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);
 	}
 
 	if ((instance->heuristics_pipe_cmd_send_poll_fd =
 	    PR_CreateSocketPollFd(heuristics_pipe_cmd_send_fd)) == NULL) {
-		qdevice_log_nss(LOG_CRIT, "Can't create NSPR heuristics pipe command send poll fd");
+		log_nss(LOG_CRIT, "Can't create NSPR heuristics pipe command send poll fd");
 		return (-1);
 	}
 
 	if ((instance->heuristics_pipe_cmd_recv_poll_fd =
 	    PR_CreateSocketPollFd(heuristics_pipe_cmd_recv_fd)) == NULL) {
-		qdevice_log_nss(LOG_CRIT, "Can't create NSPR heuristics pipe command recv poll fd");
+		log_nss(LOG_CRIT, "Can't create NSPR heuristics pipe command recv poll fd");
 		return (-1);
 	}
 
 	if ((instance->heuristics_pipe_log_recv_poll_fd =
 	    PR_CreateSocketPollFd(heuristics_pipe_log_recv_fd)) == NULL) {
-		qdevice_log_nss(LOG_CRIT, "Can't create NSPR heuristics pipe log recv poll fd");
+		log_nss(LOG_CRIT, "Can't create NSPR heuristics pipe log recv poll fd");
 		return (-1);
 	}
 
@@ -164,7 +164,7 @@ qdevice_net_instance_destroy(struct qdevice_net_instance *instance)
 		prfd = (PRFileDesc *)qdevice_ipc_user_data->model_data;
 
 		if (PR_DestroySocketPollFd(prfd) != PR_SUCCESS) {
-			qdevice_log_nss(LOG_WARNING, "Unable to destroy client IPC poll socket fd");
+			log_nss(LOG_WARNING, "Unable to destroy client IPC poll socket fd");
 		}
 	}
 
@@ -180,29 +180,29 @@ qdevice_net_instance_destroy(struct qdevice_net_instance *instance)
 	free((void *)instance->host_addr);
 
 	if (PR_DestroySocketPollFd(instance->votequorum_poll_fd) != PR_SUCCESS) {
-		qdevice_log_nss(LOG_WARNING, "Unable to close votequorum connection fd");
+		log_nss(LOG_WARNING, "Unable to close votequorum connection fd");
 	}
 
 	if (PR_DestroySocketPollFd(instance->cmap_poll_fd) != PR_SUCCESS) {
-		qdevice_log_nss(LOG_WARNING, "Unable to close votequorum connection fd");
+		log_nss(LOG_WARNING, "Unable to close votequorum connection fd");
 	}
 
 	if (PR_DestroySocketPollFd(instance->ipc_socket_poll_fd) != PR_SUCCESS) {
-		qdevice_log_nss(LOG_WARNING, "Unable to close local socket poll fd");
+		log_nss(LOG_WARNING, "Unable to close local socket poll fd");
 	}
 
 	if (PR_DestroySocketPollFd(instance->heuristics_pipe_cmd_send_poll_fd) != PR_SUCCESS) {
-		qdevice_log_nss(LOG_WARNING, "Unable to close heuristics pipe command send poll fd");
+		log_nss(LOG_WARNING, "Unable to close heuristics pipe command send poll fd");
 		return (-1);
 	}
 
 	if (PR_DestroySocketPollFd(instance->heuristics_pipe_cmd_recv_poll_fd) != PR_SUCCESS) {
-		qdevice_log_nss(LOG_WARNING, "Unable to close heuristics pipe command recv poll fd");
+		log_nss(LOG_WARNING, "Unable to close heuristics pipe command recv poll fd");
 		return (-1);
 	}
 
 	if (PR_DestroySocketPollFd(instance->heuristics_pipe_log_recv_poll_fd) != PR_SUCCESS) {
-		qdevice_log_nss(LOG_WARNING, "Unable to close heuristics pipe log recv poll fd");
+		log_nss(LOG_WARNING, "Unable to close heuristics pipe log recv poll fd");
 		return (-1);
 	}
 
@@ -233,7 +233,7 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
 
 	net_instance = malloc(sizeof(*net_instance));
 	if (net_instance == NULL) {
-		qdevice_log(LOG_ERR, "Can't alloc qdevice_net_instance");
+		log(LOG_ERR, "Can't alloc qdevice_net_instance");
 		return (-1);
 	}
 
@@ -246,7 +246,7 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
 		if ((i = utils_parse_bool_str(str)) == -1) {
 			if (strcasecmp(str, "required") != 0) {
 				free(str);
-				qdevice_log(LOG_ERR, "quorum.device.net.tls value is not valid.");
+				log(LOG_ERR, "quorum.device.net.tls value is not valid.");
 
 				goto error_free_instance;
 			} else {
@@ -267,14 +267,14 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
 	 * Host
 	 */
 	if (cmap_get_string(cmap_handle, "quorum.device.net.host", &str) != CS_OK) {
-		qdevice_log(LOG_ERR, "Qdevice net daemon address is not defined (quorum.device.net.host)");
+		log(LOG_ERR, "Qdevice net daemon address is not defined (quorum.device.net.host)");
 		goto error_free_instance;
 	}
 	host_addr = str;
 
 	if (cmap_get_string(cmap_handle, "quorum.device.net.port", &str) == CS_OK) {
 		if (utils_strtonum(str, 1, UINT16_MAX, &lli) == -1) {
-			qdevice_log(LOG_ERR, "quorum.device.net.port must be in range 1-%u", UINT16_MAX);
+			log(LOG_ERR, "quorum.device.net.port must be in range 1-%u", UINT16_MAX);
 			free(str);
 			goto error_free_host_addr;
 		}
@@ -289,7 +289,7 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
 	 * Cluster name
 	 */
 	if (cmap_get_string(cmap_handle, "totem.cluster_name", &str) != CS_OK) {
-		qdevice_log(LOG_ERR, "Cluster name (totem.cluster_name) has to be defined.");
+		log(LOG_ERR, "Cluster name (totem.cluster_name) has to be defined.");
 		goto error_free_host_addr;
 	}
 	cluster_name = str;
@@ -300,12 +300,12 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
 	cast_vote_timer_interval = instance->heartbeat_interval * 0.5;
 	heartbeat_interval = instance->heartbeat_interval * 0.8;
 	if (heartbeat_interval < instance->advanced_settings->net_heartbeat_interval_min) {
-		qdevice_log(LOG_WARNING, "Heartbeat interval too small %"PRIu32". Adjusting to %"PRIu32".",
+		log(LOG_WARNING, "Heartbeat interval too small %"PRIu32". Adjusting to %"PRIu32".",
 		    heartbeat_interval, instance->advanced_settings->net_heartbeat_interval_min);
 		heartbeat_interval = instance->advanced_settings->net_heartbeat_interval_min;
 	}
 	if (heartbeat_interval > instance->advanced_settings->net_heartbeat_interval_max) {
-		qdevice_log(LOG_WARNING, "Heartbeat interval too big %"PRIu32". Adjusting to %"PRIu32".",
+		log(LOG_WARNING, "Heartbeat interval too big %"PRIu32". Adjusting to %"PRIu32".",
 		    heartbeat_interval, instance->advanced_settings->net_heartbeat_interval_max);
 		heartbeat_interval = instance->advanced_settings->net_heartbeat_interval_max;
 	}
@@ -326,7 +326,7 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
 		} else if (strcmp(str, "lms") == 0) {
 			decision_algorithm = TLV_DECISION_ALGORITHM_TYPE_LMS;
 		} else {
-			qdevice_log(LOG_ERR, "Unknown decision algorithm %s", str);
+			log(LOG_ERR, "Unknown decision algorithm %s", str);
 			free(str);
 			goto error_free_cluster_name;
 		}
@@ -336,7 +336,7 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
 
 	if (decision_algorithm == TLV_DECISION_ALGORITHM_TYPE_TEST &&
 	    !instance->advanced_settings->net_test_algorithm_enabled) {
-		qdevice_log(LOG_ERR, "Test algorithm is not enabled. You can force enable it by "
+		log(LOG_ERR, "Test algorithm is not enabled. You can force enable it by "
 		    "passing -S net_test_algorithm_enabled=on to %s command", QDEVICE_PROGRAM_NAME);
 
 		goto error_free_cluster_name;
@@ -355,7 +355,7 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
 			tie_breaker.mode = TLV_TIE_BREAKER_MODE_HIGHEST;
 		} else {
 			if (utils_strtonum(str, 1, UINT32_MAX, &lli) == -1) {
-				qdevice_log(LOG_ERR, "tie_breaker must be lowest|highest|valid_node_id");
+				log(LOG_ERR, "tie_breaker must be lowest|highest|valid_node_id");
 				free(str);
 				goto error_free_cluster_name;
 			}
@@ -375,7 +375,7 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
 	} else {
 		if (utils_strtonum(str, instance->advanced_settings->net_min_connect_timeout,
 		    instance->advanced_settings->net_max_connect_timeout, &lli) == -1) {
-			qdevice_log(LOG_ERR, "connect_timeout must be valid number in "
+			log(LOG_ERR, "connect_timeout must be valid number in "
 			    "range <%"PRIu32",%"PRIu32">",
 			    instance->advanced_settings->net_min_connect_timeout,
 			    instance->advanced_settings->net_max_connect_timeout);
@@ -393,7 +393,7 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
 	} else {
 		if ((utils_strtonum(str, 0, 6, &lli) == -1) ||
 		    (lli != 0 && lli != 4 && lli != 6)) {
-			qdevice_log(LOG_ERR, "force_ip_version must be one of 0|4|6");
+			log(LOG_ERR, "force_ip_version must be one of 0|4|6");
 			free(str);
 			goto error_free_cluster_name;
 		}
@@ -416,7 +416,7 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
 	    instance->heuristics_instance.pipe_cmd_send,
 	    instance->heuristics_instance.pipe_cmd_recv,
 	    instance->heuristics_instance.pipe_log_recv) == -1) {
-		qdevice_log(LOG_ERR, "Can't initialize qdevice-net instance");
+		log(LOG_ERR, "Can't initialize qdevice-net instance");
 		goto error_free_instance;
 	}
 

+ 78 - 78
qdevices/qdevice-net-msg-received.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -89,19 +89,19 @@ qdevice_net_msg_received_log_msg_decode_error(int ret)
 
 	switch (ret) {
 	case -1:
-		qdevice_log(LOG_WARNING, "Received message with option with invalid length");
+		log(LOG_WARNING, "Received message with option with invalid length");
 		break;
 	case -2:
-		qdevice_log(LOG_CRIT, "Can't allocate memory");
+		log(LOG_CRIT, "Can't allocate memory");
 		break;
 	case -3:
-		qdevice_log(LOG_WARNING, "Received inconsistent msg (tlv len > msg size)");
+		log(LOG_WARNING, "Received inconsistent msg (tlv len > msg size)");
 		break;
 	case -4:
-		qdevice_log(LOG_ERR, "Received message with option with invalid value");
+		log(LOG_ERR, "Received message with option with invalid value");
 		break;
 	default:
-		qdevice_log(LOG_ERR, "Unknown error occurred when decoding message");
+		log(LOG_ERR, "Unknown error occurred when decoding message");
 		break;
 	}
 }
@@ -111,7 +111,7 @@ qdevice_net_msg_received_unexpected_msg(struct qdevice_net_instance *instance,
     const struct msg_decoded *msg, const char *msg_str)
 {
 
-	qdevice_log(LOG_ERR, "Received unexpected %s message. Disconnecting from server",
+	log(LOG_ERR, "Received unexpected %s message. Disconnecting from server",
 	    msg_str);
 
 	instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_UNEXPECTED_MSG;
@@ -141,7 +141,7 @@ qdevice_net_msg_check_seq_number(struct qdevice_net_instance *instance,
 {
 
 	if (!msg->seq_number_set || msg->seq_number != instance->last_msg_seq_num) {
-		qdevice_log(LOG_ERR, "Received message doesn't contain seq_number or "
+		log(LOG_ERR, "Received message doesn't contain seq_number or "
 		    "it's not expected one.");
 
 		return (-1);
@@ -157,10 +157,10 @@ qdevice_net_msg_received_preinit_reply(struct qdevice_net_instance *instance,
 	int res;
 	struct send_buffer_list_entry *send_buffer;
 
-	qdevice_log(LOG_DEBUG, "Received preinit reply msg");
+	log(LOG_DEBUG, "Received preinit reply msg");
 
 	if (instance->state != QDEVICE_NET_INSTANCE_STATE_WAITING_PREINIT_REPLY) {
-		qdevice_log(LOG_ERR, "Received unexpected preinit reply message. "
+		log(LOG_ERR, "Received unexpected preinit reply message. "
 		    "Disconnecting from server");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_UNEXPECTED_MSG;
@@ -178,7 +178,7 @@ qdevice_net_msg_received_preinit_reply(struct qdevice_net_instance *instance,
 	 * Check TLS support
 	 */
 	if (!msg->tls_supported_set || !msg->tls_client_cert_required_set) {
-		qdevice_log(LOG_ERR, "Required tls_supported or tls_client_cert_required "
+		log(LOG_ERR, "Required tls_supported or tls_client_cert_required "
 		    "option is unset");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_REQUIRED_OPTION_MISSING;
@@ -188,7 +188,7 @@ qdevice_net_msg_received_preinit_reply(struct qdevice_net_instance *instance,
 
 	res = qdevice_net_msg_received_check_tls_compatibility(msg->tls_supported, instance->tls_supported);
 	if (res == -1) {
-		qdevice_log(LOG_ERR, "Incompatible tls configuration (server %u client %u)",
+		log(LOG_ERR, "Incompatible tls configuration (server %u client %u)",
 		    msg->tls_supported, instance->tls_supported);
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_INCOMPATIBLE_TLS;
@@ -200,7 +200,7 @@ qdevice_net_msg_received_preinit_reply(struct qdevice_net_instance *instance,
 		 */
 		send_buffer = send_buffer_list_get_new(&instance->send_buffer_list);
 		if (send_buffer == NULL) {
-			qdevice_log(LOG_ERR, "Can't allocate send list buffer for "
+			log(LOG_ERR, "Can't allocate send list buffer for "
 			    "starttls msg");
 
 			instance->disconnect_reason =
@@ -212,7 +212,7 @@ qdevice_net_msg_received_preinit_reply(struct qdevice_net_instance *instance,
 		instance->last_msg_seq_num++;
 		if (msg_create_starttls(&send_buffer->buffer, 1,
 		    instance->last_msg_seq_num) == 0) {
-			qdevice_log(LOG_ERR, "Can't allocate send buffer for starttls msg");
+			log(LOG_ERR, "Can't allocate send buffer for starttls msg");
 
 			instance->disconnect_reason =
 			    QDEVICE_NET_DISCONNECT_REASON_CANT_ALLOCATE_MSG_BUFFER;
@@ -244,10 +244,10 @@ qdevice_net_msg_received_init_reply(struct qdevice_net_instance *instance,
 	int res;
 	enum qdevice_heuristics_mode active_heuristics_mode;
 
-	qdevice_log(LOG_DEBUG, "Received init reply msg");
+	log(LOG_DEBUG, "Received init reply msg");
 
 	if (instance->state != QDEVICE_NET_INSTANCE_STATE_WAITING_INIT_REPLY) {
-		qdevice_log(LOG_ERR, "Received unexpected init reply message. "
+		log(LOG_ERR, "Received unexpected init reply message. "
 		    "Disconnecting from server");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_UNEXPECTED_MSG;
@@ -262,7 +262,7 @@ qdevice_net_msg_received_init_reply(struct qdevice_net_instance *instance,
 	}
 
 	if (!msg->reply_error_code_set) {
-		qdevice_log(LOG_ERR, "Received init reply message without error code."
+		log(LOG_ERR, "Received init reply message without error code."
 		    "Disconnecting from server");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_REQUIRED_OPTION_MISSING;
@@ -271,20 +271,20 @@ qdevice_net_msg_received_init_reply(struct qdevice_net_instance *instance,
 	}
 
 	if (msg->reply_error_code != TLV_REPLY_ERROR_CODE_NO_ERROR) {
-		qdevice_log(LOG_ERR, "Received init reply message with error code %"PRIu16". "
+		log(LOG_ERR, "Received init reply message with error code %"PRIu16". "
 		    "Disconnecting from server", msg->reply_error_code);
 
 		if (msg->reply_error_code == TLV_REPLY_ERROR_CODE_DUPLICATE_NODE_ID) {
-			qdevice_log(LOG_ERR, "Duplicate node id may be result of server not yet "
+			log(LOG_ERR, "Duplicate node id may be result of server not yet "
 			    "accepted this node disconnect. Retry again.");
 			instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_SERVER_SENT_DUPLICATE_NODE_ID_ERROR;
 		} else if (msg->reply_error_code == TLV_REPLY_ERROR_CODE_TIE_BREAKER_DIFFERS_FROM_OTHER_NODES) {
-			qdevice_log(LOG_ERR, "Configured tie-breaker differs in cluster. This may be "
+			log(LOG_ERR, "Configured tie-breaker differs in cluster. This may be "
 			    "result of server not yet accepted this node disconnect. Retry again.");
 			instance->disconnect_reason =
 			    QDEVICE_NET_DISCONNECT_REASON_SERVER_SENT_TIE_BREAKER_DIFFERS_FROM_OTHER_NODES_ERROR;
 		} else if (msg->reply_error_code == TLV_REPLY_ERROR_CODE_ALGORITHM_DIFFERS_FROM_OTHER_NODES) {
-			qdevice_log(LOG_ERR, "Configured algorithm differs in cluster. This may be "
+			log(LOG_ERR, "Configured algorithm differs in cluster. This may be "
 			    "result of server not yet accepted this node disconnect. Retry again.");
 			instance->disconnect_reason =
 			    QDEVICE_NET_DISCONNECT_REASON_SERVER_SENT_ALGORITHM_DIFFERS_FROM_OTHER_NODES_ERROR;
@@ -296,7 +296,7 @@ qdevice_net_msg_received_init_reply(struct qdevice_net_instance *instance,
 	}
 
 	if (!msg->server_maximum_request_size_set || !msg->server_maximum_reply_size_set) {
-		qdevice_log(LOG_ERR, "Required maximum_request_size or maximum_reply_size "
+		log(LOG_ERR, "Required maximum_request_size or maximum_reply_size "
 		    "option is unset");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_REQUIRED_OPTION_MISSING;
@@ -305,7 +305,7 @@ qdevice_net_msg_received_init_reply(struct qdevice_net_instance *instance,
 	}
 
 	if (msg->supported_messages == NULL || msg->supported_options == NULL) {
-		qdevice_log(LOG_ERR, "Required supported messages or supported options "
+		log(LOG_ERR, "Required supported messages or supported options "
 		    "option is unset");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_REQUIRED_OPTION_MISSING;
@@ -314,7 +314,7 @@ qdevice_net_msg_received_init_reply(struct qdevice_net_instance *instance,
 	}
 
 	if (msg->supported_decision_algorithms == NULL) {
-		qdevice_log(LOG_ERR, "Required supported decision algorithms option is unset");
+		log(LOG_ERR, "Required supported decision algorithms option is unset");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_REQUIRED_OPTION_MISSING;
 
@@ -322,7 +322,7 @@ qdevice_net_msg_received_init_reply(struct qdevice_net_instance *instance,
 	}
 
 	if (msg->server_maximum_request_size < instance->advanced_settings->net_min_msg_send_size) {
-		qdevice_log(LOG_ERR,
+		log(LOG_ERR,
 		    "Server accepts maximum %zu bytes message but this client minimum "
 		    "is %zu bytes.", msg->server_maximum_request_size,
 		    instance->advanced_settings->net_min_msg_send_size);
@@ -332,7 +332,7 @@ qdevice_net_msg_received_init_reply(struct qdevice_net_instance *instance,
 	}
 
 	if (msg->server_maximum_reply_size > instance->advanced_settings->net_max_msg_receive_size) {
-		qdevice_log(LOG_ERR,
+		log(LOG_ERR,
 		    "Server may send message up to %zu bytes message but this client maximum "
 		    "is %zu bytes.", msg->server_maximum_reply_size,
 		    instance->advanced_settings->net_max_msg_receive_size);
@@ -361,7 +361,7 @@ qdevice_net_msg_received_init_reply(struct qdevice_net_instance *instance,
 	}
 
 	if (!res) {
-		qdevice_log(LOG_ERR, "Server doesn't support required decision algorithm");
+		log(LOG_ERR, "Server doesn't support required decision algorithm");
 
 		instance->disconnect_reason =
 		    QDEVICE_NET_DISCONNECT_REASON_SERVER_DOESNT_SUPPORT_REQUIRED_ALGORITHM;
@@ -386,7 +386,7 @@ qdevice_net_msg_received_init_reply(struct qdevice_net_instance *instance,
 
 		if (active_heuristics_mode == QDEVICE_HEURISTICS_MODE_ENABLED ||
 		    active_heuristics_mode == QDEVICE_HEURISTICS_MODE_SYNC) {
-			qdevice_log(LOG_ERR, "Heuristics are enabled but not supported by server");
+			log(LOG_ERR, "Heuristics are enabled but not supported by server");
 
 			instance->disconnect_reason =
 			    QDEVICE_NET_DISCONNECT_REASON_SERVER_DOESNT_SUPPORT_REQUIRED_OPT;
@@ -435,12 +435,12 @@ qdevice_net_msg_received_server_error(struct qdevice_net_instance *instance,
 {
 
 	if (!msg->reply_error_code_set) {
-		qdevice_log(LOG_ERR, "Received server error without error code set. "
+		log(LOG_ERR, "Received server error without error code set. "
 		    "Disconnecting from server");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_REQUIRED_OPTION_MISSING;
 	} else {
-		qdevice_log(LOG_ERR, "Received server error %"PRIu16". "
+		log(LOG_ERR, "Received server error %"PRIu16". "
 		    "Disconnecting from server", msg->reply_error_code);
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_SERVER_SENT_ERROR;
@@ -463,7 +463,7 @@ qdevice_net_msg_received_set_option_reply(struct qdevice_net_instance *instance,
 {
 
 	if (instance->state != QDEVICE_NET_INSTANCE_STATE_WAITING_VOTEQUORUM_CMAP_EVENTS) {
-		qdevice_log(LOG_ERR, "Received unexpected set option reply message. "
+		log(LOG_ERR, "Received unexpected set option reply message. "
 		    "Disconnecting from server");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_UNEXPECTED_MSG;
@@ -498,19 +498,19 @@ qdevice_net_msg_received_echo_reply(struct qdevice_net_instance *instance,
 {
 
 	if (!msg->seq_number_set) {
-		qdevice_log(LOG_ERR, "Received echo reply message doesn't contain seq_number.");
+		log(LOG_ERR, "Received echo reply message doesn't contain seq_number.");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_REQUIRED_OPTION_MISSING;
 		return (-1);
 	}
 
 	if (msg->seq_number != instance->echo_request_expected_msg_seq_num) {
-		qdevice_log(LOG_WARNING, "Received echo reply message seq_number is not expected one.");
+		log(LOG_WARNING, "Received echo reply message seq_number is not expected one.");
 	}
 
 	if (qdevice_net_algorithm_echo_reply_received(instance, msg->seq_number,
 	    msg->seq_number == instance->echo_request_expected_msg_seq_num) != 0) {
-		qdevice_log(LOG_DEBUG, "Algorithm returned error. Disconnecting");
+		log(LOG_DEBUG, "Algorithm returned error. Disconnecting");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_ALGO_ECHO_REPLY_RECEIVED_ERR;
 		return (-1);
@@ -541,7 +541,7 @@ qdevice_net_msg_received_node_list_reply(struct qdevice_net_instance *instance,
 	int ring_id_is_valid;
 
 	if (instance->state != QDEVICE_NET_INSTANCE_STATE_WAITING_VOTEQUORUM_CMAP_EVENTS) {
-		qdevice_log(LOG_ERR, "Received unexpected node list reply message. "
+		log(LOG_ERR, "Received unexpected node list reply message. "
 		    "Disconnecting from server");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_UNEXPECTED_MSG;
@@ -549,7 +549,7 @@ qdevice_net_msg_received_node_list_reply(struct qdevice_net_instance *instance,
 	}
 
 	if (!msg->vote_set || !msg->seq_number_set || !msg->node_list_type_set) {
-		qdevice_log(LOG_ERR, "Received node list reply message without "
+		log(LOG_ERR, "Received node list reply message without "
 		    "required options. Disconnecting from server");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_REQUIRED_OPTION_MISSING;
@@ -557,7 +557,7 @@ qdevice_net_msg_received_node_list_reply(struct qdevice_net_instance *instance,
 	}
 
 	if (!msg->ring_id_set) {
-		qdevice_log(LOG_ERR, "Received node list reply message "
+		log(LOG_ERR, "Received node list reply message "
 		    "without ring id set. Disconnecting from server");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_REQUIRED_OPTION_MISSING;
@@ -578,15 +578,15 @@ qdevice_net_msg_received_node_list_reply(struct qdevice_net_instance *instance,
 	}
 
 	if (str == NULL) {
-		qdevice_log(LOG_CRIT, "qdevice_net_msg_received_node_list_reply fatal error. "
+		log(LOG_CRIT, "qdevice_net_msg_received_node_list_reply fatal error. "
 		    "Unhandled node_list_type (debug output)");
 		exit(1);
 	}
 
-	qdevice_log(LOG_DEBUG, "Received %s node list reply", str);
-	qdevice_log(LOG_DEBUG, "  seq = "UTILS_PRI_MSG_SEQ, msg->seq_number);
-	qdevice_log(LOG_DEBUG, "  vote = %s", tlv_vote_to_str(msg->vote));
-	qdevice_log(LOG_DEBUG, "  ring id = ("UTILS_PRI_RING_ID")",
+	log(LOG_DEBUG, "Received %s node list reply", str);
+	log(LOG_DEBUG, "  seq = "UTILS_PRI_MSG_SEQ, msg->seq_number);
+	log(LOG_DEBUG, "  vote = %s", tlv_vote_to_str(msg->vote));
+	log(LOG_DEBUG, "  ring id = ("UTILS_PRI_RING_ID")",
 		    msg->ring_id.node_id, msg->ring_id.seq);
 
 	/*
@@ -596,7 +596,7 @@ qdevice_net_msg_received_node_list_reply(struct qdevice_net_instance *instance,
 
 	if (!tlv_ring_id_eq(&msg->ring_id, &instance->last_sent_ring_id)) {
 		ring_id_is_valid = 0;
-		qdevice_log(LOG_DEBUG, "Received node list reply with old ring id.");
+		log(LOG_DEBUG, "Received node list reply with old ring id.");
 	} else {
 		ring_id_is_valid = 1;
 	}
@@ -627,18 +627,18 @@ qdevice_net_msg_received_node_list_reply(struct qdevice_net_instance *instance,
 	}
 
 	if (!case_processed) {
-		qdevice_log(LOG_CRIT, "qdevice_net_msg_received_node_list_reply fatal error. "
+		log(LOG_CRIT, "qdevice_net_msg_received_node_list_reply fatal error. "
 		    "Unhandled node_list_type (algorithm call)");
 		exit(1);
 	}
 
 	if (res != 0) {
-		qdevice_log(LOG_DEBUG, "Algorithm returned error. Disconnecting.");
+		log(LOG_DEBUG, "Algorithm returned error. Disconnecting.");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_ALGO_NODE_LIST_REPLY_ERR;
 		return (-1);
 	} else {
-		qdevice_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));
 	}
 
 	if (qdevice_net_cast_vote_timer_update(instance, result_vote) != 0) {
@@ -665,7 +665,7 @@ qdevice_net_msg_received_ask_for_vote_reply(struct qdevice_net_instance *instanc
 	int ring_id_is_valid;
 
 	if (instance->state != QDEVICE_NET_INSTANCE_STATE_WAITING_VOTEQUORUM_CMAP_EVENTS) {
-		qdevice_log(LOG_ERR, "Received unexpected ask for vote reply message. "
+		log(LOG_ERR, "Received unexpected ask for vote reply message. "
 		    "Disconnecting from server");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_UNEXPECTED_MSG;
@@ -673,36 +673,36 @@ qdevice_net_msg_received_ask_for_vote_reply(struct qdevice_net_instance *instanc
 	}
 
 	if (!msg->vote_set || !msg->seq_number_set || !msg->ring_id_set) {
-		qdevice_log(LOG_ERR, "Received ask for vote reply message without "
+		log(LOG_ERR, "Received ask for vote reply message without "
 		    "required options. Disconnecting from server");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_REQUIRED_OPTION_MISSING;
 		return (-1);
 	}
 
-	qdevice_log(LOG_DEBUG, "Received ask for vote reply");
-	qdevice_log(LOG_DEBUG, "  seq = "UTILS_PRI_MSG_SEQ, msg->seq_number);
-	qdevice_log(LOG_DEBUG, "  vote = %s", tlv_vote_to_str(msg->vote));
-	qdevice_log(LOG_DEBUG, "  ring id = ("UTILS_PRI_RING_ID")",
+	log(LOG_DEBUG, "Received ask for vote reply");
+	log(LOG_DEBUG, "  seq = "UTILS_PRI_MSG_SEQ, msg->seq_number);
+	log(LOG_DEBUG, "  vote = %s", tlv_vote_to_str(msg->vote));
+	log(LOG_DEBUG, "  ring id = ("UTILS_PRI_RING_ID")",
 		    msg->ring_id.node_id, msg->ring_id.seq);
 
 	result_vote = msg->vote;
 
 	if (!tlv_ring_id_eq(&msg->ring_id, &instance->last_sent_ring_id)) {
 		ring_id_is_valid = 0;
-		qdevice_log(LOG_DEBUG, "Received ask for vote reply with old ring id.");
+		log(LOG_DEBUG, "Received ask for vote reply with old ring id.");
 	} else {
 		ring_id_is_valid = 1;
 	}
 
 	if (qdevice_net_algorithm_ask_for_vote_reply_received(instance, msg->seq_number,
 	    &msg->ring_id, ring_id_is_valid, &result_vote) != 0) {
-		qdevice_log(LOG_DEBUG, "Algorithm returned error. Disconnecting.");
+		log(LOG_DEBUG, "Algorithm returned error. Disconnecting.");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_ALGO_ASK_FOR_VOTE_REPLY_ERR;
 		return (-1);
 	} else {
-		qdevice_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));
 	}
 
 	if (qdevice_net_cast_vote_timer_update(instance, result_vote) != 0) {
@@ -722,7 +722,7 @@ qdevice_net_msg_received_vote_info(struct qdevice_net_instance *instance,
 	int ring_id_is_valid;
 
 	if (instance->state != QDEVICE_NET_INSTANCE_STATE_WAITING_VOTEQUORUM_CMAP_EVENTS) {
-		qdevice_log(LOG_ERR, "Received unexpected vote info message. "
+		log(LOG_ERR, "Received unexpected vote info message. "
 		    "Disconnecting from server");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_UNEXPECTED_MSG;
@@ -730,35 +730,35 @@ qdevice_net_msg_received_vote_info(struct qdevice_net_instance *instance,
 	}
 
 	if (!msg->vote_set || !msg->seq_number_set || !msg->ring_id_set) {
-		qdevice_log(LOG_ERR, "Received node list reply message without "
+		log(LOG_ERR, "Received node list reply message without "
 		    "required options. Disconnecting from server");
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_REQUIRED_OPTION_MISSING;
 		return (-1);
 	}
 
-	qdevice_log(LOG_DEBUG, "Received vote info");
-	qdevice_log(LOG_DEBUG, "  seq = "UTILS_PRI_MSG_SEQ, msg->seq_number);
-	qdevice_log(LOG_DEBUG, "  vote = %s", tlv_vote_to_str(msg->vote));
-	qdevice_log(LOG_DEBUG, "  ring id = ("UTILS_PRI_RING_ID")",
+	log(LOG_DEBUG, "Received vote info");
+	log(LOG_DEBUG, "  seq = "UTILS_PRI_MSG_SEQ, msg->seq_number);
+	log(LOG_DEBUG, "  vote = %s", tlv_vote_to_str(msg->vote));
+	log(LOG_DEBUG, "  ring id = ("UTILS_PRI_RING_ID")",
 		    msg->ring_id.node_id, msg->ring_id.seq);
 
 	result_vote = msg->vote;
 
 	if (!tlv_ring_id_eq(&msg->ring_id, &instance->last_sent_ring_id)) {
 		ring_id_is_valid = 0;
-		qdevice_log(LOG_DEBUG, "Received vote info with old ring id.");
+		log(LOG_DEBUG, "Received vote info with old ring id.");
 	} else {
 		ring_id_is_valid = 1;
 	}
 
 	if (qdevice_net_algorithm_vote_info_received(instance, msg->seq_number,
 	    &msg->ring_id, ring_id_is_valid, &result_vote) != 0) {
-		qdevice_log(LOG_DEBUG, "Algorithm returned error. Disconnecting.");
+		log(LOG_DEBUG, "Algorithm returned error. Disconnecting.");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_ALGO_VOTE_INFO_ERR;
 		return (-1);
 	} else {
-		qdevice_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));
 	}
 
 	if (qdevice_net_cast_vote_timer_update(instance, result_vote) != 0) {
@@ -771,7 +771,7 @@ qdevice_net_msg_received_vote_info(struct qdevice_net_instance *instance,
 	 */
 	send_buffer = send_buffer_list_get_new(&instance->send_buffer_list);
 	if (send_buffer == NULL) {
-		qdevice_log(LOG_ERR, "Can't allocate send list buffer for "
+		log(LOG_ERR, "Can't allocate send list buffer for "
 		    "vote info reply msg");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_ALLOCATE_MSG_BUFFER;
@@ -779,7 +779,7 @@ qdevice_net_msg_received_vote_info(struct qdevice_net_instance *instance,
 	}
 
 	if (msg_create_vote_info_reply(&send_buffer->buffer, msg->seq_number) == 0) {
-		qdevice_log(LOG_ERR, "Can't allocate send buffer for "
+		log(LOG_ERR, "Can't allocate send buffer for "
 		    "vote info reply list msg");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_ALLOCATE_MSG_BUFFER;
@@ -816,7 +816,7 @@ qdevice_net_msg_received_heuristics_change_reply(struct qdevice_net_instance *in
 	int ring_id_is_valid;
 
 	if (instance->state != QDEVICE_NET_INSTANCE_STATE_WAITING_VOTEQUORUM_CMAP_EVENTS) {
-		qdevice_log(LOG_ERR, "Received unexpected heuristics change reply message. "
+		log(LOG_ERR, "Received unexpected heuristics change reply message. "
 		    "Disconnecting from server");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_UNEXPECTED_MSG;
@@ -825,37 +825,37 @@ qdevice_net_msg_received_heuristics_change_reply(struct qdevice_net_instance *in
 
 	if (!msg->vote_set || !msg->seq_number_set || !msg->ring_id_set ||
 	    msg->heuristics == TLV_HEURISTICS_UNDEFINED) {
-		qdevice_log(LOG_ERR, "Received heuristics change reply message without "
+		log(LOG_ERR, "Received heuristics change reply message without "
 		    "required options. Disconnecting from server");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_REQUIRED_OPTION_MISSING;
 		return (-1);
 	}
 
-	qdevice_log(LOG_DEBUG, "Received heuristics change reply");
-	qdevice_log(LOG_DEBUG, "  seq = "UTILS_PRI_MSG_SEQ, msg->seq_number);
-	qdevice_log(LOG_DEBUG, "  vote = %s", tlv_vote_to_str(msg->vote));
-	qdevice_log(LOG_DEBUG, "  ring id = ("UTILS_PRI_RING_ID")",
+	log(LOG_DEBUG, "Received heuristics change reply");
+	log(LOG_DEBUG, "  seq = "UTILS_PRI_MSG_SEQ, msg->seq_number);
+	log(LOG_DEBUG, "  vote = %s", tlv_vote_to_str(msg->vote));
+	log(LOG_DEBUG, "  ring id = ("UTILS_PRI_RING_ID")",
 		    msg->ring_id.node_id, msg->ring_id.seq);
-	qdevice_log(LOG_DEBUG, "  heuristics = %s", tlv_heuristics_to_str(msg->heuristics));
+	log(LOG_DEBUG, "  heuristics = %s", tlv_heuristics_to_str(msg->heuristics));
 
 	result_vote = msg->vote;
 
 	if (!tlv_ring_id_eq(&msg->ring_id, &instance->last_sent_ring_id)) {
 		ring_id_is_valid = 0;
-		qdevice_log(LOG_DEBUG, "Received heuristics change reply with old ring id.");
+		log(LOG_DEBUG, "Received heuristics change reply with old ring id.");
 	} else {
 		ring_id_is_valid = 1;
 	}
 
 	if (qdevice_net_algorithm_heuristics_change_reply_received(instance, msg->seq_number,
 	    &msg->ring_id, ring_id_is_valid, msg->heuristics, &result_vote) != 0) {
-		qdevice_log(LOG_DEBUG, "Algorithm returned error. Disconnecting.");
+		log(LOG_DEBUG, "Algorithm returned error. Disconnecting.");
 
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_ALGO_HEURISTICS_CHANGE_REPLY_ERR;
 		return (-1);
 	} else {
-		qdevice_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));
 	}
 
 	if (qdevice_net_cast_vote_timer_update(instance, result_vote) != 0) {
@@ -882,7 +882,7 @@ qdevice_net_msg_received(struct qdevice_net_instance *instance)
 		 * Error occurred. Disconnect.
 		 */
 		qdevice_net_msg_received_log_msg_decode_error(res);
-		qdevice_log(LOG_ERR, "Disconnecting from server");
+		log(LOG_ERR, "Disconnecting from server");
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_MSG_DECODE_ERROR;
 
 		return (-1);
@@ -970,7 +970,7 @@ qdevice_net_msg_received(struct qdevice_net_instance *instance)
 	}
 
 	if (!msg_processed) {
-		qdevice_log(LOG_ERR, "Received unsupported message %u. "
+		log(LOG_ERR, "Received unsupported message %u. "
 		    "Disconnecting from server", msg.type);
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_UNEXPECTED_MSG;
 

+ 4 - 4
qdevices/qdevice-net-nss.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -47,12 +47,12 @@ qdevice_net_nss_bad_cert_hook(void *arg, PRFileDesc *fd) {
 	    PR_GetError() == SEC_ERROR_CRL_EXPIRED ||
 	    PR_GetError() == SEC_ERROR_KRL_EXPIRED ||
 	    PR_GetError() == SSL_ERROR_EXPIRED_CERT_ALERT) {
-		qdevice_log(LOG_WARNING, "Server certificate is expired.");
+		log(LOG_WARNING, "Server certificate is expired.");
 
 		return (SECSuccess);
 	}
 
-	qdevice_log_nss(LOG_ERR, "Server certificate verification failure.");
+	log_nss(LOG_ERR, "Server certificate verification failure.");
 
 	return (SECFailure);
 }
@@ -63,7 +63,7 @@ qdevice_net_nss_get_client_auth_data(void *arg, PRFileDesc *sock, struct CERTDis
 {
 	struct qdevice_net_instance *instance;
 
-	qdevice_log(LOG_DEBUG, "Sending client auth data.");
+	log(LOG_DEBUG, "Sending client auth data.");
 
 	instance = (struct qdevice_net_instance *)arg;
 

+ 16 - 16
qdevices/qdevice-net-poll.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2017 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -90,7 +90,7 @@ qdevice_net_poll_write_socket(struct qdevice_net_instance *instance, const PRPol
 			 */
 			res = nss_sock_non_blocking_client_try_next(&instance->non_blocking_client);
 			if (res == -1) {
-				qdevice_log_nss(LOG_ERR, "Can't connect to qnetd host.");
+				log_nss(LOG_ERR, "Can't connect to qnetd host.");
 				nss_sock_non_blocking_client_destroy(&instance->non_blocking_client);
 			}
 		} else if (res == 0) {
@@ -107,13 +107,13 @@ qdevice_net_poll_write_socket(struct qdevice_net_instance *instance, const PRPol
 
 			instance->state = QDEVICE_NET_INSTANCE_STATE_SENDING_PREINIT_REPLY;
 
-			qdevice_log(LOG_DEBUG, "Sending preinit msg to qnetd");
+			log(LOG_DEBUG, "Sending preinit msg to qnetd");
 			if (qdevice_net_send_preinit(instance) != 0) {
 				instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_ALLOCATE_MSG_BUFFER;
 				instance->schedule_disconnect = 1;
 			}
 		} else {
-			qdevice_log(LOG_CRIT, "Unhandled nss_sock_non_blocking_client_succeeded");
+			log(LOG_CRIT, "Unhandled nss_sock_non_blocking_client_succeeded");
 			exit(1);
 		}
 	} else {
@@ -139,7 +139,7 @@ qdevice_net_poll_err_socket(struct qdevice_net_instance *instance, const PRPollD
 			qdevice_net_poll_write_socket(instance, pfd);
 		}
 	} else {
-		qdevice_log(LOG_ERR, "POLL_ERR (%u) on main socket", pfd->out_flags);
+		log(LOG_ERR, "POLL_ERR (%u) on main socket", pfd->out_flags);
 
 		instance->schedule_disconnect = 1;
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_SERVER_CLOSED_CONNECTION;
@@ -196,7 +196,7 @@ qdevice_net_poll_read_ipc_socket(struct qdevice_net_instance *instance)
 
 	prfd = PR_CreateSocketPollFd(client->socket);
 	if (prfd == NULL) {
-		qdevice_log_nss(LOG_CRIT, "Can't create NSPR poll fd for IPC client. "
+		log_nss(LOG_CRIT, "Can't create NSPR poll fd for IPC client. "
 		    "Disconnecting client");
 		qdevice_ipc_client_disconnect(instance->qdevice_instance_ptr, client);
 
@@ -221,7 +221,7 @@ qdevice_net_pr_poll_array_create(struct qdevice_net_instance *instance)
 	ipc_client_list = &instance->qdevice_instance_ptr->local_ipc.clients;
 
 	if (qdevice_ipc_is_closed(instance->qdevice_instance_ptr)) {
-		qdevice_log(LOG_DEBUG, "Local socket is closed");
+		log(LOG_DEBUG, "Local socket is closed");
 		instance->schedule_disconnect = 1;
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_LOCAL_SOCKET_CLOSED;
 
@@ -403,7 +403,7 @@ qdevice_net_poll(struct qdevice_net_instance *instance)
 				}
 
 				if (!case_processed) {
-					qdevice_log(LOG_CRIT, "Unhandled read on poll descriptor %u", i);
+					log(LOG_CRIT, "Unhandled read on poll descriptor %zu", i);
 					exit(1);
 				}
 			}
@@ -441,7 +441,7 @@ qdevice_net_poll(struct qdevice_net_instance *instance)
 				}
 
 				if (!case_processed) {
-					qdevice_log(LOG_CRIT, "Unhandled write on poll descriptor %u", i);
+					log(LOG_CRIT, "Unhandled write on poll descriptor %zu", i);
 					exit(1);
 				}
 			}
@@ -459,11 +459,11 @@ qdevice_net_poll(struct qdevice_net_instance *instance)
 				case QDEVICE_NET_POLL_ARRAY_USER_DATA_TYPE_IPC_SOCKET:
 					case_processed = 1;
 					if (pfds[i].out_flags != PR_POLL_NVAL) {
-						qdevice_log(LOG_CRIT, "POLLERR (%u) on local socket",
+						log(LOG_CRIT, "POLLERR (%u) on local socket",
 						    pfds[i].out_flags);
 						exit(1);
 					} else {
-						qdevice_log(LOG_DEBUG, "Local socket is closed");
+						log(LOG_DEBUG, "Local socket is closed");
 						instance->schedule_disconnect = 1;
 						instance->disconnect_reason =
 						    QDEVICE_NET_DISCONNECT_REASON_LOCAL_SOCKET_CLOSED;
@@ -471,14 +471,14 @@ qdevice_net_poll(struct qdevice_net_instance *instance)
 					break;
 				case QDEVICE_NET_POLL_ARRAY_USER_DATA_TYPE_IPC_CLIENT:
 					case_processed = 1;
-					qdevice_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);
 					ipc_client->schedule_disconnect = 1;
 					break;
 				case QDEVICE_NET_POLL_ARRAY_USER_DATA_TYPE_VOTEQUORUM:
 				case QDEVICE_NET_POLL_ARRAY_USER_DATA_TYPE_CMAP:
 					case_processed = 1;
-					qdevice_log(LOG_DEBUG, "POLL_ERR (%u) on corosync socket. "
+					log(LOG_DEBUG, "POLL_ERR (%u) on corosync socket. "
 					    "Disconnecting.",  pfds[i].out_flags);
 
 					instance->schedule_disconnect = 1;
@@ -497,7 +497,7 @@ qdevice_net_poll(struct qdevice_net_instance *instance)
 					 */
 					qdevice_net_poll_read_heuristics_log(instance);
 
-					qdevice_log(LOG_DEBUG, "POLL_ERR (%u) on heuristics pipe. "
+					log(LOG_DEBUG, "POLL_ERR (%u) on heuristics pipe. "
 					    "Disconnecting.",  pfds[i].out_flags);
 
 					instance->schedule_disconnect = 1;
@@ -511,7 +511,7 @@ qdevice_net_poll(struct qdevice_net_instance *instance)
 				}
 
 				if (!case_processed) {
-					qdevice_log(LOG_CRIT, "Unhandled error on poll descriptor %u", i);
+					log(LOG_CRIT, "Unhandled error on poll descriptor %zu", i);
 					exit(1);
 				}
 			}
@@ -522,7 +522,7 @@ qdevice_net_poll(struct qdevice_net_instance *instance)
 				prfd = (PRFileDesc *)qdevice_ipc_user_data->model_data;
 
 				if (PR_DestroySocketPollFd(prfd) != PR_SUCCESS) {
-					qdevice_log_nss(LOG_WARNING, "Unable to destroy client IPC poll socket fd");
+					log_nss(LOG_WARNING, "Unable to destroy client IPC poll socket fd");
 				}
 
 				qdevice_ipc_client_disconnect(instance->qdevice_instance_ptr, ipc_client);

+ 24 - 24
qdevices/qdevice-net-send.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -46,7 +46,7 @@ qdevice_net_send_echo_request(struct qdevice_net_instance *instance)
 
 	send_buffer = send_buffer_list_get_new(&instance->send_buffer_list);
 	if (send_buffer == NULL) {
-		qdevice_log(LOG_CRIT, "Can't allocate send list buffer for reply msg.");
+		log(LOG_CRIT, "Can't allocate send list buffer for reply msg.");
 
 		return (-1);
 	}
@@ -55,7 +55,7 @@ qdevice_net_send_echo_request(struct qdevice_net_instance *instance)
 
 	if (msg_create_echo_request(&send_buffer->buffer, 1,
 	    instance->echo_request_expected_msg_seq_num) == 0) {
-		qdevice_log(LOG_ERR, "Can't allocate send buffer for echo request msg");
+		log(LOG_ERR, "Can't allocate send buffer for echo request msg");
 
 		send_buffer_list_discard_new(&instance->send_buffer_list, send_buffer);
 
@@ -74,14 +74,14 @@ qdevice_net_send_preinit(struct qdevice_net_instance *instance)
 
 	send_buffer = send_buffer_list_get_new(&instance->send_buffer_list);
 	if (send_buffer == NULL) {
-		qdevice_log(LOG_ERR, "Can't allocate send list buffer for preinit msg");
+		log(LOG_ERR, "Can't allocate send list buffer for preinit msg");
 
 		return (-1);
 	}
 
 	if (msg_create_preinit(&send_buffer->buffer, instance->cluster_name, 1,
 	    instance->last_msg_seq_num) == 0) {
-		qdevice_log(LOG_ERR, "Can't allocate buffer");
+		log(LOG_ERR, "Can't allocate buffer");
 
 		send_buffer_list_discard_new(&instance->send_buffer_list, send_buffer);
 		return (-1);
@@ -110,7 +110,7 @@ qdevice_net_send_init(struct qdevice_net_instance *instance)
 
 	send_buffer = send_buffer_list_get_new(&instance->send_buffer_list);
 	if (send_buffer == NULL) {
-		qdevice_log(LOG_ERR, "Can't allocate send list buffer for init msg");
+		log(LOG_ERR, "Can't allocate send list buffer for init msg");
 
 		return (-1);
 	}
@@ -123,7 +123,7 @@ qdevice_net_send_init(struct qdevice_net_instance *instance)
 	    supported_msgs, no_supported_msgs, supported_opts, no_supported_opts,
 	    instance->qdevice_instance_ptr->node_id, instance->heartbeat_interval,
 	    &instance->tie_breaker, &tlv_rid) == 0) {
-		qdevice_log(LOG_ERR, "Can't allocate send buffer for init msg");
+		log(LOG_ERR, "Can't allocate send buffer for init msg");
 
 		send_buffer_list_discard_new(&instance->send_buffer_list, send_buffer);
 		return (-1);
@@ -145,18 +145,18 @@ qdevice_net_send_ask_for_vote(struct qdevice_net_instance *instance)
 
 	send_buffer = send_buffer_list_get_new(&instance->send_buffer_list);
 	if (send_buffer == NULL) {
-		qdevice_log(LOG_ERR, "Can't allocate send list buffer for ask for vote msg");
+		log(LOG_ERR, "Can't allocate send list buffer for ask for vote msg");
 
 		return (-1);
 	}
 
 	instance->last_msg_seq_num++;
 
-	qdevice_log(LOG_DEBUG, "Sending ask for vote seq = "UTILS_PRI_MSG_SEQ,
+	log(LOG_DEBUG, "Sending ask for vote seq = "UTILS_PRI_MSG_SEQ,
 	    instance->last_msg_seq_num);
 
 	if (msg_create_ask_for_vote(&send_buffer->buffer, instance->last_msg_seq_num) == 0) {
-		qdevice_log(LOG_ERR, "Can't allocate send buffer for ask for vote msg");
+		log(LOG_ERR, "Can't allocate send buffer for ask for vote msg");
 
 		send_buffer_list_discard_new(&instance->send_buffer_list, send_buffer);
 		return (-1);
@@ -176,7 +176,7 @@ qdevice_net_send_config_node_list(struct qdevice_net_instance *instance,
 
 	send_buffer = send_buffer_list_get_new(&instance->send_buffer_list);
 	if (send_buffer == NULL) {
-		qdevice_log(LOG_ERR, "Can't allocate send list buffer for config "
+		log(LOG_ERR, "Can't allocate send list buffer for config "
 		    "node list msg");
 
 		return (-1);
@@ -184,7 +184,7 @@ qdevice_net_send_config_node_list(struct qdevice_net_instance *instance,
 
 	instance->last_msg_seq_num++;
 
-	qdevice_log(LOG_DEBUG, "Sending config node list seq = "UTILS_PRI_MSG_SEQ,
+	log(LOG_DEBUG, "Sending config node list seq = "UTILS_PRI_MSG_SEQ,
 	    instance->last_msg_seq_num);
 	qdevice_log_debug_dump_node_list(nlist);
 
@@ -192,7 +192,7 @@ qdevice_net_send_config_node_list(struct qdevice_net_instance *instance,
 	    (initial ? TLV_NODE_LIST_TYPE_INITIAL_CONFIG : TLV_NODE_LIST_TYPE_CHANGED_CONFIG),
 	    0, NULL, config_version_set, config_version, 0, TLV_QUORATE_INQUORATE,
 	    0, TLV_HEURISTICS_UNDEFINED, nlist) == 0) {
-		qdevice_log(LOG_ERR, "Can't allocate send buffer for config list msg");
+		log(LOG_ERR, "Can't allocate send buffer for config list msg");
 
 		send_buffer_list_discard_new(&instance->send_buffer_list, send_buffer);
 		return (-1);
@@ -211,20 +211,20 @@ qdevice_net_send_heuristics_change(struct qdevice_net_instance *instance,
 
 	send_buffer = send_buffer_list_get_new(&instance->send_buffer_list);
 	if (send_buffer == NULL) {
-		qdevice_log(LOG_ERR, "Can't allocate send list buffer for heuristics change msg");
+		log(LOG_ERR, "Can't allocate send list buffer for heuristics change msg");
 
 		return (-1);
 	}
 
 	instance->last_msg_seq_num++;
 
-	qdevice_log(LOG_DEBUG, "Sending heuristics change seq = "UTILS_PRI_MSG_SEQ
+	log(LOG_DEBUG, "Sending heuristics change seq = "UTILS_PRI_MSG_SEQ
 	    ", heuristics = %s",
 	    instance->last_msg_seq_num, tlv_heuristics_to_str(heuristics));
 
 	if (msg_create_heuristics_change(&send_buffer->buffer, instance->last_msg_seq_num,
 	    heuristics) == 0) {
-		qdevice_log(LOG_ERR, "Can't allocate send buffer for heuristics change msg");
+		log(LOG_ERR, "Can't allocate send buffer for heuristics change msg");
 
 		send_buffer_list_discard_new(&instance->send_buffer_list, send_buffer);
 		return (-1);
@@ -248,7 +248,7 @@ qdevice_net_send_membership_node_list(struct qdevice_net_instance *instance,
 
 	for (i = 0; i < node_list_entries; i++) {
 		if (node_list_add(&nlist, node_list[i], 0, TLV_NODE_STATE_NOT_SET) == NULL) {
-			qdevice_log(LOG_ERR, "Can't allocate membership node list.");
+			log(LOG_ERR, "Can't allocate membership node list.");
 
 			node_list_free(&nlist);
 
@@ -258,7 +258,7 @@ qdevice_net_send_membership_node_list(struct qdevice_net_instance *instance,
 
 	send_buffer = send_buffer_list_get_new(&instance->send_buffer_list);
 	if (send_buffer == NULL) {
-		qdevice_log(LOG_ERR, "Can't allocate send list buffer for membership "
+		log(LOG_ERR, "Can't allocate send list buffer for membership "
 		    "node list msg");
 
 		node_list_free(&nlist);
@@ -268,7 +268,7 @@ qdevice_net_send_membership_node_list(struct qdevice_net_instance *instance,
 
 	instance->last_msg_seq_num++;
 
-	qdevice_log(LOG_DEBUG, "Sending membership node list seq = "UTILS_PRI_MSG_SEQ", "
+	log(LOG_DEBUG, "Sending membership node list seq = "UTILS_PRI_MSG_SEQ", "
 	    "ringid = ("UTILS_PRI_RING_ID"), heuristics = %s.", instance->last_msg_seq_num,
 	    ring_id->node_id, ring_id->seq, tlv_heuristics_to_str(heuristics));
 	qdevice_log_debug_dump_node_list(&nlist);
@@ -276,7 +276,7 @@ qdevice_net_send_membership_node_list(struct qdevice_net_instance *instance,
 	if (msg_create_node_list(&send_buffer->buffer, instance->last_msg_seq_num,
 	    TLV_NODE_LIST_TYPE_MEMBERSHIP,
 	    1, ring_id, 0, 0, 0, 0, 1, heuristics, &nlist) == 0) {
-		qdevice_log(LOG_ERR, "Can't allocate send buffer for membership list msg");
+		log(LOG_ERR, "Can't allocate send buffer for membership list msg");
 
 		node_list_free(&nlist);
 
@@ -311,7 +311,7 @@ qdevice_net_send_quorum_node_list(struct qdevice_net_instance *instance,
 
 		if (node_list_add(&nlist, node_list[i].nodeid, 0,
 		    qdevice_net_votequorum_node_state_to_tlv(node_list[i].state)) == NULL) {
-			qdevice_log(LOG_ERR, "Can't allocate quorum node list.");
+			log(LOG_ERR, "Can't allocate quorum node list.");
 
 			node_list_free(&nlist);
 
@@ -321,7 +321,7 @@ qdevice_net_send_quorum_node_list(struct qdevice_net_instance *instance,
 
 	send_buffer = send_buffer_list_get_new(&instance->send_buffer_list);
 	if (send_buffer == NULL) {
-		qdevice_log(LOG_ERR, "Can't allocate send list buffer for quorum "
+		log(LOG_ERR, "Can't allocate send list buffer for quorum "
 		    "node list msg");
 
 		node_list_free(&nlist);
@@ -331,14 +331,14 @@ qdevice_net_send_quorum_node_list(struct qdevice_net_instance *instance,
 
 	instance->last_msg_seq_num++;
 
-	qdevice_log(LOG_DEBUG, "Sending quorum node list seq = "UTILS_PRI_MSG_SEQ", quorate = %u",
+	log(LOG_DEBUG, "Sending quorum node list seq = "UTILS_PRI_MSG_SEQ", quorate = %u",
 	    instance->last_msg_seq_num, quorate);
 	qdevice_log_debug_dump_node_list(&nlist);
 
 	if (msg_create_node_list(&send_buffer->buffer, instance->last_msg_seq_num,
 	    TLV_NODE_LIST_TYPE_QUORUM,
 	    0, NULL, 0, 0, 1, quorate, 0, TLV_HEURISTICS_UNDEFINED, &nlist) == 0) {
-		qdevice_log(LOG_ERR, "Can't allocate send buffer for quorum list msg");
+		log(LOG_ERR, "Can't allocate send buffer for quorum list msg");
 
 		node_list_free(&nlist);
 

+ 14 - 14
qdevices/qdevice-net-socket.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -57,7 +57,7 @@ qdevice_net_socket_read(struct qdevice_net_instance *instance)
 	    &instance->msg_already_received_bytes, &instance->skipping_msg);
 
 	if (!orig_skipping_msg && instance->skipping_msg) {
-		qdevice_log(LOG_DEBUG, "msgio_read set skipping_msg");
+		log(LOG_DEBUG, "msgio_read set skipping_msg");
 	}
 
 	ret_val = 0;
@@ -69,36 +69,36 @@ qdevice_net_socket_read(struct qdevice_net_instance *instance)
 		 */
 		break;
 	case -1:
-		qdevice_log(LOG_DEBUG, "Server closed connection");
+		log(LOG_DEBUG, "Server closed connection");
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_SERVER_CLOSED_CONNECTION;
 		ret_val = -1;
 		break;
 	case -2:
-		qdevice_log(LOG_ERR, "Unhandled error when reading from server. "
+		log(LOG_ERR, "Unhandled error when reading from server. "
 		    "Disconnecting from server");
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_READ_MESSAGE;
 		ret_val = -1;
 		break;
 	case -3:
-		qdevice_log(LOG_ERR, "Can't store message header from server. "
+		log(LOG_ERR, "Can't store message header from server. "
 		    "Disconnecting from server");
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_READ_MESSAGE;
 		ret_val = -1;
 		break;
 	case -4:
-		qdevice_log(LOG_ERR, "Can't store message from server. "
+		log(LOG_ERR, "Can't store message from server. "
 		    "Disconnecting from server");
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_READ_MESSAGE;
 		ret_val = -1;
 		break;
 	case -5:
-		qdevice_log(LOG_WARNING, "Server sent unsupported msg type %u. "
+		log(LOG_WARNING, "Server sent unsupported msg type %u. "
 		    "Disconnecting from server", msg_get_type(&instance->receive_buffer));
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_UNSUPPORTED_MSG;
 		ret_val = -1;
 		break;
 	case -6:
-		qdevice_log(LOG_WARNING,
+		log(LOG_WARNING,
 		    "Server wants to send too long message %u bytes. Disconnecting from server",
 		    msg_get_len(&instance->receive_buffer));
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_READ_MESSAGE;
@@ -113,7 +113,7 @@ qdevice_net_socket_read(struct qdevice_net_instance *instance)
 				ret_val = -1;
 			}
 		} else {
-			qdevice_log(LOG_CRIT, "net_socket_read in skipping msg state");
+			log(LOG_CRIT, "net_socket_read in skipping msg state");
 			exit(1);
 		}
 
@@ -122,7 +122,7 @@ qdevice_net_socket_read(struct qdevice_net_instance *instance)
 		dynar_clean(&instance->receive_buffer);
 		break;
 	default:
-		qdevice_log(LOG_CRIT, "qdevice_net_socket_read unhandled error %d", res);
+		log(LOG_CRIT, "qdevice_net_socket_read unhandled error %d", res);
 		exit(1);
 		break;
 	}
@@ -144,7 +144,7 @@ qdevice_net_socket_write_finished(struct qdevice_net_instance *instance)
 		    qdevice_net_nss_bad_cert_hook,
 		    qdevice_net_nss_get_client_auth_data,
 		    instance, 0, NULL)) == NULL) {
-			qdevice_log_nss(LOG_ERR, "Can't start TLS");
+			log_nss(LOG_ERR, "Can't start TLS");
 			instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_START_TLS;
 			return (-1);
 		}
@@ -175,7 +175,7 @@ qdevice_net_socket_write(struct qdevice_net_instance *instance)
 
 	send_buffer = send_buffer_list_get_active(&instance->send_buffer_list);
 	if (send_buffer == NULL) {
-		qdevice_log(LOG_CRIT, "send_buffer_list_get_active returned NULL");
+		log(LOG_CRIT, "send_buffer_list_get_active returned NULL");
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_SEND_MESSAGE;
 
 		return (-1);
@@ -197,13 +197,13 @@ qdevice_net_socket_write(struct qdevice_net_instance *instance)
 	}
 
 	if (res == -1) {
-		qdevice_log_nss(LOG_CRIT, "PR_Send returned 0");
+		log_nss(LOG_CRIT, "PR_Send returned 0");
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_SERVER_CLOSED_CONNECTION;
 		return (-1);
 	}
 
 	if (res == -2) {
-		qdevice_log_nss(LOG_ERR, "Unhandled error when sending message to server");
+		log_nss(LOG_ERR, "Unhandled error when sending message to server");
 		instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_CANT_SEND_MESSAGE;
 
 		return (-1);

+ 2 - 2
qdevices/qdevice-net-votequorum.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2017 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -45,7 +45,7 @@ qdevice_net_votequorum_node_state_to_tlv(uint32_t votequorum_node_state)
 	case VOTEQUORUM_NODESTATE_DEAD: res = TLV_NODE_STATE_DEAD; break;
 	case VOTEQUORUM_NODESTATE_LEAVING: res = TLV_NODE_STATE_LEAVING; break;
 	default:
-		qdevice_log(LOG_ERR, "qdevice_net_votequorum_node_state_to_tlv: Unhandled votequorum "
+		log(LOG_ERR, "qdevice_net_votequorum_node_state_to_tlv: Unhandled votequorum "
 		    "node state %"PRIu32, votequorum_node_state);
 		exit(1);
 		break;

+ 41 - 41
qdevices/qdevice-votequorum.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -49,24 +49,24 @@ qdevice_votequorum_quorum_notify_callback(votequorum_handle_t votequorum_handle,
 	uint32_t u32;
 
 	if (votequorum_context_get(votequorum_handle, (void **)&instance) != CS_OK) {
-		qdevice_log(LOG_CRIT, "Fatal error. Can't get votequorum context");
+		log(LOG_CRIT, "Fatal error. Can't get votequorum context");
 		exit(1);
 	}
 
 	instance->sync_in_progress = 0;
 
-	qdevice_log(LOG_DEBUG, "Votequorum quorum notify callback:");
-	qdevice_log(LOG_DEBUG, "  Quorate = %u", quorate);
+	log(LOG_DEBUG, "Votequorum quorum notify callback:");
+	log(LOG_DEBUG, "  Quorate = %u", quorate);
 
-	qdevice_log(LOG_DEBUG, "  Node list (size = %"PRIu32"):", node_list_entries);
+	log(LOG_DEBUG, "  Node list (size = %"PRIu32"):", node_list_entries);
 	for (u32 = 0; u32 < node_list_entries; u32++) {
-		qdevice_log(LOG_DEBUG, "    %"PRIu32" nodeid = "UTILS_PRI_NODE_ID", state = %"PRIu32,
+		log(LOG_DEBUG, "    %"PRIu32" nodeid = "UTILS_PRI_NODE_ID", state = %"PRIu32,
 		    u32, node_list[u32].nodeid, node_list[u32].state);
 	}
 
 	if (qdevice_model_votequorum_quorum_notify(instance, quorate, node_list_entries,
 	    node_list) != 0) {
-		qdevice_log(LOG_DEBUG, "qdevice_model_votequorum_quorum_notify returned error -> exit");
+		log(LOG_DEBUG, "qdevice_model_votequorum_quorum_notify returned error -> exit");
 		exit(2);
 	}
 
@@ -76,7 +76,7 @@ qdevice_votequorum_quorum_notify_callback(votequorum_handle_t votequorum_handle,
 	free(instance->vq_quorum_node_list);
 	instance->vq_quorum_node_list = malloc(sizeof(*node_list) * node_list_entries);
 	if (instance->vq_quorum_node_list == NULL) {
-		qdevice_log(LOG_CRIT, "Can't alloc votequorum node list memory");
+		log(LOG_CRIT, "Can't alloc votequorum node list memory");
 		exit(1);
 	}
 	memcpy(instance->vq_quorum_node_list, node_list, sizeof(*node_list) * node_list_entries);
@@ -96,17 +96,17 @@ qdevice_votequorum_heuristics_exec_result_callback(
 	if (qdevice_heuristics_result_notifier_list_set_active(
 	    &instance->heuristics_instance.exec_result_notifier_list,
 	    qdevice_votequorum_heuristics_exec_result_callback, 0) != 0) {
-		qdevice_log(LOG_CRIT, "Can't deactivate votequrorum heuristics exec callback notifier");
+		log(LOG_CRIT, "Can't deactivate votequrorum heuristics exec callback notifier");
 		exit(2);
 	}
 
-	qdevice_log(LOG_DEBUG, "Votequorum heuristics exec result callback:");
-	qdevice_log(LOG_DEBUG, "  seq_number = %"PRIu32", exec_result = %s",
+	log(LOG_DEBUG, "Votequorum heuristics exec result callback:");
+	log(LOG_DEBUG, "  seq_number = %"PRIu32", exec_result = %s",
 	    seq_number, qdevice_heuristics_exec_result_to_str(exec_result));
 
 	if (qdevice_model_votequorum_node_list_heuristics_notify(instance, instance->vq_node_list_ring_id,
 	    instance->vq_node_list_entries, instance->vq_node_list, exec_result) != 0) {
-		qdevice_log(LOG_DEBUG, "qdevice_votequorum_node_list_heuristics_notify_callback returned error -> exit");
+		log(LOG_DEBUG, "qdevice_votequorum_node_list_heuristics_notify_callback returned error -> exit");
 		exit(2);
 	}
 
@@ -125,38 +125,38 @@ qdevice_votequorum_node_list_notify_callback(votequorum_handle_t votequorum_hand
 	uint32_t u32;
 
 	if (votequorum_context_get(votequorum_handle, (void **)&instance) != CS_OK) {
-		qdevice_log(LOG_CRIT, "Fatal error. Can't get votequorum context");
+		log(LOG_CRIT, "Fatal error. Can't get votequorum context");
 		exit(1);
 	}
 
 	instance->sync_in_progress = 1;
 	memcpy(&instance->vq_poll_ring_id, &votequorum_ring_id, sizeof(votequorum_ring_id));
 
-	qdevice_log(LOG_DEBUG, "Votequorum nodelist notify callback:");
-	qdevice_log(LOG_DEBUG, "  Ring_id = ("UTILS_PRI_RING_ID")",
+	log(LOG_DEBUG, "Votequorum nodelist notify callback:");
+	log(LOG_DEBUG, "  Ring_id = ("UTILS_PRI_RING_ID")",
 	    votequorum_ring_id.nodeid, votequorum_ring_id.seq);
 
-	qdevice_log(LOG_DEBUG, "  Node list (size = %"PRIu32"):", node_list_entries);
+	log(LOG_DEBUG, "  Node list (size = %"PRIu32"):", node_list_entries);
 	for (u32 = 0; u32 < node_list_entries; u32++) {
-		qdevice_log(LOG_DEBUG, "    %"PRIu32" nodeid = "UTILS_PRI_NODE_ID,
+		log(LOG_DEBUG, "    %"PRIu32" nodeid = "UTILS_PRI_NODE_ID,
 		    u32, node_list[u32]);
 	}
 
 	if (qdevice_model_votequorum_node_list_notify(instance, votequorum_ring_id, node_list_entries,
 	    node_list) != 0) {
-		qdevice_log(LOG_DEBUG, "qdevice_votequorum_node_list_notify_callback returned error -> exit");
+		log(LOG_DEBUG, "qdevice_votequorum_node_list_notify_callback returned error -> exit");
 		exit(2);
 	}
 
 	if (qdevice_heuristics_result_notifier_list_set_active(
 	    &instance->heuristics_instance.exec_result_notifier_list,
 	    qdevice_votequorum_heuristics_exec_result_callback, 1) != 0) {
-		qdevice_log(LOG_CRIT, "Can't activate votequrorum heuristics exec callback notifier");
+		log(LOG_CRIT, "Can't activate votequrorum heuristics exec callback notifier");
 		exit(2);
 	}
 
 	if (qdevice_heuristics_exec(&instance->heuristics_instance, instance->sync_in_progress) != 0) {
-		qdevice_log(LOG_CRIT, "Can't start heuristics -> exit");
+		log(LOG_CRIT, "Can't start heuristics -> exit");
 		exit(2);
 	}
 
@@ -166,7 +166,7 @@ qdevice_votequorum_node_list_notify_callback(votequorum_handle_t votequorum_hand
 	free(instance->vq_node_list);
 	instance->vq_node_list = malloc(sizeof(*node_list) * node_list_entries);
 	if (instance->vq_node_list == NULL) {
-		qdevice_log(LOG_CRIT, "Can't alloc votequorum node list memory");
+		log(LOG_CRIT, "Can't alloc votequorum node list memory");
 		exit(1);
 	}
 	memcpy(instance->vq_node_list, node_list, sizeof(*node_list) * node_list_entries);
@@ -179,15 +179,15 @@ qdevice_votequorum_expected_votes_notify_callback(votequorum_handle_t votequorum
 	struct qdevice_instance *instance;
 
 	if (votequorum_context_get(votequorum_handle, (void **)&instance) != CS_OK) {
-		qdevice_log(LOG_CRIT, "Fatal error. Can't get votequorum context");
+		log(LOG_CRIT, "Fatal error. Can't get votequorum context");
 		exit(1);
 	}
 
-	qdevice_log(LOG_DEBUG, "Votequorum expected_votes notify callback:");
-	qdevice_log(LOG_DEBUG, "  Expected_votes: "UTILS_PRI_EXPECTED_VOTES, expected_votes);
+	log(LOG_DEBUG, "Votequorum expected_votes notify callback:");
+	log(LOG_DEBUG, "  Expected_votes: "UTILS_PRI_EXPECTED_VOTES, expected_votes);
 
 	if (qdevice_model_votequorum_expected_votes_notify(instance, expected_votes) != 0) {
-		qdevice_log(LOG_DEBUG, "qdevice_votequorum_expected_votes_notify_callback returned error -> exit");
+		log(LOG_DEBUG, "qdevice_votequorum_expected_votes_notify_callback returned error -> exit");
 		exit(2);
 	}
 
@@ -223,24 +223,24 @@ qdevice_votequorum_init(struct qdevice_instance *instance)
 	}
 
 	if (res != CS_OK) {
-		qdevice_log(LOG_CRIT, "Failed to initialize the votequorum API. Error %s", cs_strerror(res));
+		log(LOG_CRIT, "Failed to initialize the votequorum API. Error %s", cs_strerror(res));
 		exit(1);
 	}
 
 	if ((res = votequorum_qdevice_register(votequorum_handle,
 	    instance->advanced_settings->votequorum_device_name)) != CS_OK) {
-		qdevice_log(LOG_CRIT, "Can't register votequorum device. Error %s", cs_strerror(res));
+		log(LOG_CRIT, "Can't register votequorum device. Error %s", cs_strerror(res));
 		exit(1);
 	}
 
 	if ((res = votequorum_context_set(votequorum_handle, (void *)instance)) != CS_OK) {
-		qdevice_log(LOG_CRIT, "Can't set votequorum context. Error %s", cs_strerror(res));
+		log(LOG_CRIT, "Can't set votequorum context. Error %s", cs_strerror(res));
 		exit(1);
 	}
 
 	if ((res = votequorum_getinfo(votequorum_handle, VOTEQUORUM_QDEVICE_NODEID,
 	    &vq_info)) != CS_OK) {
-		qdevice_log(LOG_CRIT, "Can't get votequorum information. Error %s", cs_strerror(res));
+		log(LOG_CRIT, "Can't get votequorum information. Error %s", cs_strerror(res));
 		exit(1);
 	}
 	instance->vq_expected_votes = vq_info.node_expected_votes;
@@ -251,14 +251,14 @@ qdevice_votequorum_init(struct qdevice_instance *instance)
 
 	if ((res = votequorum_trackstart(instance->votequorum_handle, 0,
 	    CS_TRACK_CHANGES)) != CS_OK) {
-		qdevice_log(LOG_CRIT, "Can't start tracking votequorum changes. Error %s",
+		log(LOG_CRIT, "Can't start tracking votequorum changes. Error %s",
 		    cs_strerror(res));
 		exit(1);
 	}
 
 	if (qdevice_heuristics_result_notifier_list_add(&instance->heuristics_instance.exec_result_notifier_list,
 	    qdevice_votequorum_heuristics_exec_result_callback) == NULL) {
-		qdevice_log(LOG_CRIT, "Can't add votequrorum heuristics exec callback into notifier");
+		log(LOG_CRIT, "Can't add votequrorum heuristics exec callback into notifier");
 		exit(1);
 	}
 }
@@ -273,7 +273,7 @@ qdevice_votequorum_destroy(struct qdevice_instance *instance)
 
 	res = votequorum_trackstop(instance->votequorum_handle);
 	if (res != CS_OK) {
-		qdevice_log(LOG_WARNING, "Can't start tracking votequorum changes. Error %s",
+		log(LOG_WARNING, "Can't start tracking votequorum changes. Error %s",
 		    cs_strerror(res));
 	}
 
@@ -281,12 +281,12 @@ qdevice_votequorum_destroy(struct qdevice_instance *instance)
 		instance->advanced_settings->votequorum_device_name);
 
 	if (res != CS_OK) {
-		qdevice_log(LOG_WARNING, "Unable to unregister votequorum device. Error %s", cs_strerror(res));
+		log(LOG_WARNING, "Unable to unregister votequorum device. Error %s", cs_strerror(res));
 	}
 
 	res = votequorum_finalize(instance->votequorum_handle);
 	if (res != CS_OK) {
-		qdevice_log(LOG_WARNING, "Unable to finalize votequorum. Error %s", cs_strerror(res));
+		log(LOG_WARNING, "Unable to finalize votequorum. Error %s", cs_strerror(res));
 	}
 }
 
@@ -304,7 +304,7 @@ qdevice_votequorum_wait_for_ring_id(struct qdevice_instance *instance)
 	}
 
 	if (!instance->vq_node_list_initial_ring_id_set) {
-		qdevice_log(LOG_CRIT, "Can't get initial votequorum membership information.");
+		log(LOG_CRIT, "Can't get initial votequorum membership information.");
 		return (-1);
 	}
 
@@ -319,7 +319,7 @@ qdevice_votequorum_dispatch(struct qdevice_instance *instance)
 	res = votequorum_dispatch(instance->votequorum_handle, CS_DISPATCH_ALL);
 
 	if (res != CS_OK && res != CS_ERR_TRY_AGAIN) {
-		qdevice_log(LOG_ERR, "Can't dispatch votequorum messages");
+		log(LOG_ERR, "Can't dispatch votequorum messages");
 
 		return (-1);
 	}
@@ -341,9 +341,9 @@ qdevice_votequorum_poll(struct qdevice_instance *instance, int cast_vote)
 
 	if (res != CS_OK && res != CS_ERR_TRY_AGAIN) {
 		if (res == CS_ERR_MESSAGE_ERROR) {
-			qdevice_log(LOG_INFO, "qdevice_votequorum_poll called with old ring id");
+			log(LOG_INFO, "qdevice_votequorum_poll called with old ring id");
 		} else {
-			qdevice_log(LOG_CRIT, "Can't call votequorum_qdevice_poll. Error %s",
+			log(LOG_CRIT, "Can't call votequorum_qdevice_poll. Error %s",
 			    cs_strerror(res));
 
 			return (-1);
@@ -363,7 +363,7 @@ qdevice_votequorum_master_wins(struct qdevice_instance *instance, int allow)
 
 	if (instance->advanced_settings->master_wins ==
 	    QDEVICE_ADVANCED_SETTINGS_MASTER_WINS_FORCE_OFF && allow) {
-		qdevice_log(LOG_WARNING, "Allow of master wins is requested, but user forcibly "
+		log(LOG_WARNING, "Allow of master wins is requested, but user forcibly "
 		    "disallowed it. Keeping master wins disallowed.");
 
 		final_allow = 0;
@@ -371,7 +371,7 @@ qdevice_votequorum_master_wins(struct qdevice_instance *instance, int allow)
 
 	if (instance->advanced_settings->master_wins ==
 	    QDEVICE_ADVANCED_SETTINGS_MASTER_WINS_FORCE_ON && !allow) {
-		qdevice_log(LOG_WARNING, "Disallow of master wins is requested, but user forcibly "
+		log(LOG_WARNING, "Disallow of master wins is requested, but user forcibly "
 		    "allowed it. Keeping master wins allowed.");
 
 		final_allow = 1;
@@ -381,7 +381,7 @@ qdevice_votequorum_master_wins(struct qdevice_instance *instance, int allow)
 	    instance->advanced_settings->votequorum_device_name, final_allow);
 
 	if (res != CS_OK) {
-		qdevice_log(LOG_CRIT, "Can't set master wins. Error %s", cs_strerror(res));
+		log(LOG_CRIT, "Can't set master wins. Error %s", cs_strerror(res));
 
 		return (-1);
 	}