Commit Graph

82 Commits

Author SHA1 Message Date
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
Jan Friesse
fed67019b4 qdevice: Merge msg_decode_error functions
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-08-12 17:47:39 +02:00
Jan Friesse
313d42d1e1 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>
2019-08-12 17:47:39 +02:00
Jan Friesse
c8d19612c2 qdevice: Use log instead of libqb log
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-08-12 17:47:39 +02:00
Jan Friesse
6cc1388e06 qnetd: Add function to set log target
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-08-12 17:47:39 +02:00
Jan Friesse
5128d3182d qnetd: Check log initialization error
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-08-12 17:47:39 +02:00
Jan Friesse
f78fd81e8d qnetd: Fix double -d description
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-08-12 17:47:39 +02:00
Jan Friesse
bb9dabf945 qnetd: Rename qnetd-log.c to log.c
And remove qnetd_ prefix from function names.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-08-12 17:47:39 +02:00
Jan Friesse
9bbf2f240d 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>
2019-06-10 11:15:37 +02:00
Jan Friesse
c6548f4079 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>
2019-06-10 11:15:37 +02:00
Jan Friesse
b560db5fa4 man: Fix corosync-qdevice default connect_timeout
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-04-25 19:01:51 +02:00
Jan Friesse
6a01299730 spec: Use install -p and add license
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-03-20 18:11:06 +01:00
Jan Friesse
31cc21726e 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>
2019-03-19 15:23:09 +01:00
Jan Friesse
e1e9ae1086 certutils: Fix warnings found by coverity
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2018-11-26 14:04:46 +01:00
Jan Friesse
1965225e3e 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>
2018-11-15 17:34:35 +01:00
Jan Friesse
c65923bc9d 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>
2018-11-07 15:22:48 +01:00
Jan Friesse
d146bfa883 git-version-gen: Fail on UNKNOWN version
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-09-03 17:02:12 +02:00
Jan Friesse
a09c6604ce 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>
2018-09-03 17:01:21 +02:00
Jan Friesse
9186129ace 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>
2018-08-27 17:17:51 +02:00
Jan Friesse
f26ec675c0 build: Remove WITH_LIST
WITH_LIST is replaced in favor of bcond generator.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2018-08-22 14:20:49 +02:00
Jan Friesse
eae6806f52 spec: Autogenerate bcond options based on config
Inspired by kronosnet spec file generator.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2018-08-22 13:17:14 +02:00