45#include <qb/qbipc_common.h>
75static uint8_t qdevice_can_operate = 1;
76static void *qdevice_reg_conn =
NULL;
77static uint8_t qdevice_master_wins = 0;
82static uint8_t wait_for_all_status = 0;
83static uint8_t wait_for_all_autoset = 0;
86static int lowest_node_id = -1;
87static int highest_node_id = -1;
89#define DEFAULT_LMS_WIN 10000
90static uint8_t last_man_standing = 0;
93static uint8_t allow_downscale = 0;
97static uint32_t ev_tracking_barrier = 0;
98static int ev_tracking_fd = -1;
151#define MESSAGE_REQ_EXEC_VOTEQUORUM_NODEINFO 0
152#define MESSAGE_REQ_EXEC_VOTEQUORUM_RECONFIGURE 1
153#define MESSAGE_REQ_EXEC_VOTEQUORUM_QDEVICE_REG 2
154#define MESSAGE_REQ_EXEC_VOTEQUORUM_QDEVICE_RECONFIGURE 3
155#define MESSAGE_REQ_EXEC_VOTEQUORUM_QDEVICE_EXTRA_NODEINFO 4
157static void votequorum_exec_send_expectedvotes_notification(
void);
158static int votequorum_exec_send_quorum_notification(
void *conn,
uint64_t context);
159static int votequorum_exec_send_nodelist_notification(
void *conn,
uint64_t context);
160static int votequorum_exec_send_all_qdevice_extra_info_notification(
void *conn,
uint64_t context);
162#define VOTEQUORUM_RECONFIG_PARAM_EXPECTED_VOTES 1
163#define VOTEQUORUM_RECONFIG_PARAM_NODE_VOTES 2
164#define VOTEQUORUM_RECONFIG_PARAM_CANCEL_WFA 3
171#define VOTEQUORUM_QDEVICE_OPERATION_UNREGISTER 0
172#define VOTEQUORUM_QDEVICE_OPERATION_REGISTER 1
178#define NODE_FLAGS_QUORATE 1
179#define NODE_FLAGS_LEAVING 2
180#define NODE_FLAGS_WFASTATUS 4
181#define NODE_FLAGS_FIRST 8
182#define NODE_FLAGS_QDEVICE_REGISTERED 16
183#define NODE_FLAGS_QDEVICE_ALIVE 32
184#define NODE_FLAGS_QDEVICE_CAST_VOTE 64
185#define NODE_FLAGS_QDEVICE_MASTER_WINS 128
186#define NODE_FLAGS_QDEVICE_EXTRA_INFO_SET 256
212static uint8_t cluster_is_quorate;
223static int quorum_members_entries = 0;
224static int previous_quorum_members_entries = 0;
225static int atb_nodelist_entries = 0;
232static int cluster_nodes_entries = 0;
252static int qdevice_timer_set = 0;
254static int last_man_standing_timer_set = 0;
255static int sync_nodeinfo_sent = 0;
256static int sync_wait_for_poll_or_timeout = 0;
262static int sync_in_progress = 0;
264static void votequorum_sync_init (
267 const unsigned int *member_list,
268 size_t member_list_entries,
271static int votequorum_sync_process (
void);
272static void votequorum_sync_activate (
void);
273static void votequorum_sync_abort (
void);
282static int votequorum_exec_exit_fn (
void);
284static int votequorum_exec_send_set_qdevice_extra_info(
uint32_t nodeid);
286static void message_handler_req_exec_votequorum_nodeinfo (
289static void exec_votequorum_nodeinfo_endian_convert (
void *
message);
291static void message_handler_req_exec_votequorum_reconfigure (
294static void exec_votequorum_reconfigure_endian_convert (
void *
message);
296static void message_handler_req_exec_votequorum_qdevice_reg (
299static void exec_votequorum_qdevice_reg_endian_convert (
void *
message);
301static void message_handler_req_exec_votequorum_qdevice_reconfigure (
304static void exec_votequorum_qdevice_reconfigure_endian_convert (
void *
message);
306static void message_handler_req_exec_votequorum_qdevice_set_extra_info (
309static void exec_votequorum_qdevice_set_extra_info_endian_convert (
void *
message);
315 .exec_endian_convert_fn = exec_votequorum_nodeinfo_endian_convert
318 .exec_handler_fn = message_handler_req_exec_votequorum_reconfigure,
319 .exec_endian_convert_fn = exec_votequorum_reconfigure_endian_convert
322 .exec_handler_fn = message_handler_req_exec_votequorum_qdevice_reg,
323 .exec_endian_convert_fn = exec_votequorum_qdevice_reg_endian_convert
326 .exec_handler_fn = message_handler_req_exec_votequorum_qdevice_reconfigure,
327 .exec_endian_convert_fn = exec_votequorum_qdevice_reconfigure_endian_convert
330 .exec_handler_fn = message_handler_req_exec_votequorum_qdevice_set_extra_info,
331 .exec_endian_convert_fn = exec_votequorum_qdevice_set_extra_info_endian_convert
339static int quorum_lib_init_fn (
void *conn);
341static int quorum_lib_exit_fn (
void *conn);
343static void qdevice_timer_fn(
void *
arg);
345static void message_handler_req_lib_votequorum_getinfo (
void *conn,
348static void message_handler_req_lib_votequorum_setexpected (
void *conn,
351static void message_handler_req_lib_votequorum_setvotes (
void *conn,
354static void message_handler_req_lib_votequorum_trackstart (
void *conn,
357static void message_handler_req_lib_votequorum_trackstop (
void *conn,
360static void message_handler_req_lib_votequorum_qdevice_register (
void *conn,
363static void message_handler_req_lib_votequorum_qdevice_unregister (
void *conn,
366static void message_handler_req_lib_votequorum_qdevice_update (
void *conn,
369static void message_handler_req_lib_votequorum_qdevice_poll (
void *conn,
372static void message_handler_req_lib_votequorum_qdevice_master_wins (
void *conn,
375static void message_handler_req_lib_votequorum_qdevice_set_extra_info (
void *conn,
378static void message_handler_req_lib_votequorum_qdevice_get_extra_info (
void *conn,
388 .lib_handler_fn = message_handler_req_lib_votequorum_setexpected,
392 .lib_handler_fn = message_handler_req_lib_votequorum_setvotes,
396 .lib_handler_fn = message_handler_req_lib_votequorum_trackstart,
400 .lib_handler_fn = message_handler_req_lib_votequorum_trackstop,
404 .lib_handler_fn = message_handler_req_lib_votequorum_qdevice_register,
408 .lib_handler_fn = message_handler_req_lib_votequorum_qdevice_unregister,
412 .lib_handler_fn = message_handler_req_lib_votequorum_qdevice_update,
416 .lib_handler_fn = message_handler_req_lib_votequorum_qdevice_poll,
420 .lib_handler_fn = message_handler_req_lib_votequorum_qdevice_master_wins,
424 .lib_handler_fn = message_handler_req_lib_votequorum_qdevice_set_extra_info,
428 .lib_handler_fn = message_handler_req_lib_votequorum_qdevice_get_extra_info,
434 .
name =
"corosync vote quorum service v1.0",
437 .private_data_size =
sizeof (
struct quorum_pd),
440 .lib_init_fn = quorum_lib_init_fn,
441 .lib_exit_fn = quorum_lib_exit_fn,
442 .lib_engine = quorum_lib_service,
444 .exec_init_fn = votequorum_exec_init_fn,
445 .exec_exit_fn = votequorum_exec_exit_fn,
446 .exec_engine = votequorum_exec_engine,
448 .sync_init = votequorum_sync_init,
449 .sync_process = votequorum_sync_process,
450 .sync_activate = votequorum_sync_activate,
451 .sync_abort = votequorum_sync_abort
456 return (&votequorum_service_engine);
461 .
name =
"corosync_votequorum",
471#define max(a,b) (((a) > (b)) ? (a) : (b))
504 cl = (
struct cluster_node *)&cluster_nodes[cluster_nodes_entries];
505 cluster_nodes_entries++;
526 node_add_ordered(
cl);
564static void get_lowest_node_id(
void)
576 (
node->node_id < lowest_node_id)) {
577 lowest_node_id =
node->node_id;
586static void get_highest_node_id(
void)
598 (
node->node_id > highest_node_id)) {
599 highest_node_id =
node->node_id;
608static int check_low_node_id_partition(
void)
619 (
node->node_id == lowest_node_id)) {
628static int check_high_node_id_partition(
void)
639 (
node->node_id == highest_node_id)) {
648static int is_in_nodelist(
int nodeid,
unsigned int *
members,
int entries)
653 for (
i=0;
i<entries;
i++) {
676static int check_auto_tie_breaker(
void)
683 res = check_low_node_id_partition();
689 res = check_high_node_id_partition();
696 for (
i=0;
i < atb_nodelist_entries;
i++) {
697 if (is_in_nodelist(atb_nodelist[
i], quorum_members, quorum_members_entries)) {
704 for (
j=0;
j<
i;
j++) {
705 if (is_in_nodelist(atb_nodelist[
j], previous_quorum_members, previous_quorum_members_entries)) {
748 atb_nodelist_entries = 0;
754 atb_nodelist[atb_nodelist_entries++] =
num;
758 if (atb_nodelist_entries) {
767 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");
773static int check_qdevice_master(
void)
799 "flags: quorate: %s Leaving: %s WFA Status: %s First: %s Qdevice: %s QdeviceAlive: %s QdeviceCastVote: %s QdeviceMasterWins: %s",
815static int load_ev_tracking_barrier(
void)
825 if (ev_tracking_fd != -1) {
827 close(ev_tracking_fd);
834 ev_tracking_barrier = 0;
837 if (ev_tracking_fd != -1) {
843 close(ev_tracking_fd);
848 "Unable to create %s file",
filename);
860 if (wait_for_all_status) {
866 wait_for_all_status);
871static void update_two_node(
void)
894 qdevice_can_operate =
status;
895 icmap_set_uint8(
"runtime.votequorum.qdevice_can_operate", qdevice_can_operate);
900static void update_qdevice_master_wins(
uint8_t allow)
904 qdevice_master_wins = allow;
905 icmap_set_uint8(
"runtime.votequorum.qdevice_master_wins", qdevice_master_wins);
917 icmap_set_uint32(
"runtime.votequorum.ev_tracking_barrier", ev_tracking_barrier);
921 "Unable to update ev_tracking_barrier on disk data!!!");
929 "Unable to update ev_tracking_barrier on disk data!!!");
934 fsync(ev_tracking_fd);
948 unsigned int total_votes = 0;
949 unsigned int highest_expected = 0;
966 highest_expected =
max(highest_expected,
node->expected_votes);
967 total_votes +=
node->votes;
974 total_votes += qdevice->
votes;
986 q1 = (highest_expected + 2) / 2;
987 q2 = (total_votes + 2) / 2;
1033static void are_we_quorate(
unsigned int total_votes)
1044 if ((wait_for_all) && (wait_for_all_status)) {
1047 "Waiting for all cluster members. "
1048 "Current votes: %d expected_votes: %d",
1050 assert(!cluster_is_quorate);
1053 update_wait_for_all_status(0);
1056 if (quorum > total_votes) {
1060 get_lowest_node_id();
1061 get_highest_node_id();
1064 if ((auto_tie_breaker !=
ATB_NONE) &&
1068 (previous_quorum_members_entries - quorum_members_entries < quorum) &&
1069 (check_auto_tie_breaker() == 1)) {
1073 if ((qdevice_master_wins) &&
1075 (check_qdevice_master() == 1)) {
1080 if (cluster_is_quorate && !
quorate) {
1084 if (!cluster_is_quorate &&
quorate) {
1090 if (cluster_is_quorate) {
1098 update_wait_for_all_status(0);
1100 update_wait_for_all_status(1);
1105 (sync_in_progress == 0)) {
1106 quorum_callback(quorum_members, quorum_members_entries,
1107 cluster_is_quorate, &quorum_ringid);
1108 votequorum_exec_send_quorum_notification(
NULL, 0
L);
1116 unsigned int total_votes = 0;
1127 total_votes +=
node->votes;
1131 if (qdevice->
votes) {
1132 total_votes += qdevice->
votes;
1147 unsigned int total_votes = 0;
1164 votequorum_exec_send_expectedvotes_notification();
1167 if ((ev_tracking) &&
1175 are_we_quorate(total_votes);
1184static int votequorum_read_nodelist_configuration(
uint32_t *
votes,
1201 "No nodelist defined or our node is not in the nodelist");
1234 *
votes = node_votes;
1248static int votequorum_qdevice_is_configured(
uint32_t *qdevice_votes)
1258 *qdevice_votes = -1;
1266 update_qdevice_can_operate(1);
1278#define VOTEQUORUM_READCONFIG_STARTUP 0
1279#define VOTEQUORUM_READCONFIG_RUNTIME 1
1281static char *votequorum_readconfig(
int runtime)
1283 uint32_t node_votes = 0, qdevice_votes = 0;
1306 auto_tie_breaker = initial_auto_tie_breaker;
1315 have_qdevice = votequorum_qdevice_is_configured(&qdevice_votes);
1324 error = (
char *)
"configuration error: nodelist or quorum.expected_votes must be configured!";
1339 error = (
char *)
"configuration error: two_node and quorum device cannot be configured at the same time!";
1348 update_qdevice_can_operate(0);
1359 wait_for_all_autoset = 1;
1376 "auto_tie_breaker_node: is meaningless if auto_tie_breaker is set to 0");
1384 initial_auto_tie_breaker = auto_tie_breaker;
1387 if (allow_downscale) {
1392 if (load_ev_tracking_barrier() < 0) {
1394 return ((
char *)
"Unable to load ev_tracking file!");
1396 update_ev_tracking_barrier(ev_tracking_barrier);
1406 if (wait_for_all_autoset) {
1407 wait_for_all = two_node;
1413 if (two_node && auto_tie_breaker !=
ATB_NONE) {
1423 if ((auto_tie_breaker !=
ATB_NONE) && (node_expected_votes % 2) &&
1425 if (last_man_standing) {
1434 error = (
char *)
"configuration error: auto_tie_breaker & last_man_standing not available in odd sized cluster";
1455 error = (
char *)
"configuration error: quorum.device is not compatible with last_man_standing";
1460 update_qdevice_can_operate(0);
1466 error = (
char *)
"configuration error: quorum.device is not compatible with auto_tie_breaker";
1471 update_qdevice_can_operate(0);
1477 error = (
char *)
"configuration error: quorum.device is not compatible with allow_downscale";
1482 update_qdevice_can_operate(0);
1493 error = (
char *)
"configuration error: quorum.device.votes must be specified when quorum.expected_votes is set";
1498 update_qdevice_can_operate(0);
1508 (qdevice_votes == -1) &&
1512 error = (
char *)
"configuration error: quorum.device.votes must be specified when not all nodes votes 1";
1517 update_qdevice_can_operate(0);
1529 error = (
char *)
"configuration error: quorum.device.votes is too high or expected_votes is too low";
1534 update_qdevice_can_operate(0);
1544 (qdevice_votes == -1) &&
1548 qdevice_votes = node_expected_votes - 1;
1549 node_expected_votes = node_expected_votes + qdevice_votes;
1562 us->
votes = node_votes;
1581 if (qdevice_votes != -1) {
1582 qdevice->
votes = qdevice_votes;
1589 update_wait_for_all_status(1);
1591 }
else if (wait_for_all_autoset && wait_for_all_status) {
1596 update_wait_for_all_status(0);
1604static void votequorum_refresh_config(
1606 const char *key_name,
1627 if ( (
strcmp(key_name,
"config.totemconfig_reload_in_progress") == 0) &&
1634 if (
strcmp(key_name,
"quorum.cancel_wait_for_all") == 0 &&
1655 votequorum_exec_send_nodeinfo(us->
node_id);
1673static void votequorum_exec_add_config_notification(
void)
1683 votequorum_refresh_config,
1689 votequorum_refresh_config,
1695 votequorum_refresh_config,
1753 decode_flags(
node->flags);
1768static int votequorum_exec_send_qdevice_reconfigure(
const char *
oldname,
const char *
newname)
1818static int votequorum_exec_send_quorum_notification(
void *conn,
uint64_t context)
1881static int votequorum_exec_send_nodelist_notification(
void *
conn,
uint64_t context)
1901 for (
i=0;
i<quorum_members_entries;
i++) {
1929static void votequorum_exec_send_expectedvotes_notification(
void)
1954static void exec_votequorum_qdevice_reconfigure_endian_convert (
void *
message)
1961static void message_handler_req_exec_votequorum_qdevice_reconfigure (
1988static void exec_votequorum_qdevice_reg_endian_convert (
void *
message)
1999static void message_handler_req_exec_votequorum_qdevice_reg (
2020 if (!
strlen(qdevice_name)) {
2041 if (!qdevice_reg_conn) {
2050 if (!
strlen(qdevice_name)) {
2061 votequorum_exec_send_nodeinfo(us->
node_id);
2064 "A new qdevice with different name (new: %s old: %s) is trying to register!",
2073 qdevice_reg_conn =
NULL;
2093static void exec_votequorum_nodeinfo_endian_convert (
void *
message)
2107static void message_handler_req_exec_votequorum_nodeinfo (
2109 unsigned int sender_nodeid)
2163 if ((!cluster_is_quorate) &&
2183 if ((!cluster_is_quorate) &&
2195 if ((last_man_standing) && (
node->votes > 1)) {
2197 "cluster nodes votes are set to 1. Disabling LMS.");
2198 last_man_standing = 0;
2199 if (last_man_standing_timer_set) {
2201 last_man_standing_timer_set = 0;
2216 if ((wait_for_all) &&
2219 update_wait_for_all_status(0);
2225static void exec_votequorum_reconfigure_endian_convert (
void *
message)
2237static void message_handler_req_exec_votequorum_reconfigure (
2253 votequorum_exec_send_expectedvotes_notification();
2258 recalculate_quorum(1, 0);
2268 recalculate_quorum(1, 0);
2272 update_wait_for_all_status(0);
2275 recalculate_quorum(0, 0);
2284static int votequorum_exec_exit_fn (
void)
2294 if (allow_downscale) {
2296 ret = votequorum_exec_send_nodeinfo(us->
node_id);
2299 if ((ev_tracking) && (ev_tracking_fd != -1)) {
2300 close(ev_tracking_fd);
2308static void votequorum_set_icmap_ro_keys(
void)
2332 memset(cluster_nodes, 0,
sizeof(cluster_nodes));
2340 return ((
char *)
"Could not allocate node.");
2351 return ((
char *)
"Could not allocate node.");
2364 recalculate_quorum(0, 0);
2369 votequorum_set_icmap_ro_keys();
2374 votequorum_exec_add_config_notification();
2379 votequorum_exec_send_nodeinfo(us->
node_id);
2390static void votequorum_last_man_standing_timer_fn(
void *
arg)
2394 last_man_standing_timer_set = 0;
2395 if (cluster_is_quorate) {
2396 recalculate_quorum(1,1);
2402static void votequorum_sync_init (
2404 const unsigned int *member_list,
size_t member_list_entries,
2414 sync_in_progress = 1;
2415 sync_nodeinfo_sent = 0;
2416 sync_wait_for_poll_or_timeout = 0;
2418 if (member_list_entries > 1) {
2428 for (
i = 0;
i < quorum_members_entries;
i++) {
2430 for (
j = 0;
j < member_list_entries;
j++) {
2431 if (quorum_members[
i] == member_list[
j]) {
2438 node = find_node_by_nodeid(quorum_members[
i]);
2445 if (last_man_standing) {
2446 if (((member_list_entries >= quorum) && (
left_nodes)) ||
2447 ((member_list_entries <= quorum) && (auto_tie_breaker !=
ATB_NONE) && (check_low_node_id_partition() == 1))) {
2448 if (last_man_standing_timer_set) {
2450 last_man_standing_timer_set = 0;
2452 corosync_api->
timer_add_duration((
unsigned long long)last_man_standing_window*1000000,
2453 NULL, votequorum_last_man_standing_timer_fn,
2454 &last_man_standing_timer);
2455 last_man_standing_timer_set = 1;
2459 memcpy(previous_quorum_members, quorum_members,
sizeof(
unsigned int) * quorum_members_entries);
2460 previous_quorum_members_entries = quorum_members_entries;
2462 memcpy(quorum_members, member_list,
sizeof(
unsigned int) * member_list_entries);
2463 quorum_members_entries = member_list_entries;
2470 if (qdevice_timer_set) {
2473 corosync_api->
timer_add_duration((
unsigned long long)qdevice_sync_timeout*1000000, qdevice,
2474 qdevice_timer_fn, &qdevice_timer);
2475 qdevice_timer_set = 1;
2476 sync_wait_for_poll_or_timeout = 1;
2479 qdevice_name, qdevice_sync_timeout);
2485static int votequorum_sync_process (
void)
2487 if (!sync_nodeinfo_sent) {
2488 votequorum_exec_send_nodeinfo(us->
node_id);
2490 votequorum_exec_send_set_qdevice_extra_info(us->
node_id);
2493 if (
strlen(qdevice_name)) {
2497 votequorum_exec_send_nodelist_notification(
NULL, 0
LL);
2498 sync_nodeinfo_sent = 1;
2512static void votequorum_sync_activate (
void)
2514 recalculate_quorum(0, 0);
2515 quorum_callback(quorum_members, quorum_members_entries,
2516 cluster_is_quorate, &quorum_ringid);
2517 votequorum_exec_send_quorum_notification(
NULL, 0
L);
2519 sync_in_progress = 0;
2522static void votequorum_sync_abort (
void)
2535 return ((
char *)
"Quorate function not set");
2542 &votequorum_service[0]);
2556static int quorum_lib_init_fn (
void *conn)
2569static int quorum_lib_exit_fn (
void *
conn)
2589static void qdevice_timer_fn(
void *
arg)
2594 (!qdevice_timer_set)) {
2602 votequorum_exec_send_nodeinfo(us->
node_id);
2604 qdevice_timer_set = 0;
2605 sync_wait_for_poll_or_timeout = 0;
2614static void message_handler_req_lib_votequorum_getinfo (
void *
conn,
const void *
message)
2619 unsigned int highest_expected = 0;
2620 unsigned int total_votes = 0;
2648 total_votes += qdevice->
votes;
2651 switch(
node->state) {
2678 if (cluster_is_quorate) {
2684 if (last_man_standing) {
2687 if (auto_tie_breaker !=
ATB_NONE) {
2690 if (allow_downscale) {
2726static void message_handler_req_lib_votequorum_setexpected (
void *conn,
const void *
message)
2732 unsigned int total_votes;
2738 allow_downscale = 0;
2750 (cluster_is_quorate && (
newquorum > total_votes))) {
2770static void message_handler_req_lib_votequorum_setvotes (
void *conn,
const void *
message)
2776 unsigned int total_votes;
2796 newquorum = calculate_quorum(1, 0, &total_votes);
2819static void message_handler_req_lib_votequorum_trackstart (
void *conn,
2868static void message_handler_req_lib_votequorum_trackstop (
void *
conn,
2894static void message_handler_req_lib_votequorum_qdevice_register (
void *
conn,
2903 if (!qdevice_can_operate) {
2904 log_printf(
LOGSYS_LEVEL_INFO,
"Registration of quorum device is disabled by incorrect corosync.conf. See logs for more information");
2915 "A new qdevice with different name (new: %s old: %s) is trying to re-register!",
2921 if (qdevice_reg_conn !=
NULL) {
2923 "Registration request already in progress");
2927 qdevice_reg_conn = conn;
2931 "Unable to send qdevice registration request to cluster");
2933 qdevice_reg_conn =
NULL;
2950static void message_handler_req_lib_votequorum_qdevice_unregister (
void *conn,
2964 if (qdevice_timer_set) {
2966 qdevice_timer_set = 0;
2967 sync_wait_for_poll_or_timeout = 0;
2976 votequorum_exec_send_set_qdevice_extra_info(us->
node_id);
2978 votequorum_exec_send_nodeinfo(us->
node_id);
2994static void message_handler_req_lib_votequorum_qdevice_update (
void *conn,
3023static void message_handler_req_lib_votequorum_qdevice_poll (
void *conn,
3033 if (!qdevice_can_operate) {
3044 quorum_ringid.
nodeid, quorum_ringid.
seq);
3053 if (qdevice_timer_set) {
3055 qdevice_timer_set = 0;
3069 votequorum_exec_send_nodeinfo(us->
node_id);
3072 corosync_api->
timer_add_duration((
unsigned long long)qdevice_timeout*1000000, qdevice,
3073 qdevice_timer_fn, &qdevice_timer);
3074 qdevice_timer_set = 1;
3075 sync_wait_for_poll_or_timeout = 0;
3089static void message_handler_req_lib_votequorum_qdevice_master_wins (
void *conn,
3099 if (!qdevice_can_operate) {
3117 votequorum_exec_send_nodeinfo(us->
node_id);
3134static void fill_extra_info_notification(
3156static int votequorum_exec_send_all_qdevice_extra_info_notification(
void *conn,
uint64_t context)
3186votequorum_exec_send_qdevice_extra_info_notification(
uint32_t nodeid)
3200 "Sending extra info notification for node " CS_PRI_NODE_ID " failed, node doesn't exist",
3243 "Sending mcast extra info for node " CS_PRI_NODE_ID " failed because node doesn't exist",
3266 iov[0].iov_base = (
void *)
buf;
3276static void message_handler_req_exec_votequorum_qdevice_set_extra_info (
3307 votequorum_exec_send_qdevice_extra_info_notification(
nodeid);
3315static void exec_votequorum_qdevice_set_extra_info_endian_convert (
void *
message)
3327static void message_handler_req_lib_votequorum_qdevice_set_extra_info (
void *conn,
3337 "Local set extra info %" PRIu32 " bytes",
3340 if (!qdevice_can_operate) {
3362 votequorum_exec_send_set_qdevice_extra_info(us->
node_id);
3376static void message_handler_req_lib_votequorum_qdevice_get_extra_info (
void *conn,
3389 if (!qdevice_can_operate) {
#define SERVICE_ID_MAKE(a, b)
qb_loop_timer_handle corosync_timer_handle_t
corosync_timer_handle_t
unsigned int nodeid
the ID of the node whose info needs updating
#define COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
#define COROSYNC_LIB_FLOW_CONTROL_REQUIRED
#define PROCESSOR_COUNT_MAX
#define CS_TRACK_CHANGES_ONLY
cs_error_t
The cs_error_t enum.
void(* quorum_set_quorate_fn_t)(const unsigned int *view_list, size_t view_list_entries, int quorate, struct memb_ring_id *)
struct corosync_service_engine * votequorum_get_service_engine_ver0(void)
#define VOTEQUORUM_RECONFIG_PARAM_CANCEL_WFA
#define NODE_FLAGS_QUORATE
#define NODE_FLAGS_QDEVICE_EXTRA_INFO_SET
#define VOTEQUORUM_RECONFIG_PARAM_NODE_VOTES
char * votequorum_init(struct corosync_api_v1 *api, quorum_set_quorate_fn_t q_set_quorate_fn)
#define VOTEQUORUM_RECONFIG_PARAM_EXPECTED_VOTES
#define VOTEQUORUM_QDEVICE_OPERATION_UNREGISTER
char oldname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
uint32_t nodeid
the ID of the node whose info needs updating
#define NODE_FLAGS_QDEVICE_REGISTERED
#define MESSAGE_REQ_EXEC_VOTEQUORUM_QDEVICE_RECONFIGURE
char newname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
#define NODE_FLAGS_QDEVICE_CAST_VOTE
#define MESSAGE_REQ_EXEC_VOTEQUORUM_RECONFIGURE
#define NODE_FLAGS_QDEVICE_MASTER_WINS
#define VOTEQUORUM_READCONFIG_STARTUP
#define NODE_FLAGS_LEAVING
#define NODE_FLAGS_QDEVICE_ALIVE
#define NODE_FLAGS_WFASTATUS
uint32_t ei_size
length of the extra info
#define MESSAGE_REQ_EXEC_VOTEQUORUM_QDEVICE_REG
#define VOTEQUORUM_QDEVICE_OPERATION_REGISTER
#define MESSAGE_REQ_EXEC_VOTEQUORUM_NODEINFO
#define MESSAGE_REQ_EXEC_VOTEQUORUM_QDEVICE_EXTRA_NODEINFO
#define VOTEQUORUM_READCONFIG_RUNTIME
cs_error_t icmap_get_uint8(const char *key_name, uint8_t *u8)
#define ICMAP_TRACK_MODIFY
cs_error_t icmap_get_uint32(const char *key_name, uint32_t *u32)
cs_error_t icmap_set_uint8(const char *key_name, uint8_t value)
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 ICMAP_TRACK_DELETE
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.
#define ICMAP_TRACK_PREFIX
Whole prefix is tracked, instead of key only (so "totem." tracking means that "totem....
icmap_iter_t icmap_iter_init(const char *prefix)
Initialize iterator with given prefix.
const char * icmap_iter_next(icmap_iter_t iter, size_t *value_len, icmap_value_types_t *type)
Return next item in iterator iter.
qb_map_iter_t * icmap_iter_t
Itterator type.
void icmap_iter_finalize(icmap_iter_t iter)
Finalize iterator.
cs_error_t icmap_get_int32(const char *key_name, int32_t *i32)
#define ICMAP_KEYNAME_MAXLEN
Maximum length of key in icmap.
cs_error_t icmap_set_uint32(const char *key_name, uint32_t value)
cs_error_t icmap_get_string(const char *key_name, char **str)
Shortcut for icmap_get for string type.
#define VOTEQUORUM_QDEVICE_EXTRA_NODEINFO_MAXSIZE
#define VOTEQUORUM_QDEVICE_DEFAULT_SYNC_TIMEOUT
#define VOTEQUORUM_INFO_QDEVICE_HAS_EXTRA_INFO
#define VOTEQUORUM_INFO_AUTO_TIE_BREAKER
#define VOTEQUORUM_INFO_QDEVICE_ALIVE
#define VOTEQUORUM_NODESTATE_MEMBER
#define VOTEQUORUM_NODESTATE_DEAD
#define VOTEQUORUM_INFO_ALLOW_DOWNSCALE
@ MESSAGE_RES_VOTEQUORUM_QDEVICE_GET_EXTRA_INFO
@ MESSAGE_RES_VOTEQUORUM_NODELIST_NOTIFICATION
@ MESSAGE_RES_VOTEQUORUM_EXPECTEDVOTES_NOTIFICATION
@ MESSAGE_RES_VOTEQUORUM_QDEVICE_EXTRA_INFO_NOTIFICATION
@ MESSAGE_RES_VOTEQUORUM_STATUS
@ MESSAGE_RES_VOTEQUORUM_QUORUM_NOTIFICATION
@ MESSAGE_RES_VOTEQUORUM_GETINFO
#define VOTEQUORUM_INFO_QDEVICE_MASTER_WINS
#define VOTEQUORUM_NODESTATE_LEAVING
#define VOTEQUORUM_INFO_TWONODE
#define VOTEQUORUM_INFO_WAIT_FOR_ALL
#define VOTEQUORUM_INFO_QUORATE
#define VOTEQUORUM_INFO_QDEVICE_REGISTERED
#define VOTEQUORUM_INFO_LAST_MAN_STANDING
#define VOTEQUORUM_QDEVICE_MAX_NAME_LEN
#define VOTEQUORUM_QDEVICE_NODEID
#define VOTEQUORUM_INFO_QDEVICE_CAST_VOTE
#define VOTEQUORUM_QDEVICE_DEFAULT_TIMEOUT
#define LOGSYS_LEVEL_ERROR
#define log_printf(level, format, args...)
#define LOGSYS_LEVEL_INFO
#define LOGSYS_LEVEL_CRIT
#define LOGSYS_LEVEL_NOTICE
#define LOGSYS_DECLARE_SUBSYS(subsys)
The LOGSYS_DECLARE_SUBSYS macro.
#define LOGSYS_LEVEL_WARNING
#define LOGSYS_LEVEL_DEBUG
char * corosync_service_link_and_init(struct corosync_api_v1 *corosync_api, struct default_service *service)
Link and initialize a service.
char extra_nodeinfo[VOTEQUORUM_QDEVICE_EXTRA_NODEINFO_MAXSIZE]
The corosync_api_v1 struct.
int(* timer_add_duration)(unsigned long long nanoseconds_in_future, void *data, void(*timer_nf)(void *data), corosync_timer_handle_t *handle)
int(* totem_mcast)(const struct iovec *iovec, unsigned int iov_len, unsigned int guarantee)
void *(* ipc_private_data_get)(void *conn)
void(* timer_delete)(corosync_timer_handle_t timer_handle)
unsigned int(* totem_nodeid_get)(void)
int(* ipc_dispatch_send)(void *conn, const void *msg, size_t mlen)
int(* ipc_response_send)(void *conn, const void *msg, size_t mlen)
void(* error_memory_failure)(void) __attribute__((noreturn))
The corosync_exec_handler struct.
void(* exec_handler_fn)(const void *msg, unsigned int nodeid)
The corosync_lib_handler struct.
void(* lib_handler_fn)(void *conn, const void *msg)
The corosync_service_engine struct.
Structure passed as new_value and old_value in change callback.
unsigned char track_flags
uint64_t tracking_context
char qdevice_name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_getinfo struct.
The req_lib_votequorum_qdevice_master_wins struct.
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_qdevice_poll struct.
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_qdevice_register struct.
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_qdevice_unregister struct.
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_qdevice_update struct.
char newname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
char oldname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_setexpected struct.
unsigned int expected_votes
The req_lib_votequorum_setvotes struct.
The req_lib_votequorum_trackstart struct.
The res_lib_votequorum_expectedvotes_notification struct.
The res_lib_votequorum_getinfo struct.
unsigned int highest_expected
char qdevice_name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
unsigned int expected_votes
unsigned int qdevice_votes
The res_lib_votequorum_quorum_notification struct.
The res_lib_votequorum_status struct.
The votequorum_node struct.
#define swab32(x)
The swab32 macro.
struct memb_ring_id ring_id
struct totem_message_header header
const char * get_state_dir(void)