]> git.proxmox.com Git - mirror_corosync.git/commit
quorum: Add support for nodelist callback
authorJan Friesse <jfriesse@redhat.com>
Wed, 9 Sep 2020 12:16:55 +0000 (14:16 +0200)
committerJan Friesse <jfriesse@redhat.com>
Mon, 12 Oct 2020 11:22:11 +0000 (13:22 +0200)
commit4eb36297288f65fe26d2adedf6c33aced7544976
tree929e211f17ea8ff07bdb48b039af89f835aa194d
parentd106c1ed06bc9c6dfdac94192ac35b320a51bb7f
quorum: Add support for nodelist callback

Current quorum callback contains only actual view list and there is no
way how to find out joined/left nodes. This cannot be emulated by user
app, because when corosync restarts before other nodes notices then view
list is unchanged (ring id is changed tho).

Solution is to implement similar callback as for cpg which contains ring
id, member list, joined list and left list.

To implement such callback and keep backwards compatibility,
quorum_model_initialize is introduced. Its behavior is similar to
cpg_model_initialize. This allows passing model v1, which contains
enhanced quorum (full ring id is passed instead of just seq number)
and nodelist callbacks.

To find out which events should be sent by corosync daemon, new message
MESSAGE_REQ_QUORUM_MODEL_GETTYPE is used. Quorum library on init was
sending MESSAGE_REQ_QUORUM_GETTYPE. Whem model v1 is requested the
MESSAGE_REQ_QUORUM_MODEL_GETTYPE is used, which contains model number
so corosync knows that client is using model v1 and can send enhanced
quorum and nodelist events.

Nodelist event is (for now) send both in case of change of membership
and also when requested, also when CS_TRACK_CURRENT is requested, but
then left_list and joined_list is left empty, because they don't make
too much sense there.

New test application testquorummodel is added as an example of new API
usage.

Also during patch developement, I found few bugs here and there, which
are also fixed:
- quorum_initialize was never returning error code returned by
  MESSAGE_REQ_QUORUM_GETTYPE call (always returned CS_OK)
- Allocated memory in send_library_notification was based
  on sizeof(unsigned int) instead of mar_uint32_t. That's not wrong,
  but   it make more sense to use sizeof(mar_uint32_t) instead

(big thanks to Chrissie for englishify the man pages)

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
21 files changed:
exec/vsf_quorum.c
include/corosync/ipc_quorum.h
include/corosync/quorum.h
lib/Makefile.am
lib/libquorum.verso
lib/quorum.c
man/Makefile.am
man/quorum_context_get.3.in
man/quorum_context_set.3.in
man/quorum_dispatch.3.in
man/quorum_fd_get.3.in
man/quorum_finalize.3.in
man/quorum_getquorate.3.in
man/quorum_initialize.3.in
man/quorum_model_initialize.3.in [new file with mode: 0644]
man/quorum_overview.3
man/quorum_trackstart.3.in
man/quorum_trackstop.3.in
test/.gitignore
test/Makefile.am
test/testquorummodel.c [new file with mode: 0644]