]> git.proxmox.com Git - mirror_corosync-qdevice.git/log
mirror_corosync-qdevice.git
3 years agoqnetd: Don't alloc host_addr master
Jan Friesse [Mon, 23 Nov 2020 13:14:05 +0000 (14:14 +0100)]
qnetd: Don't alloc host_addr

getopt will return pointer to argv so there is no need to dup optarg.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqnetd: Move client schedule disconnect handling
Jan Friesse [Wed, 18 Nov 2020 16:52:12 +0000 (17:52 +0100)]
qnetd: Move client schedule disconnect handling

Client disconnect used to be per client fd in
the qnetd_client_net_socket_poll_loop_set_events_cb. Problem is, that
disconnect calls algorithm which may send message to other client
with fd which was already processed in the pr-poll-loop so POLLOUT is
not set till new loop exec is called (and that usually happens
because old one timeouts). To reproduce this problem use
ffsplit and make qnetd disconnect one of the clients - ffsplit
needs to send ack/nack votes, but it doesn't send them during
first iteration and waits for dpd timeout.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqnetd-algo-ffsplit: Simplify KAP Tie-breaker logic
Jan Friesse [Wed, 18 Nov 2020 14:03:13 +0000 (15:03 +0100)]
qnetd-algo-ffsplit: Simplify KAP Tie-breaker logic

Also make it more reliable.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqnetd: Improve dead peer detection
Jan Friesse [Wed, 18 Nov 2020 13:31:01 +0000 (14:31 +0100)]
qnetd: Improve dead peer detection

Previously dead peer detection timer was scheduled every dpd_interval,
added dpd_interval to all of the clients timestamp and if timestamp was
larger than client hearbeat interval * 1.2 then check if client sent
some message. If so, flag was reset.

This method was source of number of problems so instead different method
is now used.

Every single client has its own timer with timeout based on
(configurable) dpd_interval_coefficient and multiplied with
client heartbeat timeout. When message is received from client timer is
rescheduled. When timer callback is called (= client doesn't sent
message during timeout) then client is disconnected.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqnet-config: Add space to string concat
Jan Friesse [Fri, 13 Nov 2020 15:27:39 +0000 (16:27 +0100)]
qnet-config: Add space to string concat

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agotimer-list: Add functions for get and set interval
Jan Friesse [Fri, 13 Nov 2020 15:24:38 +0000 (16:24 +0100)]
timer-list: Add functions for get and set interval

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agotimer-list: Rename delete and reschedule ops
Jan Friesse [Fri, 13 Nov 2020 15:20:31 +0000 (16:20 +0100)]
timer-list: Rename delete and reschedule ops

Add entry to the name so it is more evident change is happening to the
entry and not to the list.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoutils: Add utils_strtod
Jan Friesse [Mon, 9 Nov 2020 14:09:01 +0000 (15:09 +0100)]
utils: Add utils_strtod

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqdevice: Handle configurations without ring0_addr
Jan Friesse [Thu, 12 Nov 2020 17:17:27 +0000 (18:17 +0100)]
qdevice: Handle configurations without ring0_addr

Configuration without ring0_addr is valid for new Corosync.

Big thanks to Fabian-Gruenbichler who reported the problem and
Oyvind Albrigtsen for englishify the error message.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqdevice: Configuration without nodelist is invalid
Jan Friesse [Thu, 12 Nov 2020 16:10:13 +0000 (17:10 +0100)]
qdevice: Configuration without nodelist is invalid

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqdevice-cmap: Load clear node high bit only once
Jan Friesse [Thu, 12 Nov 2020 15:57:50 +0000 (16:57 +0100)]
qdevice-cmap: Load clear node high bit only once

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqdevice-cmap: Fix clear high node bit typo
Jan Friesse [Thu, 12 Nov 2020 15:53:50 +0000 (16:53 +0100)]
qdevice-cmap: Fix clear high node bit typo

