pacemaker  2.0.3-4b1f869f0f
Scalable High-Availability cluster resource manager
complex.c
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2019 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>
15 
16 #include <unpack.h>
17 
18 void populate_hash(xmlNode * nvpair_list, GHashTable * hash, const char **attrs, int attrs_length);
19 
21  {
31  },
32  {
40  group_free,
42  },
43  {
51  clone_free,
53  },
54  {
64  }
65 };
66 
67 static enum pe_obj_types
68 get_resource_type(const char *name)
69 {
70  if (safe_str_eq(name, XML_CIB_TAG_RESOURCE)) {
71  return pe_native;
72 
73  } else if (safe_str_eq(name, XML_CIB_TAG_GROUP)) {
74  return pe_group;
75 
76  } else if (safe_str_eq(name, XML_CIB_TAG_INCARNATION)) {
77  return pe_clone;
78 
79  } else if (safe_str_eq(name, XML_CIB_TAG_MASTER)) {
80  // @COMPAT deprecated since 2.0.0
81  return pe_clone;
82 
83  } else if (safe_str_eq(name, XML_CIB_TAG_CONTAINER)) {
84  return pe_container;
85  }
86 
87  return pe_unknown;
88 }
89 
90 static void
91 dup_attr(gpointer key, gpointer value, gpointer user_data)
92 {
93  add_hash_param(user_data, key, value);
94 }
95 
96 void
97 get_meta_attributes(GHashTable * meta_hash, resource_t * rsc,
98  node_t * node, pe_working_set_t * data_set)
99 {
100  GHashTable *node_hash = NULL;
101 
102  if (node) {
103  node_hash = node->details->attrs;
104  }
105 
106  if (rsc->xml) {
107  xmlAttrPtr xIter = NULL;
108 
109  for (xIter = rsc->xml->properties; xIter; xIter = xIter->next) {
110  const char *prop_name = (const char *)xIter->name;
111  const char *prop_value = crm_element_value(rsc->xml, prop_name);
112 
113  add_hash_param(meta_hash, prop_name, prop_value);
114  }
115  }
116 
118  meta_hash, NULL, FALSE, data_set);
119 
120  /* set anything else based on the parent */
121  if (rsc->parent != NULL) {
122  g_hash_table_foreach(rsc->parent->meta, dup_attr, meta_hash);
123  }
124 
125  /* and finally check the defaults */
127  node_hash, meta_hash, NULL, FALSE, data_set);
128 }
129 
130 void
131 get_rsc_attributes(GHashTable * meta_hash, resource_t * rsc,
132  node_t * node, pe_working_set_t * data_set)
133 {
134  GHashTable *node_hash = NULL;
135 
136  if (node) {
137  node_hash = node->details->attrs;
138  }
139 
141  meta_hash, NULL, FALSE, data_set);
142 
143  /* set anything else based on the parent */
144  if (rsc->parent != NULL) {
145  get_rsc_attributes(meta_hash, rsc->parent, node, data_set);
146 
147  } else {
148  /* and finally check the defaults */
150  node_hash, meta_hash, NULL, FALSE, data_set);
151  }
152 }
153 
154 #if ENABLE_VERSIONED_ATTRS
155 void
156 pe_get_versioned_attributes(xmlNode * meta_hash, resource_t * rsc,
157  node_t * node, pe_working_set_t * data_set)
158 {
159  GHashTable *node_hash = NULL;
160 
161  if (node) {
162  node_hash = node->details->attrs;
163  }
164 
165  pe_unpack_versioned_attributes(data_set->input, rsc->xml, XML_TAG_ATTR_SETS, node_hash,
166  meta_hash, data_set->now, NULL);
167 
168  /* set anything else based on the parent */
169  if (rsc->parent != NULL) {
170  pe_get_versioned_attributes(meta_hash, rsc->parent, node, data_set);
171 
172  } else {
173  /* and finally check the defaults */
174  pe_unpack_versioned_attributes(data_set->input, data_set->rsc_defaults, XML_TAG_ATTR_SETS,
175  node_hash, meta_hash, data_set->now, NULL);
176  }
177 }
178 #endif
179 
180 static char *
181 template_op_key(xmlNode * op)
182 {
183  const char *name = crm_element_value(op, "name");
184  const char *role = crm_element_value(op, "role");
185  char *key = NULL;
186 
187  if (role == NULL || crm_str_eq(role, RSC_ROLE_STARTED_S, TRUE)
188  || crm_str_eq(role, RSC_ROLE_SLAVE_S, TRUE)) {
189  role = RSC_ROLE_UNKNOWN_S;
190  }
191 
192  key = crm_concat(name, role, '-');
193  return key;
194 }
195 
196 static gboolean
197 unpack_template(xmlNode * xml_obj, xmlNode ** expanded_xml, pe_working_set_t * data_set)
198 {
199  xmlNode *cib_resources = NULL;
200  xmlNode *template = NULL;
201  xmlNode *new_xml = NULL;
202  xmlNode *child_xml = NULL;
203  xmlNode *rsc_ops = NULL;
204  xmlNode *template_ops = NULL;
205  const char *template_ref = NULL;
206  const char *clone = NULL;
207  const char *id = NULL;
208 
209  if (xml_obj == NULL) {
210  pe_err("No resource object for template unpacking");
211  return FALSE;
212  }
213 
214  template_ref = crm_element_value(xml_obj, XML_CIB_TAG_RSC_TEMPLATE);
215  if (template_ref == NULL) {
216  return TRUE;
217  }
218 
219  id = ID(xml_obj);
220  if (id == NULL) {
221  pe_err("'%s' object must have a id", crm_element_name(xml_obj));
222  return FALSE;
223  }
224 
225  if (crm_str_eq(template_ref, id, TRUE)) {
226  pe_err("The resource object '%s' should not reference itself", id);
227  return FALSE;
228  }
229 
230  cib_resources = get_xpath_object("//"XML_CIB_TAG_RESOURCES, data_set->input, LOG_TRACE);
231  if (cib_resources == NULL) {
232  pe_err("No resources configured");
233  return FALSE;
234  }
235 
236  template = find_entity(cib_resources, XML_CIB_TAG_RSC_TEMPLATE, template_ref);
237  if (template == NULL) {
238  pe_err("No template named '%s'", template_ref);
239  return FALSE;
240  }
241 
242  new_xml = copy_xml(template);
243  xmlNodeSetName(new_xml, xml_obj->name);
244  crm_xml_replace(new_xml, XML_ATTR_ID, id);
245 
247  if(clone) {
248  crm_xml_add(new_xml, XML_RSC_ATTR_INCARNATION, clone);
249  }
250 
251  template_ops = find_xml_node(new_xml, "operations", FALSE);
252 
253  for (child_xml = __xml_first_child_element(xml_obj); child_xml != NULL;
254  child_xml = __xml_next_element(child_xml)) {
255  xmlNode *new_child = NULL;
256 
257  new_child = add_node_copy(new_xml, child_xml);
258 
259  if (crm_str_eq((const char *)new_child->name, "operations", TRUE)) {
260  rsc_ops = new_child;
261  }
262  }
263 
264  if (template_ops && rsc_ops) {
265  xmlNode *op = NULL;
266  GHashTable *rsc_ops_hash = g_hash_table_new_full(crm_str_hash,
267  g_str_equal, free,
268  NULL);
269 
270  for (op = __xml_first_child_element(rsc_ops); op != NULL;
271  op = __xml_next_element(op)) {
272 
273  char *key = template_op_key(op);
274 
275  g_hash_table_insert(rsc_ops_hash, key, op);
276  }
277 
278  for (op = __xml_first_child_element(template_ops); op != NULL;
279  op = __xml_next_element(op)) {
280 
281  char *key = template_op_key(op);
282 
283  if (g_hash_table_lookup(rsc_ops_hash, key) == NULL) {
284  add_node_copy(rsc_ops, op);
285  }
286 
287  free(key);
288  }
289 
290  if (rsc_ops_hash) {
291  g_hash_table_destroy(rsc_ops_hash);
292  }
293 
294  free_xml(template_ops);
295  }
296 
297  /*free_xml(*expanded_xml); */
298  *expanded_xml = new_xml;
299 
300  /* Disable multi-level templates for now */
301  /*if(unpack_template(new_xml, expanded_xml, data_set) == FALSE) {
302  free_xml(*expanded_xml);
303  *expanded_xml = NULL;
304 
305  return FALSE;
306  } */
307 
308  return TRUE;
309 }
310 
311 static gboolean
312 add_template_rsc(xmlNode * xml_obj, pe_working_set_t * data_set)
313 {
314  const char *template_ref = NULL;
315  const char *id = NULL;
316 
317  if (xml_obj == NULL) {
318  pe_err("No resource object for processing resource list of template");
319  return FALSE;
320  }
321 
322  template_ref = crm_element_value(xml_obj, XML_CIB_TAG_RSC_TEMPLATE);
323  if (template_ref == NULL) {
324  return TRUE;
325  }
326 
327  id = ID(xml_obj);
328  if (id == NULL) {
329  pe_err("'%s' object must have a id", crm_element_name(xml_obj));
330  return FALSE;
331  }
332 
333  if (crm_str_eq(template_ref, id, TRUE)) {
334  pe_err("The resource object '%s' should not reference itself", id);
335  return FALSE;
336  }
337 
338  if (add_tag_ref(data_set->template_rsc_sets, template_ref, id) == FALSE) {
339  return FALSE;
340  }
341 
342  return TRUE;
343 }
344 
345 static bool
346 detect_promotable(resource_t *rsc)
347 {
348  const char *promotable = g_hash_table_lookup(rsc->meta,
350 
351  if (crm_is_true(promotable)) {
352  return TRUE;
353  }
354 
355  // @COMPAT deprecated since 2.0.0
356  if (safe_str_eq(crm_element_name(rsc->xml), XML_CIB_TAG_MASTER)) {
357  /* @TODO in some future version, pe_warn_once() here,
358  * then drop support in even later version
359  */
360  g_hash_table_insert(rsc->meta, strdup(XML_RSC_ATTR_PROMOTABLE),
361  strdup(XML_BOOLEAN_TRUE));
362  return TRUE;
363  }
364  return FALSE;
365 }
366 
367 gboolean
368 common_unpack(xmlNode * xml_obj, resource_t ** rsc,
369  resource_t * parent, pe_working_set_t * data_set)
370 {
371  bool isdefault = FALSE;
372  xmlNode *expanded_xml = NULL;
373  xmlNode *ops = NULL;
374  const char *value = NULL;
375  const char *rclass = NULL; /* Look for this after any templates have been expanded */
376  const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
377  bool guest_node = FALSE;
378  bool remote_node = FALSE;
379  bool has_versioned_params = FALSE;
380 
381  crm_log_xml_trace(xml_obj, "Processing resource input...");
382 
383  if (id == NULL) {
384  pe_err("Must specify id tag in <resource>");
385  return FALSE;
386 
387  } else if (rsc == NULL) {
388  pe_err("Nowhere to unpack resource into");
389  return FALSE;
390 
391  }
392 
393  if (unpack_template(xml_obj, &expanded_xml, data_set) == FALSE) {
394  return FALSE;
395  }
396 
397  *rsc = calloc(1, sizeof(resource_t));
398  (*rsc)->cluster = data_set;
399 
400  if (expanded_xml) {
401  crm_log_xml_trace(expanded_xml, "Expanded resource...");
402  (*rsc)->xml = expanded_xml;
403  (*rsc)->orig_xml = xml_obj;
404 
405  } else {
406  (*rsc)->xml = xml_obj;
407  (*rsc)->orig_xml = NULL;
408  }
409 
410  /* Do not use xml_obj from here on, use (*rsc)->xml in case templates are involved */
411  rclass = crm_element_value((*rsc)->xml, XML_AGENT_ATTR_CLASS);
412  (*rsc)->parent = parent;
413 
414  ops = find_xml_node((*rsc)->xml, "operations", FALSE);
415  (*rsc)->ops_xml = expand_idref(ops, data_set->input);
416 
417  (*rsc)->variant = get_resource_type(crm_element_name((*rsc)->xml));
418  if ((*rsc)->variant == pe_unknown) {
419  pe_err("Unknown resource type: %s", crm_element_name((*rsc)->xml));
420  free(*rsc);
421  return FALSE;
422  }
423 
424  (*rsc)->parameters = crm_str_table_new();
425 
426 #if ENABLE_VERSIONED_ATTRS
427  (*rsc)->versioned_parameters = create_xml_node(NULL, XML_TAG_RSC_VER_ATTRS);
428 #endif
429 
430  (*rsc)->meta = crm_str_table_new();
431 
432  (*rsc)->allowed_nodes =
433  g_hash_table_new_full(crm_str_hash, g_str_equal, NULL, free);
434 
435  (*rsc)->known_on = g_hash_table_new_full(crm_str_hash, g_str_equal, NULL,
436  free);
437 
438  value = crm_element_value((*rsc)->xml, XML_RSC_ATTR_INCARNATION);
439  if (value) {
440  (*rsc)->id = crm_concat(id, value, ':');
441  add_hash_param((*rsc)->meta, XML_RSC_ATTR_INCARNATION, value);
442 
443  } else {
444  (*rsc)->id = strdup(id);
445  }
446 
447  (*rsc)->fns = &resource_class_functions[(*rsc)->variant];
448  pe_rsc_trace((*rsc), "Unpacking resource...");
449 
450  get_meta_attributes((*rsc)->meta, *rsc, NULL, data_set);
451  get_rsc_attributes((*rsc)->parameters, *rsc, NULL, data_set);
452 #if ENABLE_VERSIONED_ATTRS
453  pe_get_versioned_attributes((*rsc)->versioned_parameters, *rsc, NULL, data_set);
454 #endif
455 
456  (*rsc)->flags = 0;
457  set_bit((*rsc)->flags, pe_rsc_runnable);
458  set_bit((*rsc)->flags, pe_rsc_provisional);
459 
460  if (is_not_set(data_set->flags, pe_flag_maintenance_mode)) {
461  set_bit((*rsc)->flags, pe_rsc_managed);
462  }
463 
464  (*rsc)->rsc_cons = NULL;
465  (*rsc)->rsc_tickets = NULL;
466  (*rsc)->actions = NULL;
467  (*rsc)->role = RSC_ROLE_STOPPED;
468  (*rsc)->next_role = RSC_ROLE_UNKNOWN;
469 
470  (*rsc)->recovery_type = recovery_stop_start;
471  (*rsc)->stickiness = 0;
472  (*rsc)->migration_threshold = INFINITY;
473  (*rsc)->failure_timeout = 0;
474 
475  value = g_hash_table_lookup((*rsc)->meta, XML_CIB_ATTR_PRIORITY);
476  (*rsc)->priority = crm_parse_int(value, "0");
477 
478  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_NOTIFY);
479  if (crm_is_true(value)) {
480  set_bit((*rsc)->flags, pe_rsc_notify);
481  }
482 
483  if (xml_contains_remote_node((*rsc)->xml)) {
484  (*rsc)->is_remote_node = TRUE;
485  if (g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_CONTAINER)) {
486  guest_node = TRUE;
487  } else {
488  remote_node = TRUE;
489  }
490  }
491 
492  value = g_hash_table_lookup((*rsc)->meta, XML_OP_ATTR_ALLOW_MIGRATE);
493 #if ENABLE_VERSIONED_ATTRS
494  has_versioned_params = xml_has_children((*rsc)->versioned_parameters);
495 #endif
496  if (crm_is_true(value) && has_versioned_params) {
497  pe_rsc_trace((*rsc), "Migration is disabled for resources with versioned parameters");
498  } else if (crm_is_true(value)) {
499  set_bit((*rsc)->flags, pe_rsc_allow_migrate);
500  } else if ((value == NULL) && remote_node && !has_versioned_params) {
501  /* By default, we want remote nodes to be able
502  * to float around the cluster without having to stop all the
503  * resources within the remote-node before moving. Allowing
504  * migration support enables this feature. If this ever causes
505  * problems, migration support can be explicitly turned off with
506  * allow-migrate=false.
507  * We don't support migration for versioned resources, though. */
508  set_bit((*rsc)->flags, pe_rsc_allow_migrate);
509  }
510 
511  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_MANAGED);
512  if (value != NULL && safe_str_neq("default", value)) {
513  gboolean bool_value = TRUE;
514 
515  crm_str_to_boolean(value, &bool_value);
516  if (bool_value == FALSE) {
517  clear_bit((*rsc)->flags, pe_rsc_managed);
518  } else {
519  set_bit((*rsc)->flags, pe_rsc_managed);
520  }
521  }
522 
523  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_MAINTENANCE);
524  if (value != NULL && safe_str_neq("default", value)) {
525  gboolean bool_value = FALSE;
526 
527  crm_str_to_boolean(value, &bool_value);
528  if (bool_value == TRUE) {
529  clear_bit((*rsc)->flags, pe_rsc_managed);
530  set_bit((*rsc)->flags, pe_rsc_maintenance);
531  }
532 
533  } else if (is_set(data_set->flags, pe_flag_maintenance_mode)) {
534  clear_bit((*rsc)->flags, pe_rsc_managed);
535  set_bit((*rsc)->flags, pe_rsc_maintenance);
536  }
537 
538  if (pe_rsc_is_clone(uber_parent(*rsc))) {
539  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_UNIQUE);
540  if (crm_is_true(value)) {
541  set_bit((*rsc)->flags, pe_rsc_unique);
542  }
543  if (detect_promotable(*rsc)) {
544  set_bit((*rsc)->flags, pe_rsc_promotable);
545  }
546  } else {
547  set_bit((*rsc)->flags, pe_rsc_unique);
548  }
549 
550  pe_rsc_trace((*rsc), "Options for %s", (*rsc)->id);
551 
552  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_RESTART);
553  if (safe_str_eq(value, "restart")) {
554  (*rsc)->restart_type = pe_restart_restart;
555  pe_rsc_trace((*rsc), "\tDependency restart handling: restart");
557  "Support for restart-type is deprecated and will be removed in a future release");
558 
559  } else {
560  (*rsc)->restart_type = pe_restart_ignore;
561  pe_rsc_trace((*rsc), "\tDependency restart handling: ignore");
562  }
563 
564  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_MULTIPLE);
565  if (safe_str_eq(value, "stop_only")) {
566  (*rsc)->recovery_type = recovery_stop_only;
567  pe_rsc_trace((*rsc), "\tMultiple running resource recovery: stop only");
568 
569  } else if (safe_str_eq(value, "block")) {
570  (*rsc)->recovery_type = recovery_block;
571  pe_rsc_trace((*rsc), "\tMultiple running resource recovery: block");
572 
573  } else {
574  (*rsc)->recovery_type = recovery_stop_start;
575  pe_rsc_trace((*rsc), "\tMultiple running resource recovery: stop/start");
576  }
577 
578  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_STICKINESS);
579  if (value != NULL && safe_str_neq("default", value)) {
580  (*rsc)->stickiness = char2score(value);
581  }
582 
583  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_FAIL_STICKINESS);
584  if (value != NULL && safe_str_neq("default", value)) {
585  (*rsc)->migration_threshold = char2score(value);
586  if ((*rsc)->migration_threshold < 0) {
587  /* @TODO We use 1 here to preserve previous behavior, but this
588  * should probably use the default (INFINITY) or 0 (to disable)
589  * instead.
590  */
593  " must be non-negative, using 1 instead");
594  (*rsc)->migration_threshold = 1;
595  }
596  }
597 
600  set_bit((*rsc)->flags, pe_rsc_fence_device);
601  }
602 
603  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_REQUIRES);
604 
605  handle_requires_pref:
606  if (safe_str_eq(value, "nothing")) {
607 
608  } else if (safe_str_eq(value, "quorum")) {
609  set_bit((*rsc)->flags, pe_rsc_needs_quorum);
610 
611  } else if (safe_str_eq(value, "unfencing")) {
612  if (is_set((*rsc)->flags, pe_rsc_fence_device)) {
613  crm_config_warn("%s is a fencing device but requires (un)fencing", (*rsc)->id);
614  value = "quorum";
615  isdefault = TRUE;
616  goto handle_requires_pref;
617 
618  } else if (is_not_set(data_set->flags, pe_flag_stonith_enabled)) {
619  crm_config_warn("%s requires (un)fencing but fencing is disabled", (*rsc)->id);
620  value = "quorum";
621  isdefault = TRUE;
622  goto handle_requires_pref;
623 
624  } else {
625  set_bit((*rsc)->flags, pe_rsc_needs_fencing);
626  set_bit((*rsc)->flags, pe_rsc_needs_unfencing);
627  }
628 
629  } else if (safe_str_eq(value, "fencing")) {
630  set_bit((*rsc)->flags, pe_rsc_needs_fencing);
631  if (is_not_set(data_set->flags, pe_flag_stonith_enabled)) {
632  crm_config_warn("%s requires fencing but fencing is disabled", (*rsc)->id);
633  }
634 
635  } else {
636  if (value) {
637  crm_config_err("Invalid value for %s->requires: %s%s",
638  (*rsc)->id, value,
639  is_set(data_set->flags, pe_flag_stonith_enabled) ? "" : " (stonith-enabled=false)");
640  }
641 
642  isdefault = TRUE;
643  if(is_set((*rsc)->flags, pe_rsc_fence_device)) {
644  value = "quorum";
645 
646  } else if (((*rsc)->variant == pe_native)
649  && safe_str_eq(crm_element_value((*rsc)->xml, XML_AGENT_ATTR_PROVIDER), "pacemaker")
650  && safe_str_eq(crm_element_value((*rsc)->xml, XML_ATTR_TYPE), "remote")
651  ) {
652  value = "quorum";
653 
654  } else if (is_set(data_set->flags, pe_flag_enable_unfencing)) {
655  value = "unfencing";
656 
657  } else if (is_set(data_set->flags, pe_flag_stonith_enabled)) {
658  value = "fencing";
659 
660  } else if (data_set->no_quorum_policy == no_quorum_ignore) {
661  value = "nothing";
662 
663  } else {
664  value = "quorum";
665  }
666  goto handle_requires_pref;
667  }
668 
669  pe_rsc_trace((*rsc), "\tRequired to start: %s%s", value, isdefault?" (default)":"");
670  value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_FAIL_TIMEOUT);
671  if (value != NULL) {
672  // Stored as seconds
673  (*rsc)->failure_timeout = (int) (crm_parse_interval_spec(value) / 1000);
674  }
675 
676  if (remote_node) {
677  value = g_hash_table_lookup((*rsc)->parameters, XML_REMOTE_ATTR_RECONNECT_INTERVAL);
678  if (value) {
679  /* reconnect delay works by setting failure_timeout and preventing the
680  * connection from starting until the failure is cleared. */
681  (*rsc)->remote_reconnect_ms = crm_parse_interval_spec(value);
682  /* we want to override any default failure_timeout in use when remote
683  * reconnect_interval is in use. */
684  (*rsc)->failure_timeout = (*rsc)->remote_reconnect_ms / 1000;
685  }
686  }
687 
688  get_target_role(*rsc, &((*rsc)->next_role));
689  pe_rsc_trace((*rsc), "\tDesired next state: %s",
690  (*rsc)->next_role != RSC_ROLE_UNKNOWN ? role2text((*rsc)->next_role) : "default");
691 
692  if ((*rsc)->fns->unpack(*rsc, data_set) == FALSE) {
693  return FALSE;
694  }
695 
696  if (is_set(data_set->flags, pe_flag_symmetric_cluster)) {
697  // This tag must stay exactly the same because it is tested elsewhere
698  resource_location(*rsc, NULL, 0, "symmetric_default", data_set);
699  } else if (guest_node) {
700  /* remote resources tied to a container resource must always be allowed
701  * to opt-in to the cluster. Whether the connection resource is actually
702  * allowed to be placed on a node is dependent on the container resource */
703  resource_location(*rsc, NULL, 0, "remote_connection_default", data_set);
704  }
705 
706  pe_rsc_trace((*rsc), "\tAction notification: %s",
707  is_set((*rsc)->flags, pe_rsc_notify) ? "required" : "not required");
708 
709  (*rsc)->utilization = crm_str_table_new();
710 
712  (*rsc)->utilization, NULL, FALSE, data_set);
713 
714 /* data_set->resources = g_list_append(data_set->resources, (*rsc)); */
715 
716  if (expanded_xml) {
717  if (add_template_rsc(xml_obj, data_set) == FALSE) {
718  return FALSE;
719  }
720  }
721  return TRUE;
722 }
723 
724 void
725 common_update_score(resource_t * rsc, const char *id, int score)
726 {
727  node_t *node = NULL;
728 
729  node = pe_hash_table_lookup(rsc->allowed_nodes, id);
730  if (node != NULL) {
731  pe_rsc_trace(rsc, "Updating score for %s on %s: %d + %d", rsc->id, id, node->weight, score);
732  node->weight = merge_weights(node->weight, score);
733  }
734 
735  if (rsc->children) {
736  GListPtr gIter = rsc->children;
737 
738  for (; gIter != NULL; gIter = gIter->next) {
739  resource_t *child_rsc = (resource_t *) gIter->data;
740 
741  common_update_score(child_rsc, id, score);
742  }
743  }
744 }
745 
746 gboolean
748 {
749  resource_t *parent = child;
750 
751  if (parent == NULL || rsc == NULL) {
752  return FALSE;
753  }
754  while (parent->parent != NULL) {
755  if (parent->parent == rsc) {
756  return TRUE;
757  }
758  parent = parent->parent;
759  }
760  return FALSE;
761 }
762 
763 resource_t *
765 {
766  resource_t *parent = rsc;
767 
768  if (parent == NULL) {
769  return NULL;
770  }
771  while (parent->parent != NULL && parent->parent->variant != pe_container) {
772  parent = parent->parent;
773  }
774  return parent;
775 }
776 
777 void
779 {
780  if (rsc == NULL) {
781  return;
782  }
783 
784  pe_rsc_trace(rsc, "Freeing %s %d", rsc->id, rsc->variant);
785 
786  g_list_free(rsc->rsc_cons);
787  g_list_free(rsc->rsc_cons_lhs);
788  g_list_free(rsc->rsc_tickets);
789  g_list_free(rsc->dangling_migrations);
790 
791  if (rsc->parameters != NULL) {
792  g_hash_table_destroy(rsc->parameters);
793  }
794 #if ENABLE_VERSIONED_ATTRS
795  if (rsc->versioned_parameters != NULL) {
796  free_xml(rsc->versioned_parameters);
797  }
798 #endif
799  if (rsc->meta != NULL) {
800  g_hash_table_destroy(rsc->meta);
801  }
802  if (rsc->utilization != NULL) {
803  g_hash_table_destroy(rsc->utilization);
804  }
805 
806  if (rsc->parent == NULL && is_set(rsc->flags, pe_rsc_orphan)) {
807  free_xml(rsc->xml);
808  rsc->xml = NULL;
809  free_xml(rsc->orig_xml);
810  rsc->orig_xml = NULL;
811 
812  /* if rsc->orig_xml, then rsc->xml is an expanded xml from a template */
813  } else if (rsc->orig_xml) {
814  free_xml(rsc->xml);
815  rsc->xml = NULL;
816  }
817  if (rsc->running_on) {
818  g_list_free(rsc->running_on);
819  rsc->running_on = NULL;
820  }
821  if (rsc->known_on) {
822  g_hash_table_destroy(rsc->known_on);
823  rsc->known_on = NULL;
824  }
825  if (rsc->actions) {
826  g_list_free(rsc->actions);
827  rsc->actions = NULL;
828  }
829  if (rsc->allowed_nodes) {
830  g_hash_table_destroy(rsc->allowed_nodes);
831  rsc->allowed_nodes = NULL;
832  }
833  g_list_free(rsc->fillers);
834  g_list_free(rsc->rsc_location);
835  pe_rsc_trace(rsc, "Resource freed");
836  free(rsc->id);
837  free(rsc->clone_name);
838  free(rsc->allocated_to);
839  free(rsc->variant_opaque);
840  free(rsc->pending_task);
841  free(rsc);
842 }
843 
859 pe_node_t *
860 pe__find_active_on(const pe_resource_t *rsc, unsigned int *count_all,
861  unsigned int *count_clean)
862 {
863  pe_node_t *active = NULL;
864  pe_node_t *node = NULL;
865  bool keep_looking = FALSE;
866  bool is_happy = FALSE;
867 
868  if (count_all) {
869  *count_all = 0;
870  }
871  if (count_clean) {
872  *count_clean = 0;
873  }
874  if (rsc == NULL) {
875  return NULL;
876  }
877 
878  for (GList *node_iter = rsc->running_on; node_iter != NULL;
879  node_iter = node_iter->next) {
880 
881  node = node_iter->data;
882  keep_looking = FALSE;
883 
884  is_happy = node->details->online && !node->details->unclean;
885 
886  if (count_all) {
887  ++*count_all;
888  }
889  if (count_clean && is_happy) {
890  ++*count_clean;
891  }
892  if (count_all || count_clean) {
893  // If we're counting, we need to go through entire list
894  keep_looking = TRUE;
895  }
896 
897  if (rsc->partial_migration_source != NULL) {
898  if (node->details == rsc->partial_migration_source->details) {
899  // This is the migration source
900  active = node;
901  } else {
902  keep_looking = TRUE;
903  }
904  } else if (is_not_set(rsc->flags, pe_rsc_needs_fencing)) {
905  if (is_happy && (!active || !active->details->online
906  || active->details->unclean)) {
907  // This is the first clean node
908  active = node;
909  } else {
910  keep_looking = TRUE;
911  }
912  }
913  if (active == NULL) {
914  // This is first node in list
915  active = node;
916  }
917 
918  if (keep_looking == FALSE) {
919  // Don't waste time iterating if we don't have to
920  break;
921  }
922  }
923  return active;
924 }
925 
939 pe_node_t *
940 pe__find_active_requires(const pe_resource_t *rsc, unsigned int *count)
941 {
942  if (rsc && is_not_set(rsc->flags, pe_rsc_needs_fencing)) {
943  return pe__find_active_on(rsc, NULL, count);
944  }
945  return pe__find_active_on(rsc, count, NULL);
946 }
947 
948 void
950 {
951  if (rsc->children != NULL) {
952  for (GList *item = rsc->children; item != NULL; item = item->next) {
953  ((pe_resource_t *) item->data)->fns->count(item->data);
954  }
955 
956  } else if (is_not_set(rsc->flags, pe_rsc_orphan)
957  || (rsc->role > RSC_ROLE_STOPPED)) {
958  rsc->cluster->ninstances++;
959  if (pe__resource_is_disabled(rsc)) {
960  rsc->cluster->disabled_resources++;
961  }
962  if (is_set(rsc->flags, pe_rsc_block)) {
963  rsc->cluster->blocked_resources++;
964  }
965  }
966 }
get_target_role
gboolean get_target_role(resource_t *rsc, enum rsc_role_e *role)
Definition: utils.c:1742
pe__unpack_dataset_nvpairs
void pe__unpack_dataset_nvpairs(xmlNode *xml_obj, const char *set_name, GHashTable *node_hash, GHashTable *hash, const char *always_first, gboolean overwrite, pe_working_set_t *data_set)
Definition: utils.c:2558
pe_rsc_orphan
#define pe_rsc_orphan
Definition: pe_types.h:224
pe_native
@ pe_native
Definition: pe_types.h:37
RSC_ROLE_STARTED_S
#define RSC_ROLE_STARTED_S
Definition: common.h:98
GListPtr
GList * GListPtr
Definition: crm.h:214
pe_working_set_s::input
xmlNode * input
Definition: pe_types.h:118
INFINITY
#define INFINITY
Definition: crm.h:95
pe_working_set_s::now
crm_time_t * now
Definition: pe_types.h:119
pe__bundle_resource_state
enum rsc_role_e pe__bundle_resource_state(const pe_resource_t *rsc, gboolean current)
Definition: bundle.c:1891
native_resource_state
enum rsc_role_e native_resource_state(const resource_t *rsc, gboolean current)
Definition: native.c:1183
pe_rsc_notify
#define pe_rsc_notify
Definition: pe_types.h:229
pe_container
@ pe_container
Definition: pe_types.h:40
crm_str_eq
gboolean crm_str_eq(const char *a, const char *b, gboolean use_case)
Definition: strings.c:224
pe_resource_s::variant
enum pe_obj_types variant
Definition: pe_types.h:301
common_unpack
gboolean common_unpack(xmlNode *xml_obj, resource_t **rsc, resource_t *parent, pe_working_set_t *data_set)
Definition: complex.c:368
pe_resource_s::dangling_migrations
GListPtr dangling_migrations
Definition: pe_types.h:349
pe_rsc_allow_migrate
#define pe_rsc_allow_migrate
Definition: pe_types.h:247
group_active
gboolean group_active(resource_t *rsc, gboolean all)
Definition: group.c:93
pe_resource_s::actions
GListPtr actions
Definition: pe_types.h:330
msg_xml.h
RSC_ROLE_STOPPED
@ RSC_ROLE_STOPPED
Definition: common.h:88
pe_resource_s::variant_opaque
void * variant_opaque
Definition: pe_types.h:302
pe_working_set_s::rsc_defaults
xmlNode * rsc_defaults
Definition: pe_types.h:148
pe_resource_s::utilization
GHashTable * utilization
Definition: pe_types.h:346
pe__find_active_requires
pe_node_t * pe__find_active_requires(const pe_resource_t *rsc, unsigned int *count)
Definition: complex.c:940
pe_resource_s::rsc_cons_lhs
GListPtr rsc_cons_lhs
Definition: pe_types.h:327
common_free
void common_free(resource_t *rsc)
Definition: complex.c:778
XML_OP_ATTR_ALLOW_MIGRATE
#define XML_OP_ATTR_ALLOW_MIGRATE
Definition: msg_xml.h:219
LOG_TRACE
#define LOG_TRACE
Definition: logging.h:26
pe_working_set_s::disabled_resources
int disabled_resources
Definition: pe_types.h:164
pe_working_set_s::blocked_resources
int blocked_resources
Definition: pe_types.h:163
XML_REMOTE_ATTR_RECONNECT_INTERVAL
#define XML_REMOTE_ATTR_RECONNECT_INTERVAL
Definition: msg_xml.h:215
XML_RSC_ATTR_NOTIFY
#define XML_RSC_ATTR_NOTIFY
Definition: msg_xml.h:198
crm_str_to_boolean
int crm_str_to_boolean(const char *s, int *ret)
Definition: strings.c:187
clone_resource_state
enum rsc_role_e clone_resource_state(const resource_t *rsc, gboolean current)
Definition: clone.c:1006
pe_rsc_provisional
#define pe_rsc_provisional
Definition: pe_types.h:234
PCMK_RESOURCE_CLASS_STONITH
#define PCMK_RESOURCE_CLASS_STONITH
Definition: services.h:49
create_xml_node
xmlNode * create_xml_node(xmlNode *parent, const char *name)
Definition: xml.c:1970
native_unpack
gboolean native_unpack(resource_t *rsc, pe_working_set_t *data_set)
Definition: native.c:145
pe_resource_s::known_on
GHashTable * known_on
Definition: pe_types.h:338
pe_resource_s::children
GListPtr children
Definition: pe_types.h:348
pe_resource_s::id
char * id
Definition: pe_types.h:292
pe_resource_s::allocated_to
pe_node_t * allocated_to
Definition: pe_types.h:334
XML_CIB_TAG_INCARNATION
#define XML_CIB_TAG_INCARNATION
Definition: msg_xml.h:176
PCMK_RESOURCE_CLASS_OCF
#define PCMK_RESOURCE_CLASS_OCF
Definition: services.h:43
native_find_rsc
resource_t * native_find_rsc(resource_t *rsc, const char *id, const node_t *node, int flags)
Definition: native.c:214
get_xpath_object
xmlNode * get_xpath_object(const char *xpath, xmlNode *xml_obj, int error_level)
Definition: xpath.c:220
XML_RSC_ATTR_MAINTENANCE
#define XML_RSC_ATTR_MAINTENANCE
Definition: msg_xml.h:207
copy_xml
xmlNode * copy_xml(xmlNode *src_node)
Definition: xml.c:2136
pe_node_s::weight
int weight
Definition: pe_types.h:217
clear_bit
#define clear_bit(word, bit)
Definition: crm_internal.h:168
pe_rsc_fence_device
#define pe_rsc_fence_device
Definition: pe_types.h:231
pe_node_s::details
struct pe_node_shared_s * details
Definition: pe_types.h:220
pe_obj_types
pe_obj_types
Definition: pe_types.h:35
pe_wo_neg_threshold
@ pe_wo_neg_threshold
Definition: unpack.h:42
internal.h
crm_str_hash
#define crm_str_hash
Definition: util.h:62
native_location
pe_node_t * native_location(const pe_resource_t *rsc, GList **list, int current)
Definition: native.c:1205
pe_resource_s::meta
GHashTable * meta
Definition: pe_types.h:344
safe_str_eq
#define safe_str_eq(a, b)
Definition: util.h:61
XML_CIB_TAG_RESOURCES
#define XML_CIB_TAG_RESOURCES
Definition: msg_xml.h:140
XML_TAG_ATTR_SETS
#define XML_TAG_ATTR_SETS
Definition: msg_xml.h:163
resource_class_functions
resource_object_functions_t resource_class_functions[]
Definition: complex.c:20
uber_parent
resource_t * uber_parent(resource_t *rsc)
Definition: complex.c:764
pe__count_bundle
void pe__count_bundle(pe_resource_t *rsc)
Definition: bundle.c:1918
free_xml
void free_xml(xmlNode *child)
Definition: xml.c:2130
pe_group
@ pe_group
Definition: pe_types.h:38
pe_resource_s::fillers
GListPtr fillers
Definition: pe_types.h:352
XML_CIB_ATTR_PRIORITY
#define XML_CIB_ATTR_PRIORITY
Definition: msg_xml.h:235
pe_resource_s::running_on
GListPtr running_on
Definition: pe_types.h:337
pe_resource_s::orig_xml
xmlNode * orig_xml
Definition: pe_types.h:295
crm_xml_replace
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:370
pe_restart_ignore
@ pe_restart_ignore
Definition: pe_types.h:76
crm_is_true
gboolean crm_is_true(const char *s)
Definition: strings.c:176
xml_contains_remote_node
gboolean xml_contains_remote_node(xmlNode *xml)
Definition: remote.c:92
xml_has_children
gboolean xml_has_children(const xmlNode *root)
Definition: xml.c:3316
native_free
void native_free(resource_t *rsc)
Definition: native.c:1176
XML_RSC_ATTR_MULTIPLE
#define XML_RSC_ATTR_MULTIPLE
Definition: msg_xml.h:202
clone_print
void clone_print(resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: clone.c:368
pe__find_active_on
pe_node_t * pe__find_active_on(const pe_resource_t *rsc, unsigned int *count_all, unsigned int *count_clean)
Definition: complex.c:860
set_bit
#define set_bit(word, bit)
Definition: crm_internal.h:167
XML_ATTR_ID
#define XML_ATTR_ID
Definition: msg_xml.h:96
pe__unpack_bundle
gboolean pe__unpack_bundle(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: bundle.c:1024
XML_TAG_UTILIZATION
#define XML_TAG_UTILIZATION
Definition: msg_xml.h:171
ID
#define ID(x)
Definition: msg_xml.h:415
XML_CIB_TAG_RESOURCE
#define XML_CIB_TAG_RESOURCE
Definition: msg_xml.h:174
pe__resource_is_disabled
bool pe__resource_is_disabled(pe_resource_t *rsc)
Definition: utils.c:2576
pe_err
#define pe_err(fmt...)
Definition: internal.h:21
pe__print_bundle
void pe__print_bundle(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: bundle.c:1755
pe_resource_s::xml
xmlNode * xml
Definition: pe_types.h:294
find_entity
xmlNode * find_entity(xmlNode *parent, const char *node_name, const char *id)
Definition: xml.c:1823
clone_free
void clone_free(resource_t *rsc)
Definition: clone.c:972
group_print
void group_print(resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: group.c:138
pe_rsc_needs_quorum
#define pe_rsc_needs_quorum
Definition: pe_types.h:253
pe__free_bundle
void pe__free_bundle(pe_resource_t *rsc)
Definition: bundle.c:1857
XML_AGENT_ATTR_CLASS
#define XML_AGENT_ATTR_CLASS
Definition: msg_xml.h:229
XML_RSC_ATTR_PROMOTABLE
#define XML_RSC_ATTR_PROMOTABLE
Definition: msg_xml.h:190
XML_RSC_ATTR_MANAGED
#define XML_RSC_ATTR_MANAGED
Definition: msg_xml.h:195
clone_unpack
gboolean clone_unpack(resource_t *rsc, pe_working_set_t *data_set)
Definition: clone.c:112
role2text
const char * role2text(enum rsc_role_e role)
Definition: common.c:335
RSC_ROLE_UNKNOWN
@ RSC_ROLE_UNKNOWN
Definition: common.h:87
pe_rsc_runnable
#define pe_rsc_runnable
Definition: pe_types.h:242
get_meta_attributes
void get_meta_attributes(GHashTable *meta_hash, resource_t *rsc, node_t *node, pe_working_set_t *data_set)
Definition: complex.c:97
expand_idref
xmlNode * expand_idref(xmlNode *input, xmlNode *top)
Definition: xml.c:4457
XML_RSC_ATTR_UNIQUE
#define XML_RSC_ATTR_UNIQUE
Definition: msg_xml.h:197
pe_resource_s::partial_migration_source
pe_node_t * partial_migration_source
Definition: pe_types.h:336
pe_rsc_needs_unfencing
#define pe_rsc_needs_unfencing
Definition: pe_types.h:255
get_rsc_attributes
void get_rsc_attributes(GHashTable *meta_hash, resource_t *rsc, node_t *node, pe_working_set_t *data_set)
Definition: complex.c:131
crm_log_xml_trace
#define crm_log_xml_trace(xml, text)
Definition: logging.h:255
crm_xml_add
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:313
pe_warn_once
#define pe_warn_once(pe_wo_bit, fmt...)
Definition: unpack.h:47
pe_working_set_s
Definition: pe_types.h:117
pe_resource_s::cluster
pe_working_set_t * cluster
Definition: pe_types.h:298
crm_element_value
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
Definition: nvpair.c:519
no_quorum_ignore
@ no_quorum_ignore
Definition: pe_types.h:63
XML_RSC_ATTR_FAIL_TIMEOUT
#define XML_RSC_ATTR_FAIL_TIMEOUT
Definition: msg_xml.h:201
clone_active
gboolean clone_active(resource_t *rsc, gboolean all)
Definition: clone.c:236
pe_resource_s::rsc_cons
GListPtr rsc_cons
Definition: pe_types.h:328
XML_CIB_TAG_GROUP
#define XML_CIB_TAG_GROUP
Definition: msg_xml.h:175
XML_TAG_META_SETS
#define XML_TAG_META_SETS
Definition: msg_xml.h:164
pe_working_set_s::template_rsc_sets
GHashTable * template_rsc_sets
Definition: pe_types.h:159
pe_unknown
@ pe_unknown
Definition: pe_types.h:36
rules.h
add_hash_param
void add_hash_param(GHashTable *hash, const char *name, const char *value)
Definition: common.c:412
add_tag_ref
gboolean add_tag_ref(GHashTable *tags, const char *tag_name, const char *obj_ref)
Definition: utils.c:2405
pe_rsc_needs_fencing
#define pe_rsc_needs_fencing
Definition: pe_types.h:254
pe_flag_have_stonith_resource
#define pe_flag_have_stonith_resource
Definition: pe_types.h:94
pe_rsc_unique
#define pe_rsc_unique
Definition: pe_types.h:230
RSC_ROLE_SLAVE_S
#define RSC_ROLE_SLAVE_S
Definition: common.h:99
crm_parse_int
int crm_parse_int(const char *text, const char *default_text)
Parse an integer value from a string.
Definition: strings.c:114
resource_location
void resource_location(resource_t *rsc, node_t *node, int score, const char *tag, pe_working_set_t *data_set)
Definition: utils.c:1566
common_update_score
void common_update_score(resource_t *rsc, const char *id, int score)
Definition: complex.c:725
native_parameter
char * native_parameter(resource_t *rsc, node_t *node, gboolean create, const char *name, pe_working_set_t *data_set)
Definition: native.c:269
XML_RSC_ATTR_RESTART
#define XML_RSC_ATTR_RESTART
Definition: msg_xml.h:183
XML_CIB_TAG_MASTER
#define XML_CIB_TAG_MASTER
Definition: msg_xml.h:177
XML_CIB_TAG_RSC_TEMPLATE
#define XML_CIB_TAG_RSC_TEMPLATE
Definition: msg_xml.h:180
pe_resource_s::clone_name
char * clone_name
Definition: pe_types.h:293
pe_resource_s::rsc_location
GListPtr rsc_location
Definition: pe_types.h:329
safe_str_neq
gboolean safe_str_neq(const char *a, const char *b)
Definition: strings.c:161
crm_config_warn
#define crm_config_warn(fmt...)
Definition: crm_internal.h:180
recovery_stop_only
@ recovery_stop_only
Definition: common.h:76
pe_resource_s::rsc_tickets
GListPtr rsc_tickets
Definition: pe_types.h:331
pe_resource_s::parent
pe_resource_t * parent
Definition: pe_types.h:299
crm_parse_interval_spec
guint crm_parse_interval_spec(const char *input)
Definition: utils.c:542
char2score
int char2score(const char *score)
Definition: utils.c:199
RSC_ROLE_UNKNOWN_S
#define RSC_ROLE_UNKNOWN_S
Definition: common.h:96
group_free
void group_free(resource_t *rsc)
Definition: group.c:258
XML_TAG_RSC_VER_ATTRS
#define XML_TAG_RSC_VER_ATTRS
Definition: msg_xml.h:166
pe_resource_s::flags
unsigned long long flags
Definition: pe_types.h:319
pe_flag_maintenance_mode
#define pe_flag_maintenance_mode
Definition: pe_types.h:91
pe_clone
@ pe_clone
Definition: pe_types.h:39
pe_flag_enable_unfencing
#define pe_flag_enable_unfencing
Definition: pe_types.h:95
recovery_stop_start
@ recovery_stop_start
Definition: common.h:75
pe_resource_s::role
enum rsc_role_e role
Definition: pe_types.h:341
pe_rsc_trace
#define pe_rsc_trace(rsc, fmt, args...)
Definition: internal.h:19
XML_AGENT_ATTR_PROVIDER
#define XML_AGENT_ATTR_PROVIDER
Definition: msg_xml.h:230
XML_RSC_ATTR_FAIL_STICKINESS
#define XML_RSC_ATTR_FAIL_STICKINESS
Definition: msg_xml.h:200
resource_object_functions_s
Definition: pe_types.h:43
populate_hash
void populate_hash(xmlNode *nvpair_list, GHashTable *hash, const char **attrs, int attrs_length)
is_parent
gboolean is_parent(resource_t *child, resource_t *rsc)
Definition: complex.c:747
native_print
void native_print(resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: native.c:1053
find_xml_node
xmlNode * find_xml_node(xmlNode *cib, const char *node_path, gboolean must_find)
Definition: xml.c:1758
group_resource_state
enum rsc_role_e group_resource_state(const resource_t *rsc, gboolean current)
Definition: group.c:279
pe_rsc_managed
#define pe_rsc_managed
Definition: pe_types.h:225
pe_resource_s::pending_task
char * pending_task
Definition: pe_types.h:317
unpack.h
XML_ATTR_TYPE
#define XML_ATTR_TYPE
Definition: msg_xml.h:99
group_unpack
gboolean group_unpack(resource_t *rsc, pe_working_set_t *data_set)
Definition: group.c:22
pe_rsc_promotable
#define pe_rsc_promotable
Definition: pe_types.h:232
XML_RSC_ATTR_REQUIRES
#define XML_RSC_ATTR_REQUIRES
Definition: msg_xml.h:203
pe_flag_stonith_enabled
#define pe_flag_stonith_enabled
Definition: pe_types.h:93
merge_weights
int merge_weights(int w1, int w2)
Definition: common.c:375
pe_resource_s
Definition: pe_types.h:291
pe_resource_s::allowed_nodes
GHashTable * allowed_nodes
Definition: pe_types.h:339
pe_working_set_s::flags
unsigned long long flags
Definition: pe_types.h:127
pe_node_shared_s::unclean
gboolean unclean
Definition: pe_types.h:194
pe__count_common
void pe__count_common(pe_resource_t *rsc)
Definition: complex.c:949
native_active
gboolean native_active(resource_t *rsc, gboolean all)
Definition: native.c:314
pe_working_set_s::ninstances
int ninstances
Definition: pe_types.h:169
pe_working_set_s::no_quorum_policy
enum pe_quorum_policy no_quorum_policy
Definition: pe_types.h:130
pe_flag_symmetric_cluster
#define pe_flag_symmetric_cluster
Definition: pe_types.h:90
pe_wo_restart_type
@ pe_wo_restart_type
Definition: unpack.h:37
XML_RSC_ATTR_INCARNATION
#define XML_RSC_ATTR_INCARNATION
Definition: msg_xml.h:186
pe_node_shared_s::online
gboolean online
Definition: pe_types.h:190
pe__bundle_active
gboolean pe__bundle_active(pe_resource_t *rsc, gboolean all)
Definition: bundle.c:1363
pe_restart_restart
@ pe_restart_restart
Definition: pe_types.h:75
XML_CIB_TAG_CONTAINER
#define XML_CIB_TAG_CONTAINER
Definition: msg_xml.h:178
add_node_copy
xmlNode * add_node_copy(xmlNode *new_parent, xmlNode *xml_node)
Definition: xml.c:1948
crm_internal.h
XML_RSC_ATTR_STICKINESS
#define XML_RSC_ATTR_STICKINESS
Definition: msg_xml.h:199
recovery_block
@ recovery_block
Definition: common.h:77
pe_node_s
Definition: pe_types.h:216
pe_resource_s::parameters
GHashTable * parameters
Definition: pe_types.h:345
pe_rsc_maintenance
#define pe_rsc_maintenance
Definition: pe_types.h:250
XML_RSC_ATTR_CONTAINER
#define XML_RSC_ATTR_CONTAINER
Definition: msg_xml.h:205
pe_rsc_block
#define pe_rsc_block
Definition: pe_types.h:226
XML_BOOLEAN_TRUE
#define XML_BOOLEAN_TRUE
Definition: msg_xml.h:107
pe_node_shared_s::attrs
GHashTable * attrs
Definition: pe_types.h:211
crm_config_err
#define crm_config_err(fmt...)
Definition: crm_internal.h:179