Commit Graph

381 Commits

Author SHA1 Message Date
Christine Caulfield
05023ee2e9 test: Fix cpgtest
... to cope with the max number of group members.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2020-05-18 14:54:13 +02:00
Jan Friesse
ee38d93cc7 cpghum: Remove unused time variables and functions
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-11-28 09:44:44 +01:00
Jan Friesse
5731af2782 logging: Add CS_PRI_NODE_ID and CS_PRI_RING_ID
Previously node id was logged ether as a %d (most often), %u, %x or
PRI.32 and ring id ether as %lld, %llx with various separators (., :, /)
between rep nodeid and seq. This seems to cause confusion.

This patch adds macros CS_PRI_NODE_ID, CS_PRI_RING_ID and
CS_PRI_RING_ID_SEQ (CS prefix = corosync, PRI modeled in spirit of
inttypes.h PRIx32) and makes code use them.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2019-07-03 10:53:52 +02:00
Ferenc Wágner
6a476017b9 build: Use the SED variable provided by configure
Signed-off-by: Ferenc Wágner <wferi@debian.org>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2019-02-06 16:04:55 +01:00
Jan Friesse
055add9147 cpghum: Check cpg_local_get return code
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-11-29 17:49:55 +01:00
Jan Friesse
bcff529e4b testcpg2: Check cpg_dispatch return code
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-11-29 17:49:38 +01:00
Jan Friesse
06504c0f6f build: Remove NSS dependencies
Complete removal of NSS from corosync tree. Most of the changes are
in build system and cpgverify had to be rewritten to use crc32 instead
of sha1.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-09-17 10:26:05 +02:00
Ferenc Wágner
67c644e69b NSS_NoDB_Init: the parameter is reserved, must be NULL
Signed-off-by: Ferenc Wágner <wferi@debian.org>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2018-04-20 12:19:22 +02:00
Jan Friesse
0a9c3be5ad cpghum: Mark print/log functions with printf attr
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2017-11-08 09:09:44 +01:00
Chrissie Caulfield
93d48c8cc6 cpghum: Add options to change flood start/mult/end sizes (#237)
I ran out of sensible short options for cpghum so added some long
ones to cope with them.

Also added is the ability to specify most size values in a sensible format
eg 64M for 64 Megabytes or 48K for 48 Kilobytes.

Strictly those are MiB and KiB of course, but I'm old-fashioned.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2017-08-11 15:28:02 +01:00
Christine Caulfield
efef3a90e3 cpghum: remove space after delimiter
machine-readable stats do not need extra spaces!

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-05-25 15:55:17 +02:00
Christine Caulfield
57c4086fff cpghum: Add interim RTT to cpghum
when -f is selected the interim stats show the RTTs for that
size of packet.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-05-25 15:54:48 +02:00
Christine Caulfield
ce188ff3f4 cpghum: Add machine-readable output
and fix a few small counter bugs.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2017-05-15 14:19:38 +01:00
Chrissie Caulfield
0be72f03f3 test: Fold cpgbench into cpghum (#205)
* test: Fold cpgbench into cpghum

cpgbench and cpghum share a lot of code & concepts so it makes
sense to merge them into a single test program that can both
benchmark and sanity check CPG.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-05-11 08:51:34 +01:00
Bin Liu
c144dba622 cpghum: Fix printf of size_t variable
Signed-off-by: Bin Liu <bliu@suse.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-04-20 08:53:33 +02:00
Jan Friesse
eca52f679f cpghum test: Improve error codes
Return error when unknown option is found. Also return error code 2 if
one of send/crc/length/sequence error happened. Finally make sure abort
returns same error code and not 999 (what is nonsense code anyway).

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2017-04-07 09:36:39 +02:00
Christine Caulfield
e6d0f87f73 cpghum: Stop cpghum from reporting fake CRC errors
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2017-03-14 16:38:19 +00:00
Christine Caulfield
40c246fb44 cpghum: Add abort_on_error option
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2017-02-17 14:50:27 +00:00
Christine Caulfield
16a865e573 cpghum: Add min rtt and print stats every alarm
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2017-02-16 15:59:52 +00:00
Christine Caulfield
7170754919 cpghum: Add Round Trip Time (RTT) reporting
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2017-02-15 14:09:09 +00:00
Takeshi MIZUTA
4939c75629 Remove redundant header file inclusion
Signed-off-by: Takeshi MIZUTA <miz.take4@gmail.com>
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2016-12-05 09:59:08 +01:00
Jan Friesse
1925074909 Fix few bugs found by coverity
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:43 +02:00
Christine Caulfield
3a5d51fca7 votequorum: Fix up quorum/nodelist callbacks
This patch tidies the two state change callbacks and explains them
in the man page:

The difference between votequorum_nodelist_notification_t and
votequorum_quorum_notification_t is subtle but important.
The 'nodelist' callback is sent at the start of a cluster state
transition and contains the new ring_id and only the list of
nodes that are included in the sync state - ie only active nodes. No
quorum information is included this callback because it is not
available at that time.

The 'quorum' callback is sent after the cluster state transition has
completed and does contain quorum information.
In addition, the nodelist contains a list of all nodes known to
votequorum (whether up or down) and their state as well
as information about the quorum device attached (if any). quorum
callbacks will not be sent for qdevice up and down
events unless they affect quorum.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:39 +02:00
Christine Caulfield
cf0028c86e votequorum: split callbacks into nodelist and quorum
This split is needed for qdevice, so that it gets the ring_id and
nodelist as part of the sync process and not afterwards - when quorum
has been calculated.

As this is and unsupported API I'm not too worried about breaking
existing code - all the clients I know of are using the quorum API
anyway as they should be.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:38 +02:00
Christine Caulfield
fc9817fec4 votequorum: Make display of qdevice more intuitive.
corosync-quorumtool displays the votes of the qdevice whether
or not it is active. This is confusing because if it is not active
then the display looks like there is a vote being contributed to
quorum when there is not.

This patch displays 0 for qdevice votes if the device is present
(but inactive) and adds the votes after the name. If the device is
contributing votes then they are displayed as normal.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:38 +02:00
Jan Friesse
45279ec7f4 Update gitignore files
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-01-05 17:03:46 +01:00
Ruben Kerkhof
da3288217c Remove a few unused variables and functions
Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2016-01-04 17:11:06 +01:00
Ruben Kerkhof
1f10c500c6 cpghum: Fix type of recv_crc
Fixes build on FreeBSD which doesn't have ulong

Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2015-12-16 16:47:45 +01:00
Jan Friesse
145f9279d1 Don't link with libz when not needed
Commit 8cc8e51363 added check for libz
resulting in linking with lib z for all libraries. This is not expected
behavior. Patch solves it by making defining automake conditional so
cpghum is linked only if libz is available and LIBS variable is not
modified at all.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2015-06-22 16:03:28 +02:00
Jan Friesse
3842ba6080 Really add cpghum
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2015-03-10 13:20:37 +01:00
Christine Caulfield
8cc8e51363 cpg: Add support for messages larger than 1Mb
If a cpg client sends a message larger than 1Mb (actually slightly
less to allow for internal buffers) cpg will now fragment that into
several corosync messages before sending it around the ring.

cpg_mcast_joined() can now return CS_ERR_INTERRUPT which means that the
cpg membership was disrupted during the send operation and the message
needs to be resent.

The new API call cpg_max_atomic_msgsize_get() returns the maximum size
of a message that will not be fragmented internally.

New test program cpghum was written to stress test this functionality,
it checks message integrity and order of receipt.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2015-03-05 16:45:15 +00:00
Jan Friesse
f8413350b2 testvotequorum2: Opt for polling with old ringid
Option -F is added to force sending old ringid for given number of
times. Option is useful for testing failure scenario during corosync
synchronization phase.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2014-08-05 17:22:49 +02:00
Jan Friesse
b8902464d1 votequorum: Add ring id to poll call
If votequorum service receives incorrect (not current) ringid, call is
ignored and CS_ERR_MESSAGE_ERROR is returned.

This and previous commits makes incompatible changes in votequorum
API/ABI, so library version is increased.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2014-08-05 17:22:41 +02:00
Jan Friesse
5f6f68805c votequorum: Return current ring id in callback
Returning ring id will be used in poll function.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2014-08-05 17:22:37 +02:00
Christine Caulfield
fcba1652ba votequorum: Improve/add documentation for quorum device API
Improve the man pages for the votequorum qdevice API and include
them in the build. Also improve the testvotequorum2 test program.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2014-01-13 09:57:32 +00:00
Jan Friesse
5e41da13f7 testcpg: Check length of input group name
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2013-06-13 10:53:55 +02:00
Jan Friesse
5c7911b4d9 test sam: Free temp str allocated by cmap
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2013-06-13 10:53:55 +02:00
Xia Li
ca6051e80c Convert the nodeid byte order to be aligned with network order
When using corosync with clear_node_high_bit setting to yes,
the highest bit is cleared.  When all the cluster nodes are in
one subnet, we probably configure the IP addresses as follows:

node1: 147.2.207.64
node2: 147.2.207.192

If the byte order of the nodeid is little endian, wiping off the
highest bit will make the two nodes have the same nodeid!

This patch fixes this by converting the nodeid to network order.

Signed-off-by: Xia Li <xli@suse.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2013-03-19 16:39:59 +01:00
Fabio M. Di Nitto
aa3fae50a6 Update .gitignore files
Untracked files:
   (use "git add <file>..." to include in what will be committed)

       compile
       init/corosync
       init/corosync-notifyd
       test/ploadstart

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-11-22 11:13:30 +01:00
Fabio M. Di Nitto
bb5946babb build: clean AM_CFLAGS and AM_CPPFLAGS usage around
also set commont include dirs.

fPIC and DPIC are automatically detected and added
as required by libtool. We don't need to carry it around.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-09-07 09:04:07 +02:00
Jan Friesse
932829bfca Add header files when needed
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2012-09-03 09:34:31 +02:00
Fabio M. Di Nitto
c8a620fd24 build: make path to bash configurable at build time
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-08-28 15:14:49 +02:00
Fabio M. Di Nitto
9240c8d565 test: fix testcpg build on FreeBSD9
HOST_NAME_MAX is intentionally NOT defined on BSD.

Users of HOST_NAME_MAX should be using sysconf or use very
conservative values.

limits.h still defines _POSIX_HOST_NAME_MAX. use that instead.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-08-28 15:14:49 +02:00
Fabio M. Di Nitto
76d18f964d build: use libtool for linking
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-08-28 15:14:48 +02:00
Fabio M. Di Nitto
6b270c6cd1 votequorum: make the last QDEVICE define name consistent with everything else
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-08-07 11:07:17 +02:00
Fabio M. Di Nitto
2f369e7039 votequorum: delegate qdevice_master_wins setting to qdevice
votequorum has no business to device if master_wins setting is correct or not.
only the qdevice can decide and should set the value for votequorum.

Logic is:

- user requests master_wins from config
- corosync starts
- qdevice starts
- qdevice reads cmap values / register with votequorum
- qdevice decides if the node can support master_wins or not and tells votequorum
- at this point votequorum can check if an unquorate node is part of the master_wins
  partition

it is the qdevice responsibility to keep that value up to date in votequorum and the
value can be changed at runtime.

this commit also exchange per node master_wins information to lay down the infrastructure
to verify discrepancies in node config for master_wins (coming next on this channel).

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-08-07 11:07:17 +02:00
Fabio M. Di Nitto
cc7bfeb462 votequorum: drop votequorum_qdevice_getinfo and collapse data into getinfo
it's really pointless to have basically a duplicated API call
to transfer one value and one name.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-08-07 11:07:17 +02:00
Fabio M. Di Nitto
65a6c29a31 votequorum: external defines should all be prefixed with VOTEQUORUM_
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-08-07 11:07:17 +02:00
Fabio M. Di Nitto
2a37b56c49 votequorum: drop _FLAG_ from defines
those are all info flags.. it's redudant and inconsistent

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-08-07 11:07:17 +02:00
Fabio M. Di Nitto
3416eacbec votequorum: fix define name to match reality
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-08-07 11:07:17 +02:00