It's really bit, not byte.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqdevice-net-ipc-cmd: Fix compiler warning
Jan Friesse [Wed, 11 Nov 2020 16:27:06 +0000 (17:27 +0100)]
qdevice-net-ipc-cmd: Fix compiler warning

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agodevel: add corosync-qdevice.pc file for pcs to use
Fabio M. Di Nitto [Wed, 11 Nov 2020 14:48:54 +0000 (15:48 +0100)]
devel: add corosync-qdevice.pc file for pcs to use

add corosync-qdevice-devel package for future

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
3 years agotests: Fix assert problems
Jan Friesse [Thu, 5 Nov 2020 17:18:41 +0000 (18:18 +0100)]
tests: Fix assert problems

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agotimer-list: Improve efficiency of delete operation
Jan Friesse [Thu, 5 Nov 2020 16:25:59 +0000 (17:25 +0100)]
timer-list: Improve efficiency of delete operation

Position in entries array, heap_pos, is added to the entry.
This has to be kept in sync for every move so new internal set/get
functions are added too.

This removes need for searching for entry.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agotest-timer-list: Ignore poll errors
Jan Friesse [Wed, 4 Nov 2020 16:50:52 +0000 (17:50 +0100)]
test-timer-list: Ignore poll errors

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agotlv: Check dynar_cat result
Jan Friesse [Wed, 4 Nov 2020 16:46:38 +0000 (17:46 +0100)]
tlv: Check dynar_cat result

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agotest-process-list: Fix few bugs
Jan Friesse [Wed, 4 Nov 2020 16:44:35 +0000 (17:44 +0100)]
test-process-list: Fix few bugs

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agomsg: Check cat result on adding msg type and size
Jan Friesse [Wed, 4 Nov 2020 16:37:43 +0000 (17:37 +0100)]
msg: Check cat result on adding msg type and size

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agotimer-list: Implement heap based timer-list
Jan Friesse [Wed, 4 Nov 2020 16:26:54 +0000 (17:26 +0100)]
timer-list: Implement heap based timer-list

Previous timer-list was naive implementation of priority queue and very
slow when number of timers increased. This was not a problem because
only few timers were used. But with removal of dpd timer and replacement
with per-connection timer this may become problematic.

Solution is to use binary heap based priority queue which is much
faster.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agopr-poll-loop: Add queue header include
Jan Friesse [Tue, 3 Nov 2020 14:51:58 +0000 (15:51 +0100)]
pr-poll-loop: Add queue header include

Also add same includes to qnetd-alog-utils header file.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqdevice-ipc: Fix dereference bug
Jan Friesse [Tue, 27 Oct 2020 16:18:50 +0000 (17:18 +0100)]
qdevice-ipc: Fix dereference bug

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqnet: Add support for keep active partition vote
Jan Friesse [Tue, 27 Oct 2020 15:55:23 +0000 (16:55 +0100)]
qnet: Add support for keep active partition vote

This patch adds qdevice-net part of keep active partition tie breaker
functionality. It's enabled by default.

When tie happens prefer partition with members of
previously active (quorate) partition. This is hard-coded
behavior of LMS algorithm so this setting affects only
FFSplit algorithm. By default it is disabled for backwards
compatibility.

This solves problem with FFSplit when node A (with lowest id) is killed,
node B gets vote and then node A starts up and creates single node
membership and gets vote.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqnetd: Fix NULL dereference of client
Jan Friesse [Mon, 26 Oct 2020 13:52:11 +0000 (14:52 +0100)]
qnetd: Fix NULL dereference of client

Shouldn't happen but be rather safe.

Also add more comments.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqdevice-net-heuristics: Fix log message
Jan Friesse [Mon, 26 Oct 2020 11:08:12 +0000 (12:08 +0100)]
qdevice-net-heuristics: Fix log message

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqdevice: Fix set option and set option reply
Jan Friesse [Mon, 26 Oct 2020 11:05:18 +0000 (12:05 +0100)]
qdevice: Fix set option and set option reply

To match the specification add heartbeat timeout only when requested.

Also add qdevice client method to send option message.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoLICENSE: Update copyright date
Jan Friesse [Tue, 22 Sep 2020 11:37:10 +0000 (13:37 +0200)]
LICENSE: Update copyright date

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqnetd: Add support for keep active partition vote
Jan Friesse [Tue, 22 Sep 2020 11:31:24 +0000 (13:31 +0200)]
qnetd: Add support for keep active partition vote

