Commit Graph

102 Commits

Author SHA1 Message Date
Jan Friesse
77b6a19678 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>
2020-11-04 17:52:04 +01:00
Jan Friesse
3f76ace659 qdevice-ipc: Fix dereference bug
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-10-27 17:22:46 +01:00
Jan Friesse
fbc34f3b05 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>
2020-10-27 17:22:46 +01:00
Jan Friesse
09c6f78864 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>
2020-10-27 17:22:46 +01:00
Jan Friesse
0013607e4b qdevice-net-heuristics: Fix log message
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-10-27 17:22:46 +01:00
Jan Friesse
71329dbceb 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>
2020-10-27 17:22:46 +01:00
Jan Friesse
a371519328 LICENSE: Update copyright date
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-09-22 13:37:10 +02:00
Jan Friesse
7a0201a5c6 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>
2020-09-22 13:35:55 +02:00
Jan Friesse
c2007cf2ea README: Fix typos
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-09-21 16:35:32 +02:00
Jan Friesse
fa36d6791f timer-list: Add test
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-09-21 16:35:32 +02:00
Jan Friesse
dc244ea404 timer-list: Return error on adding NULL callback
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-09-21 16:35:32 +02:00
Jan Friesse
11a861c93f 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>
2020-09-21 16:35:32 +02:00
Jan Friesse
3db05bedf6 qdevice-votequorum: Fix typo in log message
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-09-21 16:35:32 +02:00
Jan Friesse
8217e33e86 qdevice: Port qdevice to use pr-poll-loop
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-31 17:04:49 +02:00
Jan Friesse
d53a5b2961 qdevice-net: Log adds newline automatically
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-31 17:04:49 +02:00
Jan Friesse
3bbf28b368 qnetd: Return error code based on ipc closed
So restore pre pr-poll-loop behavior.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-31 17:04:49 +02:00
Jan Friesse
07a7e8a7ab 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>
2020-08-31 17:04:49 +02:00
Jan Friesse
6bf5f6c011 qdevice: Fix connect heuristics result callback
Previous patch 8dbf1bc8b0 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>
2020-08-28 08:57:15 +02:00
Jan Friesse
ea6d7a909d pr-poll-loop: Add pre poll callbacks
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-28 08:57:15 +02:00
Jan Friesse
01a63aae28 pr-poll-loop: Pass PRPollDesc for prfd events
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-28 08:57:15 +02:00
Jan Friesse
d0cdeff06a 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>
2020-08-28 08:57:15 +02:00
Jan Friesse
1ad070d8a9 qnetd: Move pr_poll_loop_exec call to function
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-28 08:57:15 +02:00
Jan Friesse
292f7dd2f5 qnetd: Log pr_poll_loop_add,del errors properly
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-25 18:01:18 +02:00
Jan Friesse
b42bc20d3c qnetd: Remove unneeded pprio include
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-25 18:01:18 +02:00
Jan Friesse
8144b162f0 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>
2020-08-25 18:01:18 +02:00
Jan Friesse
7a4e9c59ee 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>
2020-08-25 18:01:17 +02:00
Jan Friesse
c1910888ed pr-poll-loop: Return error code if PR_Poll fails
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-25 18:01:17 +02:00
Jan Friesse
ae7d60290f 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>
2020-08-25 18:01:17 +02:00
Jan Friesse
e7ef364191 tests: Enhance pr-poll-loop test
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-19 14:33:01 +02:00
Jan Friesse
687a72a0fb tests: Add pr-poll-loop test
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-19 14:33:01 +02:00
Jan Friesse
c62630bfc0 pr-poll-loop: Do not add FD when events is empty
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-19 14:33:01 +02:00
Jan Friesse
8dbf1bc8b0 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>
2020-08-12 15:52:18 +02:00
Jan Friesse
8fc3c296b4 qdevice: Add space before bracket
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-12 15:52:17 +02:00
Jan Friesse
406b689d36 qdevice: Use EXIT_SUCCESS and EXIT_FAILURE codes
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-12 15:52:17 +02:00
Jan Friesse
02080d993b qnetd: Do not call ffsplit_do on shutdown
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-12 15:52:17 +02:00
Jan Friesse
6f55a0649f qnetd: Migrate main loop to pr-poll-loop
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2020-08-12 15:52:17 +02:00
Jan Friesse
108c5e8e33 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>
2020-08-12 15:52:17 +02:00
Jan Friesse
e2c682e9bd configure: Use default systemd path with prefix
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2020-07-15 12:32:33 +02:00
Jan Friesse
c4512f39ee 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>
2020-07-15 12:32:28 +02:00
Jan Friesse
ae529403fe build: Update git-version-gen
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2020-07-15 12:32:13 +02:00
liangxin1300
5cb2ff57f8 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>
2020-03-13 08:50:08 +01:00
Jan Friesse
b82970cbff qdevice: Add prototype of __vsyslog_chk
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-11-27 14:45:19 +01:00
Kumabuchi Kenji
c0bfe0993f 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>
2019-09-12 12:25:18 +02:00
Jan Friesse
563f870fdb qdevice: Add chk variant of vsyslog to test-log
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-08-14 10:00:09 +02:00
Jan Friesse
764d4b17aa qdevice: Add header files to list of test sources
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-08-13 16:09:08 +02:00
Jan Friesse
6f58a222e8 qdevice: Add log test
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-08-13 16:09:08 +02:00
Jan Friesse
d9f47ac6f2 qdevice: Free memory used by log
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-08-13 16:09:08 +02:00
Jan Friesse
00713d41fa tests: Add utils_parse_bool_str test
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-08-13 16:09:08 +02:00
Jan Friesse
1e006d42b9 qdevice: Configurable log priority bump
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-08-12 17:47:40 +02:00
Jan Friesse
c099509e72 qnetd: Use log-common for nodelist debug dump
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-08-12 17:47:40 +02:00