pacemaker 2.1.6-6fdc9deea29
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
complex.c
Go to the documentation of this file.
1/*
2 * Copyright 2004-2023 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>
14#include <crm/msg_xml.h>
16
17#include "pe_status_private.h"
18
19void populate_hash(xmlNode * nvpair_list, GHashTable * hash, const char **attrs, int attrs_length);
20
21static pe_node_t *active_node(const pe_resource_t *rsc, unsigned int *count_all,
22 unsigned int *count_clean);
23
78
79static enum pe_obj_types
80get_resource_type(const char *name)
81{
82 if (pcmk__str_eq(name, XML_CIB_TAG_RESOURCE, pcmk__str_casei)) {
83 return pe_native;
84
85 } else if (pcmk__str_eq(name, XML_CIB_TAG_GROUP, pcmk__str_casei)) {
86 return pe_group;
87
88 } else if (pcmk__str_eq(name, XML_CIB_TAG_INCARNATION, pcmk__str_casei)) {
89 return pe_clone;
90
91 } else if (pcmk__str_eq(name, PCMK_XE_PROMOTABLE_LEGACY, pcmk__str_casei)) {
92 // @COMPAT deprecated since 2.0.0
93 return pe_clone;
94
95 } else if (pcmk__str_eq(name, XML_CIB_TAG_CONTAINER, pcmk__str_casei)) {
96 return pe_container;
97 }
98
99 return pe_unknown;
100}
101
102static void
103dup_attr(gpointer key, gpointer value, gpointer user_data)
104{
105 add_hash_param(user_data, key, value);
106}
107
108static void
109expand_parents_fixed_nvpairs(pe_resource_t * rsc, pe_rule_eval_data_t * rule_data, GHashTable * meta_hash, pe_working_set_t * data_set)
110{
111 GHashTable *parent_orig_meta = pcmk__strkey_table(free, free);
112 pe_resource_t *p = rsc->parent;
113
114 if (p == NULL) {
115 return ;
116 }
117
118 /* Search all parent resources, get the fixed value of "meta_attributes" set only in the original xml, and stack it in the hash table. */
119 /* The fixed value of the lower parent resource takes precedence and is not overwritten. */
120 while(p != NULL) {
121 /* A hash table for comparison is generated, including the id-ref. */
123 rule_data, parent_orig_meta, NULL, FALSE, data_set);
124 p = p->parent;
125 }
126
127 /* If there is a fixed value of "meta_attributes" of the parent resource, it will be processed. */
128 if (parent_orig_meta != NULL) {
129 GHashTableIter iter;
130 char *key = NULL;
131 char *value = NULL;
132
133 g_hash_table_iter_init(&iter, parent_orig_meta);
134 while (g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &value)) {
135 /* Parameters set in the original xml of the parent resource will also try to overwrite the child resource. */
136 /* Attributes that already exist in the child lease are not updated. */
137 dup_attr(key, value, meta_hash);
138 }
139 }
140
141 if (parent_orig_meta != NULL) {
142 g_hash_table_destroy(parent_orig_meta);
143 }
144
145 return ;
146
147}
148void
149get_meta_attributes(GHashTable * meta_hash, pe_resource_t * rsc,
151{
152 pe_rsc_eval_data_t rsc_rule_data = {
156 };
157
158 pe_rule_eval_data_t rule_data = {
159 .node_hash = NULL,
160 .role = RSC_ROLE_UNKNOWN,
161 .now = data_set->now,
162 .match_data = NULL,
163 .rsc_data = &rsc_rule_data,
164 .op_data = NULL
165 };
166
167 if (node) {
168 rule_data.node_hash = node->details->attrs;
169 }
170
171 for (xmlAttrPtr a = pcmk__xe_first_attr(rsc->xml); a != NULL; a = a->next) {
172 const char *prop_name = (const char *) a->name;
173 const char *prop_value = crm_element_value(rsc->xml, prop_name);
174
175 add_hash_param(meta_hash, prop_name, prop_value);
176 }
177
179 meta_hash, NULL, FALSE, data_set);
180
181 /* Set the "meta_attributes" explicitly set in the parent resource to the hash table of the child resource. */
182 /* If it is already explicitly set as a child, it will not be overwritten. */
183 if (rsc->parent != NULL) {
184 expand_parents_fixed_nvpairs(rsc, &rule_data, meta_hash, data_set);
185 }
186
187 /* check the defaults */
189 &rule_data, meta_hash, NULL, FALSE, data_set);
190
191 /* If there is "meta_attributes" that the parent resource has not explicitly set, set a value that is not set from rsc_default either. */
192 /* The values already set up to this point will not be overwritten. */
193 if (rsc->parent) {
194 g_hash_table_foreach(rsc->parent->meta, dup_attr, meta_hash);
195 }
196}
197
198void
199get_rsc_attributes(GHashTable *meta_hash, const pe_resource_t *rsc,
200 const pe_node_t *node, pe_working_set_t *data_set)
201{
202 pe_rule_eval_data_t rule_data = {
203 .node_hash = NULL,
204 .role = RSC_ROLE_UNKNOWN,
205 .now = data_set->now,
206 .match_data = NULL,
207 .rsc_data = NULL,
208 .op_data = NULL
209 };
210
211 if (node) {
212 rule_data.node_hash = node->details->attrs;
213 }
214
216 meta_hash, NULL, FALSE, data_set);
217
218 /* set anything else based on the parent */
219 if (rsc->parent != NULL) {
220 get_rsc_attributes(meta_hash, rsc->parent, node, data_set);
221
222 } else {
223 /* and finally check the defaults */
225 &rule_data, meta_hash, NULL, FALSE, data_set);
226 }
227}
228
229static char *
230template_op_key(xmlNode * op)
231{
232 const char *name = crm_element_value(op, "name");
233 const char *role = crm_element_value(op, "role");
234 char *key = NULL;
235
236 if ((role == NULL)
239 role = RSC_ROLE_UNKNOWN_S;
240 }
241
242 key = crm_strdup_printf("%s-%s", name, role);
243 return key;
244}
245
246static gboolean
247unpack_template(xmlNode * xml_obj, xmlNode ** expanded_xml, pe_working_set_t * data_set)
248{
249 xmlNode *cib_resources = NULL;
250 xmlNode *template = NULL;
251 xmlNode *new_xml = NULL;
252 xmlNode *child_xml = NULL;
253 xmlNode *rsc_ops = NULL;
254 xmlNode *template_ops = NULL;
255 const char *template_ref = NULL;
256 const char *clone = NULL;
257 const char *id = NULL;
258
259 if (xml_obj == NULL) {
260 pe_err("No resource object for template unpacking");
261 return FALSE;
262 }
263
264 template_ref = crm_element_value(xml_obj, XML_CIB_TAG_RSC_TEMPLATE);
265 if (template_ref == NULL) {
266 return TRUE;
267 }
268
269 id = ID(xml_obj);
270 if (id == NULL) {
271 pe_err("'%s' object must have a id", crm_element_name(xml_obj));
272 return FALSE;
273 }
274
275 if (pcmk__str_eq(template_ref, id, pcmk__str_none)) {
276 pe_err("The resource object '%s' should not reference itself", id);
277 return FALSE;
278 }
279
281 if (cib_resources == NULL) {
282 pe_err("No resources configured");
283 return FALSE;
284 }
285
286 template = pcmk__xe_match(cib_resources, XML_CIB_TAG_RSC_TEMPLATE,
287 XML_ATTR_ID, template_ref);
288 if (template == NULL) {
289 pe_err("No template named '%s'", template_ref);
290 return FALSE;
291 }
292
293 new_xml = copy_xml(template);
294 xmlNodeSetName(new_xml, xml_obj->name);
295 crm_xml_replace(new_xml, XML_ATTR_ID, id);
296
298 if(clone) {
299 crm_xml_add(new_xml, XML_RSC_ATTR_INCARNATION, clone);
300 }
301
302 template_ops = find_xml_node(new_xml, "operations", FALSE);
303
304 for (child_xml = pcmk__xe_first_child(xml_obj); child_xml != NULL;
305 child_xml = pcmk__xe_next(child_xml)) {
306 xmlNode *new_child = NULL;
307
308 new_child = add_node_copy(new_xml, child_xml);
309
310 if (pcmk__str_eq((const char *)new_child->name, "operations", pcmk__str_none)) {
311 rsc_ops = new_child;
312 }
313 }
314
315 if (template_ops && rsc_ops) {
316 xmlNode *op = NULL;
317 GHashTable *rsc_ops_hash = pcmk__strkey_table(free, NULL);
318
319 for (op = pcmk__xe_first_child(rsc_ops); op != NULL;
320 op = pcmk__xe_next(op)) {
321
322 char *key = template_op_key(op);
323
324 g_hash_table_insert(rsc_ops_hash, key, op);
325 }
326
327 for (op = pcmk__xe_first_child(template_ops); op != NULL;
328 op = pcmk__xe_next(op)) {
329
330 char *key = template_op_key(op);
331
332 if (g_hash_table_lookup(rsc_ops_hash, key) == NULL) {
333 add_node_copy(rsc_ops, op);
334 }
335
336 free(key);
337 }
338
339 if (rsc_ops_hash) {
340 g_hash_table_destroy(rsc_ops_hash);
341 }
342
343 free_xml(template_ops);
344 }
345
346 /*free_xml(*expanded_xml); */
347 *expanded_xml = new_xml;
348
349 /* Disable multi-level templates for now */
350 /*if(unpack_template(new_xml, expanded_xml, data_set) == FALSE) {
351 free_xml(*expanded_xml);
352 *expanded_xml = NULL;
353
354 return FALSE;
355 } */
356
357 return TRUE;
358}
359
360static gboolean
361add_template_rsc(xmlNode * xml_obj, pe_working_set_t * data_set)
362{
363 const char *template_ref = NULL;
364 const char *id = NULL;
365
366 if (xml_obj == NULL) {
367 pe_err("No resource object for processing resource list of template");
368 return FALSE;
369 }
370
371 template_ref = crm_element_value(xml_obj, XML_CIB_TAG_RSC_TEMPLATE);
372 if (template_ref == NULL) {
373 return TRUE;
374 }
375
376 id = ID(xml_obj);
377 if (id == NULL) {
378 pe_err("'%s' object must have a id", crm_element_name(xml_obj));
379 return FALSE;
380 }
381
382 if (pcmk__str_eq(template_ref, id, pcmk__str_none)) {
383 pe_err("The resource object '%s' should not reference itself", id);
384 return FALSE;
385 }
386
387 if (add_tag_ref(data_set->template_rsc_sets, template_ref, id) == FALSE) {
388 return FALSE;
389 }
390
391 return TRUE;
392}
393
394static bool
395detect_promotable(pe_resource_t *rsc)
396{
397 const char *promotable = g_hash_table_lookup(rsc->meta,
399
400 if (crm_is_true(promotable)) {
401 return TRUE;
402 }
403
404 // @COMPAT deprecated since 2.0.0
405 if (pcmk__str_eq(crm_element_name(rsc->xml), PCMK_XE_PROMOTABLE_LEGACY,
407 /* @TODO in some future version, pe_warn_once() here,
408 * then drop support in even later version
409 */
410 g_hash_table_insert(rsc->meta, strdup(XML_RSC_ATTR_PROMOTABLE),
411 strdup(XML_BOOLEAN_TRUE));
412 return TRUE;
413 }
414 return FALSE;
415}
416
417static void
418free_params_table(gpointer data)
419{
420 g_hash_table_destroy((GHashTable *) data);
421}
422
435GHashTable *
438{
439 GHashTable *params_on_node = NULL;
440
441 /* A NULL node is used to request the resource's default parameters
442 * (not evaluated for node), but we always want something non-NULL
443 * as a hash table key.
444 */
445 const char *node_name = "";
446
447 // Sanity check
448 if ((rsc == NULL) || (data_set == NULL)) {
449 return NULL;
450 }
451 if ((node != NULL) && (node->details->uname != NULL)) {
452 node_name = node->details->uname;
453 }
454
455 // Find the parameter table for given node
456 if (rsc->parameter_cache == NULL) {
457 rsc->parameter_cache = pcmk__strikey_table(free, free_params_table);
458 } else {
459 params_on_node = g_hash_table_lookup(rsc->parameter_cache, node_name);
460 }
461
462 // If none exists yet, create one with parameters evaluated for node
463 if (params_on_node == NULL) {
464 params_on_node = pcmk__strkey_table(free, free);
465 get_rsc_attributes(params_on_node, rsc, node, data_set);
466 g_hash_table_insert(rsc->parameter_cache, strdup(node_name),
467 params_on_node);
468 }
469 return params_on_node;
470}
471
480static void
481unpack_requires(pe_resource_t *rsc, const char *value, bool is_default)
482{
483 if (pcmk__str_eq(value, PCMK__VALUE_NOTHING, pcmk__str_casei)) {
484
485 } else if (pcmk__str_eq(value, PCMK__VALUE_QUORUM, pcmk__str_casei)) {
487
488 } else if (pcmk__str_eq(value, PCMK__VALUE_FENCING, pcmk__str_casei)) {
491 pcmk__config_warn("%s requires fencing but fencing is disabled",
492 rsc->id);
493 }
494
495 } else if (pcmk__str_eq(value, PCMK__VALUE_UNFENCING, pcmk__str_casei)) {
497 pcmk__config_warn("Resetting \"" XML_RSC_ATTR_REQUIRES "\" for %s "
498 "to \"" PCMK__VALUE_QUORUM "\" because fencing "
499 "devices cannot require unfencing", rsc->id);
500 unpack_requires(rsc, PCMK__VALUE_QUORUM, true);
501 return;
502
503 } else if (!pcmk_is_set(rsc->cluster->flags, pe_flag_stonith_enabled)) {
504 pcmk__config_warn("Resetting \"" XML_RSC_ATTR_REQUIRES "\" for %s "
505 "to \"" PCMK__VALUE_QUORUM "\" because fencing "
506 "is disabled", rsc->id);
507 unpack_requires(rsc, PCMK__VALUE_QUORUM, true);
508 return;
509
510 } else {
513 }
514
515 } else {
516 const char *orig_value = value;
517
519 value = PCMK__VALUE_QUORUM;
520
521 } else if ((rsc->variant == pe_native)
522 && xml_contains_remote_node(rsc->xml)) {
523 value = PCMK__VALUE_QUORUM;
524
526 value = PCMK__VALUE_UNFENCING;
527
529 value = PCMK__VALUE_FENCING;
530
531 } else if (rsc->cluster->no_quorum_policy == no_quorum_ignore) {
532 value = PCMK__VALUE_NOTHING;
533
534 } else {
535 value = PCMK__VALUE_QUORUM;
536 }
537
538 if (orig_value != NULL) {
539 pcmk__config_err("Resetting '" XML_RSC_ATTR_REQUIRES "' for %s "
540 "to '%s' because '%s' is not valid",
541 rsc->id, value, orig_value);
542 }
543 unpack_requires(rsc, value, true);
544 return;
545 }
546
547 pe_rsc_trace(rsc, "\tRequired to start: %s%s", value,
548 (is_default? " (default)" : ""));
549}
550
551#ifndef PCMK__COMPAT_2_0
552static void
553warn_about_deprecated_classes(pe_resource_t *rsc)
554{
555 const char *std = crm_element_value(rsc->xml, XML_AGENT_ATTR_CLASS);
556
557 if (pcmk__str_eq(std, PCMK_RESOURCE_CLASS_UPSTART, pcmk__str_none)) {
559 "Support for Upstart resources (such as %s) is deprecated "
560 "and will be removed in a future release of Pacemaker",
561 rsc->id);
562
563 } else if (pcmk__str_eq(std, PCMK_RESOURCE_CLASS_NAGIOS, pcmk__str_none)) {
565 "Support for Nagios resources (such as %s) is deprecated "
566 "and will be removed in a future release of Pacemaker",
567 rsc->id);
568 }
569}
570#endif
571
589int
590pe__unpack_resource(xmlNode *xml_obj, pe_resource_t **rsc,
592{
593 xmlNode *expanded_xml = NULL;
594 xmlNode *ops = NULL;
595 const char *value = NULL;
596 const char *id = NULL;
597 bool guest_node = false;
598 bool remote_node = false;
599
600 pe_rule_eval_data_t rule_data = {
601 .node_hash = NULL,
602 .role = RSC_ROLE_UNKNOWN,
603 .now = NULL,
604 .match_data = NULL,
605 .rsc_data = NULL,
606 .op_data = NULL
607 };
608
609 CRM_CHECK(rsc != NULL, return EINVAL);
610 CRM_CHECK((xml_obj != NULL) && (data_set != NULL),
611 *rsc = NULL;
612 return EINVAL);
613
614 rule_data.now = data_set->now;
615
616 crm_log_xml_trace(xml_obj, "[raw XML]");
617
618 id = crm_element_value(xml_obj, XML_ATTR_ID);
619 if (id == NULL) {
620 pe_err("Ignoring <%s> configuration without " XML_ATTR_ID,
621 crm_element_name(xml_obj));
623 }
624
625 if (unpack_template(xml_obj, &expanded_xml, data_set) == FALSE) {
627 }
628
629 *rsc = calloc(1, sizeof(pe_resource_t));
630 if (*rsc == NULL) {
631 crm_crit("Unable to allocate memory for resource '%s'", id);
632 return ENOMEM;
633 }
634 (*rsc)->cluster = data_set;
635
636 if (expanded_xml) {
637 crm_log_xml_trace(expanded_xml, "[expanded XML]");
638 (*rsc)->xml = expanded_xml;
639 (*rsc)->orig_xml = xml_obj;
640
641 } else {
642 (*rsc)->xml = xml_obj;
643 (*rsc)->orig_xml = NULL;
644 }
645
646 /* Do not use xml_obj from here on, use (*rsc)->xml in case templates are involved */
647
648 (*rsc)->parent = parent;
649
650 ops = find_xml_node((*rsc)->xml, "operations", FALSE);
651 (*rsc)->ops_xml = expand_idref(ops, data_set->input);
652
653 (*rsc)->variant = get_resource_type(crm_element_name((*rsc)->xml));
654 if ((*rsc)->variant == pe_unknown) {
655 pe_err("Ignoring resource '%s' of unknown type '%s'",
656 id, crm_element_name((*rsc)->xml));
657 common_free(*rsc);
658 *rsc = NULL;
660 }
661
662#ifndef PCMK__COMPAT_2_0
663 warn_about_deprecated_classes(*rsc);
664#endif
665
666 (*rsc)->meta = pcmk__strkey_table(free, free);
667 (*rsc)->allowed_nodes = pcmk__strkey_table(NULL, free);
668 (*rsc)->known_on = pcmk__strkey_table(NULL, free);
669
670 value = crm_element_value((*rsc)->xml, XML_RSC_ATTR_INCARNATION);
671 if (value) {
672 (*rsc)->id = crm_strdup_printf("%s:%s", id, value);
673 add_hash_param((*rsc)->meta, XML_RSC_ATTR_INCARNATION, value);
674
675 } else {
676 (*rsc)->id = strdup(id);
677 }
678
679 (*rsc)->fns = &resource_class_functions[(*rsc)->variant];
680
681 get_meta_attributes((*rsc)->meta, *rsc, NULL, data_set);
682 (*rsc)->parameters = pe_rsc_params(*rsc, NULL, data_set); // \deprecated
683
684 (*rsc)->flags = 0;
686
689 }
690
691 (*rsc)->rsc_cons = NULL;
692 (*rsc)->rsc_tickets = NULL;
693 (*rsc)->actions = NULL;
694 (*rsc)->role = RSC_ROLE_STOPPED;
695 (*rsc)->next_role = RSC_ROLE_UNKNOWN;
696
697 (*rsc)->recovery_type = recovery_stop_start;
698 (*rsc)->stickiness = 0;
699 (*rsc)->migration_threshold = INFINITY;
700 (*rsc)->failure_timeout = 0;
701
702 value = g_hash_table_lookup((*rsc)->meta, XML_CIB_ATTR_PRIORITY);
703 (*rsc)->priority = char2score(value);
704
705 value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_CRITICAL);
706 if ((value == NULL) || crm_is_true(value)) {
708 }
709
710 value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_NOTIFY);
711 if (crm_is_true(value)) {
713 }
714
715 if (xml_contains_remote_node((*rsc)->xml)) {
716 (*rsc)->is_remote_node = TRUE;
717 if (g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_CONTAINER)) {
718 guest_node = true;
719 } else {
720 remote_node = true;
721 }
722 }
723
724 value = g_hash_table_lookup((*rsc)->meta, XML_OP_ATTR_ALLOW_MIGRATE);
725 if (crm_is_true(value)) {
727 } else if ((value == NULL) && remote_node) {
728 /* By default, we want remote nodes to be able
729 * to float around the cluster without having to stop all the
730 * resources within the remote-node before moving. Allowing
731 * migration support enables this feature. If this ever causes
732 * problems, migration support can be explicitly turned off with
733 * allow-migrate=false.
734 */
736 }
737
738 value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_MANAGED);
739 if (value != NULL && !pcmk__str_eq("default", value, pcmk__str_casei)) {
740 if (crm_is_true(value)) {
742 } else {
744 }
745 }
746
747 value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_MAINTENANCE);
748 if (crm_is_true(value)) {
751 }
755 }
756
757 if (pe_rsc_is_clone(pe__const_top_resource(*rsc, false))) {
758 value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_UNIQUE);
759 if (crm_is_true(value)) {
761 }
762 if (detect_promotable(*rsc)) {
764 }
765 } else {
767 }
768
769 value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_RESTART);
770 if (pcmk__str_eq(value, "restart", pcmk__str_casei)) {
771 (*rsc)->restart_type = pe_restart_restart;
772 pe_rsc_trace((*rsc), "%s dependency restart handling: restart",
773 (*rsc)->id);
775 "Support for restart-type is deprecated and will be removed in a future release");
776
777 } else {
778 (*rsc)->restart_type = pe_restart_ignore;
779 pe_rsc_trace((*rsc), "%s dependency restart handling: ignore",
780 (*rsc)->id);
781 }
782
783 value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_MULTIPLE);
784 if (pcmk__str_eq(value, "stop_only", pcmk__str_casei)) {
785 (*rsc)->recovery_type = recovery_stop_only;
786 pe_rsc_trace((*rsc), "%s multiple running resource recovery: stop only",
787 (*rsc)->id);
788
789 } else if (pcmk__str_eq(value, "block", pcmk__str_casei)) {
790 (*rsc)->recovery_type = recovery_block;
791 pe_rsc_trace((*rsc), "%s multiple running resource recovery: block",
792 (*rsc)->id);
793
794 } else if (pcmk__str_eq(value, "stop_unexpected", pcmk__str_casei)) {
795 (*rsc)->recovery_type = recovery_stop_unexpected;
796 pe_rsc_trace((*rsc), "%s multiple running resource recovery: "
797 "stop unexpected instances",
798 (*rsc)->id);
799
800 } else { // "stop_start"
801 if (!pcmk__str_eq(value, "stop_start",
803 pe_warn("%s is not a valid value for " XML_RSC_ATTR_MULTIPLE
804 ", using default of \"stop_start\"", value);
805 }
806 (*rsc)->recovery_type = recovery_stop_start;
807 pe_rsc_trace((*rsc), "%s multiple running resource recovery: "
808 "stop/start", (*rsc)->id);
809 }
810
811 value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_STICKINESS);
812 if (value != NULL && !pcmk__str_eq("default", value, pcmk__str_casei)) {
813 (*rsc)->stickiness = char2score(value);
814 }
815
816 value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_FAIL_STICKINESS);
817 if (value != NULL && !pcmk__str_eq("default", value, pcmk__str_casei)) {
818 (*rsc)->migration_threshold = char2score(value);
819 if ((*rsc)->migration_threshold < 0) {
820 /* @TODO We use 1 here to preserve previous behavior, but this
821 * should probably use the default (INFINITY) or 0 (to disable)
822 * instead.
823 */
826 " must be non-negative, using 1 instead");
827 (*rsc)->migration_threshold = 1;
828 }
829 }
830
831 if (pcmk__str_eq(crm_element_value((*rsc)->xml, XML_AGENT_ATTR_CLASS),
835 }
836
837 value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_REQUIRES);
838 unpack_requires(*rsc, value, false);
839
840 value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_FAIL_TIMEOUT);
841 if (value != NULL) {
842 // Stored as seconds
843 (*rsc)->failure_timeout = (int) (crm_parse_interval_spec(value) / 1000);
844 }
845
846 if (remote_node) {
847 GHashTable *params = pe_rsc_params(*rsc, NULL, data_set);
848
849 /* Grabbing the value now means that any rules based on node attributes
850 * will evaluate to false, so such rules should not be used with
851 * reconnect_interval.
852 *
853 * @TODO Evaluate per node before using
854 */
855 value = g_hash_table_lookup(params, XML_REMOTE_ATTR_RECONNECT_INTERVAL);
856 if (value) {
857 /* reconnect delay works by setting failure_timeout and preventing the
858 * connection from starting until the failure is cleared. */
859 (*rsc)->remote_reconnect_ms = crm_parse_interval_spec(value);
860 /* we want to override any default failure_timeout in use when remote
861 * reconnect_interval is in use. */
862 (*rsc)->failure_timeout = (*rsc)->remote_reconnect_ms / 1000;
863 }
864 }
865
866 get_target_role(*rsc, &((*rsc)->next_role));
867 pe_rsc_trace((*rsc), "%s desired next state: %s", (*rsc)->id,
868 (*rsc)->next_role != RSC_ROLE_UNKNOWN ? role2text((*rsc)->next_role) : "default");
869
870 if ((*rsc)->fns->unpack(*rsc, data_set) == FALSE) {
871 (*rsc)->fns->free(*rsc);
872 *rsc = NULL;
874 }
875
877 // This tag must stay exactly the same because it is tested elsewhere
878 resource_location(*rsc, NULL, 0, "symmetric_default", data_set);
879 } else if (guest_node) {
880 /* remote resources tied to a container resource must always be allowed
881 * to opt-in to the cluster. Whether the connection resource is actually
882 * allowed to be placed on a node is dependent on the container resource */
883 resource_location(*rsc, NULL, 0, "remote_connection_default", data_set);
884 }
885
886 pe_rsc_trace((*rsc), "%s action notification: %s", (*rsc)->id,
887 pcmk_is_set((*rsc)->flags, pe_rsc_notify)? "required" : "not required");
888
889 (*rsc)->utilization = pcmk__strkey_table(free, free);
890
891 pe__unpack_dataset_nvpairs((*rsc)->xml, XML_TAG_UTILIZATION, &rule_data,
892 (*rsc)->utilization, NULL, FALSE, data_set);
893
894 if (expanded_xml) {
895 if (add_template_rsc(xml_obj, data_set) == FALSE) {
896 (*rsc)->fns->free(*rsc);
897 *rsc = NULL;
899 }
900 }
901 return pcmk_rc_ok;
902}
903
904gboolean
906{
907 pe_resource_t *parent = child;
908
909 if (parent == NULL || rsc == NULL) {
910 return FALSE;
911 }
912 while (parent->parent != NULL) {
913 if (parent->parent == rsc) {
914 return TRUE;
915 }
917 }
918 return FALSE;
919}
920
923{
924 pe_resource_t *parent = rsc;
925
926 if (parent == NULL) {
927 return NULL;
928 }
929 while (parent->parent != NULL && parent->parent->variant != pe_container) {
931 }
932 return parent;
933}
934
946const pe_resource_t *
947pe__const_top_resource(const pe_resource_t *rsc, bool include_bundle)
948{
949 const pe_resource_t *parent = rsc;
950
951 if (parent == NULL) {
952 return NULL;
953 }
954 while (parent->parent != NULL) {
955 if (!include_bundle && (parent->parent->variant == pe_container)) {
956 break;
957 }
959 }
960 return parent;
961}
962
963void
965{
966 if (rsc == NULL) {
967 return;
968 }
969
970 pe_rsc_trace(rsc, "Freeing %s %d", rsc->id, rsc->variant);
971
972 g_list_free(rsc->rsc_cons);
973 g_list_free(rsc->rsc_cons_lhs);
974 g_list_free(rsc->rsc_tickets);
975 g_list_free(rsc->dangling_migrations);
976
977 if (rsc->parameter_cache != NULL) {
978 g_hash_table_destroy(rsc->parameter_cache);
979 }
980 if (rsc->meta != NULL) {
981 g_hash_table_destroy(rsc->meta);
982 }
983 if (rsc->utilization != NULL) {
984 g_hash_table_destroy(rsc->utilization);
985 }
986
987 if ((rsc->parent == NULL) && pcmk_is_set(rsc->flags, pe_rsc_orphan)) {
988 free_xml(rsc->xml);
989 rsc->xml = NULL;
990 free_xml(rsc->orig_xml);
991 rsc->orig_xml = NULL;
992
993 /* if rsc->orig_xml, then rsc->xml is an expanded xml from a template */
994 } else if (rsc->orig_xml) {
995 free_xml(rsc->xml);
996 rsc->xml = NULL;
997 }
998 if (rsc->running_on) {
999 g_list_free(rsc->running_on);
1000 rsc->running_on = NULL;
1001 }
1002 if (rsc->known_on) {
1003 g_hash_table_destroy(rsc->known_on);
1004 rsc->known_on = NULL;
1005 }
1006 if (rsc->actions) {
1007 g_list_free(rsc->actions);
1008 rsc->actions = NULL;
1009 }
1010 if (rsc->allowed_nodes) {
1011 g_hash_table_destroy(rsc->allowed_nodes);
1012 rsc->allowed_nodes = NULL;
1013 }
1014 g_list_free(rsc->fillers);
1015 g_list_free(rsc->rsc_location);
1016 pe_rsc_trace(rsc, "Resource freed");
1017 free(rsc->id);
1018 free(rsc->clone_name);
1019 free(rsc->allocated_to);
1020 free(rsc->variant_opaque);
1021 free(rsc->pending_task);
1022 free(rsc);
1023}
1024
1039bool
1041 pe_node_t **active, unsigned int *count_all,
1042 unsigned int *count_clean)
1043{
1044 bool keep_looking = false;
1045 bool is_happy = false;
1046
1047 CRM_CHECK((rsc != NULL) && (node != NULL) && (active != NULL),
1048 return false);
1049
1050 is_happy = node->details->online && !node->details->unclean;
1051
1052 if (count_all != NULL) {
1053 ++*count_all;
1054 }
1055 if ((count_clean != NULL) && is_happy) {
1056 ++*count_clean;
1057 }
1058 if ((count_all != NULL) || (count_clean != NULL)) {
1059 keep_looking = true; // We're counting, so go through entire list
1060 }
1061
1062 if (rsc->partial_migration_source != NULL) {
1063 if (node->details == rsc->partial_migration_source->details) {
1064 *active = node; // This is the migration source
1065 } else {
1066 keep_looking = true;
1067 }
1068 } else if (!pcmk_is_set(rsc->flags, pe_rsc_needs_fencing)) {
1069 if (is_happy && ((*active == NULL) || !(*active)->details->online
1070 || (*active)->details->unclean)) {
1071 *active = node; // This is the first clean node
1072 } else {
1073 keep_looking = true;
1074 }
1075 }
1076 if (*active == NULL) {
1077 *active = node; // This is the first node checked
1078 }
1079 return keep_looking;
1080}
1081
1082// Shared implementation of resource_object_functions_t:active_node()
1083static pe_node_t *
1084active_node(const pe_resource_t *rsc, unsigned int *count_all,
1085 unsigned int *count_clean)
1086{
1087 pe_node_t *active = NULL;
1088
1089 if (count_all != NULL) {
1090 *count_all = 0;
1091 }
1092 if (count_clean != NULL) {
1093 *count_clean = 0;
1094 }
1095 if (rsc == NULL) {
1096 return NULL;
1097 }
1098 for (GList *iter = rsc->running_on; iter != NULL; iter = iter->next) {
1099 if (!pe__count_active_node(rsc, (pe_node_t *) iter->data, &active,
1100 count_all, count_clean)) {
1101 break; // Don't waste time iterating if we don't have to
1102 }
1103 }
1104 return active;
1105}
1106
1120pe_node_t *
1121pe__find_active_requires(const pe_resource_t *rsc, unsigned int *count)
1122{
1123 if (rsc == NULL) {
1124 if (count != NULL) {
1125 *count = 0;
1126 }
1127 return NULL;
1128
1129 } else if (pcmk_is_set(rsc->flags, pe_rsc_needs_fencing)) {
1130 return rsc->fns->active_node(rsc, count, NULL);
1131
1132 } else {
1133 return rsc->fns->active_node(rsc, NULL, count);
1134 }
1135}
1136
1137void
1139{
1140 if (rsc->children != NULL) {
1141 for (GList *item = rsc->children; item != NULL; item = item->next) {
1142 ((pe_resource_t *) item->data)->fns->count(item->data);
1143 }
1144
1145 } else if (!pcmk_is_set(rsc->flags, pe_rsc_orphan)
1146 || (rsc->role > RSC_ROLE_STOPPED)) {
1147 rsc->cluster->ninstances++;
1148 if (pe__resource_is_disabled(rsc)) {
1150 }
1151 if (pcmk_is_set(rsc->flags, pe_rsc_block)) {
1152 rsc->cluster->blocked_resources++;
1153 }
1154 }
1155}
1156
1165void
1166pe__set_next_role(pe_resource_t *rsc, enum rsc_role_e role, const char *why)
1167{
1168 CRM_ASSERT((rsc != NULL) && (why != NULL));
1169 if (rsc->next_role != role) {
1170 pe_rsc_trace(rsc, "Resetting next role for %s from %s to %s (%s)",
1171 rsc->id, role2text(rsc->next_role), role2text(role), why);
1172 rsc->next_role = role;
1173 }
1174}
#define PCMK_RESOURCE_CLASS_NAGIOS
Definition agents.h:34
#define PCMK_RESOURCE_CLASS_STONITH
Definition agents.h:31
#define PCMK_RESOURCE_CLASS_UPSTART
Definition agents.h:36
pe_node_t * pe__bundle_active_node(const pe_resource_t *rsc, unsigned int *count_all, unsigned int *count_clean)
Definition bundle.c:1932
const char * parent
Definition cib.c:25
const char * name
Definition cib.c:24
char guint crm_parse_interval_spec(const char *input)
Parse milliseconds from a Pacemaker interval specification.
Definition utils.c:271
int char2score(const char *score)
Get the integer value of a score string.
Definition scores.c:36
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
gboolean crm_is_true(const char *s)
Definition strings.c:416
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
Definition util.h:121
#define RSC_ROLE_UNPROMOTED_S
Definition common.h:113
#define RSC_ROLE_STARTED_S
Definition common.h:112
#define RSC_ROLE_UNPROMOTED_LEGACY_S
Definition common.h:115
@ recovery_stop_start
Definition common.h:79
@ recovery_block
Definition common.h:81
@ recovery_stop_only
Definition common.h:80
@ recovery_stop_unexpected
Definition common.h:82
const char * role2text(enum rsc_role_e role)
Definition common.c:450
rsc_role_e
Possible roles that a resource can be in.
Definition common.h:92
@ RSC_ROLE_STOPPED
Definition common.h:94
@ RSC_ROLE_UNKNOWN
Definition common.h:93
#define RSC_ROLE_UNKNOWN_S
Definition common.h:110
pe_resource_t * uber_parent(pe_resource_t *rsc)
Definition complex.c:922
void pe__count_common(pe_resource_t *rsc)
Definition complex.c:1138
int pe__unpack_resource(xmlNode *xml_obj, pe_resource_t **rsc, pe_resource_t *parent, pe_working_set_t *data_set)
Definition complex.c:590
void get_rsc_attributes(GHashTable *meta_hash, const pe_resource_t *rsc, const pe_node_t *node, pe_working_set_t *data_set)
Definition complex.c:199
GHashTable * pe_rsc_params(pe_resource_t *rsc, const pe_node_t *node, pe_working_set_t *data_set)
Get a table of resource parameters.
Definition complex.c:436
void populate_hash(xmlNode *nvpair_list, GHashTable *hash, const char **attrs, int attrs_length)
void pe__set_next_role(pe_resource_t *rsc, enum rsc_role_e role, const char *why)
Definition complex.c:1166
pe_node_t * pe__find_active_requires(const pe_resource_t *rsc, unsigned int *count)
Definition complex.c:1121
void get_meta_attributes(GHashTable *meta_hash, pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set)
Definition complex.c:149
bool pe__count_active_node(const pe_resource_t *rsc, pe_node_t *node, pe_node_t **active, unsigned int *count_all, unsigned int *count_clean)
Definition complex.c:1040
const pe_resource_t * pe__const_top_resource(const pe_resource_t *rsc, bool include_bundle)
Definition complex.c:947
gboolean is_parent(pe_resource_t *child, pe_resource_t *rsc)
Definition complex.c:905
void common_free(pe_resource_t *rsc)
Definition complex.c:964
resource_object_functions_t resource_class_functions[]
Definition complex.c:24
char data[0]
Definition cpg.c:10
#define INFINITY
Definition crm.h:99
#define crm_crit(fmt, args...)
Definition logging.h:374
#define CRM_CHECK(expr, failure_action)
Definition logging.h:235
#define crm_log_xml_trace(xml, text)
Definition logging.h:389
#define LOG_TRACE
Definition logging.h:37
#define pcmk__config_warn(fmt...)
#define pcmk__config_err(fmt...)
#define XML_CIB_TAG_RESOURCES
Definition msg_xml.h:199
#define ID(x)
Definition msg_xml.h:480
#define XML_BOOLEAN_TRUE
Definition msg_xml.h:159
#define XML_EXPR_ATTR_TYPE
Definition msg_xml.h:360
#define XML_CIB_TAG_CONTAINER
Definition msg_xml.h:233
#define XML_CIB_ATTR_PRIORITY
Definition msg_xml.h:290
#define XML_RSC_ATTR_MANAGED
Definition msg_xml.h:248
#define XML_RSC_ATTR_REQUIRES
Definition msg_xml.h:256
#define XML_RSC_ATTR_CONTAINER
Definition msg_xml.h:257
#define XML_RSC_ATTR_NOTIFY
Definition msg_xml.h:251
#define XML_RSC_ATTR_MAINTENANCE
Definition msg_xml.h:259
#define PCMK_XE_PROMOTABLE_LEGACY
Definition msg_xml.h:42
#define XML_RSC_ATTR_STICKINESS
Definition msg_xml.h:252
#define XML_TAG_ATTR_SETS
Definition msg_xml.h:222
#define XML_CIB_TAG_INCARNATION
Definition msg_xml.h:232
#define XML_ATTR_ID
Definition msg_xml.h:147
#define XML_RSC_ATTR_FAIL_STICKINESS
Definition msg_xml.h:253
#define XML_RSC_ATTR_RESTART
Definition msg_xml.h:238
#define XML_OP_ATTR_ALLOW_MIGRATE
Definition msg_xml.h:272
#define XML_AGENT_ATTR_PROVIDER
Definition msg_xml.h:283
#define XML_RSC_ATTR_INCARNATION
Definition msg_xml.h:241
#define XML_AGENT_ATTR_CLASS
Definition msg_xml.h:282
#define XML_TAG_META_SETS
Definition msg_xml.h:223
#define XML_CIB_TAG_RSC_TEMPLATE
Definition msg_xml.h:235
#define XML_RSC_ATTR_FAIL_TIMEOUT
Definition msg_xml.h:254
#define XML_RSC_ATTR_MULTIPLE
Definition msg_xml.h:255
#define XML_CIB_TAG_GROUP
Definition msg_xml.h:231
#define XML_RSC_ATTR_UNIQUE
Definition msg_xml.h:250
#define XML_TAG_UTILIZATION
Definition msg_xml.h:227
#define XML_CIB_TAG_RESOURCE
Definition msg_xml.h:230
#define XML_RSC_ATTR_CRITICAL
Definition msg_xml.h:266
#define XML_RSC_ATTR_PROMOTABLE
Definition msg_xml.h:245
#define XML_REMOTE_ATTR_RECONNECT_INTERVAL
Definition msg_xml.h:268
pe_working_set_t * data_set
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
Definition nvpair.c:496
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:347
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:302
#define PCMK__VALUE_UNFENCING
#define PCMK__VALUE_NOTHING
#define PCMK__VALUE_FENCING
#define PCMK__VALUE_QUORUM
@ no_quorum_ignore
Definition pe_types.h:82
#define pe_rsc_notify
Definition pe_types.h:277
#define pe_rsc_runnable
Definition pe_types.h:294
#define pe_rsc_needs_quorum
Definition pe_types.h:311
#define pe_rsc_fence_device
Definition pe_types.h:279
#define pe_flag_have_stonith_resource
Definition pe_types.h:116
#define pe_rsc_needs_unfencing
Definition pe_types.h:313
#define pe_rsc_block
Definition pe_types.h:274
#define pe_rsc_managed
Definition pe_types.h:273
#define pe_flag_maintenance_mode
Definition pe_types.h:113
#define pe_rsc_provisional
Definition pe_types.h:282
#define pe_flag_enable_unfencing
Definition pe_types.h:117
#define pe_flag_symmetric_cluster
Definition pe_types.h:112
#define pe_rsc_unique
Definition pe_types.h:278
#define pe_rsc_orphan
Definition pe_types.h:272
#define pe_rsc_allow_migrate
Definition pe_types.h:304
pe_obj_types
Definition pe_types.h:36
@ pe_group
Definition pe_types.h:39
@ pe_container
Definition pe_types.h:41
@ pe_unknown
Definition pe_types.h:37
@ pe_native
Definition pe_types.h:38
@ pe_clone
Definition pe_types.h:40
#define pe_flag_stonith_enabled
Definition pe_types.h:115
#define pe_rsc_needs_fencing
Definition pe_types.h:312
#define pe_rsc_maintenance
Definition pe_types.h:308
#define pe_rsc_promotable
Definition pe_types.h:280
#define pe_rsc_critical
Definition pe_types.h:290
@ pe_restart_ignore
Definition pe_types.h:96
@ pe_restart_restart
Definition pe_types.h:95
pe_resource_t * native_find_rsc(pe_resource_t *rsc, const char *id, const pe_node_t *node, int flags)
Definition native.c:265
bool pe__resource_is_disabled(const pe_resource_t *rsc)
Definition utils.c:755
#define pe_warn_once(pe_wo_bit, fmt...)
Definition internal.h:177
gboolean pe__bundle_is_filtered(const pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition bundle.c:1872
void pe__free_bundle(pe_resource_t *rsc)
Definition bundle.c:1787
void clone_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition clone.c:590
gboolean group_active(pe_resource_t *rsc, gboolean all)
Definition group.c:235
gboolean pe__clone_is_filtered(const pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition clone.c:1243
gboolean group_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition group.c:180
void pe__count_bundle(pe_resource_t *rsc)
Definition bundle.c:1848
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:319
gboolean clone_active(pe_resource_t *rsc, gboolean all)
Definition clone.c:442
enum rsc_role_e clone_resource_state(const pe_resource_t *rsc, gboolean current)
Definition clone.c:1203
void clone_free(pe_resource_t *rsc)
Definition clone.c:1169
#define pe__clear_resource_flags(resource, flags_to_clear)
Definition internal.h:83
#define pe_warn(fmt...)
Definition internal.h:57
@ pe_wo_upstart
Definition internal.h:171
@ pe_wo_nagios
Definition internal.h:172
@ pe_wo_neg_threshold
Definition internal.h:164
@ pe_wo_restart_type
Definition internal.h:159
gboolean clone_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition clone.c:295
#define pe_rsc_trace(rsc, fmt, args...)
Definition internal.h:50
gboolean get_target_role(const pe_resource_t *rsc, enum rsc_role_e *role)
Definition utils.c:449
gboolean native_active(pe_resource_t *rsc, gboolean all)
Definition native.c:341
void resource_location(pe_resource_t *rsc, const pe_node_t *node, int score, const char *tag, pe_working_set_t *data_set)
Definition utils.c:398
void group_free(pe_resource_t *rsc)
Definition group.c:453
pe_node_t * native_location(const pe_resource_t *rsc, GList **list, int current)
Definition native.c:1093
void native_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition native.c:911
#define pe__set_resource_flags(resource, flags_to_set)
Definition internal.h:77
gboolean pe__bundle_active(pe_resource_t *rsc, gboolean all)
Definition bundle.c:1127
gboolean native_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition native.c:199
void native_free(pe_resource_t *rsc)
Definition native.c:1063
enum rsc_role_e native_resource_state(const pe_resource_t *rsc, gboolean current)
Definition native.c:1070
enum rsc_role_e group_resource_state(const pe_resource_t *rsc, gboolean current)
Definition group.c:474
void pe__unpack_dataset_nvpairs(const xmlNode *xml_obj, const char *set_name, const pe_rule_eval_data_t *rule_data, GHashTable *hash, const char *always_first, gboolean overwrite, pe_working_set_t *data_set)
Definition utils.c:737
gboolean pe__native_is_filtered(const pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition native.c:1401
enum rsc_role_e pe__bundle_resource_state(const pe_resource_t *rsc, gboolean current)
Definition bundle.c:1821
gboolean pe__group_is_filtered(const pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition group.c:493
gboolean pe__unpack_bundle(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition bundle.c:789
void group_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition group.c:289
void pe__print_bundle(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition bundle.c:1685
gboolean add_tag_ref(GHashTable *tags, const char *tag_name, const char *obj_ref)
Definition utils.c:651
#define pe__set_working_set_flags(working_set, flags_to_set)
Definition internal.h:65
#define pe_err(fmt...)
Definition internal.h:52
void add_hash_param(GHashTable *hash, const char *name, const char *value)
Definition common.c:500
bool xml_contains_remote_node(xmlNode *xml)
Definition remote.c:84
#define CRM_ASSERT(expr)
Definition results.h:42
@ pcmk_rc_ok
Definition results.h:151
@ pcmk_rc_unpack_error
Definition results.h:115
GHashTable * pcmk__strkey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
Definition strings.c:611
bool pcmk__strcase_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
Definition strings.c:933
@ pcmk__str_none
@ pcmk__str_null_matches
@ pcmk__str_casei
GHashTable * pcmk__strikey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
Definition strings.c:649
int count
Definition pe_types.h:267
struct pe_node_shared_s * details
Definition pe_types.h:268
GHashTable * attrs
Definition pe_types.h:257
gboolean online
Definition pe_types.h:236
const char * uname
Definition pe_types.h:232
gboolean unclean
Definition pe_types.h:240
GList * running_on
Definition pe_types.h:398
GList * actions
Definition pe_types.h:391
GList * rsc_location
Definition pe_types.h:390
enum pe_obj_types variant
Definition pe_types.h:356
GHashTable * meta
Definition pe_types.h:405
GList * rsc_cons
Definition pe_types.h:389
GList * rsc_cons_lhs
Definition pe_types.h:388
GList * children
Definition pe_types.h:409
GHashTable * known_on
Definition pe_types.h:399
pe_working_set_t * cluster
Definition pe_types.h:353
char * clone_name
Definition pe_types.h:348
xmlNode * xml
Definition pe_types.h:349
GHashTable * utilization
Definition pe_types.h:407
GHashTable * allowed_nodes
Definition pe_types.h:400
GList * dangling_migrations
Definition pe_types.h:410
GHashTable * parameter_cache
Definition pe_types.h:426
pe_node_t * partial_migration_source
Definition pe_types.h:397
GList * rsc_tickets
Definition pe_types.h:392
pe_node_t * allocated_to
Definition pe_types.h:395
void * variant_opaque
Definition pe_types.h:357
unsigned long long flags
Definition pe_types.h:373
char * pending_task
Definition pe_types.h:371
pe_resource_t * parent
Definition pe_types.h:354
GList * fillers
Definition pe_types.h:413
xmlNode * orig_xml
Definition pe_types.h:350
enum rsc_role_e next_role
Definition pe_types.h:403
enum rsc_role_e role
Definition pe_types.h:402
resource_object_functions_t * fns
Definition pe_types.h:358
const char * standard
Definition common.h:182
GHashTable * node_hash
Definition common.h:193
crm_time_t * now
Definition common.h:195
GHashTable * template_rsc_sets
Definition pe_types.h:201
xmlNode * input
Definition pe_types.h:160
unsigned long long flags
Definition pe_types.h:169
xmlNode * rsc_defaults
Definition pe_types.h:190
enum pe_quorum_policy no_quorum_policy
Definition pe_types.h:172
crm_time_t * now
Definition pe_types.h:161
pe_node_t *(* active_node)(const pe_resource_t *rsc, unsigned int *count_all, unsigned int *count_clean)
Definition pe_types.h:73
xmlNode * expand_idref(xmlNode *input, xmlNode *top)
Definition xml.c:2593
xmlNode * get_xpath_object(const char *xpath, xmlNode *xml_obj, int error_level)
Definition xpath.c:214
void free_xml(xmlNode *child)
Definition xml.c:813
xmlNode * find_xml_node(const xmlNode *root, const char *search_path, gboolean must_find)
Definition xml.c:404
xmlNode * add_node_copy(xmlNode *new_parent, xmlNode *xml_node)
Definition xml.c:663
xmlNode * copy_xml(xmlNode *src_node)
Definition xml.c:819
xmlNode * pcmk__xe_match(const xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
Definition xml.c:454