When tie happens prefer partition with members of
previously active (quorate) partition. This is hard-coded
behavior of LMS algorithm so this setting affects only
FFSplit algorithm. By default it is disabled for backwards
compatibility.

This solves problem with FFSplit when node A (with lowest id) is killed,
node B gets vote and then node A starts up and creates single node
membership and gets vote.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoREADME: Fix typos
Jan Friesse [Wed, 16 Sep 2020 12:15:04 +0000 (14:15 +0200)]
README: Fix typos

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agotimer-list: Add test
Jan Friesse [Tue, 15 Sep 2020 15:35:47 +0000 (17:35 +0200)]
timer-list: Add test

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agotimer-list: Return error on adding NULL callback
Jan Friesse [Tue, 15 Sep 2020 14:54:48 +0000 (16:54 +0200)]
timer-list: Return error on adding NULL callback

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqnetd: Fix dpd timer
Jan Friesse [Tue, 15 Sep 2020 13:10:53 +0000 (15:10 +0200)]
qnetd: Fix dpd timer

With default config of running dpd timer every 10 second and waiting for
2 * client_timeout to clear message received flag and then waiting
another 2 * client_timeout without message received it was possible that
client was marked as a dead after more than 40 seconds making qdevice to
stop sending votequorum hearbeat for too long so corosync lost votes
from qdevice.

This patch is simpler solution which just changes default dpd timer to
1 second and timeout to 1.2 * client_timeout.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqdevice-votequorum: Fix typo in log message
Jan Friesse [Tue, 1 Sep 2020 15:23:08 +0000 (17:23 +0200)]
qdevice-votequorum: Fix typo in log message

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqdevice: Port qdevice to use pr-poll-loop
Jan Friesse [Mon, 31 Aug 2020 14:59:58 +0000 (16:59 +0200)]
qdevice: Port qdevice to use pr-poll-loop

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqdevice-net: Log adds newline automatically
Jan Friesse [Mon, 31 Aug 2020 09:58:23 +0000 (11:58 +0200)]
qdevice-net: Log adds newline automatically

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqnetd: Return error code based on ipc closed
Jan Friesse [Mon, 31 Aug 2020 08:33:54 +0000 (10:33 +0200)]
qnetd: Return error code based on ipc closed

So restore pre pr-poll-loop behavior.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agopr-poll-loop: Fix set_events_cb return code
Jan Friesse [Mon, 31 Aug 2020 08:08:45 +0000 (10:08 +0200)]
pr-poll-loop: Fix set_events_cb return code

When events is set to 0 and set_events return -2 it was changed to -1.
Solution is to check, if return code was 0 and only if so, change return
code to -1 if events is 0.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqdevice: Fix connect heuristics result callback
Jan Friesse [Fri, 28 Aug 2020 06:53:24 +0000 (08:53 +0200)]
qdevice: Fix connect heuristics result callback

Previous patch 8dbf1bc8b0f348e468e7c70448705ac92dab68ea was wrong
because it fixed the crash but made qdevice not work at all.

Correct solution is to test, if state is
QDEVICE_NET_INSTANCE_STATE_WAITING_INIT_REPLY.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agopr-poll-loop: Add pre poll callbacks
Jan Friesse [Thu, 27 Aug 2020 12:16:14 +0000 (14:16 +0200)]
pr-poll-loop: Add pre poll callbacks

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agopr-poll-loop: Pass PRPollDesc for prfd events
Jan Friesse [Wed, 26 Aug 2020 15:10:44 +0000 (17:10 +0200)]
pr-poll-loop: Pass PRPollDesc for prfd events

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agopr-poll-loop: Add support for PR_POLL_EXCEPT
Jan Friesse [Wed, 26 Aug 2020 12:45:03 +0000 (14:45 +0200)]
pr-poll-loop: Add support for PR_POLL_EXCEPT

