VOTEQ...IALIZE(3)

πŸ’– VOTEQ...IALIZE(3) β€” the Corosync Cluster Engine Programmer's Manual glow-up πŸ’–

okay bestie, sit DOWN, we're talking about votequorum_initialize from the Corosync Cluster Engine Programmer's Manual. yes it's a mouthful. yes it's iconic. let's get into it πŸ’…


✨ NAME ✨

votequorum_initialize β€” make a brand new connection to the VoteQuorum service 🫢


✨ SYNOPSIS ✨

#include <corosync/votequorum.h>

int votequorum_initialize(votequorum_handle_t *handle,
votequorum_callbacks_t *callbacks);

like. that's it. that's the whole entrance. πŸ’«


✨ DESCRIPTION ✨

so the votequorum_initialize function is the girl that sets up your connection to the vote-based quorum database API. main character energy fr fr. πŸ‘‘

each application can have several connections to the votequorum API, no cap. and every single one of them uses the handle argument to uniquely identify itself. that handle then gets passed into the other function calls so everyone knows which connection is the one doing the talking to the votequorum service. it's giving name tag at a party. πŸŽ€

every time the voting configuration is about to change (eg a node joins or leaves the cluster), the callback gets called. that callback function is described by these type definitions:

typedef void (*votequorum_nodelist_notification_fn_t) (
     votequorum_handle_t handle,
     uint64_t context,
     uint32_t node_list_entries,
     uint32_t node_list[]
     );

the current ring_id (the one you get in votequorum_quorum_notification_fn) has to be passed to votequorum_qdevice_poll or else qdevice voting is not valid. lowkey important, don't skip that step bestie. 🚨

every time the quorum state changes (eg a node joins or leaves the cluster), the callback gets called too. that callback function is described by these type definitions:

typedef void (*votequorum_quorum_notification_fn_t) (
     votequorum_handle_t handle,
     uint64_t context,
     uint32_t quorate,
     uint32_t node_list_entries,
     votequorum_node_t node_list[]
     );

now. the difference between votequorum_nodelist_notification_t and votequorum_quorum_notification_t? subtle but important, iykyk. 🧚

  • the 'nodelist' callback gets sent at the start of a cluster state transition. it carries the new ring_id and only the list of nodes that are included in the sync state β€” ie only active nodes. there is no quorum information in this callback because it literally is not available at that time. it's giving "we're mid-transition, don't ask me questions yet". πŸ™ˆ
  • the 'quorum' callback gets sent after the cluster state transition has completed and it does contain quorum information. on top of that, the nodelist contains a list of all nodes known to votequorum (whether up or down) and their state, plus info about the quorum device attached (if any).

and listen β€” quorum callbacks will not be sent for qdevice up and down events unless they actually affect quorum. periodt. πŸ’€

every time the expected votes are changed, the callback is called. the expected votes callback function is described by these type definitions:

typedef void (*votequorum_expectedvotes_notification_fn_t) (
        votequorum_handle_t handle,
        uint64_t context,
        uint32_t expected_votes);

the callbacks argument is of the type:

typedef struct {
     votequorum_quorum_notification_fn_t votequorum_quorum_notify_fn;
     votequorum_expectedvotes_notification_fn_t votequorum_expectedvotes_notify_fn;
     votequorum_nodelist_notification_fn_t votequorum_nodelist_notify_fn;
} votequorum_callbacks_t;

and when a configuration change occurs, the callback gets called from the votequorum_dispatch() function. that's the vibe check moment. ✨


✨ RETURN VALUE ✨

this call returns the CS_OK value if it ate and left no crumbs. otherwise an error is returned. 😭


✨ ERRORS ✨

  • CS_ERR_TRY_AGAIN β€” resource temporarily unavailable 😡
  • CS_ERR_INVALID_PARAM β€” invalid argument 🚫
  • CS_ERR_ACCESS β€” permission denied πŸ™…
  • CS_ERR_LIBRARY β€” the connection failed πŸ’”
  • CS_ERR_INTERRUPT β€” system call interrupted by a signal ⚑
  • CS_ERR_NOT_SUPPORTED β€” the requested protocol/functionality not supported 🫠
  • CS_ERR_MESSAGE_ERROR β€” incorrect auth message received πŸ“¨
  • CS_ERR_NO_MEMORY β€” not enough memory to complete the requested task 🧠

✨ SEE ALSO ✨

the whole friend group, go say hi πŸ’œ


ok that's the whole page bestie, you're basically a quorum girlie now πŸ¦‹πŸŒΈ

this lil masterpiece is part of the corosync Man Page, dated 2026-09-04. no thoughts, just man pages. slay, drink water, and go initialize something πŸ’–βœ¨πŸŽ€
πŸ“¦ where this page comes from