38 #include <sys/types.h> 44 #include <qb/qbipc_common.h> 75 static uint8_t qdevice_can_operate = 1;
76 static void *qdevice_reg_conn = NULL;
77 static uint8_t qdevice_master_wins = 0;
79 static uint8_t two_node = 0;
81 static uint8_t wait_for_all = 0;
82 static uint8_t wait_for_all_status = 0;
85 static int lowest_node_id = -1;
86 static int highest_node_id = -1;
88 #define DEFAULT_LMS_WIN 10000 89 static uint8_t last_man_standing = 0;
92 static uint8_t allow_downscale = 0;
93 static uint32_t ev_barrier = 0;
95 static uint8_t ev_tracking = 0;
96 static uint32_t ev_tracking_barrier = 0;
97 static int ev_tracking_fd = -1;
112 struct qb_ipc_request_header header __attribute__((aligned(8)));
122 struct qb_ipc_request_header header __attribute__((aligned(8)));
128 struct qb_ipc_request_header header __attribute__((aligned(8)));
143 #define MESSAGE_REQ_EXEC_VOTEQUORUM_NODEINFO 0 144 #define MESSAGE_REQ_EXEC_VOTEQUORUM_RECONFIGURE 1 145 #define MESSAGE_REQ_EXEC_VOTEQUORUM_QDEVICE_REG 2 146 #define MESSAGE_REQ_EXEC_VOTEQUORUM_QDEVICE_RECONFIGURE 3 148 static void votequorum_exec_send_expectedvotes_notification(
void);
149 static int votequorum_exec_send_quorum_notification(
void *conn, uint64_t context);
151 #define VOTEQUORUM_RECONFIG_PARAM_EXPECTED_VOTES 1 152 #define VOTEQUORUM_RECONFIG_PARAM_NODE_VOTES 2 153 #define VOTEQUORUM_RECONFIG_PARAM_CANCEL_WFA 3 155 static int votequorum_exec_send_reconfigure(uint8_t
param,
unsigned int nodeid, uint32_t
value);
160 #define VOTEQUORUM_QDEVICE_OPERATION_UNREGISTER 0 161 #define VOTEQUORUM_QDEVICE_OPERATION_REGISTER 1 167 #define NODE_FLAGS_QUORATE 1 168 #define NODE_FLAGS_LEAVING 2 169 #define NODE_FLAGS_WFASTATUS 4 170 #define NODE_FLAGS_FIRST 8 171 #define NODE_FLAGS_QDEVICE_REGISTERED 16 172 #define NODE_FLAGS_QDEVICE_ALIVE 32 173 #define NODE_FLAGS_QDEVICE_CAST_VOTE 64 174 #define NODE_FLAGS_QDEVICE_MASTER_WINS 128 195 static uint8_t quorum;
196 static uint8_t cluster_is_quorate;
203 static struct list_head cluster_members_list;
207 static int quorum_members_entries = 0;
208 static int previous_quorum_members_entries = 0;
209 static int atb_nodelist_entries = 0;
216 static int cluster_nodes_entries = 0;
236 static int qdevice_timer_set = 0;
238 static int last_man_standing_timer_set = 0;
239 static int sync_nodeinfo_sent = 0;
240 static int sync_wait_for_poll_or_timeout = 0;
246 static int sync_in_progress = 0;
248 static void votequorum_sync_init (
249 const unsigned int *trans_list,
250 size_t trans_list_entries,
251 const unsigned int *member_list,
252 size_t member_list_entries,
255 static int votequorum_sync_process (
void);
256 static void votequorum_sync_activate (
void);
257 static void votequorum_sync_abort (
void);
266 static int votequorum_exec_exit_fn (
void);
267 static int votequorum_exec_send_nodeinfo(uint32_t
nodeid);
269 static void message_handler_req_exec_votequorum_nodeinfo (
272 static void exec_votequorum_nodeinfo_endian_convert (
void *message);
274 static void message_handler_req_exec_votequorum_reconfigure (
277 static void exec_votequorum_reconfigure_endian_convert (
void *message);
279 static void message_handler_req_exec_votequorum_qdevice_reg (
282 static void exec_votequorum_qdevice_reg_endian_convert (
void *message);
284 static void message_handler_req_exec_votequorum_qdevice_reconfigure (
287 static void exec_votequorum_qdevice_reconfigure_endian_convert (
void *message);
293 .exec_endian_convert_fn = exec_votequorum_nodeinfo_endian_convert
296 .exec_handler_fn = message_handler_req_exec_votequorum_reconfigure,
297 .exec_endian_convert_fn = exec_votequorum_reconfigure_endian_convert
300 .exec_handler_fn = message_handler_req_exec_votequorum_qdevice_reg,
301 .exec_endian_convert_fn = exec_votequorum_qdevice_reg_endian_convert
304 .exec_handler_fn = message_handler_req_exec_votequorum_qdevice_reconfigure,
305 .exec_endian_convert_fn = exec_votequorum_qdevice_reconfigure_endian_convert
313 static int quorum_lib_init_fn (
void *conn);
315 static int quorum_lib_exit_fn (
void *conn);
317 static void qdevice_timer_fn(
void *arg);
319 static void message_handler_req_lib_votequorum_getinfo (
void *conn,
320 const void *message);
322 static void message_handler_req_lib_votequorum_setexpected (
void *conn,
323 const void *message);
325 static void message_handler_req_lib_votequorum_setvotes (
void *conn,
326 const void *message);
328 static void message_handler_req_lib_votequorum_trackstart (
void *conn,
329 const void *message);
331 static void message_handler_req_lib_votequorum_trackstop (
void *conn,
332 const void *message);
334 static void message_handler_req_lib_votequorum_qdevice_register (
void *conn,
335 const void *message);
337 static void message_handler_req_lib_votequorum_qdevice_unregister (
void *conn,
338 const void *message);
340 static void message_handler_req_lib_votequorum_qdevice_update (
void *conn,
341 const void *message);
343 static void message_handler_req_lib_votequorum_qdevice_poll (
void *conn,
344 const void *message);
346 static void message_handler_req_lib_votequorum_qdevice_master_wins (
void *conn,
347 const void *message);
356 .lib_handler_fn = message_handler_req_lib_votequorum_setexpected,
360 .lib_handler_fn = message_handler_req_lib_votequorum_setvotes,
364 .lib_handler_fn = message_handler_req_lib_votequorum_trackstart,
368 .lib_handler_fn = message_handler_req_lib_votequorum_trackstop,
372 .lib_handler_fn = message_handler_req_lib_votequorum_qdevice_register,
376 .lib_handler_fn = message_handler_req_lib_votequorum_qdevice_unregister,
380 .lib_handler_fn = message_handler_req_lib_votequorum_qdevice_update,
384 .lib_handler_fn = message_handler_req_lib_votequorum_qdevice_poll,
388 .lib_handler_fn = message_handler_req_lib_votequorum_qdevice_master_wins,
394 .
name =
"corosync vote quorum service v1.0",
397 .private_data_size =
sizeof (
struct quorum_pd),
400 .lib_init_fn = quorum_lib_init_fn,
401 .lib_exit_fn = quorum_lib_exit_fn,
402 .lib_engine = quorum_lib_service,
404 .exec_init_fn = votequorum_exec_init_fn,
405 .exec_exit_fn = votequorum_exec_exit_fn,
406 .exec_engine = votequorum_exec_engine,
408 .sync_init = votequorum_sync_init,
409 .sync_process = votequorum_sync_process,
410 .sync_activate = votequorum_sync_activate,
411 .sync_abort = votequorum_sync_abort
416 return (&votequorum_service_engine);
421 .
name =
"corosync_votequorum",
431 #define max(a,b) (((a) > (b)) ? (a) : (b)) 433 #define list_iterate(v, head) \ 434 for (v = (head)->next; v != head; v = v->next) 436 static void node_add_ordered(
struct cluster_node *newnode)
452 list_add(&newnode->
list, &cluster_members_list);
471 cl = (
struct cluster_node *)&cluster_nodes[cluster_nodes_entries];
472 cluster_nodes_entries++;
493 node_add_ordered(cl);
502 static struct cluster_node *find_node_by_nodeid(
unsigned int nodeid)
531 static void get_lowest_node_id(
void)
543 (node->
node_id < lowest_node_id)) {
544 lowest_node_id = node->
node_id;
553 static void get_highest_node_id(
void)
565 (node->
node_id > highest_node_id)) {
566 highest_node_id = node->
node_id;
575 static int check_low_node_id_partition(
void)
586 (node->
node_id == lowest_node_id)) {
595 static int check_high_node_id_partition(
void)
606 (node->
node_id == highest_node_id)) {
615 static int is_in_nodelist(
int nodeid,
unsigned int *members,
int entries)
620 for (i=0; i<entries; i++) {
621 if (nodeid == members[i]) {
643 static int check_auto_tie_breaker(
void)
650 res = check_low_node_id_partition();
656 res = check_high_node_id_partition();
663 for (i=0; i < atb_nodelist_entries; i++) {
664 if (is_in_nodelist(atb_nodelist[i], quorum_members, quorum_members_entries)) {
671 for (j=0; j<i; j++) {
672 if (is_in_nodelist(atb_nodelist[j], previous_quorum_members, previous_quorum_members_entries)) {
699 static void parse_atb_string(
char *atb_string)
707 if (!strcmp(atb_string,
"lowest"))
710 if (!strcmp(atb_string,
"highest"))
713 if (atoi(atb_string)) {
715 atb_nodelist_entries = 0;
718 num = strtol(ptr, &ptr, 10);
721 atb_nodelist[atb_nodelist_entries++] = num;
725 if (atb_nodelist_entries) {
734 log_printf(
LOGSYS_LEVEL_WARNING,
"auto_tie_breaker_nodes is not valid. It must be 'lowest', 'highest' or a space-separated list of node IDs. auto_tie_breaker is disabled");
740 static int check_qdevice_master(
void)
761 static void decode_flags(uint32_t
flags)
766 "flags: quorate: %s Leaving: %s WFA Status: %s First: %s Qdevice: %s QdeviceAlive: %s QdeviceCastVote: %s QdeviceMasterWins: %s",
782 static int load_ev_tracking_barrier(
void)
785 char filename[PATH_MAX];
789 snprintf(filename,
sizeof(filename) - 1,
"%s/ev_tracking",
get_run_dir());
791 ev_tracking_fd = open(filename, O_RDWR, 0700);
792 if (ev_tracking_fd != -1) {
793 res = read (ev_tracking_fd, &ev_tracking_barrier,
sizeof(uint32_t));
794 if (res ==
sizeof (uint32_t)) {
800 ev_tracking_barrier = 0;
802 ev_tracking_fd = open (filename, O_CREAT|O_RDWR, 0700);
803 if (ev_tracking_fd != -1) {
804 res = write (ev_tracking_fd, &ev_tracking_barrier,
sizeof (uint32_t));
805 if ((res == -1) || (res !=
sizeof (uint32_t))) {
807 "Unable to write to %s", filename);
813 "Unable to create %s file", filename);
820 static void update_wait_for_all_status(uint8_t wfa_status)
824 wait_for_all_status = wfa_status;
825 if (wait_for_all_status) {
831 wait_for_all_status);
836 static void update_two_node(
void)
855 static void update_qdevice_can_operate(uint8_t status)
859 qdevice_can_operate = status;
860 icmap_set_uint8(
"runtime.votequorum.qdevice_can_operate", qdevice_can_operate);
865 static void update_qdevice_master_wins(uint8_t allow)
869 qdevice_master_wins = allow;
870 icmap_set_uint8(
"runtime.votequorum.qdevice_master_wins", qdevice_master_wins);
875 static void update_ev_tracking_barrier(uint32_t ev_t_barrier)
881 ev_tracking_barrier = ev_t_barrier;
882 icmap_set_uint32(
"runtime.votequorum.ev_tracking_barrier", ev_tracking_barrier);
884 if (lseek (ev_tracking_fd, 0, SEEK_SET) != 0) {
886 "Unable to update ev_tracking_barrier on disk data!!!");
891 res = write (ev_tracking_fd, &ev_tracking_barrier,
sizeof (uint32_t));
892 if (res !=
sizeof (uint32_t)) {
894 "Unable to update ev_tracking_barrier on disk data!!!");
896 #ifdef HAVE_FDATASYNC 897 fdatasync(ev_tracking_fd);
899 fsync(ev_tracking_fd);
909 static int calculate_quorum(
int allow_decrease,
unsigned int max_expected,
unsigned int *ret_total_votes)
913 unsigned int total_votes = 0;
914 unsigned int highest_expected = 0;
915 unsigned int newquorum, q1, q2;
916 unsigned int total_nodes = 0;
920 if ((allow_downscale) && (allow_decrease) && (max_expected)) {
921 max_expected =
max(ev_barrier, max_expected);
936 total_votes += node->
votes;
943 total_votes += qdevice->
votes;
947 if (max_expected > 0) {
948 highest_expected = max_expected;
955 q1 = (highest_expected + 2) / 2;
956 q2 = (total_votes + 2) / 2;
957 newquorum =
max(q1, q2);
963 if (!allow_decrease) {
964 newquorum =
max(quorum, newquorum);
974 if (two_node && total_nodes <= 2) {
978 if (ret_total_votes) {
979 *ret_total_votes = total_votes;
986 static void are_we_quorate(
unsigned int total_votes)
989 int quorum_change = 0;
997 if ((wait_for_all) && (wait_for_all_status)) {
1000 "Waiting for all cluster members. " 1001 "Current votes: %d expected_votes: %d",
1003 cluster_is_quorate = 0;
1006 update_wait_for_all_status(0);
1009 if (quorum > total_votes) {
1013 get_lowest_node_id();
1014 get_highest_node_id();
1017 if ((auto_tie_breaker !=
ATB_NONE) &&
1021 (previous_quorum_members_entries - quorum_members_entries < quorum) &&
1022 (check_auto_tie_breaker() == 1)) {
1026 if ((qdevice_master_wins) &&
1028 (check_qdevice_master() == 1)) {
1033 if (cluster_is_quorate && !quorate) {
1037 if (!cluster_is_quorate && quorate) {
1043 if (cluster_is_quorate) {
1051 update_wait_for_all_status(0);
1053 update_wait_for_all_status(1);
1057 if ((quorum_change) &&
1058 (sync_in_progress == 0)) {
1059 quorum_callback(quorum_members, quorum_members_entries,
1060 cluster_is_quorate, &quorum_ringid);
1061 votequorum_exec_send_quorum_notification(NULL, 0L);
1067 static void get_total_votes(
unsigned int *totalvotes,
unsigned int *current_members)
1069 unsigned int total_votes = 0;
1070 unsigned int cluster_members = 0;
1080 total_votes += node->
votes;
1084 if (qdevice->
votes) {
1085 total_votes += qdevice->
votes;
1089 *totalvotes = total_votes;
1090 *current_members = cluster_members;
1098 static void recalculate_quorum(
int allow_decrease,
int by_current_nodes)
1100 unsigned int total_votes = 0;
1101 unsigned int cluster_members = 0;
1105 get_total_votes(&total_votes, &cluster_members);
1107 if (!by_current_nodes) {
1108 cluster_members = 0;
1117 votequorum_exec_send_expectedvotes_notification();
1120 if ((ev_tracking) &&
1125 quorum = calculate_quorum(allow_decrease, cluster_members, &total_votes);
1126 are_we_quorate(total_votes);
1135 static int votequorum_read_nodelist_configuration(uint32_t *
votes,
1137 uint32_t *expected_votes)
1140 const char *iter_key;
1142 uint32_t our_pos, node_pos;
1143 uint32_t nodecount = 0;
1144 uint32_t nodelist_expected_votes = 0;
1145 uint32_t node_votes = 0;
1152 "No nodelist defined or our node is not in the nodelist");
1160 res = sscanf(iter_key,
"nodelist.node.%u.%s", &node_pos, tmp_key);
1165 if (strcmp(tmp_key,
"ring0_addr") != 0) {
1176 nodelist_expected_votes = nodelist_expected_votes + node_votes;
1178 if (node_pos == our_pos) {
1179 *votes = node_votes;
1183 *expected_votes = nodelist_expected_votes;
1193 static int votequorum_qdevice_is_configured(uint32_t *qdevice_votes)
1195 char *qdevice_model = NULL;
1201 if (strlen(qdevice_model)) {
1203 *qdevice_votes = -1;
1211 update_qdevice_can_operate(1);
1215 free(qdevice_model);
1223 #define VOTEQUORUM_READCONFIG_STARTUP 0 1224 #define VOTEQUORUM_READCONFIG_RUNTIME 1 1226 static char *votequorum_readconfig(
int runtime)
1228 uint32_t node_votes = 0, qdevice_votes = 0;
1229 uint32_t node_expected_votes = 0, expected_votes = 0;
1230 uint32_t node_count = 0;
1232 int have_nodelist, have_qdevice;
1233 char *atb_string = NULL;
1252 have_nodelist = votequorum_read_nodelist_configuration(&node_votes, &node_count, &node_expected_votes);
1253 have_qdevice = votequorum_qdevice_is_configured(&qdevice_votes);
1260 if ((!have_nodelist) && (!expected_votes)) {
1262 error = (
char *)
"configuration error: nodelist or quorum.expected_votes must be configured!";
1275 if ((two_node) && (have_qdevice)) {
1277 error = (
char *)
"configuration error: two_node and quorum device cannot be configured at the same time!";
1286 update_qdevice_can_operate(0);
1302 icmap_get_uint32(
"quorum.last_man_standing_window", &last_man_standing_window);
1316 "auto_tie_breaker_node: is meaningless if auto_tie_breaker is set to 0");
1320 if (atb && atb_string) {
1321 parse_atb_string(atb_string);
1326 if (allow_downscale) {
1331 if (load_ev_tracking_barrier() < 0) {
1333 return ((
char *)
"Unable to load ev_tracking file!");
1335 update_ev_tracking_barrier(ev_tracking_barrier);
1343 if (two_node && auto_tie_breaker !=
ATB_NONE) {
1353 if ((auto_tie_breaker !=
ATB_NONE) && (node_expected_votes % 2) &&
1355 if (last_man_standing) {
1364 error = (
char *)
"configuration error: auto_tie_breaker & last_man_standing not available in odd sized cluster";
1383 if ((have_qdevice) && (last_man_standing)) {
1385 error = (
char *)
"configuration error: quorum.device is not compatible with last_man_standing";
1390 update_qdevice_can_operate(0);
1394 if ((have_qdevice) && (auto_tie_breaker !=
ATB_NONE)) {
1396 error = (
char *)
"configuration error: quorum.device is not compatible with auto_tie_breaker";
1401 update_qdevice_can_operate(0);
1405 if ((have_qdevice) && (wait_for_all)) {
1407 error = (
char *)
"configuration error: quorum.device is not compatible with wait_for_all";
1412 update_qdevice_can_operate(0);
1416 if ((have_qdevice) && (allow_downscale)) {
1418 error = (
char *)
"configuration error: quorum.device is not compatible with allow_downscale";
1423 update_qdevice_can_operate(0);
1432 if ((expected_votes) && (have_qdevice) && (qdevice_votes == -1)) {
1434 error = (
char *)
"configuration error: quorum.device.votes must be specified when quorum.expected_votes is set";
1439 update_qdevice_can_operate(0);
1448 if ((have_qdevice) &&
1449 (qdevice_votes == -1) &&
1451 (node_count != node_expected_votes)) {
1453 error = (
char *)
"configuration error: quorum.device.votes must be specified when not all nodes votes 1";
1458 update_qdevice_can_operate(0);
1466 if ((qdevice_votes > 0) && (expected_votes)) {
1467 int delta = expected_votes - qdevice_votes;
1470 error = (
char *)
"configuration error: quorum.device.votes is too high or expected_votes is too low";
1475 update_qdevice_can_operate(0);
1484 if ((have_qdevice) &&
1485 (qdevice_votes == -1) &&
1486 (!expected_votes) &&
1488 (node_count == node_expected_votes)) {
1489 qdevice_votes = node_expected_votes - 1;
1490 node_expected_votes = node_expected_votes + qdevice_votes;
1496 log_printf(
LOGSYS_LEVEL_DEBUG,
"ev_tracking=%d, ev_tracking_barrier = %d: expected_votes = %d\n", ev_tracking, ev_tracking_barrier, expected_votes);
1499 expected_votes = ev_tracking_barrier;
1502 if (have_nodelist) {
1503 us->
votes = node_votes;
1510 if (expected_votes) {
1518 if (!have_qdevice) {
1522 if (qdevice_votes != -1) {
1523 qdevice->
votes = qdevice_votes;
1529 update_wait_for_all_status(1);
1537 static void votequorum_refresh_config(
1539 const char *key_name,
1544 int old_votes, old_expected_votes;
1554 if (
icmap_get_uint8(
"config.totemconfig_reload_in_progress", &reloading) ==
CS_OK && reloading) {
1559 if (strcmp(key_name,
"quorum.cancel_wait_for_all") == 0 &&
1567 old_votes = us->
votes;
1578 votequorum_exec_send_nodeinfo(us->
node_id);
1580 if (us->
votes != old_votes) {
1592 static void votequorum_exec_add_config_notification(
void)
1602 votequorum_refresh_config,
1604 &icmap_track_nodelist);
1608 votequorum_refresh_config,
1610 &icmap_track_quorum);
1614 votequorum_refresh_config,
1616 &icmap_track_reload);
1625 static int votequorum_exec_send_reconfigure(uint8_t
param,
unsigned int nodeid, uint32_t
value)
1628 struct iovec iov[1];
1636 req_exec_quorum_reconfigure.
_pad0 = 0;
1637 req_exec_quorum_reconfigure.
_pad1 = 0;
1638 req_exec_quorum_reconfigure.
_pad2 = 0;
1641 req_exec_quorum_reconfigure.header.size =
sizeof(req_exec_quorum_reconfigure);
1643 iov[0].iov_base = (
void *)&req_exec_quorum_reconfigure;
1644 iov[0].iov_len =
sizeof(req_exec_quorum_reconfigure);
1652 static int votequorum_exec_send_nodeinfo(uint32_t nodeid)
1655 struct iovec iov[1];
1661 node = find_node_by_nodeid(nodeid);
1667 req_exec_quorum_nodeinfo.
votes = node->
votes;
1669 req_exec_quorum_nodeinfo.
flags = node->
flags;
1671 decode_flags(node->
flags);
1675 req_exec_quorum_nodeinfo.header.size =
sizeof(req_exec_quorum_nodeinfo);
1677 iov[0].iov_base = (
void *)&req_exec_quorum_nodeinfo;
1678 iov[0].iov_len =
sizeof(req_exec_quorum_nodeinfo);
1686 static int votequorum_exec_send_qdevice_reconfigure(
const char *
oldname,
const char *
newname)
1689 struct iovec iov[1];
1695 req_exec_quorum_qdevice_reconfigure.header.size =
sizeof(req_exec_quorum_qdevice_reconfigure);
1696 strcpy(req_exec_quorum_qdevice_reconfigure.
oldname, oldname);
1697 strcpy(req_exec_quorum_qdevice_reconfigure.
newname, newname);
1699 iov[0].iov_base = (
void *)&req_exec_quorum_qdevice_reconfigure;
1700 iov[0].iov_len =
sizeof(req_exec_quorum_qdevice_reconfigure);
1708 static int votequorum_exec_send_qdevice_reg(uint32_t
operation,
const char *qdevice_name_req)
1711 struct iovec iov[1];
1717 req_exec_quorum_qdevice_reg.header.size =
sizeof(req_exec_quorum_qdevice_reg);
1719 strcpy(req_exec_quorum_qdevice_reg.
qdevice_name, qdevice_name_req);
1721 iov[0].iov_base = (
void *)&req_exec_quorum_qdevice_reg;
1722 iov[0].iov_len =
sizeof(req_exec_quorum_qdevice_reg);
1730 static int votequorum_exec_send_quorum_notification(
void *conn, uint64_t context)
1735 int cluster_members = 0;
1738 char buf[
sizeof(
struct res_lib_votequorum_notification) + sizeof(struct votequorum_node) * (
PROCESSOR_COUNT_MAX + 2)];
1750 size =
sizeof(
struct res_lib_votequorum_notification) + sizeof(struct votequorum_node) * cluster_members;
1752 res_lib_votequorum_notification = (
struct res_lib_votequorum_notification *)&buf;
1753 res_lib_votequorum_notification->quorate = cluster_is_quorate;
1754 res_lib_votequorum_notification->node_list_entries = cluster_members;
1755 res_lib_votequorum_notification->ring_id.nodeid = quorum_ringid.
rep.
nodeid;
1756 res_lib_votequorum_notification->ring_id.seq = quorum_ringid.
seq;
1757 res_lib_votequorum_notification->context = context;
1760 res_lib_votequorum_notification->node_list[i].nodeid = node->
node_id;
1761 res_lib_votequorum_notification->node_list[i++].state = node->
state;
1765 res_lib_votequorum_notification->node_list[i++].state = qdevice->
state;
1768 res_lib_votequorum_notification->header.size = size;
1769 res_lib_votequorum_notification->header.error =
CS_OK;
1791 static void votequorum_exec_send_expectedvotes_notification(
void)
1802 res_lib_votequorum_expectedvotes_notification.header.size =
sizeof(res_lib_votequorum_expectedvotes_notification);
1803 res_lib_votequorum_expectedvotes_notification.header.error =
CS_OK;
1804 res_lib_votequorum_expectedvotes_notification.expected_votes = us->
expected_votes;
1808 res_lib_votequorum_expectedvotes_notification.context = qpd->
tracking_context;
1810 sizeof(
struct res_lib_votequorum_expectedvotes_notification));
1816 static void exec_votequorum_qdevice_reconfigure_endian_convert (
void *message)
1823 static void message_handler_req_exec_votequorum_qdevice_reconfigure (
1824 const void *message,
1825 unsigned int nodeid)
1833 req_exec_quorum_qdevice_reconfigure->
oldname,
1834 req_exec_quorum_qdevice_reconfigure->
newname);
1836 if (!strcmp(req_exec_quorum_qdevice_reconfigure->
oldname, qdevice_name)) {
1839 strcpy(qdevice_name, req_exec_quorum_qdevice_reconfigure->
newname);
1850 static void exec_votequorum_qdevice_reg_endian_convert (
void *message)
1861 static void message_handler_req_exec_votequorum_qdevice_reg (
1862 const void *message,
1863 unsigned int nodeid)
1867 int wipe_qdevice_name = 1;
1878 switch(req_exec_quorum_qdevice_reg->
operation)
1882 if (!strlen(qdevice_name)) {
1884 strcpy(qdevice_name, req_exec_quorum_qdevice_reg->
qdevice_name);
1903 if (!qdevice_reg_conn) {
1912 if (!strlen(qdevice_name)) {
1913 strcpy(qdevice_name, req_exec_quorum_qdevice_reg->
qdevice_name);
1919 if ((!strncmp(req_exec_quorum_qdevice_reg->
qdevice_name,
1923 votequorum_exec_send_nodeinfo(us->
node_id);
1926 "A new qdevice with different name (new: %s old: %s) is trying to register!",
1927 req_exec_quorum_qdevice_reg->
qdevice_name, qdevice_name);
1931 res_lib_votequorum_status.header.size =
sizeof(res_lib_votequorum_status);
1933 res_lib_votequorum_status.header.error = error;
1934 corosync_api->
ipc_response_send(qdevice_reg_conn, &res_lib_votequorum_status,
sizeof(res_lib_votequorum_status));
1935 qdevice_reg_conn = NULL;
1942 wipe_qdevice_name = 0;
1946 if (wipe_qdevice_name) {
1955 static void exec_votequorum_nodeinfo_endian_convert (
void *message)
1969 static void message_handler_req_exec_votequorum_nodeinfo (
1970 const void *message,
1971 unsigned int sender_nodeid)
1978 nodestate_t old_state;
1980 int allow_downgrade = 0;
1982 unsigned int nodeid = req_exec_quorum_nodeinfo->
nodeid;
1989 req_exec_quorum_nodeinfo->
votes,
1991 req_exec_quorum_nodeinfo->
flags);
1994 decode_flags(req_exec_quorum_nodeinfo->
flags);
1997 node = find_node_by_nodeid(nodeid);
1999 node = allocate_node(nodeid);
2014 old_votes = node->
votes;
2016 old_state = node->
state;
2017 old_flags = node->
flags;
2021 struct cluster_node *sender_node = find_node_by_nodeid(sender_nodeid);
2023 assert(sender_node != NULL);
2025 if ((!cluster_is_quorate) &&
2027 node->
votes = req_exec_quorum_nodeinfo->
votes;
2035 node->
flags = req_exec_quorum_nodeinfo->
flags;
2036 node->
votes = req_exec_quorum_nodeinfo->
votes;
2041 allow_downgrade = 1;
2045 if ((!cluster_is_quorate) &&
2047 allow_downgrade = 1;
2057 if ((last_man_standing) && (node->
votes > 1)) {
2059 "cluster nodes votes are set to 1. Disabling LMS.");
2060 last_man_standing = 0;
2061 if (last_man_standing_timer_set) {
2063 last_man_standing_timer_set = 0;
2071 (old_votes != node->
votes) ||
2073 (old_flags != node->
flags) ||
2074 (old_state != node->
state)) {
2075 recalculate_quorum(allow_downgrade, by_node);
2078 if ((wait_for_all) &&
2081 update_wait_for_all_status(0);
2087 static void exec_votequorum_reconfigure_endian_convert (
void *message)
2099 static void message_handler_req_exec_votequorum_reconfigure (
2100 const void *message,
2101 unsigned int nodeid)
2110 nodeid, req_exec_quorum_reconfigure->
nodeid);
2112 switch(req_exec_quorum_reconfigure->
param)
2121 votequorum_exec_send_expectedvotes_notification();
2122 update_ev_barrier(req_exec_quorum_reconfigure->
value);
2126 recalculate_quorum(1, 0);
2130 node = find_node_by_nodeid(req_exec_quorum_reconfigure->
nodeid);
2135 node->
votes = req_exec_quorum_reconfigure->
value;
2136 recalculate_quorum(1, 0);
2140 update_wait_for_all_status(0);
2142 req_exec_quorum_reconfigure->
nodeid);
2143 recalculate_quorum(0, 0);
2152 static int votequorum_exec_exit_fn (
void)
2162 if (allow_downscale) {
2164 ret = votequorum_exec_send_nodeinfo(us->
node_id);
2167 if ((ev_tracking) && (ev_tracking_fd != -1)) {
2168 close(ev_tracking_fd);
2176 static void votequorum_set_icmap_ro_keys(
void)
2196 list_init(&cluster_members_list);
2197 list_init(&trackers_list);
2200 memset(cluster_nodes, 0,
sizeof(cluster_nodes));
2208 return ((
char *)
"Could not allocate node.");
2219 return ((
char *)
"Could not allocate node.");
2232 recalculate_quorum(0, 0);
2237 votequorum_set_icmap_ro_keys();
2242 votequorum_exec_add_config_notification();
2247 votequorum_exec_send_nodeinfo(us->
node_id);
2258 static void votequorum_last_man_standing_timer_fn(
void *arg)
2262 last_man_standing_timer_set = 0;
2263 if (cluster_is_quorate) {
2264 recalculate_quorum(1,1);
2270 static void votequorum_sync_init (
2271 const unsigned int *trans_list,
size_t trans_list_entries,
2272 const unsigned int *member_list,
size_t member_list_entries,
2282 sync_in_progress = 1;
2283 sync_nodeinfo_sent = 0;
2284 sync_wait_for_poll_or_timeout = 0;
2286 if (member_list_entries > 1) {
2296 for (i = 0; i < quorum_members_entries; i++) {
2298 for (j = 0; j < member_list_entries; j++) {
2299 if (quorum_members[i] == member_list[j]) {
2306 node = find_node_by_nodeid(quorum_members[i]);
2313 if (last_man_standing) {
2314 if (((member_list_entries >= quorum) && (left_nodes)) ||
2315 ((member_list_entries <= quorum) && (auto_tie_breaker !=
ATB_NONE) && (check_low_node_id_partition() == 1))) {
2316 if (last_man_standing_timer_set) {
2318 last_man_standing_timer_set = 0;
2320 corosync_api->
timer_add_duration((
unsigned long long)last_man_standing_window*1000000,
2321 NULL, votequorum_last_man_standing_timer_fn,
2322 &last_man_standing_timer);
2323 last_man_standing_timer_set = 1;
2327 memcpy(previous_quorum_members, quorum_members,
sizeof(
unsigned int) * quorum_members_entries);
2328 previous_quorum_members_entries = quorum_members_entries;
2330 memcpy(quorum_members, member_list,
sizeof(
unsigned int) * member_list_entries);
2331 quorum_members_entries = member_list_entries;
2332 memcpy(&quorum_ringid, ring_id,
sizeof(*ring_id));
2338 if (qdevice_timer_set) {
2341 corosync_api->
timer_add_duration((
unsigned long long)qdevice_sync_timeout*1000000, qdevice,
2342 qdevice_timer_fn, &qdevice_timer);
2343 qdevice_timer_set = 1;
2344 sync_wait_for_poll_or_timeout = 1;
2347 qdevice_name, qdevice_sync_timeout);
2353 static int votequorum_sync_process (
void)
2356 if (!sync_nodeinfo_sent) {
2357 votequorum_exec_send_nodeinfo(us->
node_id);
2359 if (strlen(qdevice_name)) {
2363 sync_nodeinfo_sent = 1;
2377 static void votequorum_sync_activate (
void)
2379 recalculate_quorum(0, 0);
2380 quorum_callback(quorum_members, quorum_members_entries,
2381 cluster_is_quorate, &quorum_ringid);
2382 votequorum_exec_send_quorum_notification(NULL, 0L);
2384 sync_in_progress = 0;
2387 static void votequorum_sync_abort (
void)
2399 if (q_set_quorate_fn == NULL) {
2400 return ((
char *)
"Quorate function not set");
2404 quorum_callback = q_set_quorate_fn;
2407 &votequorum_service[0]);
2421 static int quorum_lib_init_fn (
void *conn)
2427 list_init (&pd->
list);
2434 static int quorum_lib_exit_fn (
void *conn)
2441 list_del (&quorum_pd->
list);
2442 list_init (&quorum_pd->
list);
2454 static void qdevice_timer_fn(
void *arg)
2459 (!qdevice_timer_set)) {
2467 votequorum_exec_send_nodeinfo(us->
node_id);
2469 qdevice_timer_set = 0;
2470 sync_wait_for_poll_or_timeout = 0;
2479 static void message_handler_req_lib_votequorum_getinfo (
void *conn,
const void *message)
2484 unsigned int highest_expected = 0;
2485 unsigned int total_votes = 0;
2487 uint32_t nodeid = req_lib_votequorum_getinfo->
nodeid;
2497 node = find_node_by_nodeid(nodeid);
2508 total_votes += iternode->
votes;
2513 total_votes += qdevice->
votes;
2516 switch(node->
state) {
2527 res_lib_votequorum_getinfo.
state = node->
state;
2530 res_lib_votequorum_getinfo.
state = node->
state;
2531 res_lib_votequorum_getinfo.
votes = node->
votes;
2535 res_lib_votequorum_getinfo.
quorum = quorum;
2536 res_lib_votequorum_getinfo.
total_votes = total_votes;
2537 res_lib_votequorum_getinfo.
flags = 0;
2543 if (cluster_is_quorate) {
2549 if (last_man_standing) {
2552 if (auto_tie_breaker !=
ATB_NONE) {
2555 if (allow_downscale) {
2560 strcpy(res_lib_votequorum_getinfo.
qdevice_name, qdevice_name);
2579 res_lib_votequorum_getinfo.header.size =
sizeof(res_lib_votequorum_getinfo);
2581 res_lib_votequorum_getinfo.header.error = error;
2582 corosync_api->
ipc_response_send(conn, &res_lib_votequorum_getinfo,
sizeof(res_lib_votequorum_getinfo));
2588 static void message_handler_req_lib_votequorum_setexpected (
void *conn,
const void *message)
2593 unsigned int newquorum;
2594 unsigned int total_votes;
2595 uint8_t allow_downscale_status = 0;
2599 allow_downscale_status = allow_downscale;
2600 allow_downscale = 0;
2605 newquorum = calculate_quorum(1, req_lib_votequorum_setexpected->
expected_votes, &total_votes);
2606 allow_downscale = allow_downscale_status;
2607 if (newquorum < total_votes / 2 ||
2608 newquorum > total_votes) {
2617 res_lib_votequorum_status.header.size =
sizeof(res_lib_votequorum_status);
2619 res_lib_votequorum_status.header.error = error;
2620 corosync_api->
ipc_response_send(conn, &res_lib_votequorum_status,
sizeof(res_lib_votequorum_status));
2625 static void message_handler_req_lib_votequorum_setvotes (
void *conn,
const void *message)
2630 unsigned int newquorum;
2631 unsigned int total_votes;
2632 unsigned int saved_votes;
2638 nodeid = req_lib_votequorum_setvotes->
nodeid;
2639 node = find_node_by_nodeid(nodeid);
2648 saved_votes = node->
votes;
2649 node->
votes = req_lib_votequorum_setvotes->
votes;
2651 newquorum = calculate_quorum(1, 0, &total_votes);
2653 if (newquorum < total_votes / 2 ||
2654 newquorum > total_votes) {
2655 node->
votes = saved_votes;
2661 req_lib_votequorum_setvotes->
votes);
2664 res_lib_votequorum_status.header.size =
sizeof(res_lib_votequorum_status);
2666 res_lib_votequorum_status.header.error = error;
2667 corosync_api->
ipc_response_send(conn, &res_lib_votequorum_status,
sizeof(res_lib_votequorum_status));
2672 static void message_handler_req_lib_votequorum_trackstart (
void *conn,
2673 const void *message)
2689 votequorum_exec_send_quorum_notification(conn, req_lib_votequorum_trackstart->
context);
2707 list_add (&quorum_pd->
list, &trackers_list);
2711 res_lib_votequorum_status.header.size =
sizeof(res_lib_votequorum_status);
2713 res_lib_votequorum_status.header.error = error;
2714 corosync_api->
ipc_response_send(conn, &res_lib_votequorum_status,
sizeof(res_lib_votequorum_status));
2719 static void message_handler_req_lib_votequorum_trackstop (
void *conn,
2720 const void *message)
2731 list_del (&quorum_pd->
list);
2732 list_init (&quorum_pd->
list);
2737 res_lib_votequorum_status.header.size =
sizeof(res_lib_votequorum_status);
2739 res_lib_votequorum_status.header.error = error;
2740 corosync_api->
ipc_response_send(conn, &res_lib_votequorum_status,
sizeof(res_lib_votequorum_status));
2745 static void message_handler_req_lib_votequorum_qdevice_register (
void *conn,
2746 const void *message)
2754 if (!qdevice_can_operate) {
2755 log_printf(
LOGSYS_LEVEL_INFO,
"Registration of quorum device is disabled by incorrect corosync.conf. See logs for more information");
2761 if ((!strncmp(req_lib_votequorum_qdevice_register->
name,
2766 "A new qdevice with different name (new: %s old: %s) is trying to re-register!",
2767 req_lib_votequorum_qdevice_register->
name, qdevice_name);
2772 if (qdevice_reg_conn != NULL) {
2774 "Registration request already in progress");
2778 qdevice_reg_conn = conn;
2780 req_lib_votequorum_qdevice_register->
name) != 0) {
2782 "Unable to send qdevice registration request to cluster");
2784 qdevice_reg_conn = NULL;
2793 res_lib_votequorum_status.header.size =
sizeof(res_lib_votequorum_status);
2795 res_lib_votequorum_status.header.error = error;
2796 corosync_api->
ipc_response_send(conn, &res_lib_votequorum_status,
sizeof(res_lib_votequorum_status));
2801 static void message_handler_req_lib_votequorum_qdevice_unregister (
void *conn,
2802 const void *message)
2815 if (qdevice_timer_set) {
2817 qdevice_timer_set = 0;
2818 sync_wait_for_poll_or_timeout = 0;
2824 votequorum_exec_send_nodeinfo(us->
node_id);
2826 req_lib_votequorum_qdevice_unregister->
name);
2832 res_lib_votequorum_status.header.size =
sizeof(res_lib_votequorum_status);
2834 res_lib_votequorum_status.header.error = error;
2835 corosync_api->
ipc_response_send(conn, &res_lib_votequorum_status,
sizeof(res_lib_votequorum_status));
2840 static void message_handler_req_lib_votequorum_qdevice_update (
void *conn,
2841 const void *message)
2854 votequorum_exec_send_qdevice_reconfigure(req_lib_votequorum_qdevice_update->
oldname,
2855 req_lib_votequorum_qdevice_update->
newname);
2861 res_lib_votequorum_status.header.size =
sizeof(res_lib_votequorum_status);
2863 res_lib_votequorum_status.header.error = error;
2864 corosync_api->
ipc_response_send(conn, &res_lib_votequorum_status,
sizeof(res_lib_votequorum_status));
2869 static void message_handler_req_lib_votequorum_qdevice_poll (
void *conn,
2870 const void *message)
2879 if (!qdevice_can_operate) {
2885 if (!(req_lib_votequorum_qdevice_poll->ring_id.nodeid == quorum_ringid.
rep.
nodeid &&
2886 req_lib_votequorum_qdevice_poll->ring_id.seq == quorum_ringid.
seq)) {
2888 "ring id (%u.%"PRIu64
"). Ignoring poll call.",
2889 req_lib_votequorum_qdevice_poll->ring_id.nodeid, req_lib_votequorum_qdevice_poll->ring_id.seq,
2899 if (qdevice_timer_set) {
2901 qdevice_timer_set = 0;
2904 oldflags = us->
flags;
2908 if (req_lib_votequorum_qdevice_poll->
cast_vote) {
2914 if (us->
flags != oldflags) {
2915 votequorum_exec_send_nodeinfo(us->
node_id);
2918 corosync_api->
timer_add_duration((
unsigned long long)qdevice_timeout*1000000, qdevice,
2919 qdevice_timer_fn, &qdevice_timer);
2920 qdevice_timer_set = 1;
2921 sync_wait_for_poll_or_timeout = 0;
2927 res_lib_votequorum_status.header.size =
sizeof(res_lib_votequorum_status);
2929 res_lib_votequorum_status.header.error = error;
2930 corosync_api->
ipc_response_send(conn, &res_lib_votequorum_status,
sizeof(res_lib_votequorum_status));
2935 static void message_handler_req_lib_votequorum_qdevice_master_wins (
void *conn,
2936 const void *message)
2941 uint32_t oldflags = us->
flags;
2945 if (!qdevice_can_operate) {
2956 if (req_lib_votequorum_qdevice_master_wins->
allow) {
2962 if (us->
flags != oldflags) {
2963 votequorum_exec_send_nodeinfo(us->
node_id);
2966 update_qdevice_master_wins(req_lib_votequorum_qdevice_master_wins->
allow);
2972 res_lib_votequorum_status.header.size =
sizeof(res_lib_votequorum_status);
2974 res_lib_votequorum_status.header.error = error;
2975 corosync_api->
ipc_response_send(conn, &res_lib_votequorum_status,
sizeof(res_lib_votequorum_status));
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
char newname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
void *(* ipc_private_data_get)(void *conn)
#define VOTEQUORUM_INFO_QUORATE
char oldname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
#define VOTEQUORUM_READCONFIG_STARTUP
const char * get_run_dir(void)
void(* timer_delete)(corosync_timer_handle_t timer_handle)
int(* timer_add_duration)(unsigned long long nanoseconds_in_future, void *data, void(*timer_nf)(void *data), corosync_timer_handle_t *handle)
const char * icmap_iter_next(icmap_iter_t iter, size_t *value_len, icmap_value_types_t *type)
Return next item in iterator iter.
#define NODE_FLAGS_WFASTATUS
#define LOGSYS_LEVEL_INFO
#define NODE_FLAGS_QUORATE
#define VOTEQUORUM_QDEVICE_DEFAULT_SYNC_TIMEOUT
The corosync_service_engine struct.
void icmap_iter_finalize(icmap_iter_t iter)
Finalize iterator.
The req_lib_votequorum_qdevice_master_wins struct.
#define VOTEQUORUM_QDEVICE_OPERATION_UNREGISTER
#define MESSAGE_REQ_EXEC_VOTEQUORUM_RECONFIGURE
int(* ipc_response_send)(void *conn, const void *msg, size_t mlen)
#define list_iterate(v, head)
char * votequorum_init(struct corosync_api_v1 *api, quorum_set_quorate_fn_t q_set_quorate_fn)
#define VOTEQUORUM_RECONFIG_PARAM_CANCEL_WFA
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
char qdevice_name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_qdevice_unregister struct.
#define NODE_FLAGS_QDEVICE_MASTER_WINS
The corosync_lib_handler struct.
unsigned int highest_expected
#define VOTEQUORUM_INFO_LAST_MAN_STANDING
struct message_header header
#define VOTEQUORUM_INFO_WAIT_FOR_ALL
#define NODE_FLAGS_QDEVICE_CAST_VOTE
The res_lib_votequorum_status struct.
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
#define MESSAGE_REQ_EXEC_VOTEQUORUM_QDEVICE_RECONFIGURE
The corosync_exec_handler struct.
#define VOTEQUORUM_INFO_TWONODE
int(* totem_mcast)(const struct iovec *iovec, unsigned int iov_len, unsigned int guarantee)
char qdevice_name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
#define VOTEQUORUM_INFO_QDEVICE_REGISTERED
#define log_printf(level, format, args...)
unsigned int expected_votes
void(* exec_handler_fn)(const void *msg, unsigned int nodeid)
The res_lib_votequorum_notification struct.
#define VOTEQUORUM_QDEVICE_NODEID
#define VOTEQUORUM_INFO_QDEVICE_MASTER_WINS
#define VOTEQUORUM_NODESTATE_MEMBER
#define SERVICE_ID_MAKE(a, b)
#define ICMAP_TRACK_DELETE
#define ICMAP_KEYNAME_MAXLEN
Maximum length of key in icmap.
void(* quorum_set_quorate_fn_t)(const unsigned int *view_list, size_t view_list_entries, int quorate, struct memb_ring_id *)
#define VOTEQUORUM_QDEVICE_OPERATION_REGISTER
cs_error_t icmap_get_uint8(const char *key_name, uint8_t *u8)
void(* error_memory_failure)(void) __attribute__((noreturn))
#define VOTEQUORUM_INFO_ALLOW_DOWNSCALE
#define LOGSYS_LEVEL_WARNING
#define ICMAP_TRACK_MODIFY
#define VOTEQUORUM_INFO_QDEVICE_ALIVE
cs_error_t icmap_set_uint32(const char *key_name, uint32_t value)
unsigned int(* totem_nodeid_get)(void)
#define CS_TRACK_CHANGES_ONLY
The req_lib_votequorum_getinfo struct.
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
struct totem_ip_address rep
#define COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
The req_lib_votequorum_qdevice_update struct.
cs_error_t
The cs_error_t enum.
unsigned char track_flags
#define LOGSYS_LEVEL_DEBUG
LOGSYS_DECLARE_SUBSYS("VOTEQ")
The req_lib_votequorum_setvotes struct.
The corosync_api_v1 struct.
cs_error_t icmap_get_uint32(const char *key_name, uint32_t *u32)
The req_lib_votequorum_setexpected struct.
#define swab32(x)
The swab32 macro.
#define VOTEQUORUM_INFO_AUTO_TIE_BREAKER
struct corosync_service_engine * votequorum_get_service_engine_ver0(void)
The res_lib_votequorum_expectedvotes_notification struct.
The req_lib_votequorum_qdevice_register struct.
char * corosync_service_link_and_init(struct corosync_api_v1 *corosync_api, struct default_service *service)
Link and initialize a service.
char newname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
#define VOTEQUORUM_NODESTATE_LEAVING
#define PROCESSOR_COUNT_MAX
unsigned int qdevice_votes
#define MESSAGE_REQ_EXEC_VOTEQUORUM_QDEVICE_REG
#define VOTEQUORUM_READCONFIG_RUNTIME
#define MESSAGE_REQ_EXEC_VOTEQUORUM_NODEINFO
The req_lib_votequorum_trackstart struct.
#define VOTEQUORUM_RECONFIG_PARAM_NODE_VOTES
#define VOTEQUORUM_QDEVICE_MAX_NAME_LEN
qb_loop_timer_handle corosync_timer_handle_t
corosync_timer_handle_t
The req_lib_votequorum_qdevice_poll struct.
cs_error_t icmap_get_string(const char *key_name, char **str)
Shortcut for icmap_get for string type.
#define LOGSYS_LEVEL_CRIT
char oldname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
#define NODE_FLAGS_LEAVING
#define list_entry(ptr, type, member)
#define COROSYNC_LIB_FLOW_CONTROL_REQUIRED
#define LOGSYS_LEVEL_NOTICE
cs_error_t icmap_set_uint8(const char *key_name, uint8_t value)
void(* lib_handler_fn)(void *conn, const void *msg)
The res_lib_votequorum_getinfo struct.
#define VOTEQUORUM_NODESTATE_DEAD
cs_error_t icmap_set_ro_access(const char *key_name, int prefix, int ro_access)
Set read-only access for given key (key_name) or prefix, If prefix is set.
#define VOTEQUORUM_INFO_QDEVICE_CAST_VOTE
int(* ipc_dispatch_send)(void *conn, const void *msg, size_t mlen)
#define VOTEQUORUM_QDEVICE_DEFAULT_TIMEOUT
icmap_iter_t icmap_iter_init(const char *prefix)
Initialize iterator with given prefix.
struct memb_ring_id ring_id
uint64_t tracking_context
#define VOTEQUORUM_RECONFIG_PARAM_EXPECTED_VOTES
#define NODE_FLAGS_QDEVICE_ALIVE
qb_map_iter_t * icmap_iter_t
Itterator type.
Structure passed as new_value and old_value in change callback.
#define NODE_FLAGS_QDEVICE_REGISTERED
cs_error_t icmap_track_add(const char *key_name, int32_t track_type, icmap_notify_fn_t notify_fn, void *user_data, icmap_track_t *icmap_track)
Add tracking function for given key_name.
struct qb_ipc_request_header header __attribute__((aligned(8)))
#define ICMAP_TRACK_PREFIX
Whole prefix is tracked, instead of key only (so "totem." tracking means that "totem.nodeid", "totem.version", ...
unsigned int expected_votes