Map PR_POLL_EXCEPT to POLLPRI (as NSPR does).

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqnetd: Move pr_poll_loop_exec call to function
Jan Friesse [Wed, 26 Aug 2020 12:04:02 +0000 (14:04 +0200)]
qnetd: Move pr_poll_loop_exec call to function

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqnetd: Log pr_poll_loop_add,del errors properly
Jan Friesse [Tue, 25 Aug 2020 14:47:44 +0000 (16:47 +0200)]
qnetd: Log pr_poll_loop_add,del errors properly

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqnetd: Remove unneeded pprio include
Jan Friesse [Tue, 25 Aug 2020 14:43:49 +0000 (16:43 +0200)]
qnetd: Remove unneeded pprio include

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqnetd: Remove write callback on listening sockets
Jan Friesse [Tue, 25 Aug 2020 14:32:41 +0000 (16:32 +0200)]
qnetd: Remove write callback on listening sockets

IPC and TLS sockets are read only, so write callbacks should never
happen (specifically tested in pr-poll-loop test) so remove them.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqdevice: Initial port to use pr-poll-loop
Jan Friesse [Tue, 25 Aug 2020 14:14:00 +0000 (16:14 +0200)]
qdevice: Initial port to use pr-poll-loop

Only qdevice_instance_wait_for_initial_heuristics_exec_result is ported
for now.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agopr-poll-loop: Return error code if PR_Poll fails
Jan Friesse [Tue, 25 Aug 2020 12:30:49 +0000 (14:30 +0200)]
pr-poll-loop: Return error code if PR_Poll fails

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoheuristics: Remove qdevice instance pointer
Jan Friesse [Thu, 20 Aug 2020 15:33:53 +0000 (17:33 +0200)]
heuristics: Remove qdevice instance pointer

Heuristics is designed to be component of its own, which doesn't depend
on qdevice_instance. Removing qdevice_instance pointer was easy as soon
as exec notifier got two user data pointers.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agotests: Enhance pr-poll-loop test
Jan Friesse [Wed, 19 Aug 2020 12:30:08 +0000 (14:30 +0200)]
tests: Enhance pr-poll-loop test

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agotests: Add pr-poll-loop test
Jan Friesse [Thu, 13 Aug 2020 16:02:06 +0000 (18:02 +0200)]
tests: Add pr-poll-loop test

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agopr-poll-loop: Do not add FD when events is empty
Jan Friesse [Thu, 13 Aug 2020 12:28:52 +0000 (14:28 +0200)]
pr-poll-loop: Do not add FD when events is empty

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqdevice: Fix connect heuristics result callback
Jan Friesse [Wed, 12 Aug 2020 13:42:12 +0000 (15:42 +0200)]
qdevice: Fix connect heuristics result callback

Qdevice may crash if server disconnect before connect
heuristics callback is processed.

This is quite hard to reproduce without adding sleep before
qdevice_net_heuristics_exec_after_connect call.

Solution is to check if qdevice is still connected and if it doesn't,
just throw away connect heuristics results.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqdevice: Add space before bracket
Jan Friesse [Wed, 12 Aug 2020 13:32:17 +0000 (15:32 +0200)]
qdevice: Add space before bracket

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqdevice: Use EXIT_SUCCESS and EXIT_FAILURE codes
Jan Friesse [Wed, 12 Aug 2020 13:31:33 +0000 (15:31 +0200)]
qdevice: Use EXIT_SUCCESS and EXIT_FAILURE codes

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqnetd: Do not call ffsplit_do on shutdown
Jan Friesse [Wed, 12 Aug 2020 12:36:59 +0000 (14:36 +0200)]
qnetd: Do not call ffsplit_do on shutdown

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoqnetd: Migrate main loop to pr-poll-loop
Jan Friesse [Wed, 12 Aug 2020 12:36:24 +0000 (14:36 +0200)]
qnetd: Migrate main loop to pr-poll-loop

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agopr-poll-loop: Add main poll loop based on PR_Poll
Jan Friesse [Wed, 12 Aug 2020 12:32:33 +0000 (14:32 +0200)]
pr-poll-loop: Add main poll loop based on PR_Poll

