pacemaker  1.1.14-70404b0
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 (C) 2004 Andrew Beekhof <andrew@beekhof.net>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #include <crm_internal.h>
20 
21 #include <crm/pengine/rules.h>
22 #include <crm/pengine/status.h>
23 #include <crm/pengine/internal.h>
24 #include <unpack.h>
25 #include <crm/msg_xml.h>
26 
27 #define VARIANT_CLONE 1
28 #include "./variant.h"
29 
30 void clone_create_notifications(resource_t * rsc, action_t * action, action_t * action_complete,
31  pe_working_set_t * data_set);
32 void force_non_unique_clone(resource_t * rsc, const char *rid, pe_working_set_t * data_set);
33 resource_t *create_child_clone(resource_t * rsc, int sub_id, pe_working_set_t * data_set);
34 
35 static void
36 mark_as_orphan(resource_t * rsc)
37 {
38  GListPtr gIter = rsc->children;
39 
41 
42  for (; gIter != NULL; gIter = gIter->next) {
43  resource_t *child = (resource_t *) gIter->data;
44 
45  mark_as_orphan(child);
46  }
47 }
48 
49 void
50 force_non_unique_clone(resource_t * rsc, const char *rid, pe_working_set_t * data_set)
51 {
52  if (rsc->variant == pe_clone || rsc->variant == pe_master) {
53  clone_variant_data_t *clone_data = NULL;
54 
55  get_clone_variant_data(clone_data, rsc);
56 
57  crm_config_warn("Clones %s contains non-OCF resource %s and so "
58  "can only be used as an anonymous clone. "
59  "Set the " XML_RSC_ATTR_UNIQUE " meta attribute to false", rsc->id, rid);
60 
61  clone_data->clone_node_max = 1;
62  clone_data->clone_max = g_list_length(data_set->nodes);
64  }
65 }
66 
67 resource_t *
68 find_clone_instance(resource_t * rsc, const char *sub_id, pe_working_set_t * data_set)
69 {
70  char *child_id = NULL;
71  resource_t *child = NULL;
72  const char *child_base = NULL;
73  clone_variant_data_t *clone_data = NULL;
74 
75  get_clone_variant_data(clone_data, rsc);
76 
77  child_base = ID(clone_data->xml_obj_child);
78  child_id = crm_concat(child_base, sub_id, ':');
79  child = pe_find_resource(rsc->children, child_id);
80 
81  free(child_id);
82  return child;
83 }
84 
85 resource_t *
86 create_child_clone(resource_t * rsc, int sub_id, pe_working_set_t * data_set)
87 {
88  gboolean as_orphan = FALSE;
89  char *inc_num = NULL;
90  char *inc_max = NULL;
91  resource_t *child_rsc = NULL;
92  xmlNode *child_copy = NULL;
93  clone_variant_data_t *clone_data = NULL;
94 
95  get_clone_variant_data(clone_data, rsc);
96 
97  CRM_CHECK(clone_data->xml_obj_child != NULL, return FALSE);
98 
99  if (sub_id < 0) {
100  as_orphan = TRUE;
101  sub_id = clone_data->total_clones;
102  }
103  inc_num = crm_itoa(sub_id);
104  inc_max = crm_itoa(clone_data->clone_max);
105 
106  child_copy = copy_xml(clone_data->xml_obj_child);
107 
108  crm_xml_add(child_copy, XML_RSC_ATTR_INCARNATION, inc_num);
109 
110  if (common_unpack(child_copy, &child_rsc, rsc, data_set) == FALSE) {
111  pe_err("Failed unpacking resource %s", crm_element_value(child_copy, XML_ATTR_ID));
112  child_rsc = NULL;
113  goto bail;
114  }
115 /* child_rsc->globally_unique = rsc->globally_unique; */
116 
117  CRM_ASSERT(child_rsc);
118  clone_data->total_clones += 1;
119  pe_rsc_trace(child_rsc, "Setting clone attributes for: %s", child_rsc->id);
120  rsc->children = g_list_append(rsc->children, child_rsc);
121  if (as_orphan) {
122  mark_as_orphan(child_rsc);
123  }
124 
125  add_hash_param(child_rsc->meta, XML_RSC_ATTR_INCARNATION_MAX, inc_max);
126 
127  print_resource(LOG_DEBUG_3, "Added ", child_rsc, FALSE);
128 
129  bail:
130  free(inc_num);
131  free(inc_max);
132 
133  return child_rsc;
134 }
135 
136 gboolean
138 {
139  const char *master_max = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_MASTER_MAX);
140  const char *master_node_max = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_MASTER_NODEMAX);
141 
142  g_hash_table_replace(rsc->meta, strdup("stateful"), strdup(XML_BOOLEAN_TRUE));
143  if (clone_unpack(rsc, data_set)) {
144  clone_variant_data_t *clone_data = NULL;
145 
146  get_clone_variant_data(clone_data, rsc);
147  clone_data->master_max = crm_parse_int(master_max, "1");
148  clone_data->master_node_max = crm_parse_int(master_node_max, "1");
149  return TRUE;
150  }
151  return FALSE;
152 }
153 
154 gboolean
156 {
157  int lpc = 0;
158  const char *type = NULL;
159  int num_xml_children = 0;
160  xmlNode *a_child = NULL;
161  xmlNode *xml_obj = rsc->xml;
162  clone_variant_data_t *clone_data = NULL;
163 
164  const char *ordered = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_ORDERED);
165  const char *interleave = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_INTERLEAVE);
166  const char *max_clones = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_INCARNATION_MAX);
167  const char *max_clones_node = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_INCARNATION_NODEMAX);
168 
169  pe_rsc_trace(rsc, "Processing resource %s...", rsc->id);
170 
171  clone_data = calloc(1, sizeof(clone_variant_data_t));
172  rsc->variant_opaque = clone_data;
173  clone_data->interleave = FALSE;
174  clone_data->ordered = FALSE;
175 
176  clone_data->active_clones = 0;
177  clone_data->xml_obj_child = NULL;
178  clone_data->clone_node_max = crm_parse_int(max_clones_node, "1");
179 
180  if (max_clones) {
181  clone_data->clone_max = crm_parse_int(max_clones, "1");
182 
183  } else if (g_list_length(data_set->nodes) > 0) {
184  clone_data->clone_max = g_list_length(data_set->nodes);
185 
186  } else {
187  clone_data->clone_max = 1; /* Handy during crm_verify */
188  }
189 
190  if (crm_is_true(interleave)) {
191  clone_data->interleave = TRUE;
192  }
193  if (crm_is_true(ordered)) {
194  clone_data->ordered = TRUE;
195  }
196  if ((rsc->flags & pe_rsc_unique) == 0 && clone_data->clone_node_max > 1) {
197  crm_config_err("Anonymous clones (%s) may only support one copy per node", rsc->id);
198  clone_data->clone_node_max = 1;
199  }
200 
201  pe_rsc_trace(rsc, "Options for %s", rsc->id);
202  pe_rsc_trace(rsc, "\tClone max: %d", clone_data->clone_max);
203  pe_rsc_trace(rsc, "\tClone node max: %d", clone_data->clone_node_max);
204  pe_rsc_trace(rsc, "\tClone is unique: %s",
205  is_set(rsc->flags, pe_rsc_unique) ? "true" : "false");
206 
207  clone_data->xml_obj_child = find_xml_node(xml_obj, XML_CIB_TAG_GROUP, FALSE);
208 
209  if (clone_data->xml_obj_child == NULL) {
210  clone_data->xml_obj_child = find_xml_node(xml_obj, XML_CIB_TAG_RESOURCE, TRUE);
211  for (a_child = __xml_first_child(xml_obj); a_child != NULL; a_child = __xml_next_element(a_child)) {
212  if (crm_str_eq((const char *)a_child->name, XML_CIB_TAG_RESOURCE, TRUE)) {
213  num_xml_children++;
214  }
215  }
216  }
217 
218  if (clone_data->xml_obj_child == NULL) {
219  crm_config_err("%s has nothing to clone", rsc->id);
220  return FALSE;
221  }
222 
223  for (a_child = __xml_first_child(xml_obj); a_child != NULL; a_child = __xml_next_element(a_child)) {
224  if (crm_str_eq((const char *)a_child->name, type, TRUE)) {
225  num_xml_children++;
226  }
227  }
228 
229  if (num_xml_children > 1) {
230  crm_config_err("%s has too many children. Only the first (%s) will be cloned.",
231  rsc->id, ID(clone_data->xml_obj_child));
232  }
233 
234  /*
235  * Make clones ever so slightly sticky by default
236  *
237  * This helps ensure clone instances are not shuffled around the cluster
238  * for no benefit in situations when pre-allocation is not appropriate
239  */
240  if (g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_STICKINESS) == NULL) {
242  }
243 
244  pe_rsc_trace(rsc, "\tClone is unique (fixed): %s",
245  is_set(rsc->flags, pe_rsc_unique) ? "true" : "false");
246  clone_data->notify_confirm = is_set(rsc->flags, pe_rsc_notify);
249 
250  for (lpc = 0; lpc < clone_data->clone_max; lpc++) {
251  if (create_child_clone(rsc, lpc, data_set) == NULL) {
252  return FALSE;
253  }
254  }
255 
256  if (clone_data->clone_max == 0) {
257  /* create one so that unpack_find_resource() will hook up
258  * any orphans up to the parent correctly
259  */
260  if (create_child_clone(rsc, -1, data_set) == NULL) {
261  return FALSE;
262  }
263  }
264 
265  pe_rsc_trace(rsc, "Added %d children to resource %s...", clone_data->clone_max, rsc->id);
266  return TRUE;
267 }
268 
269 gboolean
270 clone_active(resource_t * rsc, gboolean all)
271 {
272  GListPtr gIter = rsc->children;
273 
274  for (; gIter != NULL; gIter = gIter->next) {
275  resource_t *child_rsc = (resource_t *) gIter->data;
276  gboolean child_active = child_rsc->fns->active(child_rsc, all);
277 
278  if (all == FALSE && child_active) {
279  return TRUE;
280  } else if (all && child_active == FALSE) {
281  return FALSE;
282  }
283  }
284 
285  if (all) {
286  return TRUE;
287  } else {
288  return FALSE;
289  }
290 }
291 
292 static void
293 short_print(char *list, const char *prefix, const char *type, long options, void *print_data)
294 {
295  if (list) {
296  if (options & pe_print_html) {
297  status_print("<li>");
298  }
299  status_print("%s%s: [%s ]", prefix, type, list);
300 
301  if (options & pe_print_html) {
302  status_print("</li>\n");
303 
304  } else if (options & pe_print_suppres_nl) {
305  /* nothing */
306  } else if ((options & pe_print_printf) || (options & pe_print_ncurses)) {
307  status_print("\n");
308  }
309 
310  }
311 }
312 
313 static void
314 clone_print_xml(resource_t * rsc, const char *pre_text, long options, void *print_data)
315 {
316  int is_master_slave = rsc->variant == pe_master ? 1 : 0;
317  char *child_text = crm_concat(pre_text, " ", ' ');
318  GListPtr gIter = rsc->children;
319 
320  status_print("%s<clone ", pre_text);
321  status_print("id=\"%s\" ", rsc->id);
322  status_print("multi_state=\"%s\" ", is_master_slave ? "true" : "false");
323  status_print("unique=\"%s\" ", is_set(rsc->flags, pe_rsc_unique) ? "true" : "false");
324  status_print("managed=\"%s\" ", is_set(rsc->flags, pe_rsc_managed) ? "true" : "false");
325  status_print("failed=\"%s\" ", is_set(rsc->flags, pe_rsc_failed) ? "true" : "false");
326  status_print("failure_ignored=\"%s\" ",
327  is_set(rsc->flags, pe_rsc_failure_ignored) ? "true" : "false");
328  status_print(">\n");
329 
330  for (; gIter != NULL; gIter = gIter->next) {
331  resource_t *child_rsc = (resource_t *) gIter->data;
332 
333  child_rsc->fns->print(child_rsc, child_text, options, print_data);
334  }
335 
336  status_print("%s</clone>\n", pre_text);
337  free(child_text);
338 }
339 
340 bool is_set_recursive(resource_t * rsc, long long flag, bool any)
341 {
342  GListPtr gIter;
343  bool all = !any;
344 
345  if(is_set(rsc->flags, flag)) {
346  if(any) {
347  return TRUE;
348  }
349  } else if(all) {
350  return FALSE;
351  }
352 
353  for (gIter = rsc->children; gIter != NULL; gIter = gIter->next) {
354  if(is_set_recursive(gIter->data, flag, any)) {
355  if(any) {
356  return TRUE;
357  }
358 
359  } else if(all) {
360  return FALSE;
361  }
362  }
363 
364  if(all) {
365  return TRUE;
366  }
367  return FALSE;
368 }
369 
370 void
371 clone_print(resource_t * rsc, const char *pre_text, long options, void *print_data)
372 {
373  char *list_text = NULL;
374  char *child_text = NULL;
375  char *stopped_list = NULL;
376  const char *type = "Clone";
377 
378  GListPtr master_list = NULL;
379  GListPtr started_list = NULL;
380  GListPtr gIter = rsc->children;
381 
382  clone_variant_data_t *clone_data = NULL;
383  int active_instances = 0;
384 
385  if (pre_text == NULL) {
386  pre_text = " ";
387  }
388 
389  if (options & pe_print_xml) {
390  clone_print_xml(rsc, pre_text, options, print_data);
391  return;
392  }
393 
394  get_clone_variant_data(clone_data, rsc);
395 
396  child_text = crm_concat(pre_text, " ", ' ');
397 
398  if (rsc->variant == pe_master) {
399  type = "Master/Slave";
400  }
401 
402  status_print("%s%s Set: %s [%s]%s%s",
403  pre_text ? pre_text : "", type, rsc->id, ID(clone_data->xml_obj_child),
404  is_set(rsc->flags, pe_rsc_unique) ? " (unique)" : "",
405  is_set(rsc->flags, pe_rsc_managed) ? "" : " (unmanaged)");
406 
407  if (options & pe_print_html) {
408  status_print("\n<ul>\n");
409 
410  } else if ((options & pe_print_log) == 0) {
411  status_print("\n");
412  }
413 
414  for (; gIter != NULL; gIter = gIter->next) {
415  gboolean print_full = FALSE;
416  resource_t *child_rsc = (resource_t *) gIter->data;
417 
418  if (options & pe_print_clone_details) {
419  print_full = TRUE;
420  }
421 
422  if (child_rsc->fns->active(child_rsc, FALSE) == FALSE) {
423  /* Inactive clone */
424  if (is_set(child_rsc->flags, pe_rsc_orphan)) {
425  continue;
426 
427  } else if (is_set(rsc->flags, pe_rsc_unique)) {
428  print_full = TRUE;
429 
430  } else if (is_not_set(options, pe_print_clone_active)) {
431  stopped_list = add_list_element(stopped_list, child_rsc->id);
432  }
433 
434  } else if (is_set_recursive(child_rsc, pe_rsc_unique, TRUE)
435  || is_set_recursive(child_rsc, pe_rsc_orphan, TRUE)
436  || is_set_recursive(child_rsc, pe_rsc_managed, FALSE) == FALSE
437  || is_set_recursive(child_rsc, pe_rsc_failed, TRUE)) {
438 
439  /* Unique, unmanaged or failed clone */
440  print_full = TRUE;
441 
442  } else if (is_set(options, pe_print_pending) && child_rsc->pending_task != NULL) {
443  /* In a pending state */
444  print_full = TRUE;
445 
446  } else if (child_rsc->fns->active(child_rsc, TRUE)) {
447  /* Fully active anonymous clone */
448  node_t *location = child_rsc->fns->location(child_rsc, NULL, TRUE);
449 
450  if (location) {
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  /* And active on a single node as master */
458  master_list = g_list_append(master_list, location);
459 
460  } else {
461  /* And active on a single node as started/slave */
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  /* 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", 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  short_print(list_text, child_text, rsc->variant == pe_master ? "Slaves" : "Started", options,
510  print_data);
511  g_list_free(started_list);
512  free(list_text);
513  list_text = NULL;
514 
515  if (is_not_set(options, pe_print_clone_active)) {
516  /* Stopped */
517  if (is_not_set(rsc->flags, pe_rsc_unique)
518  && (clone_data->clone_max > active_instances)) {
519 
520  GListPtr nIter;
521  GListPtr list = g_hash_table_get_values(rsc->allowed_nodes);
522 
523  /* Custom stopped list for non-unique clones */
524  free(stopped_list); stopped_list = NULL;
525 
526  if (g_list_length(list) == 0) {
527  /* Clusters with symmetrical=false haven't calculated allowed_nodes yet
528  * If we've not probed for them yet, the Stopped list will be empty
529  */
530  list = g_hash_table_get_values(rsc->known_on);
531  }
532 
533  list = g_list_sort(list, sort_node_uname);
534  for (nIter = list; nIter != NULL; nIter = nIter->next) {
535  node_t *node = (node_t *)nIter->data;
536 
537  if (pe_find_node(rsc->running_on, node->details->uname) == NULL) {
538  stopped_list = add_list_element(stopped_list, node->details->uname);
539  }
540  }
541  g_list_free(list);
542  }
543  short_print(stopped_list, child_text, "Stopped", options, print_data);
544  free(stopped_list);
545  }
546 
547  if (options & pe_print_html) {
548  status_print("</ul>\n");
549  }
550 
551  free(child_text);
552 }
553 
554 void
556 {
557  GListPtr gIter = rsc->children;
558  clone_variant_data_t *clone_data = NULL;
559 
560  get_clone_variant_data(clone_data, rsc);
561 
562  pe_rsc_trace(rsc, "Freeing %s", rsc->id);
563 
564  for (; gIter != NULL; gIter = gIter->next) {
565  resource_t *child_rsc = (resource_t *) gIter->data;
566 
567  CRM_ASSERT(child_rsc);
568  pe_rsc_trace(child_rsc, "Freeing child %s", child_rsc->id);
569  free_xml(child_rsc->xml);
570  child_rsc->xml = NULL;
571  /* There could be a saved unexpanded xml */
572  free_xml(child_rsc->orig_xml);
573  child_rsc->orig_xml = NULL;
574  child_rsc->fns->free(child_rsc);
575  }
576 
577  g_list_free(rsc->children);
578 
579  if (clone_data) {
580  CRM_ASSERT(clone_data->demote_notify == NULL);
581  CRM_ASSERT(clone_data->stop_notify == NULL);
582  CRM_ASSERT(clone_data->start_notify == NULL);
583  CRM_ASSERT(clone_data->promote_notify == NULL);
584  }
585 
586  common_free(rsc);
587 }
588 
589 enum rsc_role_e
590 clone_resource_state(const resource_t * rsc, gboolean current)
591 {
592  enum rsc_role_e clone_role = RSC_ROLE_UNKNOWN;
593  GListPtr gIter = rsc->children;
594 
595  for (; gIter != NULL; gIter = gIter->next) {
596  resource_t *child_rsc = (resource_t *) gIter->data;
597  enum rsc_role_e a_role = child_rsc->fns->state(child_rsc, current);
598 
599  if (a_role > clone_role) {
600  clone_role = a_role;
601  }
602  }
603 
604  pe_rsc_trace(rsc, "%s role: %s", rsc->id, role2text(clone_role));
605  return clone_role;
606 }
#define CRM_CHECK(expr, failure_action)
Definition: logging.h:164
GListPtr nodes
Definition: status.h:100
xmlNode * find_xml_node(xmlNode *cib, const char *node_path, gboolean must_find)
Definition: xml.c:2440
const char * uname
Definition: status.h:129
xmlNode * xml
Definition: status.h:242
node_t *(* location)(resource_t *, GListPtr *, gboolean)
Definition: complex.h:49
gboolean clone_unpack(resource_t *rsc, pe_working_set_t *data_set)
Definition: clone.c:155
#define XML_BOOLEAN_FALSE
Definition: msg_xml.h:116
#define crm_config_err(fmt...)
Definition: crm_internal.h:269
#define XML_RSC_ATTR_INCARNATION
Definition: msg_xml.h:195
#define pe_rsc_orphan
Definition: status.h:171
gboolean common_unpack(xmlNode *xml_obj, resource_t **rsc, resource_t *parent, pe_working_set_t *data_set)
Definition: complex.c:381
enum pe_obj_types variant
Definition: status.h:248
void(* free)(resource_t *)
Definition: complex.h:50
void common_free(resource_t *rsc)
Definition: complex.c:794
#define status_print(fmt, args...)
Definition: unpack.h:83
int crm_parse_int(const char *text, const char *default_text)
Definition: utils.c:643
node_t * pe_find_node(GListPtr node_list, const char *uname)
Definition: status.c:298
char * add_list_element(char *list, const char *value)
Definition: utils.c:2284
AIS_Host host
Definition: internal.h:52
#define XML_RSC_ATTR_STICKINESS
Definition: msg_xml.h:206
void force_non_unique_clone(resource_t *rsc, const char *rid, pe_working_set_t *data_set)
Definition: clone.c:50
gboolean master_unpack(resource_t *rsc, pe_working_set_t *data_set)
Definition: clone.c:137
xmlNode * orig_xml
Definition: status.h:243
gboolean clone_active(resource_t *rsc, gboolean all)
Definition: clone.c:270
#define XML_RSC_ATTR_MASTER_NODEMAX
Definition: msg_xml.h:200
#define XML_RSC_ATTR_INCARNATION_MAX
Definition: msg_xml.h:196
GListPtr children
Definition: status.h:284
char * id
Definition: status.h:240
xmlNode * copy_xml(xmlNode *src_node)
Definition: xml.c:2894
const char * role2text(enum rsc_role_e role)
Definition: common.c:338
gboolean(* active)(resource_t *, gboolean)
Definition: complex.h:47
struct node_shared_s * details
Definition: status.h:165
#define set_bit(word, bit)
Definition: crm_internal.h:198
gboolean unclean
Definition: status.h:135
void clone_free(resource_t *rsc)
Definition: clone.c:555
enum rsc_role_e clone_resource_state(const resource_t *rsc, gboolean current)
Definition: clone.c:590
#define XML_ATTR_ID
Definition: msg_xml.h:100
char * pending_task
Definition: status.h:293
#define XML_CIB_TAG_RESOURCE
Definition: msg_xml.h:181
#define XML_BOOLEAN_TRUE
Definition: msg_xml.h:115
#define pe_rsc_failed
Definition: status.h:188
resource_object_functions_t * fns
Definition: status.h:249
GHashTable * allowed_nodes
Definition: status.h:275
void * variant_opaque
Definition: status.h:247
void clone_create_notifications(resource_t *rsc, action_t *action, action_t *action_complete, pe_working_set_t *data_set)
#define XML_RSC_ATTR_ORDERED
Definition: msg_xml.h:193
const char * crm_element_value(xmlNode *data, const char *name)
Definition: xml.c:5839
unsigned long long flags
Definition: status.h:264
#define XML_RSC_ATTR_INCARNATION_NODEMAX
Definition: msg_xml.h:198
void free_xml(xmlNode *child)
Definition: xml.c:2848
gboolean crm_str_eq(const char *a, const char *b, gboolean use_case)
Definition: utils.c:1415
#define XML_RSC_ATTR_UNIQUE
Definition: msg_xml.h:204
void clone_print(resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: clone.c:371
#define crm_config_warn(fmt...)
Definition: crm_internal.h:270
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Definition: xml.c:2695
#define XML_RSC_ATTR_MASTER_MAX
Definition: msg_xml.h:199
#define pe_rsc_unique
Definition: status.h:177
resource_t * create_child_clone(resource_t *rsc, int sub_id, pe_working_set_t *data_set)
Definition: clone.c:86
GHashTable * meta
Definition: status.h:280
void add_hash_param(GHashTable *hash, const char *name, const char *value)
Definition: common.c:414
void(* print)(resource_t *, const char *, long, void *)
Definition: complex.h:46
enum rsc_role_e(* state)(const resource_t *, gboolean)
Definition: complex.h:48
gboolean online
Definition: status.h:131
#define pe_rsc_failure_ignored
Definition: status.h:198
resource_t * find_clone_instance(resource_t *rsc, const char *sub_id, pe_working_set_t *data_set)
Definition: clone.c:68
bool is_set_recursive(resource_t *rsc, long long flag, bool any)
Definition: clone.c:340
#define pe_rsc_managed
Definition: status.h:172
#define CRM_ASSERT(expr)
Definition: error.h:35
rsc_role_e
Definition: common.h:81
GHashTable * known_on
Definition: status.h:274
void clear_bit_recursive(resource_t *rsc, unsigned long long flag)
Definition: utils.c:2103
Definition: status.h:161
gboolean crm_is_true(const char *s)
Definition: utils.c:683
#define XML_CIB_TAG_GROUP
Definition: msg_xml.h:182
#define pe_rsc_trace(rsc, fmt, args...)
Definition: internal.h:24
char * crm_concat(const char *prefix, const char *suffix, char join)
Definition: utils.c:403
#define ID(x)
Definition: msg_xml.h:408
#define pe_err(fmt...)
Definition: internal.h:26
void print_resource(int log_level, const char *pre_text, resource_t *rsc, gboolean details)
Definition: utils.c:1070
char * crm_itoa(int an_int)
Definition: utils.c:441
resource_t * pe_find_resource(GListPtr rsc_list, const char *id_rh)
Definition: status.c:252
#define XML_RSC_ATTR_INTERLEAVE
Definition: msg_xml.h:194
#define LOG_DEBUG_3
Definition: logging.h:32
gint sort_node_uname(gconstpointer a, gconstpointer b)
Definition: utils.c:165
GList * GListPtr
Definition: crm.h:190
#define pe_rsc_notify
Definition: status.h:176
enum crm_ais_msg_types type
Definition: internal.h:51
GListPtr running_on
Definition: status.h:273