pacemaker  2.1.0-7c3f660
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
complex.c
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2021 the Pacemaker project contributors
3  *
4  * The version control history for this file may have further details.
5  *
6  * This source code is licensed under the GNU Lesser General Public License
7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8  */
9 
10 #include <crm_internal.h>
11 
12 #include <crm/pengine/rules.h>
13 #include <crm/pengine/internal.h>
14 #include <crm/msg_xml.h>
16 
17 void populate_hash(xmlNode * nvpair_list, GHashTable * hash, const char **attrs, int attrs_length);
18 
20  {
31  },
32  {
40  group_free,
43  },
44  {
52  clone_free,
55  },
56  {
67  }
68 };
69 
70 static enum pe_obj_types
71 get_resource_type(const char *name)
72 {
73  if (pcmk__str_eq(name, XML_CIB_TAG_RESOURCE, pcmk__str_casei)) {
74  return pe_native;
75 
76  } else if (pcmk__str_eq(name, XML_CIB_TAG_GROUP, pcmk__str_casei)) {
77  return pe_group;
78 
79  } else if (pcmk__str_eq(name, XML_CIB_TAG_INCARNATION, pcmk__str_casei)) {
80  return pe_clone;
81 
82  } else if (pcmk__str_eq(name, PCMK_XE_PROMOTABLE_LEGACY, pcmk__str_casei)) {
83  // @COMPAT deprecated since 2.0.0
84  return pe_clone;
85 
86  } else if (pcmk__str_eq(name, XML_CIB_TAG_CONTAINER, pcmk__str_casei)) {
87  return pe_container;
88  }
89 
90  return pe_unknown;
91 }
92 
93 static void
94 dup_attr(gpointer key, gpointer value, gpointer user_data)
95 {
96  add_hash_param(user_data, key, value);
97 }
98 
99 static void
100 expand_parents_fixed_nvpairs(pe_resource_t * rsc, pe_rule_eval_data_t * rule_data, GHashTable * meta_hash, pe_working_set_t * data_set)
101 {
102  GHashTable *parent_orig_meta = pcmk__strkey_table(free, free);
103  pe_resource_t *p = rsc->parent;
104 
105  if (p == NULL) {
106  return ;
107  }
108 
109  /* Search all parent resources, get the fixed value of "meta_attributes" set only in the original xml, and stack it in the hash table. */
110  /* The fixed value of the lower parent resource takes precedence and is not overwritten. */
111  while(p != NULL) {
112  /* A hash table for comparison is generated, including the id-ref. */
114  rule_data, parent_orig_meta, NULL, FALSE, data_set);
115  p = p->parent;
116  }
117 
118  /* If there is a fixed value of "meta_attributes" of the parent resource, it will be processed. */
119  if (parent_orig_meta != NULL) {
120  GHashTableIter iter;
121  char *key = NULL;
122  char *value = NULL;
123 
124  g_hash_table_iter_init(&iter, parent_orig_meta);
125  while (g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &value)) {
126  /* Parameters set in the original xml of the parent resource will also try to overwrite the child resource. */
127  /* Attributes that already exist in the child lease are not updated. */
128  dup_attr(key, value, meta_hash);
129  }
130  }
131 
132  if (parent_orig_meta != NULL) {
133  g_hash_table_destroy(parent_orig_meta);
134  }
135 
136  return ;
137 
138 }
139 void
140 get_meta_attributes(GHashTable * meta_hash, pe_resource_t * rsc,
141  pe_node_t * node, pe_working_set_t * data_set)
142 {
143  pe_rsc_eval_data_t rsc_rule_data = {
145  .provider = crm_element_value(rsc->xml, XML_AGENT_ATTR_PROVIDER),
147  };
148 
149  pe_rule_eval_data_t rule_data = {
150  .node_hash = NULL,
151  .role = RSC_ROLE_UNKNOWN,
152  .now = data_set->now,
153  .match_data = NULL,
154  .rsc_data = &rsc_rule_data,
155  .op_data = NULL
156  };
157 
158  if (node) {
159  rule_data.node_hash = node->details->attrs;
160  }
161 
162  for (xmlAttrPtr a = pcmk__xe_first_attr(rsc->xml); a != NULL; a = a->next) {
163  const char *prop_name = (const char *) a->name;
164  const char *prop_value = crm_element_value(rsc->xml, prop_name);
165 
166  add_hash_param(meta_hash, prop_name, prop_value);
167  }
168 
170  meta_hash, NULL, FALSE, data_set);
171 
172  /* Set the "meta_attributes" explicitly set in the parent resource to the hash table of the child resource. */
173  /* If it is already explicitly set as a child, it will not be overwritten. */
174  if (rsc->parent != NULL) {
175  expand_parents_fixed_nvpairs(rsc, &rule_data, meta_hash, data_set);
176  }
177 
178  /* check the defaults */
180  &rule_data, meta_hash, NULL, FALSE, data_set);
181 
182  /* If there is "meta_attributes" that the parent resource has not explicitly set, set a value that is not set from rsc_default either. */
183  /* The values already set up to this point will not be overwritten. */
184  if (rsc->parent) {
185  g_hash_table_foreach(rsc->parent->meta, dup_attr, meta_hash);
186  }
187 }
188 
189 void
190 get_rsc_attributes(GHashTable * meta_hash, pe_resource_t * rsc,
191  pe_node_t * node, pe_working_set_t * data_set)
192 {
193  pe_rule_eval_data_t rule_data = {
194  .node_hash = NULL,
195  .role = RSC_ROLE_UNKNOWN,
196  .now = data_set->now,
197  .match_data = NULL,
198  .rsc_data = NULL,
199  .op_data = NULL
200  };
201 
202  if (node) {
203  rule_data.node_hash = node->details->attrs;
204  }
205 
207  meta_hash, NULL, FALSE, data_set);
208 
209  /* set anything else based on the parent */
210  if (rsc->parent != NULL) {
211  get_rsc_attributes(meta_hash, rsc->parent, node, data_set);
212 
213  } else {
214  /* and finally check the defaults */
216  &rule_data, meta_hash, NULL, FALSE, data_set);
217  }
218 }
219 
220 #if ENABLE_VERSIONED_ATTRS
221 void
222 pe_get_versioned_attributes(xmlNode * meta_hash, pe_resource_t * rsc,
223  pe_node_t * node, pe_working_set_t * data_set)
224 {
225  pe_rule_eval_data_t rule_data = {
226  .node_hash = (node == NULL)? NULL : node->details->attrs,
227  .role = RSC_ROLE_UNKNOWN,
228  .now = data_set->now,
229  .match_data = NULL,
230  .rsc_data = NULL,
231  .op_data = NULL
232  };
233 
234  pe_eval_versioned_attributes(data_set->input, rsc->xml, XML_TAG_ATTR_SETS,
235  &rule_data, meta_hash, NULL);
236 
237  /* set anything else based on the parent */
238  if (rsc->parent != NULL) {
239  pe_get_versioned_attributes(meta_hash, rsc->parent, node, data_set);
240 
241  } else {
242  /* and finally check the defaults */
243  pe_eval_versioned_attributes(data_set->input, data_set->rsc_defaults,
244  XML_TAG_ATTR_SETS, &rule_data, meta_hash,
245  NULL);
246  }
247 }
248 #endif
249 
250 static char *
251 template_op_key(xmlNode * op)
252 {
253  const char *name = crm_element_value(op, "name");
254  const char *role = crm_element_value(op, "role");
255  char *key = NULL;
256 
257  if ((role == NULL)
260  role = RSC_ROLE_UNKNOWN_S;
261  }
262 
263  key = crm_strdup_printf("%s-%s", name, role);
264  return key;
265 }
266 
267 static gboolean
268 unpack_template(xmlNode * xml_obj, xmlNode ** expanded_xml, pe_working_set_t * data_set)
269 {
270  xmlNode *cib_resources = NULL;
271  xmlNode *template = NULL;
272  xmlNode *new_xml = NULL;
273  xmlNode *child_xml = NULL;
274  xmlNode *rsc_ops = NULL;
275  xmlNode *template_ops = NULL;
276  const char *template_ref = NULL;
277  const char *clone = NULL;
278  const char *id = NULL;
279 
280  if (xml_obj == NULL) {
281  pe_err("No resource object for template unpacking");
282  return FALSE;
283  }
284 
285  template_ref = crm_element_value(xml_obj, XML_CIB_TAG_RSC_TEMPLATE);
286  if (template_ref == NULL) {
287  return TRUE;
288  }
289 
290  id = ID(xml_obj);
291  if (id == NULL) {
292  pe_err("'%s' object must have a id", crm_element_name(xml_obj));
293  return FALSE;
294  }
295 
296  if (pcmk__str_eq(template_ref, id, pcmk__str_none)) {
297  pe_err("The resource object '%s' should not reference itself", id);
298  return FALSE;
299  }
300 
301  cib_resources = get_xpath_object("//"XML_CIB_TAG_RESOURCES, data_set->input, LOG_TRACE);
302  if (cib_resources == NULL) {
303  pe_err("No resources configured");
304  return FALSE;
305  }
306 
307  template = pcmk__xe_match(cib_resources, XML_CIB_TAG_RSC_TEMPLATE,
308  XML_ATTR_ID, template_ref);
309  if (template == NULL) {
310  pe_err("No template named '%s'", template_ref);
311  return FALSE;
312  }
313 
314  new_xml = copy_xml(template);
315  xmlNodeSetName(new_xml, xml_obj->name);
316  crm_xml_replace(new_xml, XML_ATTR_ID, id);
317 
319  if(clone) {
320  crm_xml_add(new_xml, XML_RSC_ATTR_INCARNATION, clone);
321  }
322 
323  template_ops = find_xml_node(new_xml, "operations", FALSE);
324 
325  for (child_xml = pcmk__xe_first_child(xml_obj); child_xml != NULL;
326  child_xml = pcmk__xe_next(child_xml)) {
327  xmlNode *new_child = NULL;
328 
329  new_child = add_node_copy(new_xml, child_xml);
330 
331  if (pcmk__str_eq((const char *)new_child->name, "operations", pcmk__str_none)) {
332  rsc_ops = new_child;
333  }
334  }
335 
336  if (template_ops && rsc_ops) {
337  xmlNode *op = NULL;
338  GHashTable *rsc_ops_hash = pcmk__strkey_table(free, NULL);
339 
340  for (op = pcmk__xe_first_child(rsc_ops); op != NULL;
341  op = pcmk__xe_next(op)) {
342 
343  char *key = template_op_key(op);
344 
345  g_hash_table_insert(rsc_ops_hash, key, op);
346  }
347 
348  for (op = pcmk__xe_first_child(template_ops); op != NULL;
349  op = pcmk__xe_next(op)) {
350 
351  char *key = template_op_key(op);
352 
353  if (g_hash_table_lookup(rsc_ops_hash, key) == NULL) {
354  add_node_copy(rsc_ops, op);
355  }
356 
357  free(key);
358  }
359 
360  if (rsc_ops_hash) {
361  g_hash_table_destroy(rsc_ops_hash);
362  }
363 
364  free_xml(template_ops);
365  }
366 
367  /*free_xml(*expanded_xml); */
368  *expanded_xml = new_xml;
369 
370  /* Disable multi-level templates for now */
371  /*if(unpack_template(new_xml, expanded_xml, data_set) == FALSE) {
372  free_xml(*expanded_xml);
373  *expanded_xml = NULL;
374 
375  return FALSE;
376  } */
377 
378  return TRUE;
379 }
380 
381 static gboolean
382 add_template_rsc(xmlNode * xml_obj, pe_working_set_t * data_set)
383 {
384  const char *template_ref = NULL;
385  const char *id = NULL;
386 
387  if (xml_obj == NULL) {
388  pe_err("No resource object for processing resource list of template");
389  return FALSE;
390  }
391 
392  template_ref = crm_element_value(xml_obj, XML_CIB_TAG_RSC_TEMPLATE);
393  if (template_ref == NULL) {
394  return TRUE;
395  }
396 
397  id = ID(xml_obj);
398  if (id == NULL) {
399  pe_err("'%s' object must have a id", crm_element_name(xml_obj));
400  return FALSE;
401  }
402 
403  if (pcmk__str_eq(template_ref, id, pcmk__str_none)) {
404  pe_err("The resource object '%s' should not reference itself", id);
405  return FALSE;
406  }
407 
408  if (add_tag_ref(data_set->template_rsc_sets, template_ref, id) == FALSE) {
409  return FALSE;
410  }
411 
412  return TRUE;
413 }
414 
415 static bool
416 detect_promotable(pe_resource_t *rsc)
417 {
418  const char *promotable = g_hash_table_lookup(rsc->meta,
420 
421  if (crm_is_true(promotable)) {
422  return TRUE;
423  }
424 
425  // @COMPAT deprecated since 2.0.0
426  if (pcmk__str_eq(crm_element_name(rsc->xml), PCMK_XE_PROMOTABLE_LEGACY,
427  pcmk__str_casei)) {
428  /* @TODO in some future version, pe_warn_once() here,
429  * then drop support in even later version
430  */
431  g_hash_table_insert(rsc->meta, strdup(XML_RSC_ATTR_PROMOTABLE),
432  strdup(XML_BOOLEAN_TRUE));
433  return TRUE;
434  }
435  return FALSE;
436 }
437 
438 static void
439 free_params_table(gpointer data)
440 {
441  g_hash_table_destroy((GHashTable *) data);
442 }
443 
456 GHashTable *
458 {
459  GHashTable *params_on_node = NULL;
460 
461  /* A NULL node is used to request the resource's default parameters
462  * (not evaluated for node), but we always want something non-NULL
463  * as a hash table key.
464  */
465  const char *node_name = "";
466 
467  // Sanity check
468  if ((rsc == NULL) || (data_set == NULL)) {
469  return NULL;
470  }
471  if ((node != NULL) && (node->details->uname != NULL)) {
472  node_name = node->details->uname;
473  }
474 
475  // Find the parameter table for given node
476  if (rsc->parameter_cache == NULL) {
477  rsc->parameter_cache = pcmk__strikey_table(free, free_params_table);
478  } else {
479  params_on_node = g_hash_table_lookup(rsc->parameter_cache, node_name);
480  }
481 
482  // If none exists yet, create one with parameters evaluated for node
483  if (params_on_node == NULL) {
484  params_on_node = pcmk__strkey_table(free, free);
485  get_rsc_attributes(params_on_node, rsc, node, data_set);
486  g_hash_table_insert(rsc->parameter_cache, strdup(node_name),
487  params_on_node);
488  }
489  return params_on_node;
490 }
491 
492 gboolean
493 common_unpack(xmlNode * xml_obj, pe_resource_t ** rsc,
494  pe_resource_t * parent, pe_working_set_t * data_set)
495 {
496  bool isdefault = FALSE;
497  xmlNode *expanded_xml = NULL;
498  xmlNode *ops = NULL;
499  const char *value = NULL;
500  const char *rclass = NULL; /* Look for this after any templates have been expanded */
501  const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
502  bool guest_node = FALSE;
503  bool remote_node = FALSE;
504  bool has_versioned_params = FALSE;
505 
506  pe_rule_eval_data_t rule_data = {
507  .node_hash = NULL,
508  .role = RSC_ROLE_UNKNOWN,
509  .now = data_set->now,
510  .match_data = NULL,
511  .rsc_data = NULL,
512  .op_data = NULL
513  };
514 
515  crm_log_xml_trace(xml_obj, "Processing resource input...");
516 
517  if (id == NULL) {
518  pe_err("Must specify id tag in <resource>");
519  return FALSE;
520 
521  } else if (rsc == NULL) {
522  pe_err("Nowhere to unpack resource into");
523  return FALSE;
524 
525  }
526 
527  if (unpack_template(xml_obj, &expanded_xml, data_set) == FALSE) {
528  return FALSE;
529  }
530 
531  *rsc = calloc(1, sizeof(pe_resource_t));
532  (*rsc)->cluster = data_set;
533 
534  if (expanded_xml) {
535  crm_log_xml_trace(expanded_xml, "Expanded resource...");
536  (*rsc)->xml = expanded_xml;
537  (*rsc)->orig_xml = xml_obj;
538 
539  } else {
540  (*rsc)->xml = xml_obj;
541  (*rsc)->orig_xml = NULL;
542  }
543 
544  /* Do not use xml_obj from here on, use (*rsc)->xml in case templates are involved */
545  rclass = crm_element_value((*rsc)->xml, XML_AGENT_ATTR_CLASS);
546  (*rsc)->parent = parent;
547 
548  ops = find_xml_node((*rsc)->xml, "operations", FALSE);
549  (*rsc)->ops_xml = expand_idref(ops, data_set->input);
550 
551  (*rsc)->variant = get_resource_type(crm_element_name((*rsc)->xml));
552  if ((*rsc)->variant == pe_unknown) {
553  pe_err("Unknown resource type: %s", crm_element_name((*rsc)->xml));
554  free(*rsc);
555  return FALSE;
556  }
557 
558 #if ENABLE_VERSIONED_ATTRS
559  (*rsc)->versioned_parameters = create_xml_node(NULL, XML_TAG_RSC_VER_ATTRS);
560 #endif
561 
562  (*rsc)->meta = pcmk__strkey_table(free, free);
563  (*rsc)->allowed_nodes = pcmk__strkey_table(NULL, free);
564  (*rsc)->known_on = pcmk__strkey_table(NULL, free);
565 
566  value = crm_element_value((*rsc)->xml, XML_RSC_ATTR_INCARNATION);
567  if (value) {
568  (*rsc)->id = crm_strdup_printf("%s:%s", id, value);
569  add_hash_param((*rsc)->meta, XML_RSC_ATTR_INCARNATION, value);
570 
571  } else {
572  (*rsc)->id = strdup(id);
573  }
574 
575  (*rsc)->fns = &resource_class_functions[(*rsc)->variant];
576  pe_rsc_trace((*rsc), "Unpacking resource...");
577 
578  get_meta_attributes((*rsc)->meta, *rsc, NULL, data_set);
579  (*rsc)->parameters = pe_rsc_params(*rsc, NULL, data_set); // \deprecated
580 #if ENABLE_VERSIONED_ATTRS
581  pe_get_versioned_attributes((*rsc)->versioned_parameters, *rsc, NULL, data_set);
582 #endif
583 
584  (*rsc)->flags = 0;
586 
587  if (!pcmk_is_set(data_set->flags, pe_flag_maintenance_mode)) {
589  }
590 
591  (*rsc)->rsc_cons = NULL;
592  (*rsc)->rsc_tickets = NULL;
593  (*rsc)->actions = NULL;
594  (*rsc)->role = RSC_ROLE_STOPPED;
595  (*rsc)->next_role = RSC_ROLE_UNKNOWN;
596 
597  (*rsc)->recovery_type = recovery_stop_start;
598  (*rsc)->stickiness = 0;
599  (*rsc)->migration_threshold = INFINITY;
600  (*rsc)->failure_timeout = 0;
601 
602  value = g_hash_table_lookup((*rsc)->meta, XML_CIB_ATTR_PRIORITY);
603  (*rsc)->priority = char2score(value);
604 
605  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_CRITICAL);
606  if ((value == NULL) || crm_is_true(value)) {
608  }
609 
610  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_NOTIFY);
611  if (crm_is_true(value)) {
613  }
614 
615  if (xml_contains_remote_node((*rsc)->xml)) {
616  (*rsc)->is_remote_node = TRUE;
617  if (g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_CONTAINER)) {
618  guest_node = TRUE;
619  } else {
620  remote_node = TRUE;
621  }
622  }
623 
624  value = g_hash_table_lookup((*rsc)->meta, XML_OP_ATTR_ALLOW_MIGRATE);
625 #if ENABLE_VERSIONED_ATTRS
626  has_versioned_params = xml_has_children((*rsc)->versioned_parameters);
627 #endif
628  if (crm_is_true(value) && has_versioned_params) {
629  pe_rsc_trace((*rsc), "Migration is disabled for resources with versioned parameters");
630  } else if (crm_is_true(value)) {
632  } else if ((value == NULL) && remote_node && !has_versioned_params) {
633  /* By default, we want remote nodes to be able
634  * to float around the cluster without having to stop all the
635  * resources within the remote-node before moving. Allowing
636  * migration support enables this feature. If this ever causes
637  * problems, migration support can be explicitly turned off with
638  * allow-migrate=false.
639  * We don't support migration for versioned resources, though. */
641  }
642 
643  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_MANAGED);
644  if (value != NULL && !pcmk__str_eq("default", value, pcmk__str_casei)) {
645  if (crm_is_true(value)) {
647  } else {
649  }
650  }
651 
652  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_MAINTENANCE);
653  if (crm_is_true(value)) {
656  }
657  if (pcmk_is_set(data_set->flags, pe_flag_maintenance_mode)) {
660  }
661 
662  if (pe_rsc_is_clone(uber_parent(*rsc))) {
663  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_UNIQUE);
664  if (crm_is_true(value)) {
666  }
667  if (detect_promotable(*rsc)) {
669  }
670  } else {
672  }
673 
674  pe_rsc_trace((*rsc), "Options for %s", (*rsc)->id);
675 
676  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_RESTART);
677  if (pcmk__str_eq(value, "restart", pcmk__str_casei)) {
678  (*rsc)->restart_type = pe_restart_restart;
679  pe_rsc_trace((*rsc), "\tDependency restart handling: restart");
681  "Support for restart-type is deprecated and will be removed in a future release");
682 
683  } else {
684  (*rsc)->restart_type = pe_restart_ignore;
685  pe_rsc_trace((*rsc), "\tDependency restart handling: ignore");
686  }
687 
688  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_MULTIPLE);
689  if (pcmk__str_eq(value, "stop_only", pcmk__str_casei)) {
690  (*rsc)->recovery_type = recovery_stop_only;
691  pe_rsc_trace((*rsc), "\tMultiple running resource recovery: stop only");
692 
693  } else if (pcmk__str_eq(value, "block", pcmk__str_casei)) {
694  (*rsc)->recovery_type = recovery_block;
695  pe_rsc_trace((*rsc), "\tMultiple running resource recovery: block");
696 
697  } else {
698  (*rsc)->recovery_type = recovery_stop_start;
699  pe_rsc_trace((*rsc), "\tMultiple running resource recovery: stop/start");
700  }
701 
702  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_STICKINESS);
703  if (value != NULL && !pcmk__str_eq("default", value, pcmk__str_casei)) {
704  (*rsc)->stickiness = char2score(value);
705  }
706 
707  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_FAIL_STICKINESS);
708  if (value != NULL && !pcmk__str_eq("default", value, pcmk__str_casei)) {
709  (*rsc)->migration_threshold = char2score(value);
710  if ((*rsc)->migration_threshold < 0) {
711  /* @TODO We use 1 here to preserve previous behavior, but this
712  * should probably use the default (INFINITY) or 0 (to disable)
713  * instead.
714  */
717  " must be non-negative, using 1 instead");
718  (*rsc)->migration_threshold = 1;
719  }
720  }
721 
722  if (pcmk__str_eq(rclass, PCMK_RESOURCE_CLASS_STONITH, pcmk__str_casei)) {
725  }
726 
727  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_REQUIRES);
728 
729  handle_requires_pref:
730  if (pcmk__str_eq(value, "nothing", pcmk__str_casei)) {
731 
732  } else if (pcmk__str_eq(value, "quorum", pcmk__str_casei)) {
734 
735  } else if (pcmk__str_eq(value, "unfencing", pcmk__str_casei)) {
736  if (pcmk_is_set((*rsc)->flags, pe_rsc_fence_device)) {
737  pcmk__config_warn("Resetting '" XML_RSC_ATTR_REQUIRES "' for %s "
738  "to 'quorum' because fencing devices cannot "
739  "require unfencing", (*rsc)->id);
740  value = "quorum";
741  isdefault = TRUE;
742  goto handle_requires_pref;
743 
744  } else if (!pcmk_is_set(data_set->flags, pe_flag_stonith_enabled)) {
745  pcmk__config_warn("Resetting '" XML_RSC_ATTR_REQUIRES "' for %s "
746  "to 'quorum' because fencing is disabled",
747  (*rsc)->id);
748  value = "quorum";
749  isdefault = TRUE;
750  goto handle_requires_pref;
751 
752  } else {
755  }
756 
757  } else if (pcmk__str_eq(value, "fencing", pcmk__str_casei)) {
759  if (!pcmk_is_set(data_set->flags, pe_flag_stonith_enabled)) {
760  pcmk__config_warn("%s requires fencing but fencing is disabled",
761  (*rsc)->id);
762  }
763 
764  } else {
765  const char *orig_value = value;
766 
767  isdefault = TRUE;
768  if (pcmk_is_set((*rsc)->flags, pe_rsc_fence_device)) {
769  value = "quorum";
770 
771  } else if (((*rsc)->variant == pe_native)
773  && pcmk__str_eq(crm_element_value((*rsc)->xml, XML_AGENT_ATTR_PROVIDER), "pacemaker", pcmk__str_casei)
774  && pcmk__str_eq(crm_element_value((*rsc)->xml, XML_ATTR_TYPE), "remote", pcmk__str_casei)
775  ) {
776  value = "quorum";
777 
778  } else if (pcmk_is_set(data_set->flags, pe_flag_enable_unfencing)) {
779  value = "unfencing";
780 
781  } else if (pcmk_is_set(data_set->flags, pe_flag_stonith_enabled)) {
782  value = "fencing";
783 
784  } else if (data_set->no_quorum_policy == no_quorum_ignore) {
785  value = "nothing";
786 
787  } else {
788  value = "quorum";
789  }
790 
791  if (orig_value != NULL) {
792  pcmk__config_err("Resetting '" XML_RSC_ATTR_REQUIRES "' for %s "
793  "to '%s' because '%s' is not valid",
794  (*rsc)->id, value, orig_value);
795  }
796 
797  goto handle_requires_pref;
798  }
799 
800  pe_rsc_trace((*rsc), "\tRequired to start: %s%s", value, isdefault?" (default)":"");
801  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_FAIL_TIMEOUT);
802  if (value != NULL) {
803  // Stored as seconds
804  (*rsc)->failure_timeout = (int) (crm_parse_interval_spec(value) / 1000);
805  }
806 
807  if (remote_node) {
808  GHashTable *params = pe_rsc_params(*rsc, NULL, data_set);
809 
810  /* Grabbing the value now means that any rules based on node attributes
811  * will evaluate to false, so such rules should not be used with
812  * reconnect_interval.
813  *
814  * @TODO Evaluate per node before using
815  */
816  value = g_hash_table_lookup(params, XML_REMOTE_ATTR_RECONNECT_INTERVAL);
817  if (value) {
818  /* reconnect delay works by setting failure_timeout and preventing the
819  * connection from starting until the failure is cleared. */
820  (*rsc)->remote_reconnect_ms = crm_parse_interval_spec(value);
821  /* we want to override any default failure_timeout in use when remote
822  * reconnect_interval is in use. */
823  (*rsc)->failure_timeout = (*rsc)->remote_reconnect_ms / 1000;
824  }
825  }
826 
827  get_target_role(*rsc, &((*rsc)->next_role));
828  pe_rsc_trace((*rsc), "\tDesired next state: %s",
829  (*rsc)->next_role != RSC_ROLE_UNKNOWN ? role2text((*rsc)->next_role) : "default");
830 
831  if ((*rsc)->fns->unpack(*rsc, data_set) == FALSE) {
832  return FALSE;
833  }
834 
835  if (pcmk_is_set(data_set->flags, pe_flag_symmetric_cluster)) {
836  // This tag must stay exactly the same because it is tested elsewhere
837  resource_location(*rsc, NULL, 0, "symmetric_default", data_set);
838  } else if (guest_node) {
839  /* remote resources tied to a container resource must always be allowed
840  * to opt-in to the cluster. Whether the connection resource is actually
841  * allowed to be placed on a node is dependent on the container resource */
842  resource_location(*rsc, NULL, 0, "remote_connection_default", data_set);
843  }
844 
845  pe_rsc_trace((*rsc), "\tAction notification: %s",
846  pcmk_is_set((*rsc)->flags, pe_rsc_notify)? "required" : "not required");
847 
848  (*rsc)->utilization = pcmk__strkey_table(free, free);
849 
850  pe__unpack_dataset_nvpairs((*rsc)->xml, XML_TAG_UTILIZATION, &rule_data,
851  (*rsc)->utilization, NULL, FALSE, data_set);
852 
853 /* data_set->resources = g_list_append(data_set->resources, (*rsc)); */
854 
855  if (expanded_xml) {
856  if (add_template_rsc(xml_obj, data_set) == FALSE) {
857  return FALSE;
858  }
859  }
860  return TRUE;
861 }
862 
863 void
864 common_update_score(pe_resource_t * rsc, const char *id, int score)
865 {
866  pe_node_t *node = NULL;
867 
868  node = pe_hash_table_lookup(rsc->allowed_nodes, id);
869  if (node != NULL) {
870  pe_rsc_trace(rsc, "Updating score for %s on %s: %d + %d", rsc->id, id, node->weight, score);
871  node->weight = pe__add_scores(node->weight, score);
872  }
873 
874  if (rsc->children) {
875  GList *gIter = rsc->children;
876 
877  for (; gIter != NULL; gIter = gIter->next) {
878  pe_resource_t *child_rsc = (pe_resource_t *) gIter->data;
879 
880  common_update_score(child_rsc, id, score);
881  }
882  }
883 }
884 
885 gboolean
887 {
888  pe_resource_t *parent = child;
889 
890  if (parent == NULL || rsc == NULL) {
891  return FALSE;
892  }
893  while (parent->parent != NULL) {
894  if (parent->parent == rsc) {
895  return TRUE;
896  }
897  parent = parent->parent;
898  }
899  return FALSE;
900 }
901 
904 {
905  pe_resource_t *parent = rsc;
906 
907  if (parent == NULL) {
908  return NULL;
909  }
910  while (parent->parent != NULL && parent->parent->variant != pe_container) {
911  parent = parent->parent;
912  }
913  return parent;
914 }
915 
916 void
918 {
919  if (rsc == NULL) {
920  return;
921  }
922 
923  pe_rsc_trace(rsc, "Freeing %s %d", rsc->id, rsc->variant);
924 
925  g_list_free(rsc->rsc_cons);
926  g_list_free(rsc->rsc_cons_lhs);
927  g_list_free(rsc->rsc_tickets);
928  g_list_free(rsc->dangling_migrations);
929 
930  if (rsc->parameter_cache != NULL) {
931  g_hash_table_destroy(rsc->parameter_cache);
932  }
933 #if ENABLE_VERSIONED_ATTRS
934  if (rsc->versioned_parameters != NULL) {
935  free_xml(rsc->versioned_parameters);
936  }
937 #endif
938  if (rsc->meta != NULL) {
939  g_hash_table_destroy(rsc->meta);
940  }
941  if (rsc->utilization != NULL) {
942  g_hash_table_destroy(rsc->utilization);
943  }
944 
945  if ((rsc->parent == NULL) && pcmk_is_set(rsc->flags, pe_rsc_orphan)) {
946  free_xml(rsc->xml);
947  rsc->xml = NULL;
948  free_xml(rsc->orig_xml);
949  rsc->orig_xml = NULL;
950 
951  /* if rsc->orig_xml, then rsc->xml is an expanded xml from a template */
952  } else if (rsc->orig_xml) {
953  free_xml(rsc->xml);
954  rsc->xml = NULL;
955  }
956  if (rsc->running_on) {
957  g_list_free(rsc->running_on);
958  rsc->running_on = NULL;
959  }
960  if (rsc->known_on) {
961  g_hash_table_destroy(rsc->known_on);
962  rsc->known_on = NULL;
963  }
964  if (rsc->actions) {
965  g_list_free(rsc->actions);
966  rsc->actions = NULL;
967  }
968  if (rsc->allowed_nodes) {
969  g_hash_table_destroy(rsc->allowed_nodes);
970  rsc->allowed_nodes = NULL;
971  }
972  g_list_free(rsc->fillers);
973  g_list_free(rsc->rsc_location);
974  pe_rsc_trace(rsc, "Resource freed");
975  free(rsc->id);
976  free(rsc->clone_name);
977  free(rsc->allocated_to);
978  free(rsc->variant_opaque);
979  free(rsc->pending_task);
980  free(rsc);
981 }
982 
998 pe_node_t *
999 pe__find_active_on(const pe_resource_t *rsc, unsigned int *count_all,
1000  unsigned int *count_clean)
1001 {
1002  pe_node_t *active = NULL;
1003  pe_node_t *node = NULL;
1004  bool keep_looking = FALSE;
1005  bool is_happy = FALSE;
1006 
1007  if (count_all) {
1008  *count_all = 0;
1009  }
1010  if (count_clean) {
1011  *count_clean = 0;
1012  }
1013  if (rsc == NULL) {
1014  return NULL;
1015  }
1016 
1017  for (GList *node_iter = rsc->running_on; node_iter != NULL;
1018  node_iter = node_iter->next) {
1019 
1020  node = node_iter->data;
1021  keep_looking = FALSE;
1022 
1023  is_happy = node->details->online && !node->details->unclean;
1024 
1025  if (count_all) {
1026  ++*count_all;
1027  }
1028  if (count_clean && is_happy) {
1029  ++*count_clean;
1030  }
1031  if (count_all || count_clean) {
1032  // If we're counting, we need to go through entire list
1033  keep_looking = TRUE;
1034  }
1035 
1036  if (rsc->partial_migration_source != NULL) {
1037  if (node->details == rsc->partial_migration_source->details) {
1038  // This is the migration source
1039  active = node;
1040  } else {
1041  keep_looking = TRUE;
1042  }
1043  } else if (!pcmk_is_set(rsc->flags, pe_rsc_needs_fencing)) {
1044  if (is_happy && (!active || !active->details->online
1045  || active->details->unclean)) {
1046  // This is the first clean node
1047  active = node;
1048  } else {
1049  keep_looking = TRUE;
1050  }
1051  }
1052  if (active == NULL) {
1053  // This is first node in list
1054  active = node;
1055  }
1056 
1057  if (keep_looking == FALSE) {
1058  // Don't waste time iterating if we don't have to
1059  break;
1060  }
1061  }
1062  return active;
1063 }
1064 
1078 pe_node_t *
1079 pe__find_active_requires(const pe_resource_t *rsc, unsigned int *count)
1080 {
1081  if (rsc && !pcmk_is_set(rsc->flags, pe_rsc_needs_fencing)) {
1082  return pe__find_active_on(rsc, NULL, count);
1083  }
1084  return pe__find_active_on(rsc, count, NULL);
1085 }
1086 
1087 void
1089 {
1090  if (rsc->children != NULL) {
1091  for (GList *item = rsc->children; item != NULL; item = item->next) {
1092  ((pe_resource_t *) item->data)->fns->count(item->data);
1093  }
1094 
1095  } else if (!pcmk_is_set(rsc->flags, pe_rsc_orphan)
1096  || (rsc->role > RSC_ROLE_STOPPED)) {
1097  rsc->cluster->ninstances++;
1098  if (pe__resource_is_disabled(rsc)) {
1099  rsc->cluster->disabled_resources++;
1100  }
1101  if (pcmk_is_set(rsc->flags, pe_rsc_block)) {
1102  rsc->cluster->blocked_resources++;
1103  }
1104  }
1105 }
1106 
1115 void
1116 pe__set_next_role(pe_resource_t *rsc, enum rsc_role_e role, const char *why)
1117 {
1118  CRM_ASSERT((rsc != NULL) && (why != NULL));
1119  if (rsc->next_role != role) {
1120  pe_rsc_trace(rsc, "Resetting next role for %s from %s to %s (%s)",
1121  rsc->id, role2text(rsc->next_role), role2text(role), why);
1122  rsc->next_role = role;
1123  }
1124 }
#define LOG_TRACE
Definition: logging.h:36
xmlNode * find_xml_node(xmlNode *cib, const char *node_path, gboolean must_find)
Definition: xml.c:446
#define RSC_ROLE_UNPROMOTED_S
Definition: common.h:113
xmlNode * orig_xml
Definition: pe_types.h:323
enum pe_quorum_policy no_quorum_policy
Definition: pe_types.h:149
void get_meta_attributes(GHashTable *meta_hash, pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set)
Definition: complex.c:140
GHashTable * known_on
Definition: pe_types.h:366
GHashTable * attrs
Definition: pe_types.h:234
void group_free(pe_resource_t *rsc)
Definition: group.c:345
GList * rsc_tickets
Definition: pe_types.h:359
char data[0]
Definition: cpg.c:55
#define INFINITY
Definition: crm.h:99
GList * rsc_cons
Definition: pe_types.h:356
gboolean is_parent(pe_resource_t *child, pe_resource_t *rsc)
Definition: complex.c:886
void group_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: group.c:135
#define XML_EXPR_ATTR_TYPE
Definition: msg_xml.h:342
#define XML_CIB_TAG_CONTAINER
Definition: msg_xml.h:217
pe_node_t * pe__find_active_on(const pe_resource_t *rsc, unsigned int *count_all, unsigned int *count_clean)
Definition: complex.c:999
bool pcmk__strcase_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
Definition: strings.c:929
pe_node_t * partial_migration_source
Definition: pe_types.h:364
#define XML_ATTR_TYPE
Definition: msg_xml.h:132
#define pe_rsc_runnable
Definition: pe_types.h:268
enum rsc_role_e role
Definition: pe_types.h:369
#define XML_TAG_UTILIZATION
Definition: msg_xml.h:211
#define pcmk__config_warn(fmt...)
#define RSC_ROLE_STARTED_S
Definition: common.h:112
GList * children
Definition: pe_types.h:376
void pe__free_bundle(pe_resource_t *rsc)
Definition: bundle.c:1973
#define pe_flag_symmetric_cluster
Definition: pe_types.h:95
enum rsc_role_e pe__bundle_resource_state(const pe_resource_t *rsc, gboolean current)
Definition: bundle.c:2007
xmlNode * xml
Definition: pe_types.h:322
void pe__count_common(pe_resource_t *rsc)
Definition: complex.c:1088
#define XML_RSC_ATTR_INCARNATION
Definition: msg_xml.h:225
gboolean pe__group_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: group.c:385
enum rsc_role_e next_role
Definition: pe_types.h:370
#define pe_flag_maintenance_mode
Definition: pe_types.h:96
gboolean group_active(pe_resource_t *rsc, gboolean all)
Definition: group.c:90
int char2score(const char *score)
Definition: utils.c:61
#define pcmk__config_err(fmt...)
pe_node_t * native_location(const pe_resource_t *rsc, GList **list, int current)
Definition: native.c:1052
GHashTable * meta
Definition: pe_types.h:372
#define pe_rsc_unique
Definition: pe_types.h:254
#define pe_rsc_notify
Definition: pe_types.h:253
xmlNode * pcmk__xe_match(xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
Definition: xml.c:496
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:324
#define pe_rsc_critical
Definition: pe_types.h:265
#define XML_CIB_TAG_RSC_TEMPLATE
Definition: msg_xml.h:219
#define XML_RSC_ATTR_STICKINESS
Definition: msg_xml.h:236
void resource_location(pe_resource_t *rsc, pe_node_t *node, int score, const char *tag, pe_working_set_t *data_set)
Definition: utils.c:1588
GList * rsc_cons_lhs
Definition: pe_types.h:355
pe_node_t * allocated_to
Definition: pe_types.h:362
void pe__print_bundle(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: bundle.c:1871
char * pending_task
Definition: pe_types.h:345
xmlNode * get_xpath_object(const char *xpath, xmlNode *xml_obj, int error_level)
Definition: xpath.c:214
gboolean pe__unpack_bundle(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: bundle.c:1013
void native_free(pe_resource_t *rsc)
Definition: native.c:1022
#define pe__set_resource_flags(resource, flags_to_set)
Definition: internal.h:47
void clone_free(pe_resource_t *rsc)
Definition: clone.c:1142
#define XML_CIB_ATTR_PRIORITY
Definition: msg_xml.h:272
void pe__unpack_dataset_nvpairs(xmlNode *xml_obj, const char *set_name, pe_rule_eval_data_t *rule_data, GHashTable *hash, const char *always_first, gboolean overwrite, pe_working_set_t *data_set)
Definition: utils.c:2335
xmlNode * copy_xml(xmlNode *src_node)
Definition: xml.c:829
enum rsc_role_e group_resource_state(const pe_resource_t *rsc, gboolean current)
Definition: group.c:366
#define pe_rsc_provisional
Definition: pe_types.h:258
#define XML_TAG_ATTR_SETS
Definition: msg_xml.h:203
#define XML_CIB_TAG_RESOURCES
Definition: msg_xml.h:180
#define XML_RSC_ATTR_PROMOTABLE
Definition: msg_xml.h:229
const char * role2text(enum rsc_role_e role)
Definition: common.c:459
int weight
Definition: pe_types.h:241
GList * dangling_migrations
Definition: pe_types.h:377
enum rsc_role_e clone_resource_state(const pe_resource_t *rsc, gboolean current)
Definition: clone.c:1176
#define XML_RSC_ATTR_REQUIRES
Definition: msg_xml.h:240
#define PCMK_RESOURCE_CLASS_OCF
Definition: services.h:43
gboolean pe__native_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: native.c:1339
#define pe_rsc_allow_migrate
Definition: pe_types.h:273
#define XML_RSC_ATTR_CRITICAL
Definition: msg_xml.h:250
pe_resource_t * uber_parent(pe_resource_t *rsc)
Definition: complex.c:903
#define XML_RSC_ATTR_CONTAINER
Definition: msg_xml.h:241
gboolean clone_active(pe_resource_t *rsc, gboolean all)
Definition: clone.c:261
#define XML_ATTR_ID
Definition: msg_xml.h:129
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
Definition: nvpair.c:530
#define XML_CIB_TAG_RESOURCE
Definition: msg_xml.h:214
#define XML_BOOLEAN_TRUE
Definition: msg_xml.h:140
xmlNode * rsc_defaults
Definition: pe_types.h:167
const char * crm_xml_replace(xmlNode *node, const char *name, const char *value)
Replace an XML attribute with specified name and (possibly NULL) value.
Definition: nvpair.c:381
#define pe_warn_once(pe_wo_bit, fmt...)
Definition: internal.h:154
char * native_parameter(pe_resource_t *rsc, pe_node_t *node, gboolean create, const char *name, pe_working_set_t *data_set)
Definition: native.c:323
#define RSC_ROLE_UNPROMOTED_LEGACY_S
Definition: common.h:115
bool xml_contains_remote_node(xmlNode *xml)
Definition: remote.c:84
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
Definition: util.h:114
xmlNode * add_node_copy(xmlNode *new_parent, xmlNode *xml_node)
Definition: xml.c:674
int blocked_resources
Definition: pe_types.h:182
struct pe_node_shared_s * details
Definition: pe_types.h:244
gboolean get_target_role(pe_resource_t *rsc, enum rsc_role_e *role)
Definition: utils.c:1764
xmlNode * expand_idref(xmlNode *input, xmlNode *top)
Definition: xml.c:2863
#define XML_AGENT_ATTR_PROVIDER
Definition: msg_xml.h:267
#define pe_rsc_needs_fencing
Definition: pe_types.h:280
void common_free(pe_resource_t *rsc)
Definition: complex.c:917
unsigned long long flags
Definition: pe_types.h:347
const char * uname
Definition: pe_types.h:209
#define pe_rsc_promotable
Definition: pe_types.h:256
GHashTable * pe_rsc_params(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set)
Get a table of resource parameters.
Definition: complex.c:457
#define XML_TAG_META_SETS
Definition: msg_xml.h:204
char * clone_name
Definition: pe_types.h:321
gboolean add_tag_ref(GHashTable *tags, const char *tag_name, const char *obj_ref)
Definition: utils.c:2178
#define XML_RSC_ATTR_MANAGED
Definition: msg_xml.h:232
xmlNode * create_xml_node(xmlNode *parent, const char *name)
Definition: xml.c:696
#define pe_flag_stonith_enabled
Definition: pe_types.h:98
enum rsc_role_e native_resource_state(const pe_resource_t *rsc, gboolean current)
Definition: native.c:1029
GList * actions
Definition: pe_types.h:358
void clone_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: clone.c:394
GHashTable * utilization
Definition: pe_types.h:374
void native_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: native.c:878
gboolean pe__bundle_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: bundle.c:2058
#define XML_TAG_RSC_VER_ATTRS
Definition: msg_xml.h:206
void free_xml(xmlNode *child)
Definition: xml.c:823
enum pe_obj_types variant
Definition: pe_types.h:329
gboolean xml_has_children(const xmlNode *root)
Definition: xml.c:2027
xmlNode * input
Definition: pe_types.h:137
void common_update_score(pe_resource_t *rsc, const char *id, int score)
Definition: complex.c:864
#define XML_REMOTE_ATTR_RECONNECT_INTERVAL
Definition: msg_xml.h:252
#define XML_RSC_ATTR_NOTIFY
Definition: msg_xml.h:235
#define XML_RSC_ATTR_FAIL_STICKINESS
Definition: msg_xml.h:237
resource_object_functions_t resource_class_functions[]
Definition: complex.c:19
gboolean native_active(pe_resource_t *rsc, gboolean all)
Definition: native.c:347
void populate_hash(xmlNode *nvpair_list, GHashTable *hash, const char **attrs, int attrs_length)
#define pe_rsc_fence_device
Definition: pe_types.h:255
#define XML_RSC_ATTR_UNIQUE
Definition: msg_xml.h:234
GList * fillers
Definition: pe_types.h:380
#define PCMK_RESOURCE_CLASS_STONITH
Definition: services.h:49
void get_rsc_attributes(GHashTable *meta_hash, pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set)
Definition: complex.c:190
pe_resource_t * native_find_rsc(pe_resource_t *rsc, const char *id, const pe_node_t *node, int flags)
Definition: native.c:267
#define XML_CIB_TAG_INCARNATION
Definition: msg_xml.h:216
const char * standard
Definition: common.h:173
GHashTable * pcmk__strkey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
Definition: strings.c:610
#define XML_RSC_ATTR_MAINTENANCE
Definition: msg_xml.h:243
#define XML_RSC_ATTR_FAIL_TIMEOUT
Definition: msg_xml.h:238
void add_hash_param(GHashTable *hash, const char *name, const char *value)
Definition: common.c:579
void * variant_opaque
Definition: pe_types.h:330
int pe__add_scores(int score1, int score2)
Definition: common.c:516
#define CRM_ASSERT(expr)
Definition: results.h:42
gboolean clone_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: clone.c:120
GHashTable * node_hash
Definition: common.h:184
char guint crm_parse_interval_spec(const char *input)
Parse milliseconds from a Pacemaker interval specification.
Definition: utils.c:314
int disabled_resources
Definition: pe_types.h:183
void pe__set_next_role(pe_resource_t *rsc, enum rsc_role_e role, const char *why)
Definition: complex.c:1116
#define PCMK_XE_PROMOTABLE_LEGACY
Definition: msg_xml.h:33
GList * rsc_location
Definition: pe_types.h:357
#define pe_rsc_needs_unfencing
Definition: pe_types.h:281
#define XML_RSC_ATTR_MULTIPLE
Definition: msg_xml.h:239
#define pe__clear_resource_flags(resource, flags_to_clear)
Definition: internal.h:53
#define pe__set_working_set_flags(working_set, flags_to_set)
Definition: internal.h:35
rsc_role_e
Possible roles that a resource can be in.
Definition: common.h:92
GList * running_on
Definition: pe_types.h:365
#define pe_rsc_block
Definition: pe_types.h:250
#define pe_rsc_maintenance
Definition: pe_types.h:276
#define XML_RSC_ATTR_RESTART
Definition: msg_xml.h:222
pe_working_set_t * cluster
Definition: pe_types.h:326
#define RSC_ROLE_UNKNOWN_S
Definition: common.h:110
#define pe_rsc_needs_quorum
Definition: pe_types.h:279
#define crm_log_xml_trace(xml, text)
Definition: logging.h:364
GHashTable * parameter_cache
Definition: pe_types.h:391
gboolean common_unpack(xmlNode *xml_obj, pe_resource_t **rsc, pe_resource_t *parent, pe_working_set_t *data_set)
Definition: complex.c:493
gboolean crm_is_true(const char *s)
Definition: strings.c:415
#define pe_flag_have_stonith_resource
Definition: pe_types.h:99
#define XML_CIB_TAG_GROUP
Definition: msg_xml.h:215
#define pe_flag_enable_unfencing
Definition: pe_types.h:100
#define pe_rsc_trace(rsc, fmt, args...)
Definition: internal.h:20
pe_node_t * pe__find_active_requires(const pe_resource_t *rsc, unsigned int *count)
Definition: complex.c:1079
bool pe__resource_is_disabled(pe_resource_t *rsc)
Definition: utils.c:2353
unsigned long long flags
Definition: pe_types.h:146
#define ID(x)
Definition: msg_xml.h:456
#define pe_err(fmt...)
Definition: internal.h:22
char * name
Definition: pcmk_fence.c:31
gboolean native_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: native.c:197
gboolean unclean
Definition: pe_types.h:217
gboolean pe__clone_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: clone.c:1217
crm_time_t * now
Definition: pe_types.h:138
#define pe_rsc_managed
Definition: pe_types.h:249
#define pe_rsc_orphan
Definition: pe_types.h:248
GHashTable * template_rsc_sets
Definition: pe_types.h:178
void pe__count_bundle(pe_resource_t *rsc)
Definition: bundle.c:2034
gboolean online
Definition: pe_types.h:213
#define XML_OP_ATTR_ALLOW_MIGRATE
Definition: msg_xml.h:256
pe_resource_t * parent
Definition: pe_types.h:327
pe_obj_types
Definition: pe_types.h:35
gboolean pe__bundle_active(pe_resource_t *rsc, gboolean all)
Definition: bundle.c:1338
GHashTable * pcmk__strikey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
Definition: strings.c:648
#define XML_AGENT_ATTR_CLASS
Definition: msg_xml.h:266
char * id
Definition: pe_types.h:320
GHashTable * allowed_nodes
Definition: pe_types.h:367
gboolean group_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: group.c:23