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