1QUORUM_MODEL_INITIACLoIrZoEs(y3n)c Cluster Engine Programmer'QsUOMRaUnMu_aMlODEL_INITIALIZE(3)
2
3
4
6 quorum_model_initialize - Create a new connection to the Quorum service
7
9 #include <corosync/quorum.h>
10
11 cs_error_t quorum_model_initialize(quorum_handle_t *handle, quo‐
12 rum_model_t model, quorum_model_data_t *model_data, uint32_t *quo‐
13 rum_type,void *context);
14
16 The quorum_model_initialize function is an enhanced way to initialize a
17 connection to the quorum API.
18
19 Each application may have several connections to the quorum API. Each
20 application uses the handle argument to uniquely identify the connec‐
21 tion. The handle argument is then used in other function calls to
22 identify the connection to be used for communication with the quorum
23 service.
24
25 The model is used to explicitly choose set of callbacks and internal
26 parameters. Currently two models QUORUM_MODEL_V0 and QUORUM_MODEL_V1
27 are defined. QUORUM_MODEL_V0 exists only for compatibility reasons
28 with quorum_initialize(3) function and it is not recommended to be used
29 as an argument for quorum_model_initialize(3).
30
31 The Following description is focused only on QUORUM_MODEL_V1 model.
32
33
34 Every time the voting configuration changes (eg a node joins or leave
35 the cluster) or the quorum status changes the quorum callback is
36 called. The quorum callback function is described by the following
37 type definitions:
38
39 typedef void (*quorum_v1_quorum_notification_fn_t) (
40 quorum_handle_t handle,
41 uint32_t quorate,
42 struct quorum_ring_id ring_id,
43 uint32_t member_list_entries,
44 const uint32_t *member_list
45 );
46
47 Also every time when membership configuration changes (eg a node joins
48 or leave the cluster) the node list change callback is called before
49 the quorum callback. The node list change callback function is de‐
50 scribed by the following type definitions:
51
52 typedef void (*quorum_v1_nodelist_notification_fn_t) (
53 quorum_handle_t handle,
54 struct quorum_ring_id ring_id,
55 uint32_t member_list_entries,
56 const uint32_t *member_list,
57 uint32_t joined_list_entries,
58 const uint32_t *joined_list,
59 uint32_t left_list_entries,
60 const uint32_t *left_list
61 );
62
63 The model_data argument for QUORUM_MODEL_V1 is of the type:
64
65 typedef struct {
66 quorum_model_t model;
67 quorum_v1_quorum_notification_fn_t quorum_notify_fn;
68 quorum_v1_nodelist_notification_fn_t nodelist_notify_fn;
69 } quorum_model_v1_data_t;
70
71 It's not required (nor recommended) to set model field in the struc‐
72 ture. It is also fine if only some of notification callbacks are used
73 (only these events will be delivered then).
74
75
76 The quorum_type argument is set to:
77
78 #define QUORUM_FREE 0
79 #define QUORUM_SET 1
80
81 QUORUM_FREE value means that no quorum algorithm is loaded and that no
82 callbacks will take place.
83
84 QUORUM_SET value means that one quorum algorithm is configured and that
85 callbacks will take place.
86
87 The context argument sets context same way as quorum_context_set(3).
88
89 When a configuration change occurs, the callback is called from the
90 quorum_dispatch(3) function.
91
93 This call returns the CS_OK value if successful, otherwise an error is
94 returned.
95
97 CS_ERR_TRY_AGAIN Resource temporarily unavailable
98
99 CS_ERR_INVALID_PARAM Invalid argument
100
101 CS_ERR_ACCESS Permission denied
102
103 CS_ERR_LIBRARY The connection failed
104
105 CS_ERR_INTERRUPT System call interrupted by a signal
106
107 CS_ERR_NOT_SUPPORTED The requested protocol/functionality not supported
108
109 CS_ERR_MESSAGE_ERROR Incorrect auth message received
110
111 CS_ERR_NO_MEMORY Not enough memory to complete the requested task
112
113
115 quorum_overview(3), quorum_initialize(3), quorum_finalize(3), quo‐
116 rum_getquorate(3), quorum_trackstart(3), quorum_trackstop(3), quo‐
117 rum_fd_get(3), quorum_dispatch(3), quorum_context_set(3), quorum_con‐
118 text_get(3)
119
120corosync Man Page 2021-11-15 QUORUM_MODEL_INITIALIZE(3)