QUORU...IALIZE(3)

πŸ’– QUORU...IALIZE(3) πŸ’–

okay bestie, sit down, hydrate, because this is a page from the Corosync Cluster Engine Programmer's Manual, section 3, and it's about the moment you and the Quorum service first start talking. it's giving first-day-of-school butterflies but for daemons. πŸ¦‹


✨ NAME ✨

quorum_model_initialize β€” create a new connection to the Quorum service

like. that's it. that's the whole vibe. you're opening a connection. slay.


🌸 SYNOPSIS 🌸

#include <corosync/quorum.h>

cs_error_t quorum_model_initialize(quorum_handle_t *handle,
quorum_model_t model, quorum_model_data_t *model_data, uint32_t
*quorum_type,void *context);

yes the line breaks are weird, no I did not fix them, that's literally what it says πŸ’…


πŸ‘‘ DESCRIPTION πŸ‘‘

so quorum_model_initialize is the glow-up version of connecting to the quorum API. it's the enhanced way to initialize a connection. the old way walked so this one could run.

each application can have several connections to the quorum API. not one, not two, several β€” she's popular. πŸ’… and each application uses the handle argument to uniquely identify which connection is which. that handle then gets passed into other function calls so everyone knows which connection you're talking about when you're communicating with the quorum service.

the model is how you explicitly choose your set of callbacks and internal parameters. right now two models are defined: QUORUM_MODEL_V0 and QUORUM_MODEL_V1.

🚨 okay important: QUORUM_MODEL_V0 exists only for compatibility reasons with quorum_initialize(3), and it is not recommended to use it as an argument for quorum_model_initialize(3). it's the old ex you keep texting. don't.

the following description is focused only on the QUORUM_MODEL_V1 model. V1 is the main character here, periodt. ✨

every single time the voting configuration changes β€” like when a node joins or leaves the cluster β€” or when the quorum status changes, the quorum callback gets called. here's the type definition for that callback function:

typedef void (*quorum_v1_quorum_notification_fn_t) (
        quorum_handle_t handle,
        uint32_t quorate,
        struct quorum_ring_id ring_id,
        uint32_t member_list_entries,
        const uint32_t *member_list
);

and ALSO, every time the membership configuration changes β€” again, node joins or leaves the cluster β€” the node list change callback gets called before the quorum callback. yes, order matters, she has a schedule. the node list change callback function looks like this:

typedef void (*quorum_v1_nodelist_notification_fn_t) (
        quorum_handle_t handle,
        struct quorum_ring_id ring_id,
        uint32_t member_list_entries,
        const uint32_t *member_list,
        uint32_t joined_list_entries,
        const uint32_t *joined_list,
        uint32_t left_list_entries,
        const uint32_t *left_list
);

the model_data argument for QUORUM_MODEL_V1 is this type:

typedef struct {
        quorum_model_t model;
        quorum_v1_quorum_notification_fn_t quorum_notify_fn;
        quorum_v1_nodelist_notification_fn_t nodelist_notify_fn;
} quorum_model_v1_data_t;

ngl, it's not required (and honestly not recommended) to set the model field in the structure. and it's also totally fine if you only use some of the notification callbacks β€” in that case only those events will be delivered. lowkey a choose-your-own-adventure. πŸŽ€

the quorum_type argument gets set to one of these:

#define QUORUM_FREE     0
#define QUORUM_SET      1
  • QUORUM_FREE means no quorum algorithm is loaded and no callbacks will take place. it's the empty party. 😭
  • QUORUM_SET means one quorum algorithm is configured and callbacks will take place. the party is ON. πŸ”₯

the context argument sets context the exact same way as quorum_context_set(3) does. same energy, same behaviour. 🫢

and when a configuration change occurs, the callback is called from the quorum_dispatch(3) function. iykyk.


⭐ RETURN VALUE ⭐

this call returns the CS_OK value if it's successful. otherwise, an error gets returned. no cap. πŸ™ˆ


πŸ’€ 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 🌈

quorum_overview(3), quorum_initialize(3), quorum_finalize(3), quorum_getquorate(3), quorum_trackstart(3), quorum_trackstop(3), quorum_fd_get(3), quorum_dispatch(3), quorum_context_set(3), quorum_context_get(3)

go read those too bestie, the whole squad is iconic πŸ‘‘


and that's the page!! this lil beauty comes from the corosync Man Page, dated 2026-09-04. go forth and initialize your quorum connection, you absolute legend. mwah. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from