Add main loop abstraction based on PR_Poll with set_events, read, write
and error callbacks.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
3 years agoconfigure: Use default systemd path with prefix
Jan Friesse [Tue, 14 Jul 2020 14:29:08 +0000 (16:29 +0200)]
configure: Use default systemd path with prefix

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
3 years agobuild: Use git-version-gen during specfile build
Jan Friesse [Tue, 14 Jul 2020 13:38:12 +0000 (15:38 +0200)]
build: Use git-version-gen during specfile build

Instead of copying parts of git-version-gen for spec target use
git-version-gen directly and parse final version into components
(rpmver, alphatag, numcomm) and use them.

Main reason is to simplify code a bit (sed scripts are a bit repetitive
tho), reuse the code and also allow building of RPM from dist tarball
generated from non-tagged commit or dirty git (not very useful).

The code relies on fact, that hyphen is never used in tagged release
name.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
3 years agobuild: Update git-version-gen
Jan Friesse [Tue, 14 Jul 2020 13:22:55 +0000 (15:22 +0200)]
build: Update git-version-gen

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
4 years agoqdevice: Change log level to NOTICE on PASS
liangxin1300 [Thu, 12 Mar 2020 16:35:58 +0000 (00:35 +0800)]
qdevice: Change log level to NOTICE on PASS

Previously when heuristics result became PASS it was logged as an error.
It shouldn't be and error message so change it to LOG_NOTICE level.

Signed-off-by: liangxin1300 <XLiang@suse.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
4 years agoqdevice: Add prototype of __vsyslog_chk
Jan Friesse [Wed, 27 Nov 2019 13:43:22 +0000 (14:43 +0100)]
qdevice: Add prototype of __vsyslog_chk

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
4 years agoinit: change restart to on-failure for qdevice
Kumabuchi Kenji [Tue, 10 Sep 2019 13:44:07 +0000 (22:44 +0900)]
init: change restart to on-failure for qdevice

Signed-off-by: Kumabuchi Kenji <k.kumabuchi+curvygrin@gmail.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
4 years agoqdevice: Add chk variant of vsyslog to test-log
Jan Friesse [Wed, 14 Aug 2019 07:58:48 +0000 (09:58 +0200)]
qdevice: Add chk variant of vsyslog to test-log

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
4 years agoqdevice: Add header files to list of test sources
Jan Friesse [Tue, 13 Aug 2019 14:00:28 +0000 (16:00 +0200)]
qdevice: Add header files to list of test sources

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
4 years agoqdevice: Add log test
Jan Friesse [Tue, 13 Aug 2019 13:57:09 +0000 (15:57 +0200)]
qdevice: Add log test

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
4 years agoqdevice: Free memory used by log
Jan Friesse [Tue, 13 Aug 2019 13:55:05 +0000 (15:55 +0200)]
qdevice: Free memory used by log

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
4 years agotests: Add utils_parse_bool_str test
Jan Friesse [Tue, 13 Aug 2019 13:11:57 +0000 (15:11 +0200)]
tests: Add utils_parse_bool_str test

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
4 years agoqdevice: Configurable log priority bump
Jan Friesse [Mon, 12 Aug 2019 15:43:51 +0000 (17:43 +0200)]
qdevice: Configurable log priority bump

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
4 years agoqnetd: Use log-common for nodelist debug dump
Jan Friesse [Mon, 12 Aug 2019 14:52:18 +0000 (16:52 +0200)]
qnetd: Use log-common for nodelist debug dump

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
4 years agoqdevice: Merge msg_decode_error functions
Jan Friesse [Mon, 12 Aug 2019 14:45:31 +0000 (16:45 +0200)]
qdevice: Merge msg_decode_error functions

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
4 years agoqdevice: Import log instead of qdevice-log
Jan Friesse [Mon, 12 Aug 2019 14:33:30 +0000 (16:33 +0200)]
qdevice: Import log instead of qdevice-log

