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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>