pacemaker  2.0.4-2deceaa
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
election.c
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2019 Andrew Beekhof <andrew@beekhof.net>
3  *
4  * This source code is licensed under the GNU Lesser General Public License
5  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
6  */
7 
8 #include <crm_internal.h>
9 
10 #include <sys/time.h>
11 #include <sys/resource.h>
12 
13 #include <crm/msg_xml.h>
14 #include <crm/common/xml.h>
15 
16 #include <crm/common/mainloop.h>
17 #include <crm/cluster/internal.h>
18 #include <crm/cluster/election.h>
19 #include <crm/crm.h>
20 
21 #define STORM_INTERVAL 2 /* in seconds */
22 
23 struct election_s {
24  enum election_result state;
25  guint count; // How many times local node has voted
26  char *name; // Descriptive name for this election
27  char *uname; // Local node's name
28  GSourceFunc cb; // Function to call if election is won
29  GHashTable *voted; // Key = node name, value = how node voted
30  mainloop_timer_t *timeout; // When to abort if all votes not received
31  int election_wins; // Track wins, for storm detection
32  bool wrote_blackbox; // Write a storm blackbox at most once
33  time_t expires; // When storm detection period ends
34  time_t last_election_loss; // When dampening period ends
35 };
36 
37 static void election_complete(election_t *e)
38 {
39  e->state = election_won;
40 
41  if(e->cb) {
42  e->cb(e);
43  }
44 
45  election_reset(e);
46 }
47 
48 static gboolean election_timer_cb(gpointer user_data)
49 {
50  election_t *e = user_data;
51 
52  crm_info("%s timed out, declaring local node as winner", e->name);
53  election_complete(e);
54  return FALSE;
55 }
56 
57 enum election_result
59 {
60  if(e) {
61  return e->state;
62  }
63  return election_error;
64 }
65 
82 election_t *
83 election_init(const char *name, const char *uname, guint period_ms, GSourceFunc cb)
84 {
85  election_t *e = NULL;
86 
87  static guint count = 0;
88 
89  CRM_CHECK(uname != NULL, return NULL);
90 
91  e = calloc(1, sizeof(election_t));
92  if (e == NULL) {
93  crm_perror(LOG_CRIT, "Cannot create election");
94  return NULL;
95  }
96 
97  e->uname = strdup(uname);
98  if (e->uname == NULL) {
99  crm_perror(LOG_CRIT, "Cannot create election");
100  free(e);
101  return NULL;
102  }
103 
104  e->name = name? crm_strdup_printf("election-%s", name)
105  : crm_strdup_printf("election-%u", count++);
106  e->cb = cb;
107  e->timeout = mainloop_timer_add(e->name, period_ms, FALSE,
108  election_timer_cb, e);
109  crm_trace("Created %s", e->name);
110  return e;
111 }
112 
122 void
124 {
125  if(e && uname && e->voted) {
126  crm_trace("Discarding %s (no-)vote from lost peer %s", e->name, uname);
127  g_hash_table_remove(e->voted, uname);
128  }
129 }
130 
136 void
138 {
139  if (e != NULL) {
140  crm_trace("Resetting election %s", e->name);
141  mainloop_timer_stop(e->timeout);
142  if (e->voted) {
143  crm_trace("Destroying voted cache with %d members", g_hash_table_size(e->voted));
144  g_hash_table_destroy(e->voted);
145  e->voted = NULL;
146  }
147  }
148 }
149 
158 void
160 {
161  if(e) {
162  election_reset(e);
163  crm_trace("Destroying %s", e->name);
164  mainloop_timer_del(e->timeout);
165  free(e->uname);
166  free(e->name);
167  free(e);
168  }
169 }
170 
171 static void
172 election_timeout_start(election_t *e)
173 {
174  if(e) {
175  mainloop_timer_start(e->timeout);
176  }
177 }
178 
184 void
186 {
187  if(e) {
188  mainloop_timer_stop(e->timeout);
189  }
190 }
191 
198 void
200 {
201  if(e) {
202  mainloop_timer_set_period(e->timeout, period);
203  } else {
204  crm_err("No election defined");
205  }
206 }
207 
208 static int
209 crm_uptime(struct timeval *output)
210 {
211  static time_t expires = 0;
212  static struct rusage info;
213 
214  time_t tm_now = time(NULL);
215 
216  if (expires < tm_now) {
217  int rc = 0;
218 
219  info.ru_utime.tv_sec = 0;
220  info.ru_utime.tv_usec = 0;
221  rc = getrusage(RUSAGE_SELF, &info);
222 
223  output->tv_sec = 0;
224  output->tv_usec = 0;
225 
226  if (rc < 0) {
227  crm_perror(LOG_ERR, "Could not calculate the current uptime");
228  expires = 0;
229  return -1;
230  }
231 
232  crm_debug("Current CPU usage is: %lds, %ldus", (long)info.ru_utime.tv_sec,
233  (long)info.ru_utime.tv_usec);
234  }
235 
236  expires = tm_now + STORM_INTERVAL; /* N seconds after the last _access_ */
237  output->tv_sec = info.ru_utime.tv_sec;
238  output->tv_usec = info.ru_utime.tv_usec;
239 
240  return 1;
241 }
242 
243 static int
244 crm_compare_age(struct timeval your_age)
245 {
246  struct timeval our_age;
247 
248  crm_uptime(&our_age); /* If an error occurred, our_age will be compared as {0,0} */
249 
250  if (our_age.tv_sec > your_age.tv_sec) {
251  crm_debug("Win: %ld vs %ld (seconds)", (long)our_age.tv_sec, (long)your_age.tv_sec);
252  return 1;
253  } else if (our_age.tv_sec < your_age.tv_sec) {
254  crm_debug("Lose: %ld vs %ld (seconds)", (long)our_age.tv_sec, (long)your_age.tv_sec);
255  return -1;
256  } else if (our_age.tv_usec > your_age.tv_usec) {
257  crm_debug("Win: %ld.%06ld vs %ld.%06ld (usec)",
258  (long)our_age.tv_sec, (long)our_age.tv_usec, (long)your_age.tv_sec, (long)your_age.tv_usec);
259  return 1;
260  } else if (our_age.tv_usec < your_age.tv_usec) {
261  crm_debug("Lose: %ld.%06ld vs %ld.%06ld (usec)",
262  (long)our_age.tv_sec, (long)our_age.tv_usec, (long)your_age.tv_sec, (long)your_age.tv_usec);
263  return -1;
264  }
265 
266  return 0;
267 }
268 
282 void
284 {
285  struct timeval age;
286  xmlNode *vote = NULL;
287  crm_node_t *our_node;
288 
289  if (e == NULL) {
290  crm_trace("Election vote requested, but no election available");
291  return;
292  }
293 
294  our_node = crm_get_peer(0, e->uname);
295  if ((our_node == NULL) || (crm_is_peer_active(our_node) == FALSE)) {
296  crm_trace("Cannot vote in %s yet: local node not connected to cluster",
297  e->name);
298  return;
299  }
300 
301  election_reset(e);
302  e->state = election_in_progress;
303  vote = create_request(CRM_OP_VOTE, NULL, NULL, CRM_SYSTEM_CRMD, CRM_SYSTEM_CRMD, NULL);
304 
305  e->count++;
306  crm_xml_add(vote, F_CRM_ELECTION_OWNER, our_node->uuid);
307  crm_xml_add_int(vote, F_CRM_ELECTION_ID, e->count);
308 
309  crm_uptime(&age);
311 
312  send_cluster_message(NULL, crm_msg_crmd, vote, TRUE);
313  free_xml(vote);
314 
315  crm_debug("Started %s round %d", e->name, e->count);
316  election_timeout_start(e);
317  return;
318 }
319 
335 bool
337 {
338  int voted_size = 0;
339  int num_members = 0;
340 
341  if(e == NULL) {
342  crm_trace("Election check requested, but no election available");
343  return FALSE;
344  }
345  if (e->voted == NULL) {
346  crm_trace("%s check requested, but no votes received yet", e->name);
347  return FALSE;
348  }
349 
350  voted_size = g_hash_table_size(e->voted);
351  num_members = crm_active_peers();
352 
353  /* in the case of #voted > #members, it is better to
354  * wait for the timeout and give the cluster time to
355  * stabilize
356  */
357  if (voted_size >= num_members) {
358  /* we won and everyone has voted */
360  if (voted_size > num_members) {
361  GHashTableIter gIter;
362  const crm_node_t *node;
363  char *key = NULL;
364 
365  crm_warn("Received too many votes in %s", e->name);
366  g_hash_table_iter_init(&gIter, crm_peer_cache);
367  while (g_hash_table_iter_next(&gIter, NULL, (gpointer *) & node)) {
368  if (crm_is_peer_active(node)) {
369  crm_warn("* expected vote: %s", node->uname);
370  }
371  }
372 
373  g_hash_table_iter_init(&gIter, e->voted);
374  while (g_hash_table_iter_next(&gIter, (gpointer *) & key, NULL)) {
375  crm_warn("* actual vote: %s", key);
376  }
377 
378  }
379 
380  crm_info("%s won by local node", e->name);
381  election_complete(e);
382  return TRUE;
383 
384  } else {
385  crm_debug("%s still waiting on %d of %d votes",
386  e->name, num_members - voted_size, num_members);
387  }
388 
389  return FALSE;
390 }
391 
392 #define LOSS_DAMPEN 2 /* in seconds */
393 
394 struct vote {
395  const char *op;
396  const char *from;
397  const char *version;
398  const char *election_owner;
399  int election_id;
400  struct timeval age;
401 };
402 
414 static bool
415 parse_election_message(election_t *e, xmlNode *message, struct vote *vote)
416 {
417  CRM_CHECK(message && vote, return FALSE);
418 
419  vote->election_id = -1;
420  vote->age.tv_sec = -1;
421  vote->age.tv_usec = -1;
422 
423  vote->op = crm_element_value(message, F_CRM_TASK);
424  vote->from = crm_element_value(message, F_CRM_HOST_FROM);
425  vote->version = crm_element_value(message, F_CRM_VERSION);
426  vote->election_owner = crm_element_value(message, F_CRM_ELECTION_OWNER);
427 
428  crm_element_value_int(message, F_CRM_ELECTION_ID, &(vote->election_id));
429 
430  if ((vote->op == NULL) || (vote->from == NULL) || (vote->version == NULL)
431  || (vote->election_owner == NULL) || (vote->election_id < 0)) {
432 
433  crm_warn("Invalid %s message from %s in %s ",
434  (vote->op? vote->op : "election"),
435  (vote->from? vote->from : "unspecified node"),
436  (e? e->name : "election"));
437  return FALSE;
438  }
439 
440  // Op-specific validation
441 
442  if (crm_str_eq(vote->op, CRM_OP_VOTE, TRUE)) {
443  // Only vote ops have uptime
445  F_CRM_ELECTION_AGE_US, &(vote->age));
446  if ((vote->age.tv_sec < 0) || (vote->age.tv_usec < 0)) {
447  crm_warn("Cannot count %s %s from %s because it is missing uptime",
448  (e? e->name : "election"), vote->op, vote->from);
449  return FALSE;
450  }
451 
452  } else if (!crm_str_eq(vote->op, CRM_OP_NOVOTE, TRUE)) {
453  crm_info("Cannot process %s message from %s because %s is not a known election op",
454  (e? e->name : "election"), vote->from, vote->op);
455  return FALSE;
456  }
457 
458  // Election validation
459 
460  if (e == NULL) {
461  crm_info("Cannot count %s from %s because no election available",
462  vote->op, vote->from);
463  return FALSE;
464  }
465 
466  /* If the membership cache is NULL, we REALLY shouldn't be voting --
467  * the question is how we managed to get here.
468  */
469  if (crm_peer_cache == NULL) {
470  crm_info("Cannot count %s %s from %s because no peer information available",
471  e->name, vote->op, vote->from);
472  return FALSE;
473  }
474  return TRUE;
475 }
476 
477 static void
478 record_vote(election_t *e, struct vote *vote)
479 {
480  char *voter_copy = NULL;
481  char *vote_copy = NULL;
482 
483  CRM_ASSERT(e && vote && vote->from && vote->op);
484  if (e->voted == NULL) {
485  e->voted = crm_str_table_new();
486  }
487 
488  voter_copy = strdup(vote->from);
489  vote_copy = strdup(vote->op);
490  CRM_ASSERT(voter_copy && vote_copy);
491 
492  g_hash_table_replace(e->voted, voter_copy, vote_copy);
493 }
494 
495 static void
496 send_no_vote(crm_node_t *peer, struct vote *vote)
497 {
498  // @TODO probably shouldn't hardcode CRM_SYSTEM_CRMD and crm_msg_crmd
499 
500  xmlNode *novote = create_request(CRM_OP_NOVOTE, NULL, vote->from,
502 
503  crm_xml_add(novote, F_CRM_ELECTION_OWNER, vote->election_owner);
504  crm_xml_add_int(novote, F_CRM_ELECTION_ID, vote->election_id);
505 
506  send_cluster_message(peer, crm_msg_crmd, novote, TRUE);
507  free_xml(novote);
508 }
509 
525 enum election_result
526 election_count_vote(election_t *e, xmlNode *message, bool can_win)
527 {
528  int log_level = LOG_INFO;
529  gboolean done = FALSE;
530  gboolean we_lose = FALSE;
531  const char *reason = "unknown";
532  bool we_are_owner = FALSE;
533  crm_node_t *our_node = NULL, *your_node = NULL;
534  time_t tm_now = time(NULL);
535  struct vote vote;
536 
537  CRM_CHECK(message != NULL, return election_error);
538  if (parse_election_message(e, message, &vote) == FALSE) {
539  return election_error;
540  }
541 
542  your_node = crm_get_peer(0, vote.from);
543  our_node = crm_get_peer(0, e->uname);
544  we_are_owner = (our_node != NULL)
545  && crm_str_eq(our_node->uuid, vote.election_owner, TRUE);
546 
547  if(can_win == FALSE) {
548  reason = "Not eligible";
549  we_lose = TRUE;
550 
551  } else if (our_node == NULL || crm_is_peer_active(our_node) == FALSE) {
552  reason = "We are not part of the cluster";
553  log_level = LOG_ERR;
554  we_lose = TRUE;
555 
556  } else if (we_are_owner && (vote.election_id != e->count)) {
557  log_level = LOG_TRACE;
558  reason = "Superseded";
559  done = TRUE;
560 
561  } else if (your_node == NULL || crm_is_peer_active(your_node) == FALSE) {
562  /* Possibly we cached the message in the FSA queue at a point that it wasn't */
563  reason = "Peer is not part of our cluster";
564  log_level = LOG_WARNING;
565  done = TRUE;
566 
567  } else if (crm_str_eq(vote.op, CRM_OP_NOVOTE, TRUE)
568  || crm_str_eq(vote.from, e->uname, TRUE)) {
569  /* Receiving our own broadcast vote, or a no-vote from peer, is a vote
570  * for us to win
571  */
572  if (!we_are_owner) {
573  crm_warn("Cannot count %s round %d %s from %s because we are not election owner (%s)",
574  e->name, vote.election_id, vote.op, vote.from,
575  vote.election_owner);
576  return election_error;
577  }
578  if (e->state != election_in_progress) {
579  // Should only happen if we already lost
580  crm_debug("Not counting %s round %d %s from %s because no election in progress",
581  e->name, vote.election_id, vote.op, vote.from);
582  return e->state;
583  }
584  record_vote(e, &vote);
585  reason = "Recorded";
586  done = TRUE;
587 
588  } else {
589  // A peer vote requires a comparison to determine which node is better
590  int age_result = crm_compare_age(vote.age);
591  int version_result = compare_version(vote.version, CRM_FEATURE_SET);
592 
593  if (version_result < 0) {
594  reason = "Version";
595  we_lose = TRUE;
596 
597  } else if (version_result > 0) {
598  reason = "Version";
599 
600  } else if (age_result < 0) {
601  reason = "Uptime";
602  we_lose = TRUE;
603 
604  } else if (age_result > 0) {
605  reason = "Uptime";
606 
607  } else if (strcasecmp(e->uname, vote.from) > 0) {
608  reason = "Host name";
609  we_lose = TRUE;
610 
611  } else {
612  reason = "Host name";
613  }
614  }
615 
616  if (e->expires < tm_now) {
617  e->election_wins = 0;
618  e->expires = tm_now + STORM_INTERVAL;
619 
620  } else if (done == FALSE && we_lose == FALSE) {
621  int peers = 1 + g_hash_table_size(crm_peer_cache);
622 
623  /* If every node has to vote down every other node, thats N*(N-1) total elections
624  * Allow some leeway before _really_ complaining
625  */
626  e->election_wins++;
627  if (e->election_wins > (peers * peers)) {
628  crm_warn("%s election storm detected: %d wins in %d seconds",
629  e->name, e->election_wins, STORM_INTERVAL);
630  e->election_wins = 0;
631  e->expires = tm_now + STORM_INTERVAL;
632  if (e->wrote_blackbox == FALSE) {
633  /* It's questionable whether a black box (from every node in the
634  * cluster) would be truly helpful in diagnosing an election
635  * storm. It's also highly doubtful a production environment
636  * would get multiple election storms from distinct causes, so
637  * saving one blackbox per process lifetime should be
638  * sufficient. Alternatives would be to save a timestamp of the
639  * last blackbox write instead of a boolean, and write a new one
640  * if some amount of time has passed; or to save a storm count,
641  * write a blackbox on every Nth occurrence.
642  */
643  crm_write_blackbox(0, NULL);
644  e->wrote_blackbox = TRUE;
645  }
646  }
647  }
648 
649  if (done) {
650  do_crm_log(log_level + 1,
651  "Processed %s round %d %s (current round %d) from %s (%s)",
652  e->name, vote.election_id, vote.op, e->count, vote.from,
653  reason);
654  return e->state;
655 
656  } else if (we_lose == FALSE) {
657  /* We track the time of the last election loss to implement an election
658  * dampening period, reducing the likelihood of an election storm. If
659  * this node has lost within the dampening period, don't start a new
660  * election, even if we win against a peer's vote -- the peer we lost to
661  * should win again.
662  *
663  * @TODO This has a problem case: if an election winner immediately
664  * leaves the cluster, and a new election is immediately called, all
665  * nodes could lose, with no new winner elected. The ideal solution
666  * would be to tie the election structure with the peer caches, which
667  * would allow us to clear the dampening when the previous winner
668  * leaves (and would allow other improvements as well).
669  */
670  if ((e->last_election_loss == 0)
671  || ((tm_now - e->last_election_loss) > (time_t) LOSS_DAMPEN)) {
672 
673  do_crm_log(log_level, "%s round %d (owner node ID %s) pass: %s from %s (%s)",
674  e->name, vote.election_id, vote.election_owner, vote.op,
675  vote.from, reason);
676 
677  e->last_election_loss = 0;
679 
680  /* Start a new election by voting down this, and other, peers */
681  e->state = election_start;
682  return e->state;
683  } else {
684  char *loss_time = ctime(&e->last_election_loss);
685 
686  if (loss_time) {
687  // Show only HH:MM:SS
688  loss_time += 11;
689  loss_time[8] = '\0';
690  }
691  crm_info("Ignoring %s round %d (owner node ID %s) pass vs %s because we lost less than %ds ago at %s",
692  e->name, vote.election_id, vote.election_owner, vote.from,
693  LOSS_DAMPEN, (loss_time? loss_time : "unknown"));
694  }
695  }
696 
697  e->last_election_loss = tm_now;
698 
699  do_crm_log(log_level, "%s round %d (owner node ID %s) lost: %s from %s (%s)",
700  e->name, vote.election_id, vote.election_owner, vote.op,
701  vote.from, reason);
702 
703  election_reset(e);
704  send_no_vote(your_node, &vote);
705  e->state = election_lost;
706  return e->state;
707 }
708 
714 void
716 {
717  e->last_election_loss = 0;
718 }
#define F_CRM_TASK
Definition: msg_xml.h:52
#define LOG_TRACE
Definition: logging.h:36
bool election_check(election_t *e)
Check whether local node has won an election.
Definition: election.c:336
#define CRM_CHECK(expr, failure_action)
Definition: logging.h:233
char uname[MAX_NAME]
Definition: internal.h:85
void crm_write_blackbox(int nsig, struct qb_log_callsite *callsite)
Definition: logging.c:394
A dumping ground.
enum election_result election_count_vote(election_t *e, xmlNode *vote, bool can_win)
Process an election message (vote or no-vote) from a peer.
Definition: election.c:526
void mainloop_timer_start(mainloop_timer_t *t)
Definition: mainloop.c:1267
guint mainloop_timer_set_period(mainloop_timer_t *t, guint period_ms)
Definition: mainloop.c:1287
void mainloop_timer_del(mainloop_timer_t *t)
Definition: mainloop.c:1324
void election_remove(election_t *e, const char *uname)
Disregard any previous vote by specified peer.
Definition: election.c:123
gboolean crm_is_peer_active(const crm_node_t *node)
Definition: membership.c:272
void election_fini(election_t *e)
Free an election object.
Definition: election.c:159
char * uuid
Definition: cluster.h:58
#define STORM_INTERVAL
Definition: election.c:21
const char * crm_xml_add_int(xmlNode *node, const char *name, int value)
Create an XML attribute with specified name and integer value.
Definition: nvpair.c:424
#define CRM_FEATURE_SET
Definition: crm.h:54
#define F_CRM_HOST_FROM
Definition: msg_xml.h:57
struct mainloop_timer_s mainloop_timer_t
Definition: mainloop.h:34
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
Definition: nvpair.c:316
crm_node_t * crm_get_peer(unsigned int id, const char *uname)
Definition: membership.c:653
#define CRM_OP_NOVOTE
Definition: crm.h:134
guint crm_active_peers(void)
Definition: membership.c:365
int crm_element_value_int(const xmlNode *data, const char *name, int *dest)
Retrieve the integer value of an XML attribute.
Definition: nvpair.c:558
void mainloop_timer_stop(mainloop_timer_t *t)
Definition: mainloop.c:1277
#define F_CRM_ELECTION_AGE_S
Definition: msg_xml.h:65
Wrappers for and extensions to glib mainloop.
void election_vote(election_t *e)
Start a new election by offering local node&#39;s candidacy.
Definition: election.c:283
struct election_s election_t
Definition: election.h:56
#define crm_warn(fmt, args...)
Definition: logging.h:364
int rc
Definition: pcmk_fence.c:34
#define crm_debug(fmt, args...)
Definition: logging.h:368
election_result
Definition: election.h:59
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
Definition: nvpair.c:522
int crm_element_value_timeval(const xmlNode *data, const char *name_sec, const char *name_usec, struct timeval *dest)
Retrieve the value of XML second/microsecond attributes as time.
Definition: nvpair.c:678
#define crm_trace(fmt, args...)
Definition: logging.h:369
#define do_crm_log(level, fmt, args...)
Log a message.
Definition: logging.h:150
Wrappers for and extensions to libxml2.
void free_xml(xmlNode *child)
Definition: xml.c:2136
gboolean crm_str_eq(const char *a, const char *b, gboolean use_case)
Definition: strings.c:326
const char * crm_xml_add_timeval(xmlNode *xml, const char *name_sec, const char *name_usec, const struct timeval *value)
Create XML attributes for seconds and microseconds.
Definition: nvpair.c:498
#define CRM_SYSTEM_CRMD
Definition: crm.h:102
enum election_result election_state(election_t *e)
Definition: election.c:58
void election_clear_dampening(election_t *e)
Reset any election dampening currently in effect.
Definition: election.c:715
#define CRM_OP_VOTE
Definition: crm.h:133
election_t * election_init(const char *name, const char *uname, guint period_ms, GSourceFunc cb)
Create a new election object.
Definition: election.c:83
#define F_CRM_ELECTION_AGE_US
Definition: msg_xml.h:66
#define crm_perror(level, fmt, args...)
Send a system error message to both the log and stderr.
Definition: logging.h:314
#define crm_err(fmt, args...)
Definition: logging.h:363
#define CRM_ASSERT(expr)
Definition: results.h:42
void election_timeout_stop(election_t *e)
Stop an election&#39;s timer, if running.
Definition: election.c:185
void election_reset(election_t *e)
Stop election timer and disregard all votes.
Definition: election.c:137
int compare_version(const char *version1, const char *version2)
Definition: utils.c:227
mainloop_timer_t * mainloop_timer_add(const char *name, guint period_ms, bool repeat, GSourceFunc cb, void *userdata)
Definition: mainloop.c:1303
char * uname
Definition: cluster.h:57
void election_timeout_set_period(election_t *e, guint period_ms)
Change an election&#39;s timeout (restarting timer if running)
Definition: election.c:199
#define F_CRM_ELECTION_ID
Definition: msg_xml.h:64
char * name
Definition: pcmk_fence.c:30
char * crm_strdup_printf(char const *format,...) __attribute__((__format__(__printf__
unsigned int timeout
Definition: pcmk_fence.c:31
gboolean send_cluster_message(crm_node_t *node, enum crm_ais_msg_types service, xmlNode *data, gboolean ordered)
Definition: cluster.c:104
#define create_request(task, xml_data, host_to, sys_to, sys_from, uuid_from)
Definition: ipc.h:32
GHashTable * crm_peer_cache
Definition: membership.c:34
#define crm_info(fmt, args...)
Definition: logging.h:366
#define F_CRM_VERSION
Definition: msg_xml.h:59
uint32_t version
Definition: remote.c:147
#define LOSS_DAMPEN
Definition: election.c:392
Functions for conducting elections.
#define F_CRM_ELECTION_OWNER
Definition: msg_xml.h:67