and move qdevice-log-debug to log-common to share it with qnetd.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
4 years agoqdevice: Use log instead of libqb log
Jan Friesse [Mon, 12 Aug 2019 13:20:09 +0000 (15:20 +0200)]
qdevice: Use log instead of libqb log

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
4 years agoqnetd: Add function to set log target
Jan Friesse [Mon, 12 Aug 2019 12:04:04 +0000 (14:04 +0200)]
qnetd: Add function to set log target

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
4 years agoqnetd: Check log initialization error
Jan Friesse [Mon, 12 Aug 2019 11:31:13 +0000 (13:31 +0200)]
qnetd: Check log initialization error

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
4 years agoqnetd: Fix double -d description
Jan Friesse [Mon, 12 Aug 2019 11:30:53 +0000 (13:30 +0200)]
qnetd: Fix double -d description

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
4 years agoqnetd: Rename qnetd-log.c to log.c
Jan Friesse [Mon, 12 Aug 2019 11:19:02 +0000 (13:19 +0200)]
qnetd: Rename qnetd-log.c to log.c

And remove qnetd_ prefix from function names.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
4 years agoqdevice: Fix qdevice_heuristics_destroy error
Jan Friesse [Mon, 10 Jun 2019 09:11:54 +0000 (11:11 +0200)]
qdevice: Fix qdevice_heuristics_destroy error

When daemonization is used, heuristics worker is not a child of
the corosync-qdevice process any longer so it's not possible
to wait for its exit.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
4 years agoconfigure: Add user-flags configure option
Jan Friesse [Mon, 10 Jun 2019 08:25:42 +0000 (10:25 +0200)]
configure: Add user-flags configure option

configure.ac adds by optimization and debug flags by default. This is
not always intended so conifgure option is added.

Support for using this option in specfile is added too.

Also fix GDB_CFLAGS typo. GDB_FLAGS (without C)
is the correct name of variable to print in the summary.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
5 years agoman: Fix corosync-qdevice default connect_timeout
Jan Friesse [Thu, 25 Apr 2019 17:01:51 +0000 (19:01 +0200)]
man: Fix corosync-qdevice default connect_timeout

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
5 years agospec: Use install -p and add license
Jan Friesse [Wed, 20 Mar 2019 17:11:06 +0000 (18:11 +0100)]
spec: Use install -p and add license

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
5 years agoqnetd: Check existence of NSS DB dir before fork
Jan Friesse [Tue, 19 Mar 2019 14:16:11 +0000 (15:16 +0100)]
qnetd: Check existence of NSS DB dir before fork

Previously, when user tried start corosync-qnetd without
initialized NSS database then generic (not very helpful
and misleading) NSS error was logged
"NSS error (-8015): The certificate/key database is in an old,
unsupported format.".

Solution is to check if it's possible to open NSS DB directory and
display (usually much more informative) result of strerror function.

Such check is called before fork, so init system can return error code
during start.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
5 years agocertutils: Fix warnings found by coverity
Jan Friesse [Mon, 26 Nov 2018 13:03:32 +0000 (14:03 +0100)]
certutils: Fix warnings found by coverity

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
5 years agoinit: Fix init scripts to work with containers
Jan Friesse [Wed, 14 Nov 2018 16:52:11 +0000 (17:52 +0100)]
init: Fix init scripts to work with containers

Previously init scripts were not using pid file so pidof was used. This
is usually not a problem, but when containers are used it may result to
killing improper instance when issued on host.

Solution is to always use pidfile.

Also try to use LSB complaint status codes.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
5 years agoconfigure: move to AC_COMPILE_IFELSE
Jan Friesse [Wed, 7 Nov 2018 14:16:13 +0000 (09:16 -0500)]
configure: move to AC_COMPILE_IFELSE

from AC_PREPROC_IFELSE which is strongly discouraged.

Our detection system was very weak and recent versions of clang did
show that PREPROC_IFELFE (cpp) would enable warning options that
the compiler does not support (clang).

Use a full compilation test to detect what works and what doesn't.

Based on knet patch 88491f27375a9e8aceb946853a1abf4d23ebb8f3.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
5 years agogit-version-gen: Fail on UNKNOWN version
Jan Friesse [Fri, 31 Aug 2018 12:52:24 +0000 (14:52 +0200)]
git-version-gen: Fail on UNKNOWN version

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
5 years agobuild: Support for git archive stored tags
Jan Friesse [Mon, 3 Sep 2018 15:01:21 +0000 (17:01 +0200)]
build: Support for git archive stored tags

