pacemaker  1.1.15-e174ec8
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules 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, const char *suffix, long options, void *print_data)
294 {
295  if(suffix == NULL) {
296  suffix = "";
297  }
298 
299  if (list) {
300  if (options & pe_print_html) {
301  status_print("<li>");
302  }
303  status_print("%s%s: [%s ]%s", prefix, type, list, suffix);
304 
305  if (options & pe_print_html) {
306  status_print("</li>\n");
307 
308  } else if (options & pe_print_suppres_nl) {
309  /* nothing */
310  } else if ((options & pe_print_printf) || (options & pe_print_ncurses)) {
311  status_print("\n");
312  }
313 
314  }
315 }
316 
317 static void
318 clone_print_xml(resource_t * rsc, const char *pre_text, long options, void *print_data)
319 {
320  int is_master_slave = rsc->variant == pe_master ? 1 : 0;
321  char *child_text = crm_concat(pre_text, " ", ' ');
322  GListPtr gIter = rsc->children;
323 
324  status_print("%s<clone ", pre_text);
325  status_print("id=\"%s\" ", rsc->id);
326  status_print("multi_state=\"%s\" ", is_master_slave ? "true" : "false");
327  status_print("unique=\"%s\" ", is_set(rsc->flags, pe_rsc_unique) ? "true" : "false");
328  status_print("managed=\"%s\" ", is_set(rsc->flags, pe_rsc_managed) ? "true" : "false");
329  status_print("failed=\"%s\" ", is_set(rsc->flags, pe_rsc_failed) ? "true" : "false");
330  status_print("failure_ignored=\"%s\" ",
331  is_set(rsc->flags, pe_rsc_failure_ignored) ? "true" : "false");
332  status_print(">\n");
333 
334  for (; gIter != NULL; gIter = gIter->next) {
335  resource_t *child_rsc = (resource_t *) gIter->data;
336 
337  child_rsc->fns->print(child_rsc, child_text, options, print_data);
338  }
339 
340  status_print("%s</clone>\n", pre_text);
341  free(child_text);
342 }
343 
344 bool is_set_recursive(resource_t * rsc, long long flag, bool any)
345 {
346  GListPtr gIter;
347  bool all = !any;
348 
349  if(is_set(rsc->flags, flag)) {
350  if(any) {
351  return TRUE;
352  }
353  } else if(all) {
354  return FALSE;
355  }
356 
357  for (gIter = rsc->children; gIter != NULL; gIter = gIter->next) {
358  if(is_set_recursive(gIter->data, flag, any)) {
359  if(any) {
360  return TRUE;
361  }
362 
363  } else if(all) {
364  return FALSE;
365  }
366  }
367 
368  if(all) {
369  return TRUE;
370  }
371  return FALSE;
372 }
373 
374 static enum rsc_role_e
375 configured_role(resource_t * rsc)
376 {
377  const char *target_role = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_TARGET_ROLE);
378 
379  if(target_role == NULL) {
380  target_role = g_hash_table_lookup(((resource_t*)rsc->children->data)->meta, XML_RSC_ATTR_TARGET_ROLE);
381  }
382 
383  if(target_role) {
384  return text2role(target_role);
385  }
386  return RSC_ROLE_UNKNOWN;
387 }
388 
389 void
390 clone_print(resource_t * rsc, const char *pre_text, long options, void *print_data)
391 {
392  char *list_text = NULL;
393  char *child_text = NULL;
394  char *stopped_list = NULL;
395  const char *type = "Clone";
396 
397  GListPtr master_list = NULL;
398  GListPtr started_list = NULL;
399  GListPtr gIter = rsc->children;
400 
401  clone_variant_data_t *clone_data = NULL;
402  int active_instances = 0;
403 
404  if (pre_text == NULL) {
405  pre_text = " ";
406  }
407 
408  if (options & pe_print_xml) {
409  clone_print_xml(rsc, pre_text, options, print_data);
410  return;
411  }
412 
413  get_clone_variant_data(clone_data, rsc);
414 
415  child_text = crm_concat(pre_text, " ", ' ');
416 
417  if (rsc->variant == pe_master) {
418  type = "Master/Slave";
419  }
420 
421  status_print("%s%s Set: %s [%s]%s%s",
422  pre_text ? pre_text : "", type, rsc->id, ID(clone_data->xml_obj_child),
423  is_set(rsc->flags, pe_rsc_unique) ? " (unique)" : "",
424  is_set(rsc->flags, pe_rsc_managed) ? "" : " (unmanaged)");
425 
426  if (options & pe_print_html) {
427  status_print("\n<ul>\n");
428 
429  } else if ((options & pe_print_log) == 0) {
430  status_print("\n");
431  }
432 
433  for (; gIter != NULL; gIter = gIter->next) {
434  gboolean print_full = FALSE;
435  resource_t *child_rsc = (resource_t *) gIter->data;
436 
437  if (options & pe_print_clone_details) {
438  print_full = TRUE;
439  }
440 
441  if (child_rsc->fns->active(child_rsc, FALSE) == FALSE) {
442  /* Inactive clone */
443  if (is_set(child_rsc->flags, pe_rsc_orphan)) {
444  continue;
445 
446  } else if (is_set(rsc->flags, pe_rsc_unique)) {
447  print_full = TRUE;
448 
449  } else if (is_not_set(options, pe_print_clone_active)) {
450  stopped_list = add_list_element(stopped_list, child_rsc->id);
451  }
452 
453  } else if (is_set_recursive(child_rsc, pe_rsc_unique, TRUE)
454  || is_set_recursive(child_rsc, pe_rsc_orphan, TRUE)
455  || is_set_recursive(child_rsc, pe_rsc_managed, FALSE) == FALSE
456  || is_set_recursive(child_rsc, pe_rsc_failed, TRUE)) {
457 
458  /* Unique, unmanaged or failed clone */
459  print_full = TRUE;
460 
461  } else if (is_set(options, pe_print_pending) && child_rsc->pending_task != NULL) {
462  /* In a pending state */
463  print_full = TRUE;
464 
465  } else if (child_rsc->fns->active(child_rsc, TRUE)) {
466  /* Fully active anonymous clone */
467  node_t *location = child_rsc->fns->location(child_rsc, NULL, TRUE);
468 
469  if (location) {
470  enum rsc_role_e a_role = child_rsc->fns->state(child_rsc, TRUE);
471 
472  if (location->details->online == FALSE && location->details->unclean) {
473  print_full = TRUE;
474 
475  } else if (a_role > RSC_ROLE_SLAVE) {
476  /* And active on a single node as master */
477  master_list = g_list_append(master_list, location);
478 
479  } else {
480  /* And active on a single node as started/slave */
481  started_list = g_list_append(started_list, location);
482  }
483 
484  } else {
485  /* uncolocated group - bleh */
486  print_full = TRUE;
487  }
488 
489  } else {
490  /* Partially active anonymous clone */
491  print_full = TRUE;
492  }
493 
494  if (print_full) {
495  if (options & pe_print_html) {
496  status_print("<li>\n");
497  }
498  child_rsc->fns->print(child_rsc, child_text, options, print_data);
499  if (options & pe_print_html) {
500  status_print("</li>\n");
501  }
502  }
503  }
504 
505  /* Masters */
506  master_list = g_list_sort(master_list, sort_node_uname);
507  for (gIter = master_list; gIter; gIter = gIter->next) {
508  node_t *host = gIter->data;
509 
510  list_text = add_list_element(list_text, host->details->uname);
511  active_instances++;
512  }
513 
514  short_print(list_text, child_text, "Masters", NULL, options, print_data);
515  g_list_free(master_list);
516  free(list_text);
517  list_text = NULL;
518 
519  /* Started/Slaves */
520  started_list = g_list_sort(started_list, sort_node_uname);
521  for (gIter = started_list; gIter; gIter = gIter->next) {
522  node_t *host = gIter->data;
523 
524  list_text = add_list_element(list_text, host->details->uname);
525  active_instances++;
526  }
527 
528  if(rsc->variant == pe_master) {
529  enum rsc_role_e role = configured_role(rsc);
530 
531  if(role == RSC_ROLE_SLAVE) {
532  short_print(list_text, child_text, "Slaves (target-role)", NULL, options, print_data);
533  } else {
534  short_print(list_text, child_text, "Slaves", NULL, options, print_data);
535  }
536 
537  } else {
538  short_print(list_text, child_text, "Started", NULL, options, print_data);
539  }
540 
541  g_list_free(started_list);
542  free(list_text);
543  list_text = NULL;
544 
545  if (is_not_set(options, pe_print_clone_active)) {
546  const char *state = "Stopped";
547  enum rsc_role_e role = configured_role(rsc);
548 
549  if (role == RSC_ROLE_STOPPED) {
550  state = "Stopped (disabled)";
551  }
552 
553  if (is_not_set(rsc->flags, pe_rsc_unique)
554  && (clone_data->clone_max > active_instances)) {
555 
556  GListPtr nIter;
557  GListPtr list = g_hash_table_get_values(rsc->allowed_nodes);
558 
559  /* Custom stopped list for non-unique clones */
560  free(stopped_list); stopped_list = NULL;
561 
562  if (g_list_length(list) == 0) {
563  /* Clusters with symmetrical=false haven't calculated allowed_nodes yet
564  * If we've not probed for them yet, the Stopped list will be empty
565  */
566  list = g_hash_table_get_values(rsc->known_on);
567  }
568 
569  list = g_list_sort(list, sort_node_uname);
570  for (nIter = list; nIter != NULL; nIter = nIter->next) {
571  node_t *node = (node_t *)nIter->data;
572 
573  if (pe_find_node(rsc->running_on, node->details->uname) == NULL) {
574  stopped_list = add_list_element(stopped_list, node->details->uname);
575  }
576  }
577  g_list_free(list);
578  }
579 
580  short_print(stopped_list, child_text, state, NULL, options, print_data);
581  free(stopped_list);
582  }
583 
584  if (options & pe_print_html) {
585  status_print("</ul>\n");
586  }
587 
588  free(child_text);
589 }
590 
591 void
593 {
594  GListPtr gIter = rsc->children;
595  clone_variant_data_t *clone_data = NULL;
596 
597  get_clone_variant_data(clone_data, rsc);
598 
599  pe_rsc_trace(rsc, "Freeing %s", rsc->id);
600 
601  for (; gIter != NULL; gIter = gIter->next) {
602  resource_t *child_rsc = (resource_t *) gIter->data;
603 
604  CRM_ASSERT(child_rsc);
605  pe_rsc_trace(child_rsc, "Freeing child %s", child_rsc->id);
606  free_xml(child_rsc->xml);
607  child_rsc->xml = NULL;
608  /* There could be a saved unexpanded xml */
609  free_xml(child_rsc->orig_xml);
610  child_rsc->orig_xml = NULL;
611  child_rsc->fns->free(child_rsc);
612  }
613 
614  g_list_free(rsc->children);
615 
616  if (clone_data) {
617  CRM_ASSERT(clone_data->demote_notify == NULL);
618  CRM_ASSERT(clone_data->stop_notify == NULL);
619  CRM_ASSERT(clone_data->start_notify == NULL);
620  CRM_ASSERT(clone_data->promote_notify == NULL);
621  }
622 
623  common_free(rsc);
624 }
625 
626 enum rsc_role_e
627 clone_resource_state(const resource_t * rsc, gboolean current)
628 {
629  enum rsc_role_e clone_role = RSC_ROLE_UNKNOWN;
630  GListPtr gIter = rsc->children;
631 
632  for (; gIter != NULL; gIter = gIter->next) {
633  resource_t *child_rsc = (resource_t *) gIter->data;
634  enum rsc_role_e a_role = child_rsc->fns->state(child_rsc, current);
635 
636  if (a_role > clone_role) {
637  clone_role = a_role;
638  }
639  }
640 
641  pe_rsc_trace(rsc, "%s role: %s", rsc->id, role2text(clone_role));
642  return clone_role;
643 }
#define CRM_CHECK(expr, failure_action)
Definition: logging.h:164
GListPtr nodes
Definition: status.h:101
xmlNode * find_xml_node(xmlNode *cib, const char *node_path, gboolean must_find)
Definition: xml.c:2443
const char * uname
Definition: status.h:133
xmlNode * xml
Definition: status.h:246
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:270
#define XML_RSC_ATTR_INCARNATION
Definition: msg_xml.h:198
#define pe_rsc_orphan
Definition: status.h:175
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:252
void(* free)(resource_t *)
Definition: complex.h:50
void common_free(resource_t *rsc)
Definition: complex.c:795
#define status_print(fmt, args...)
Definition: unpack.h:83
int crm_parse_int(const char *text, const char *default_text)
Definition: utils.c:671
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:2331
AIS_Host host
Definition: internal.h:52
#define XML_RSC_ATTR_STICKINESS
Definition: msg_xml.h:209
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:247
gboolean clone_active(resource_t *rsc, gboolean all)
Definition: clone.c:270
#define XML_RSC_ATTR_MASTER_NODEMAX
Definition: msg_xml.h:203
#define XML_RSC_ATTR_INCARNATION_MAX
Definition: msg_xml.h:199
GListPtr children
Definition: status.h:288
char * id
Definition: status.h:244
xmlNode * copy_xml(xmlNode *src_node)
Definition: xml.c:2897
const char * role2text(enum rsc_role_e role)
Definition: common.c:340
gboolean(* active)(resource_t *, gboolean)
Definition: complex.h:47
struct node_shared_s * details
Definition: status.h:169
#define set_bit(word, bit)
Definition: crm_internal.h:199
gboolean unclean
Definition: status.h:139
void clone_free(resource_t *rsc)
Definition: clone.c:592
enum rsc_role_e clone_resource_state(const resource_t *rsc, gboolean current)
Definition: clone.c:627
#define XML_ATTR_ID
Definition: msg_xml.h:100
char * pending_task
Definition: status.h:297
#define XML_CIB_TAG_RESOURCE
Definition: msg_xml.h:184
#define XML_BOOLEAN_TRUE
Definition: msg_xml.h:115
#define pe_rsc_failed
Definition: status.h:192
resource_object_functions_t * fns
Definition: status.h:253
GHashTable * allowed_nodes
Definition: status.h:279
void * variant_opaque
Definition: status.h:251
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:196
const char * crm_element_value(xmlNode *data, const char *name)
Definition: xml.c:5842
unsigned long long flags
Definition: status.h:268
#define XML_RSC_ATTR_INCARNATION_NODEMAX
Definition: msg_xml.h:201
#define XML_RSC_ATTR_TARGET_ROLE
Definition: msg_xml.h:206
void free_xml(xmlNode *child)
Definition: xml.c:2851
enum rsc_role_e text2role(const char *role)
Definition: common.c:360
gboolean crm_str_eq(const char *a, const char *b, gboolean use_case)
Definition: utils.c:1441
#define XML_RSC_ATTR_UNIQUE
Definition: msg_xml.h:207
void clone_print(resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: clone.c:390
#define crm_config_warn(fmt...)
Definition: crm_internal.h:271
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Definition: xml.c:2698
#define XML_RSC_ATTR_MASTER_MAX
Definition: msg_xml.h:202
#define pe_rsc_unique
Definition: status.h:181
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:284
void add_hash_param(GHashTable *hash, const char *name, const char *value)
Definition: common.c:416
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:135
#define pe_rsc_failure_ignored
Definition: status.h:202
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:344
#define pe_rsc_managed
Definition: status.h:176
#define CRM_ASSERT(expr)
Definition: error.h:35
rsc_role_e
Definition: common.h:81
GHashTable * known_on
Definition: status.h:278
void clear_bit_recursive(resource_t *rsc, unsigned long long flag)
Definition: utils.c:2022
Definition: status.h:165
gboolean crm_is_true(const char *s)
Definition: utils.c:711
#define XML_CIB_TAG_GROUP
Definition: msg_xml.h:185
#define pe_rsc_trace(rsc, fmt, args...)
Definition: internal.h:25
char * crm_concat(const char *prefix, const char *suffix, char join)
Definition: utils.c:431
#define ID(x)
Definition: msg_xml.h:419
#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:1068
char * crm_itoa(int an_int)
Definition: utils.c:469
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:197
#define LOG_DEBUG_3
Definition: logging.h:32
gint sort_node_uname(gconstpointer a, gconstpointer b)
Definition: utils.c:164
GList * GListPtr
Definition: crm.h:192
#define pe_rsc_notify
Definition: status.h:180
enum crm_ais_msg_types type
Definition: internal.h:51
GListPtr running_on
Definition: status.h:277