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