Attempt to solve problem with git archive generated tarballs
(used for example by github when release is downloaded) which are no
longer git tree and (in contrast to officially released tarballs) also
doesn't contain .tarball-version file so git-version-gen script simply
cannot obtain valid version info.

Solution is based on using gitattributes which is instructs git to
replace string in the .gitarchivever file by known ref names.
git-version-gen is enhanced to support this file and tries to parse
any string which looks like "tag: v[0-9]+.[0-9]+.[0-9]". If such string
is found it's used as a version. This file is used as a last attempt and
other methods (.tarball-version, git abbrev) have precedence.

Based on idea stated by Jan Pokorný <jpokorny@redhat.com>.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
5 years agoqdevice: Propagate error to exit code
Jan Friesse [Mon, 27 Aug 2018 15:07:53 +0000 (17:07 +0200)]
qdevice: Propagate error to exit code

Net model never returned error when qdevice_model_run was called. This
was incorrect because with exception of local ipc close all other
disconnect reasons are errors.

Solution is to return proper error code.

Also instead of exit right after qdevice_model_run it's better to store
result value, try clean resources and use stored value to return correct
exit code.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
5 years agobuild: Remove WITH_LIST
Jan Friesse [Wed, 22 Aug 2018 12:19:32 +0000 (14:19 +0200)]
build: Remove WITH_LIST

WITH_LIST is replaced in favor of bcond generator.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
5 years agospec: Autogenerate bcond options based on config
Jan Friesse [Wed, 22 Aug 2018 11:11:00 +0000 (13:11 +0200)]
spec: Autogenerate bcond options based on config

Inspired by kronosnet spec file generator.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
5 years agospec: add exlicit docdir
Jan Friesse [Tue, 21 Aug 2018 15:07:53 +0000 (17:07 +0200)]
spec: add exlicit docdir

OpenSUSE does not ship docs in the normal dir and their rpm macro
does not appear to set it for us.

Based on corosync 30c7f3319f003efa1abeb2173eef9e5c7943ae5b.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
5 years agospec: Use different BuildRequires for SUSE
Jan Friesse [Tue, 21 Aug 2018 13:19:10 +0000 (15:19 +0200)]
spec: Use different BuildRequires for SUSE

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
5 years agoinit: disable stderr output in systemd unit file
Jan Friesse [Tue, 21 Aug 2018 08:01:26 +0000 (10:01 +0200)]
init: disable stderr output in systemd unit file

Usually both syslog and stderr are enabled so log entries are duplicated
in journal. Solution is to use similar patch as corosync
c34208ad402b45f52b5d3ee8d2a08df0779ec9aa and disable stderr.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
5 years agotests: Enlarge timeout for process-list test
Jan Friesse [Tue, 21 Aug 2018 07:18:58 +0000 (09:18 +0200)]
tests: Enlarge timeout for process-list test

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
5 years agospec: Add explicit gcc build dependency
Jan Friesse [Thu, 9 Aug 2018 13:52:51 +0000 (15:52 +0200)]
spec: Add explicit gcc build dependency

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
5 years agoconfig: Remove unneeded qb includes
Jan Friesse [Thu, 9 Aug 2018 13:35:24 +0000 (15:35 +0200)]
config: Remove unneeded qb includes

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
5 years agoqnetd-certutil: Add -G option
Jan Friesse [Thu, 9 Aug 2018 12:55:36 +0000 (08:55 -0400)]
qnetd-certutil: Add -G option

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
5 years agoman: Document NSS database conversion
Jan Friesse [Thu, 9 Aug 2018 11:57:04 +0000 (07:57 -0400)]
man: Document NSS database conversion

This is not needed at least for cert8 -> cert9, but it's still nice to
have it documented. Also document NSS_IGNORE_SYSTEM_POLICY=1 workaround.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
5 years agoqdevice-net-certutil: Implement scp wrapper
Jan Friesse [Wed, 8 Aug 2018 13:20:02 +0000 (09:20 -0400)]
qdevice-net-certutil: Implement scp wrapper

Standard scp doesn't handle copy of file from remote machine to remote
machine very well when agent forwarding is used and no key exists
between the machines.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>