pacemaker  2.0.1-57cc9c14bf
Scalable High-Availability cluster resource manager
clone.c
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2018 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 <crm/pengine/rules.h>
11 #include <crm/pengine/status.h>
12 #include <crm/pengine/internal.h>
13 #include <unpack.h>
14 #include <pe_status_private.h>
15 #include <crm/msg_xml.h>
16 
17 #define VARIANT_CLONE 1
18 #include "./variant.h"
19 
20 void
21 pe__force_anon(const char *standard, pe_resource_t *rsc, const char *rid,
22  pe_working_set_t *data_set)
23 {
24  if (pe_rsc_is_clone(rsc)) {
25  clone_variant_data_t *clone_data = NULL;
26 
27  get_clone_variant_data(clone_data, rsc);
28 
29  pe_warn("Ignoring " XML_RSC_ATTR_UNIQUE " for %s because %s resources "
30  "such as %s can be used only as anonymous clones",
31  rsc->id, standard, rid);
32 
33  clone_data->clone_node_max = 1;
34  clone_data->clone_max = QB_MIN(clone_data->clone_max,
35  g_list_length(data_set->nodes));
36  }
37 }
38 
39 resource_t *
40 find_clone_instance(resource_t * rsc, const char *sub_id, pe_working_set_t * data_set)
41 {
42  char *child_id = NULL;
43  resource_t *child = NULL;
44  const char *child_base = NULL;
45  clone_variant_data_t *clone_data = NULL;
46 
47  get_clone_variant_data(clone_data, rsc);
48 
49  child_base = ID(clone_data->xml_obj_child);
50  child_id = crm_concat(child_base, sub_id, ':');
51  child = pe_find_resource(rsc->children, child_id);
52 
53  free(child_id);
54  return child;
55 }
56 
59 {
60  gboolean as_orphan = FALSE;
61  char *inc_num = NULL;
62  char *inc_max = NULL;
63  resource_t *child_rsc = NULL;
64  xmlNode *child_copy = NULL;
65  clone_variant_data_t *clone_data = NULL;
66 
67  get_clone_variant_data(clone_data, rsc);
68 
69  CRM_CHECK(clone_data->xml_obj_child != NULL, return FALSE);
70 
71  if (clone_data->total_clones >= clone_data->clone_max) {
72  // If we've already used all available instances, this is an orphan
73  as_orphan = TRUE;
74  }
75 
76  // Allocate instance numbers in numerical order (starting at 0)
77  inc_num = crm_itoa(clone_data->total_clones);
78  inc_max = crm_itoa(clone_data->clone_max);
79 
80  child_copy = copy_xml(clone_data->xml_obj_child);
81 
82  crm_xml_add(child_copy, XML_RSC_ATTR_INCARNATION, inc_num);
83 
84  if (common_unpack(child_copy, &child_rsc, rsc, data_set) == FALSE) {
85  pe_err("Failed unpacking resource %s", crm_element_value(child_copy, XML_ATTR_ID));
86  child_rsc = NULL;
87  goto bail;
88  }
89 /* child_rsc->globally_unique = rsc->globally_unique; */
90 
91  CRM_ASSERT(child_rsc);
92  clone_data->total_clones += 1;
93  pe_rsc_trace(child_rsc, "Setting clone attributes for: %s", child_rsc->id);
94  rsc->children = g_list_append(rsc->children, child_rsc);
95  if (as_orphan) {
96  set_bit_recursive(child_rsc, pe_rsc_orphan);
97  }
98 
99  add_hash_param(child_rsc->meta, XML_RSC_ATTR_INCARNATION_MAX, inc_max);
100 
101  print_resource(LOG_TRACE, "Added ", child_rsc, FALSE);
102 
103  bail:
104  free(inc_num);
105  free(inc_max);
106 
107  return child_rsc;
108 }
109 
110 gboolean
112 {
113  int lpc = 0;
114  xmlNode *a_child = NULL;
115  xmlNode *xml_obj = rsc->xml;
116  clone_variant_data_t *clone_data = NULL;
117 
118  const char *ordered = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_ORDERED);
119  const char *interleave = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_INTERLEAVE);
120  const char *max_clones = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_INCARNATION_MAX);
121  const char *max_clones_node = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_INCARNATION_NODEMAX);
122 
123  pe_rsc_trace(rsc, "Processing resource %s...", rsc->id);
124 
125  clone_data = calloc(1, sizeof(clone_variant_data_t));
126  rsc->variant_opaque = clone_data;
127 
128  if (is_set(rsc->flags, pe_rsc_promotable)) {
129  const char *promoted_max = NULL;
130  const char *promoted_node_max = NULL;
131 
132  promoted_max = g_hash_table_lookup(rsc->meta,
134  if (promoted_max == NULL) {
135  // @COMPAT deprecated since 2.0.0
136  promoted_max = g_hash_table_lookup(rsc->meta,
138  }
139 
140  promoted_node_max = g_hash_table_lookup(rsc->meta,
142  if (promoted_node_max == NULL) {
143  // @COMPAT deprecated since 2.0.0
144  promoted_node_max = g_hash_table_lookup(rsc->meta,
146  }
147 
148  clone_data->promoted_max = crm_parse_int(promoted_max, "1");
149  clone_data->promoted_node_max = crm_parse_int(promoted_node_max, "1");
150  }
151 
152  // Implied by calloc()
153  /* clone_data->xml_obj_child = NULL; */
154 
155  clone_data->clone_node_max = crm_parse_int(max_clones_node, "1");
156 
157  if (max_clones) {
158  clone_data->clone_max = crm_parse_int(max_clones, "1");
159 
160  } else if (g_list_length(data_set->nodes) > 0) {
161  clone_data->clone_max = g_list_length(data_set->nodes);
162 
163  } else {
164  clone_data->clone_max = 1; /* Handy during crm_verify */
165  }
166 
167  clone_data->interleave = crm_is_true(interleave);
168  clone_data->ordered = crm_is_true(ordered);
169 
170  if ((rsc->flags & pe_rsc_unique) == 0 && clone_data->clone_node_max > 1) {
171  crm_config_err("Anonymous clones (%s) may only support one copy per node", rsc->id);
172  clone_data->clone_node_max = 1;
173  }
174 
175  pe_rsc_trace(rsc, "Options for %s", rsc->id);
176  pe_rsc_trace(rsc, "\tClone max: %d", clone_data->clone_max);
177  pe_rsc_trace(rsc, "\tClone node max: %d", clone_data->clone_node_max);
178  pe_rsc_trace(rsc, "\tClone is unique: %s",
179  is_set(rsc->flags, pe_rsc_unique) ? "true" : "false");
180  pe_rsc_trace(rsc, "\tClone is promotable: %s",
181  is_set(rsc->flags, pe_rsc_promotable) ? "true" : "false");
182 
183  // Clones may contain a single group or primitive
184  for (a_child = __xml_first_child(xml_obj); a_child != NULL;
185  a_child = __xml_next_element(a_child)) {
186 
187  if (crm_str_eq((const char *)a_child->name, XML_CIB_TAG_RESOURCE, TRUE)
188  || crm_str_eq((const char *)a_child->name, XML_CIB_TAG_GROUP, TRUE)) {
189  clone_data->xml_obj_child = a_child;
190  break;
191  }
192  }
193 
194  if (clone_data->xml_obj_child == NULL) {
195  crm_config_err("%s has nothing to clone", rsc->id);
196  return FALSE;
197  }
198 
199  /*
200  * Make clones ever so slightly sticky by default
201  *
202  * This helps ensure clone instances are not shuffled around the cluster
203  * for no benefit in situations when pre-allocation is not appropriate
204  */
205  if (g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_STICKINESS) == NULL) {
207  }
208 
209  /* This ensures that the globally-unique value always exists for children to
210  * inherit when being unpacked, as well as in resource agents' environment.
211  */
214 
215  if (clone_data->clone_max <= 0) {
216  /* Create one child instance so that unpack_find_resource() will hook up
217  * any orphans up to the parent correctly.
218  */
219  if (pe__create_clone_child(rsc, data_set) == NULL) {
220  return FALSE;
221  }
222 
223  } else {
224  // Create a child instance for each available instance number
225  for (lpc = 0; lpc < clone_data->clone_max; lpc++) {
226  if (pe__create_clone_child(rsc, data_set) == NULL) {
227  return FALSE;
228  }
229  }
230  }
231 
232  pe_rsc_trace(rsc, "Added %d children to resource %s...", clone_data->clone_max, rsc->id);
233  return TRUE;
234 }
235 
236 gboolean
237 clone_active(resource_t * rsc, gboolean all)
238 {
239  GListPtr gIter = rsc->children;
240 
241  for (; gIter != NULL; gIter = gIter->next) {
242  resource_t *child_rsc = (resource_t *) gIter->data;
243  gboolean child_active = child_rsc->fns->active(child_rsc, all);
244 
245  if (all == FALSE && child_active) {
246  return TRUE;
247  } else if (all && child_active == FALSE) {
248  return FALSE;
249  }
250  }
251 
252  if (all) {
253  return TRUE;
254  } else {
255  return FALSE;
256  }
257 }
258 
259 static void
260 short_print(char *list, const char *prefix, const char *type, const char *suffix, long options, void *print_data)
261 {
262  if(suffix == NULL) {
263  suffix = "";
264  }
265 
266  if (list) {
267  if (options & pe_print_html) {
268  status_print("<li>");
269  }
270  status_print("%s%s: [%s ]%s", prefix, type, list, suffix);
271 
272  if (options & pe_print_html) {
273  status_print("</li>\n");
274 
275  } else if (options & pe_print_suppres_nl) {
276  /* nothing */
277  } else if ((options & pe_print_printf) || (options & pe_print_ncurses)) {
278  status_print("\n");
279  }
280 
281  }
282 }
283 
284 static const char *
285 configured_role_str(resource_t * rsc)
286 {
287  const char *target_role = g_hash_table_lookup(rsc->meta,
289 
290  if ((target_role == NULL) && rsc->children && rsc->children->data) {
291  target_role = g_hash_table_lookup(((resource_t*)rsc->children->data)->meta,
293  }
294  return target_role;
295 }
296 
297 static enum rsc_role_e
298 configured_role(resource_t * rsc)
299 {
300  const char *target_role = configured_role_str(rsc);
301 
302  if (target_role) {
303  return text2role(target_role);
304  }
305  return RSC_ROLE_UNKNOWN;
306 }
307 
308 static void
309 clone_print_xml(resource_t * rsc, const char *pre_text, long options, void *print_data)
310 {
311  char *child_text = crm_concat(pre_text, " ", ' ');
312  const char *target_role = configured_role_str(rsc);
313  GListPtr gIter = rsc->children;
314 
315  status_print("%s<clone ", pre_text);
316  status_print("id=\"%s\" ", rsc->id);
317  status_print("multi_state=\"%s\" ", is_set(rsc->flags, pe_rsc_promotable)? "true" : "false");
318  status_print("unique=\"%s\" ", is_set(rsc->flags, pe_rsc_unique) ? "true" : "false");
319  status_print("managed=\"%s\" ", is_set(rsc->flags, pe_rsc_managed) ? "true" : "false");
320  status_print("failed=\"%s\" ", is_set(rsc->flags, pe_rsc_failed) ? "true" : "false");
321  status_print("failure_ignored=\"%s\" ",
322  is_set(rsc->flags, pe_rsc_failure_ignored) ? "true" : "false");
323  if (target_role) {
324  status_print("target_role=\"%s\" ", target_role);
325  }
326  status_print(">\n");
327 
328  for (; gIter != NULL; gIter = gIter->next) {
329  resource_t *child_rsc = (resource_t *) gIter->data;
330 
331  child_rsc->fns->print(child_rsc, child_text, options, print_data);
332  }
333 
334  status_print("%s</clone>\n", pre_text);
335  free(child_text);
336 }
337 
338 bool is_set_recursive(resource_t * rsc, long long flag, bool any)
339 {
340  GListPtr gIter;
341  bool all = !any;
342 
343  if(is_set(rsc->flags, flag)) {
344  if(any) {
345  return TRUE;
346  }
347  } else if(all) {
348  return FALSE;
349  }
350 
351  for (gIter = rsc->children; gIter != NULL; gIter = gIter->next) {
352  if(is_set_recursive(gIter->data, flag, any)) {
353  if(any) {
354  return TRUE;
355  }
356 
357  } else if(all) {
358  return FALSE;
359  }
360  }
361 
362  if(all) {
363  return TRUE;
364  }
365  return FALSE;
366 }
367 
368 void
369 clone_print(resource_t * rsc, const char *pre_text, long options, void *print_data)
370 {
371  char *list_text = NULL;
372  char *child_text = NULL;
373  char *stopped_list = NULL;
374 
375  GListPtr master_list = NULL;
376  GListPtr started_list = NULL;
377  GListPtr gIter = rsc->children;
378 
379  clone_variant_data_t *clone_data = NULL;
380  int active_instances = 0;
381 
382  if (pre_text == NULL) {
383  pre_text = " ";
384  }
385 
386  if (options & pe_print_xml) {
387  clone_print_xml(rsc, pre_text, options, print_data);
388  return;
389  }
390 
391  get_clone_variant_data(clone_data, rsc);
392 
393  child_text = crm_concat(pre_text, " ", ' ');
394 
395  status_print("%sClone Set: %s [%s]%s%s%s",
396  pre_text ? pre_text : "", rsc->id, ID(clone_data->xml_obj_child),
397  is_set(rsc->flags, pe_rsc_promotable) ? " (promotable)" : "",
398  is_set(rsc->flags, pe_rsc_unique) ? " (unique)" : "",
399  is_set(rsc->flags, pe_rsc_managed) ? "" : " (unmanaged)");
400 
401  if (options & pe_print_html) {
402  status_print("\n<ul>\n");
403 
404  } else if ((options & pe_print_log) == 0) {
405  status_print("\n");
406  }
407 
408  for (; gIter != NULL; gIter = gIter->next) {
409  gboolean print_full = FALSE;
410  resource_t *child_rsc = (resource_t *) gIter->data;
411  gboolean partially_active = child_rsc->fns->active(child_rsc, FALSE);
412 
413  if (options & pe_print_clone_details) {
414  print_full = TRUE;
415  }
416 
417  if (is_set(rsc->flags, pe_rsc_unique)) {
418  // Print individual instance when unique (except stopped orphans)
419  if (partially_active || is_not_set(rsc->flags, pe_rsc_orphan)) {
420  print_full = TRUE;
421  }
422 
423  // Everything else in this block is for anonymous clones
424 
425  } else if (is_set(options, pe_print_pending)
426  && (child_rsc->pending_task != NULL)
427  && strcmp(child_rsc->pending_task, "probe")) {
428  // Print individual instance when non-probe action is pending
429  print_full = TRUE;
430 
431  } else if (partially_active == FALSE) {
432  // List stopped instances when requested (except orphans)
433  if (is_not_set(child_rsc->flags, pe_rsc_orphan)
434  && is_not_set(options, pe_print_clone_active)) {
435  stopped_list = add_list_element(stopped_list, child_rsc->id);
436  }
437 
438  } else if (is_set_recursive(child_rsc, pe_rsc_orphan, TRUE)
439  || is_set_recursive(child_rsc, pe_rsc_managed, FALSE) == FALSE
440  || is_set_recursive(child_rsc, pe_rsc_failed, TRUE)) {
441 
442  // Print individual instance when active orphaned/unmanaged/failed
443  print_full = TRUE;
444 
445  } else if (child_rsc->fns->active(child_rsc, TRUE)) {
446  // Instance of fully active anonymous clone
447 
448  node_t *location = child_rsc->fns->location(child_rsc, NULL, TRUE);
449 
450  if (location) {
451  // Instance is active on a single node
452 
453  enum rsc_role_e a_role = child_rsc->fns->state(child_rsc, TRUE);
454 
455  if (location->details->online == FALSE && location->details->unclean) {
456  print_full = TRUE;
457 
458  } else if (a_role > RSC_ROLE_SLAVE) {
459  master_list = g_list_append(master_list, location);
460 
461  } else {
462  started_list = g_list_append(started_list, location);
463  }
464 
465  } else {
466  /* uncolocated group - bleh */
467  print_full = TRUE;
468  }
469 
470  } else {
471  // Instance of partially active anonymous clone
472  print_full = TRUE;
473  }
474 
475  if (print_full) {
476  if (options & pe_print_html) {
477  status_print("<li>\n");
478  }
479  child_rsc->fns->print(child_rsc, child_text, options, print_data);
480  if (options & pe_print_html) {
481  status_print("</li>\n");
482  }
483  }
484  }
485 
486  /* Masters */
487  master_list = g_list_sort(master_list, sort_node_uname);
488  for (gIter = master_list; gIter; gIter = gIter->next) {
489  node_t *host = gIter->data;
490 
491  list_text = add_list_element(list_text, host->details->uname);
492  active_instances++;
493  }
494 
495  short_print(list_text, child_text, "Masters", NULL, options, print_data);
496  g_list_free(master_list);
497  free(list_text);
498  list_text = NULL;
499 
500  /* Started/Slaves */
501  started_list = g_list_sort(started_list, sort_node_uname);
502  for (gIter = started_list; gIter; gIter = gIter->next) {
503  node_t *host = gIter->data;
504 
505  list_text = add_list_element(list_text, host->details->uname);
506  active_instances++;
507  }
508 
509  if (is_set(rsc->flags, pe_rsc_promotable)) {
510  enum rsc_role_e role = configured_role(rsc);
511 
512  if(role == RSC_ROLE_SLAVE) {
513  short_print(list_text, child_text, "Slaves (target-role)", NULL, options, print_data);
514  } else {
515  short_print(list_text, child_text, "Slaves", NULL, options, print_data);
516  }
517 
518  } else {
519  short_print(list_text, child_text, "Started", NULL, options, print_data);
520  }
521 
522  g_list_free(started_list);
523  free(list_text);
524  list_text = NULL;
525 
526  if (is_not_set(options, pe_print_clone_active)) {
527  const char *state = "Stopped";
528  enum rsc_role_e role = configured_role(rsc);
529 
530  if (role == RSC_ROLE_STOPPED) {
531  state = "Stopped (disabled)";
532  }
533 
534  if (is_not_set(rsc->flags, pe_rsc_unique)
535  && (clone_data->clone_max > active_instances)) {
536 
537  GListPtr nIter;
538  GListPtr list = g_hash_table_get_values(rsc->allowed_nodes);
539 
540  /* Custom stopped list for non-unique clones */
541  free(stopped_list); stopped_list = NULL;
542 
543  if (g_list_length(list) == 0) {
544  /* Clusters with symmetrical=false haven't calculated allowed_nodes yet
545  * If we've not probed for them yet, the Stopped list will be empty
546  */
547  list = g_hash_table_get_values(rsc->known_on);
548  }
549 
550  list = g_list_sort(list, sort_node_uname);
551  for (nIter = list; nIter != NULL; nIter = nIter->next) {
552  node_t *node = (node_t *)nIter->data;
553 
554  if (pe_find_node(rsc->running_on, node->details->uname) == NULL) {
555  stopped_list = add_list_element(stopped_list, node->details->uname);
556  }
557  }
558  g_list_free(list);
559  }
560 
561  short_print(stopped_list, child_text, state, NULL, options, print_data);
562  free(stopped_list);
563  }
564 
565  if (options & pe_print_html) {
566  status_print("</ul>\n");
567  }
568 
569  free(child_text);
570 }
571 
572 void
574 {
575  clone_variant_data_t *clone_data = NULL;
576 
577  get_clone_variant_data(clone_data, rsc);
578 
579  pe_rsc_trace(rsc, "Freeing %s", rsc->id);
580 
581  for (GListPtr gIter = rsc->children; gIter != NULL; gIter = gIter->next) {
582  resource_t *child_rsc = (resource_t *) gIter->data;
583 
584  CRM_ASSERT(child_rsc);
585  pe_rsc_trace(child_rsc, "Freeing child %s", child_rsc->id);
586  free_xml(child_rsc->xml);
587  child_rsc->xml = NULL;
588  /* There could be a saved unexpanded xml */
589  free_xml(child_rsc->orig_xml);
590  child_rsc->orig_xml = NULL;
591  child_rsc->fns->free(child_rsc);
592  }
593 
594  g_list_free(rsc->children);
595 
596  if (clone_data) {
597  CRM_ASSERT(clone_data->demote_notify == NULL);
598  CRM_ASSERT(clone_data->stop_notify == NULL);
599  CRM_ASSERT(clone_data->start_notify == NULL);
600  CRM_ASSERT(clone_data->promote_notify == NULL);
601  }
602 
603  common_free(rsc);
604 }
605 
606 enum rsc_role_e
607 clone_resource_state(const resource_t * rsc, gboolean current)
608 {
609  enum rsc_role_e clone_role = RSC_ROLE_UNKNOWN;
610  GListPtr gIter = rsc->children;
611 
612  for (; gIter != NULL; gIter = gIter->next) {
613  resource_t *child_rsc = (resource_t *) gIter->data;
614  enum rsc_role_e a_role = child_rsc->fns->state(child_rsc, current);
615 
616  if (a_role > clone_role) {
617  clone_role = a_role;
618  }
619  }
620 
621  pe_rsc_trace(rsc, "%s role: %s", rsc->id, role2text(clone_role));
622  return clone_role;
623 }
624 
632 bool
634  pe_working_set_t *data_set)
635 {
636  if (pe_rsc_is_clone(rsc)) {
637  clone_variant_data_t *clone_data = NULL;
638 
639  get_clone_variant_data(clone_data, rsc);
640  if (clone_data->clone_max == g_list_length(data_set->nodes)) {
641  return TRUE;
642  }
643  }
644  return FALSE;
645 }
#define LOG_TRACE
Definition: logging.h:35
#define CRM_CHECK(expr, failure_action)
Definition: logging.h:165
GListPtr nodes
Definition: status.h:108
xmlNode * orig_xml
Definition: status.h:262
GHashTable * known_on
Definition: status.h:305
gboolean clone_unpack(resource_t *rsc, pe_working_set_t *data_set)
Definition: clone.c:111
#define XML_BOOLEAN_FALSE
Definition: msg_xml.h:106
#define crm_config_err(fmt...)
Definition: crm_internal.h:177
xmlNode * xml
Definition: status.h:261
#define XML_RSC_ATTR_INCARNATION
Definition: msg_xml.h:184
#define pe_rsc_orphan
Definition: status.h:192
bool pe__is_universal_clone(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: clone.c:633
void pe__force_anon(const char *standard, pe_resource_t *rsc, const char *rid, pe_working_set_t *data_set)
Definition: clone.c:21
GHashTable * meta
Definition: status.h:311
gboolean common_unpack(xmlNode *xml_obj, resource_t **rsc, resource_t *parent, pe_working_set_t *data_set)
Definition: complex.c:358
void common_free(resource_t *rsc)
Definition: complex.c:758
resource_object_functions_t * fns
Definition: status.h:270
#define status_print(fmt, args...)
Definition: unpack.h:67
int crm_parse_int(const char *text, const char *default_text)
Parse an integer value from a string.
Definition: strings.c:107
AIS_Host host
Definition: internal.h:84
pe_node_t * pe_find_node(GListPtr node_list, const char *uname)
Definition: status.c:412
#define XML_RSC_ATTR_STICKINESS
Definition: msg_xml.h:197
void set_bit_recursive(resource_t *rsc, unsigned long long flag)
Definition: utils.c:2127
gboolean clone_active(resource_t *rsc, gboolean all)
Definition: clone.c:237
#define XML_RSC_ATTR_MASTER_NODEMAX
Definition: msg_xml.h:192
#define XML_RSC_ATTR_INCARNATION_MAX
Definition: msg_xml.h:185
char * pending_task
Definition: status.h:284
xmlNode * copy_xml(xmlNode *src_node)
Definition: xml.c:2145
const char * role2text(enum rsc_role_e role)
Definition: common.c:329
pe_node_t *(* location)(const pe_resource_t *, GList **, int)
Definition: complex.h:33
#define pe_warn(fmt...)
Definition: internal.h:19
void clone_free(resource_t *rsc)
Definition: clone.c:573
enum rsc_role_e clone_resource_state(const resource_t *rsc, gboolean current)
Definition: clone.c:607
char * add_list_element(char *list, const char *value)
Definition: strings.c:392
#define XML_ATTR_ID
Definition: msg_xml.h:94
#define XML_CIB_TAG_RESOURCE
Definition: msg_xml.h:172
#define XML_BOOLEAN_TRUE
Definition: msg_xml.h:105
#define pe_rsc_failed
Definition: status.h:209
struct pe_node_shared_s * details
Definition: status.h:188
GListPtr running_on
Definition: status.h:304
unsigned long long flags
Definition: status.h:286
const char * uname
Definition: status.h:154
#define XML_RSC_ATTR_ORDERED
Definition: msg_xml.h:182
void(* print)(pe_resource_t *, const char *, long, void *)
Definition: complex.h:30
#define XML_RSC_ATTR_INCARNATION_NODEMAX
Definition: msg_xml.h:187
pe_resource_t * pe__create_clone_child(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: clone.c:58
#define XML_RSC_ATTR_TARGET_ROLE
Definition: msg_xml.h:194
void(* free)(pe_resource_t *)
Definition: complex.h:34
void free_xml(xmlNode *child)
Definition: xml.c:2139
enum rsc_role_e text2role(const char *role)
Definition: common.c:350
gboolean crm_str_eq(const char *a, const char *b, gboolean use_case)
Definition: strings.c:204
const char * crm_element_value(const xmlNode *data, const char *name)
Definition: xml.c:4641
pe_resource_t * pe_find_resource(GListPtr rsc_list, const char *id_rh)
Definition: status.c:360
#define XML_RSC_ATTR_UNIQUE
Definition: msg_xml.h:195
void clone_print(resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: clone.c:369
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Definition: xml.c:1907
enum rsc_role_e(* state)(const pe_resource_t *, gboolean)
Definition: complex.h:32
#define XML_RSC_ATTR_MASTER_MAX
Definition: msg_xml.h:191
#define pe_rsc_unique
Definition: status.h:198
#define XML_RSC_ATTR_PROMOTED_MAX
Definition: msg_xml.h:189
Cluster status and scheduling.
GListPtr children
Definition: status.h:315
void add_hash_param(GHashTable *hash, const char *name, const char *value)
Definition: common.c:406
void * variant_opaque
Definition: status.h:269
#define CRM_ASSERT(expr)
Definition: results.h:20
#define pe_rsc_promotable
Definition: status.h:200
#define pe_rsc_failure_ignored
Definition: status.h:217
resource_t * find_clone_instance(resource_t *rsc, const char *sub_id, pe_working_set_t *data_set)
Definition: clone.c:40
bool is_set_recursive(resource_t *rsc, long long flag, bool any)
Definition: clone.c:338
#define pe_rsc_managed
Definition: status.h:193
rsc_role_e
Definition: common.h:86
#define XML_RSC_ATTR_PROMOTED_NODEMAX
Definition: msg_xml.h:190
gboolean crm_is_true(const char *s)
Definition: strings.c:156
#define XML_CIB_TAG_GROUP
Definition: msg_xml.h:173
#define pe_rsc_trace(rsc, fmt, args...)
Definition: internal.h:16
#define ID(x)
Definition: msg_xml.h:412
#define pe_err(fmt...)
Definition: internal.h:18
void print_resource(int log_level, const char *pre_text, resource_t *rsc, gboolean details)
Definition: utils.c:1295
#define XML_RSC_ATTR_INTERLEAVE
Definition: msg_xml.h:183
gint sort_node_uname(gconstpointer a, gconstpointer b)
Definition: utils.c:215
gboolean unclean
Definition: status.h:162
GList * GListPtr
Definition: crm.h:190
gboolean online
Definition: status.h:158
enum crm_ais_msg_types type
Definition: internal.h:83
gboolean(* active)(pe_resource_t *, gboolean)
Definition: complex.h:31
char * id
Definition: status.h:259
GHashTable * allowed_nodes
Definition: status.h:306