pacemaker 2.1.4-dc6eb4362e
Scalable High-Availability cluster resource manager
complex.c
Go to the documentation of this file.
1/*
2 * Copyright 2004-2022 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
17void populate_hash(xmlNode * nvpair_list, GHashTable * hash, const char **attrs, int attrs_length);
18
20 {
31 },
32 {
43 },
44 {
55 },
56 {
67 }
68};
69
70static enum pe_obj_types
71get_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
93static void
94dup_attr(gpointer key, gpointer value, gpointer user_data)
95{
96 add_hash_param(user_data, key, value);
97}
98
99static void
100expand_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}
139void
140get_meta_attributes(GHashTable * meta_hash, pe_resource_t * rsc,
142{
143 pe_rsc_eval_data_t rsc_rule_data = {
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
189void
190get_rsc_attributes(GHashTable * meta_hash, pe_resource_t * rsc,
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
221void
222pe_get_versioned_attributes(xmlNode * meta_hash, pe_resource_t * rsc,
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
250static char *
251template_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
267static gboolean
268unpack_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
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
381static gboolean
382add_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
415static bool
416detect_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,
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
438static void
439free_params_table(gpointer data)
440{
441 g_hash_table_destroy((GHashTable *) data);
442}
443
456GHashTable *
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
492gboolean
493common_unpack(xmlNode * xml_obj, pe_resource_t ** rsc,
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
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 }
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 if (pcmk__str_eq(value, "stop_unexpected", pcmk__str_casei)) {
698 (*rsc)->recovery_type = recovery_stop_unexpected;
699 pe_rsc_trace((*rsc), "\tMultiple running resource recovery: "
700 "stop unexpected instances");
701
702 } else { // "stop_start"
703 if (!pcmk__str_eq(value, "stop_start",
705 pe_warn("%s is not a valid value for " XML_RSC_ATTR_MULTIPLE
706 ", using default of \"stop_start\"", value);
707 }
708 (*rsc)->recovery_type = recovery_stop_start;
709 pe_rsc_trace((*rsc), "\tMultiple running resource recovery: stop/start");
710 }
711
712 value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_STICKINESS);
713 if (value != NULL && !pcmk__str_eq("default", value, pcmk__str_casei)) {
714 (*rsc)->stickiness = char2score(value);
715 }
716
717 value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_FAIL_STICKINESS);
718 if (value != NULL && !pcmk__str_eq("default", value, pcmk__str_casei)) {
719 (*rsc)->migration_threshold = char2score(value);
720 if ((*rsc)->migration_threshold < 0) {
721 /* @TODO We use 1 here to preserve previous behavior, but this
722 * should probably use the default (INFINITY) or 0 (to disable)
723 * instead.
724 */
727 " must be non-negative, using 1 instead");
728 (*rsc)->migration_threshold = 1;
729 }
730 }
731
732 if (pcmk__str_eq(rclass, PCMK_RESOURCE_CLASS_STONITH, pcmk__str_casei)) {
735 }
736
737 value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_REQUIRES);
738
739 handle_requires_pref:
740 if (pcmk__str_eq(value, "nothing", pcmk__str_casei)) {
741
742 } else if (pcmk__str_eq(value, "quorum", pcmk__str_casei)) {
744
745 } else if (pcmk__str_eq(value, "unfencing", pcmk__str_casei)) {
746 if (pcmk_is_set((*rsc)->flags, pe_rsc_fence_device)) {
747 pcmk__config_warn("Resetting '" XML_RSC_ATTR_REQUIRES "' for %s "
748 "to 'quorum' because fencing devices cannot "
749 "require unfencing", (*rsc)->id);
750 value = "quorum";
751 isdefault = TRUE;
752 goto handle_requires_pref;
753
755 pcmk__config_warn("Resetting '" XML_RSC_ATTR_REQUIRES "' for %s "
756 "to 'quorum' because fencing is disabled",
757 (*rsc)->id);
758 value = "quorum";
759 isdefault = TRUE;
760 goto handle_requires_pref;
761
762 } else {
765 }
766
767 } else if (pcmk__str_eq(value, "fencing", pcmk__str_casei)) {
770 pcmk__config_warn("%s requires fencing but fencing is disabled",
771 (*rsc)->id);
772 }
773
774 } else {
775 const char *orig_value = value;
776
777 isdefault = TRUE;
778 if (pcmk_is_set((*rsc)->flags, pe_rsc_fence_device)) {
779 value = "quorum";
780
781 } else if (((*rsc)->variant == pe_native)
783 && pcmk__str_eq(crm_element_value((*rsc)->xml, XML_AGENT_ATTR_PROVIDER), "pacemaker", pcmk__str_casei)
784 && pcmk__str_eq(crm_element_value((*rsc)->xml, XML_ATTR_TYPE), "remote", pcmk__str_casei)
785 ) {
786 value = "quorum";
787
789 value = "unfencing";
790
792 value = "fencing";
793
795 value = "nothing";
796
797 } else {
798 value = "quorum";
799 }
800
801 if (orig_value != NULL) {
802 pcmk__config_err("Resetting '" XML_RSC_ATTR_REQUIRES "' for %s "
803 "to '%s' because '%s' is not valid",
804 (*rsc)->id, value, orig_value);
805 }
806
807 goto handle_requires_pref;
808 }
809
810 pe_rsc_trace((*rsc), "\tRequired to start: %s%s", value, isdefault?" (default)":"");
811 value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_FAIL_TIMEOUT);
812 if (value != NULL) {
813 // Stored as seconds
814 (*rsc)->failure_timeout = (int) (crm_parse_interval_spec(value) / 1000);
815 }
816
817 if (remote_node) {
818 GHashTable *params = pe_rsc_params(*rsc, NULL, data_set);
819
820 /* Grabbing the value now means that any rules based on node attributes
821 * will evaluate to false, so such rules should not be used with
822 * reconnect_interval.
823 *
824 * @TODO Evaluate per node before using
825 */
826 value = g_hash_table_lookup(params, XML_REMOTE_ATTR_RECONNECT_INTERVAL);
827 if (value) {
828 /* reconnect delay works by setting failure_timeout and preventing the
829 * connection from starting until the failure is cleared. */
830 (*rsc)->remote_reconnect_ms = crm_parse_interval_spec(value);
831 /* we want to override any default failure_timeout in use when remote
832 * reconnect_interval is in use. */
833 (*rsc)->failure_timeout = (*rsc)->remote_reconnect_ms / 1000;
834 }
835 }
836
837 get_target_role(*rsc, &((*rsc)->next_role));
838 pe_rsc_trace((*rsc), "\tDesired next state: %s",
839 (*rsc)->next_role != RSC_ROLE_UNKNOWN ? role2text((*rsc)->next_role) : "default");
840
841 if ((*rsc)->fns->unpack(*rsc, data_set) == FALSE) {
842 return FALSE;
843 }
844
846 // This tag must stay exactly the same because it is tested elsewhere
847 resource_location(*rsc, NULL, 0, "symmetric_default", data_set);
848 } else if (guest_node) {
849 /* remote resources tied to a container resource must always be allowed
850 * to opt-in to the cluster. Whether the connection resource is actually
851 * allowed to be placed on a node is dependent on the container resource */
852 resource_location(*rsc, NULL, 0, "remote_connection_default", data_set);
853 }
854
855 pe_rsc_trace((*rsc), "\tAction notification: %s",
856 pcmk_is_set((*rsc)->flags, pe_rsc_notify)? "required" : "not required");
857
858 (*rsc)->utilization = pcmk__strkey_table(free, free);
859
860 pe__unpack_dataset_nvpairs((*rsc)->xml, XML_TAG_UTILIZATION, &rule_data,
861 (*rsc)->utilization, NULL, FALSE, data_set);
862
863/* data_set->resources = g_list_append(data_set->resources, (*rsc)); */
864
865 if (expanded_xml) {
866 if (add_template_rsc(xml_obj, data_set) == FALSE) {
867 return FALSE;
868 }
869 }
870 return TRUE;
871}
872
873void
874common_update_score(pe_resource_t * rsc, const char *id, int score)
875{
876 pe_node_t *node = NULL;
877
878 node = pe_hash_table_lookup(rsc->allowed_nodes, id);
879 if (node != NULL) {
880 pe_rsc_trace(rsc, "Updating score for %s on %s: %d + %d", rsc->id, id, node->weight, score);
881 node->weight = pcmk__add_scores(node->weight, score);
882 }
883
884 if (rsc->children) {
885 GList *gIter = rsc->children;
886
887 for (; gIter != NULL; gIter = gIter->next) {
888 pe_resource_t *child_rsc = (pe_resource_t *) gIter->data;
889
890 common_update_score(child_rsc, id, score);
891 }
892 }
893}
894
895gboolean
897{
898 pe_resource_t *parent = child;
899
900 if (parent == NULL || rsc == NULL) {
901 return FALSE;
902 }
903 while (parent->parent != NULL) {
904 if (parent->parent == rsc) {
905 return TRUE;
906 }
907 parent = parent->parent;
908 }
909 return FALSE;
910}
911
914{
915 pe_resource_t *parent = rsc;
916
917 if (parent == NULL) {
918 return NULL;
919 }
920 while (parent->parent != NULL && parent->parent->variant != pe_container) {
921 parent = parent->parent;
922 }
923 return parent;
924}
925
926void
928{
929 if (rsc == NULL) {
930 return;
931 }
932
933 pe_rsc_trace(rsc, "Freeing %s %d", rsc->id, rsc->variant);
934
935 g_list_free(rsc->rsc_cons);
936 g_list_free(rsc->rsc_cons_lhs);
937 g_list_free(rsc->rsc_tickets);
938 g_list_free(rsc->dangling_migrations);
939
940 if (rsc->parameter_cache != NULL) {
941 g_hash_table_destroy(rsc->parameter_cache);
942 }
943#if ENABLE_VERSIONED_ATTRS
944 if (rsc->versioned_parameters != NULL) {
945 free_xml(rsc->versioned_parameters);
946 }
947#endif
948 if (rsc->meta != NULL) {
949 g_hash_table_destroy(rsc->meta);
950 }
951 if (rsc->utilization != NULL) {
952 g_hash_table_destroy(rsc->utilization);
953 }
954
955 if ((rsc->parent == NULL) && pcmk_is_set(rsc->flags, pe_rsc_orphan)) {
956 free_xml(rsc->xml);
957 rsc->xml = NULL;
958 free_xml(rsc->orig_xml);
959 rsc->orig_xml = NULL;
960
961 /* if rsc->orig_xml, then rsc->xml is an expanded xml from a template */
962 } else if (rsc->orig_xml) {
963 free_xml(rsc->xml);
964 rsc->xml = NULL;
965 }
966 if (rsc->running_on) {
967 g_list_free(rsc->running_on);
968 rsc->running_on = NULL;
969 }
970 if (rsc->known_on) {
971 g_hash_table_destroy(rsc->known_on);
972 rsc->known_on = NULL;
973 }
974 if (rsc->actions) {
975 g_list_free(rsc->actions);
976 rsc->actions = NULL;
977 }
978 if (rsc->allowed_nodes) {
979 g_hash_table_destroy(rsc->allowed_nodes);
980 rsc->allowed_nodes = NULL;
981 }
982 g_list_free(rsc->fillers);
983 g_list_free(rsc->rsc_location);
984 pe_rsc_trace(rsc, "Resource freed");
985 free(rsc->id);
986 free(rsc->clone_name);
987 free(rsc->allocated_to);
988 free(rsc->variant_opaque);
989 free(rsc->pending_task);
990 free(rsc);
991}
992
1008pe_node_t *
1009pe__find_active_on(const pe_resource_t *rsc, unsigned int *count_all,
1010 unsigned int *count_clean)
1011{
1012 pe_node_t *active = NULL;
1013 pe_node_t *node = NULL;
1014 bool keep_looking = FALSE;
1015 bool is_happy = FALSE;
1016
1017 if (count_all) {
1018 *count_all = 0;
1019 }
1020 if (count_clean) {
1021 *count_clean = 0;
1022 }
1023 if (rsc == NULL) {
1024 return NULL;
1025 }
1026
1027 for (GList *node_iter = rsc->running_on; node_iter != NULL;
1028 node_iter = node_iter->next) {
1029
1030 node = node_iter->data;
1031 keep_looking = FALSE;
1032
1033 is_happy = node->details->online && !node->details->unclean;
1034
1035 if (count_all) {
1036 ++*count_all;
1037 }
1038 if (count_clean && is_happy) {
1039 ++*count_clean;
1040 }
1041 if (count_all || count_clean) {
1042 // If we're counting, we need to go through entire list
1043 keep_looking = TRUE;
1044 }
1045
1046 if (rsc->partial_migration_source != NULL) {
1047 if (node->details == rsc->partial_migration_source->details) {
1048 // This is the migration source
1049 active = node;
1050 } else {
1051 keep_looking = TRUE;
1052 }
1053 } else if (!pcmk_is_set(rsc->flags, pe_rsc_needs_fencing)) {
1054 if (is_happy && (!active || !active->details->online
1055 || active->details->unclean)) {
1056 // This is the first clean node
1057 active = node;
1058 } else {
1059 keep_looking = TRUE;
1060 }
1061 }
1062 if (active == NULL) {
1063 // This is first node in list
1064 active = node;
1065 }
1066
1067 if (keep_looking == FALSE) {
1068 // Don't waste time iterating if we don't have to
1069 break;
1070 }
1071 }
1072 return active;
1073}
1074
1088pe_node_t *
1089pe__find_active_requires(const pe_resource_t *rsc, unsigned int *count)
1090{
1091 if (rsc && !pcmk_is_set(rsc->flags, pe_rsc_needs_fencing)) {
1092 return pe__find_active_on(rsc, NULL, count);
1093 }
1094 return pe__find_active_on(rsc, count, NULL);
1095}
1096
1097void
1099{
1100 if (rsc->children != NULL) {
1101 for (GList *item = rsc->children; item != NULL; item = item->next) {
1102 ((pe_resource_t *) item->data)->fns->count(item->data);
1103 }
1104
1105 } else if (!pcmk_is_set(rsc->flags, pe_rsc_orphan)
1106 || (rsc->role > RSC_ROLE_STOPPED)) {
1107 rsc->cluster->ninstances++;
1108 if (pe__resource_is_disabled(rsc)) {
1110 }
1111 if (pcmk_is_set(rsc->flags, pe_rsc_block)) {
1112 rsc->cluster->blocked_resources++;
1113 }
1114 }
1115}
1116
1125void
1126pe__set_next_role(pe_resource_t *rsc, enum rsc_role_e role, const char *why)
1127{
1128 CRM_ASSERT((rsc != NULL) && (why != NULL));
1129 if (rsc->next_role != role) {
1130 pe_rsc_trace(rsc, "Resetting next role for %s from %s to %s (%s)",
1131 rsc->id, role2text(rsc->next_role), role2text(role), why);
1132 rsc->next_role = role;
1133 }
1134}
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:242
int pcmk__add_scores(int score1, int score2)
Definition: scores.c:140
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:122
#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:454
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:913
pe_node_t * pe__find_active_on(const pe_resource_t *rsc, unsigned int *count_all, unsigned int *count_clean)
Definition: complex.c:1009
void pe__count_common(pe_resource_t *rsc)
Definition: complex.c:1098
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:1126
pe_node_t * pe__find_active_requires(const pe_resource_t *rsc, unsigned int *count)
Definition: complex.c:1089
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
void common_update_score(pe_resource_t *rsc, const char *id, int score)
Definition: complex.c:874
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
gboolean common_unpack(xmlNode *xml_obj, pe_resource_t **rsc, pe_resource_t *parent, pe_working_set_t *data_set)
Definition: complex.c:493
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
gboolean is_parent(pe_resource_t *child, pe_resource_t *rsc)
Definition: complex.c:896
void common_free(pe_resource_t *rsc)
Definition: complex.c:927
resource_object_functions_t resource_class_functions[]
Definition: complex.c:19
char data[0]
Definition: cpg.c:10
#define INFINITY
Definition: crm.h:99
#define crm_log_xml_trace(xml, text)
Definition: logging.h:372
#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:186
#define ID(x)
Definition: msg_xml.h:460
#define XML_BOOLEAN_TRUE
Definition: msg_xml.h:146
#define XML_EXPR_ATTR_TYPE
Definition: msg_xml.h:348
#define XML_CIB_TAG_CONTAINER
Definition: msg_xml.h:223
#define XML_TAG_RSC_VER_ATTRS
Definition: msg_xml.h:212
#define XML_CIB_ATTR_PRIORITY
Definition: msg_xml.h:278
#define XML_RSC_ATTR_MANAGED
Definition: msg_xml.h:238
#define XML_RSC_ATTR_REQUIRES
Definition: msg_xml.h:246
#define XML_RSC_ATTR_CONTAINER
Definition: msg_xml.h:247
#define XML_RSC_ATTR_NOTIFY
Definition: msg_xml.h:241
#define XML_RSC_ATTR_MAINTENANCE
Definition: msg_xml.h:249
#define PCMK_XE_PROMOTABLE_LEGACY
Definition: msg_xml.h:39
#define XML_RSC_ATTR_STICKINESS
Definition: msg_xml.h:242
#define XML_TAG_ATTR_SETS
Definition: msg_xml.h:209
#define XML_CIB_TAG_INCARNATION
Definition: msg_xml.h:222
#define XML_ATTR_ID
Definition: msg_xml.h:135
#define XML_RSC_ATTR_FAIL_STICKINESS
Definition: msg_xml.h:243
#define XML_RSC_ATTR_RESTART
Definition: msg_xml.h:228
#define XML_OP_ATTR_ALLOW_MIGRATE
Definition: msg_xml.h:262
#define XML_AGENT_ATTR_PROVIDER
Definition: msg_xml.h:273
#define XML_RSC_ATTR_INCARNATION
Definition: msg_xml.h:231
#define XML_AGENT_ATTR_CLASS
Definition: msg_xml.h:272
#define XML_TAG_META_SETS
Definition: msg_xml.h:210
#define XML_CIB_TAG_RSC_TEMPLATE
Definition: msg_xml.h:225
#define XML_ATTR_TYPE
Definition: msg_xml.h:138
#define XML_RSC_ATTR_FAIL_TIMEOUT
Definition: msg_xml.h:244
#define XML_RSC_ATTR_MULTIPLE
Definition: msg_xml.h:245
#define XML_CIB_TAG_GROUP
Definition: msg_xml.h:221
#define XML_RSC_ATTR_UNIQUE
Definition: msg_xml.h:240
#define XML_TAG_UTILIZATION
Definition: msg_xml.h:217
#define XML_CIB_TAG_RESOURCE
Definition: msg_xml.h:220
#define XML_RSC_ATTR_CRITICAL
Definition: msg_xml.h:256
#define XML_RSC_ATTR_PROMOTABLE
Definition: msg_xml.h:235
#define XML_REMOTE_ATTR_RECONNECT_INTERVAL
Definition: msg_xml.h:258
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:529
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:380
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:323
@ no_quorum_ignore
Definition: pe_types.h:66
#define pe_rsc_notify
Definition: pe_types.h:261
#define pe_rsc_runnable
Definition: pe_types.h:277
#define pe_rsc_needs_quorum
Definition: pe_types.h:293
#define pe_rsc_fence_device
Definition: pe_types.h:263
#define pe_flag_have_stonith_resource
Definition: pe_types.h:100
#define pe_rsc_needs_unfencing
Definition: pe_types.h:295
#define pe_rsc_block
Definition: pe_types.h:258
#define pe_rsc_managed
Definition: pe_types.h:257
#define pe_flag_maintenance_mode
Definition: pe_types.h:97
#define pe_rsc_provisional
Definition: pe_types.h:266
#define pe_flag_enable_unfencing
Definition: pe_types.h:101
#define pe_flag_symmetric_cluster
Definition: pe_types.h:96
#define pe_rsc_unique
Definition: pe_types.h:262
#define pe_rsc_orphan
Definition: pe_types.h:256
#define pe_rsc_allow_migrate
Definition: pe_types.h:287
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:99
#define pe_rsc_needs_fencing
Definition: pe_types.h:294
#define pe_rsc_maintenance
Definition: pe_types.h:290
#define pe_rsc_promotable
Definition: pe_types.h:264
#define pe_rsc_critical
Definition: pe_types.h:274
@ pe_restart_ignore
Definition: pe_types.h:80
@ pe_restart_restart
Definition: pe_types.h:79
pe_resource_t * native_find_rsc(pe_resource_t *rsc, const char *id, const pe_node_t *node, int flags)
Definition: native.c:270
#define pe_warn_once(pe_wo_bit, fmt...)
Definition: internal.h:157
void pe__free_bundle(pe_resource_t *rsc)
Definition: bundle.c:1974
gboolean pe__native_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: native.c:1362
void clone_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: clone.c:479
gboolean group_active(pe_resource_t *rsc, gboolean all)
Definition: group.c:166
gboolean group_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: group.c:99
bool pe__resource_is_disabled(pe_resource_t *rsc)
Definition: utils.c:2425
void pe__count_bundle(pe_resource_t *rsc)
Definition: bundle.c:2035
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:324
gboolean clone_active(pe_resource_t *rsc, gboolean all)
Definition: clone.c:346
enum rsc_role_e clone_resource_state(const pe_resource_t *rsc, gboolean current)
Definition: clone.c:1069
void clone_free(pe_resource_t *rsc)
Definition: clone.c:1035
gboolean get_target_role(pe_resource_t *rsc, enum rsc_role_e *role)
Definition: utils.c:1868
gboolean pe__clone_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: clone.c:1110
#define pe__clear_resource_flags(resource, flags_to_clear)
Definition: internal.h:55
gboolean pe__bundle_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: bundle.c:2059
#define pe_warn(fmt...)
Definition: internal.h:29
@ pe_wo_neg_threshold
Definition: internal.h:150
@ pe_wo_restart_type
Definition: internal.h:145
gboolean clone_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: clone.c:205
#define pe_rsc_trace(rsc, fmt, args...)
Definition: internal.h:22
gboolean pe__group_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: group.c:403
gboolean native_active(pe_resource_t *rsc, gboolean all)
Definition: native.c:346
void group_free(pe_resource_t *rsc)
Definition: group.c:363
pe_node_t * native_location(const pe_resource_t *rsc, GList **list, int current)
Definition: native.c:1058
void native_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: native.c:888
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:1692
#define pe__set_resource_flags(resource, flags_to_set)
Definition: internal.h:49
gboolean pe__bundle_active(pe_resource_t *rsc, gboolean all)
Definition: bundle.c:1355
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:2407
gboolean native_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: native.c:200
void native_free(pe_resource_t *rsc)
Definition: native.c:1028
enum rsc_role_e native_resource_state(const pe_resource_t *rsc, gboolean current)
Definition: native.c:1035
enum rsc_role_e group_resource_state(const pe_resource_t *rsc, gboolean current)
Definition: group.c:384
enum rsc_role_e pe__bundle_resource_state(const pe_resource_t *rsc, gboolean current)
Definition: bundle.c:2008
gboolean pe__unpack_bundle(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: bundle.c:1007
void group_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: group.c:211
void pe__print_bundle(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: bundle.c:1872
gboolean add_tag_ref(GHashTable *tags, const char *tag_name, const char *obj_ref)
Definition: utils.c:2279
#define pe__set_working_set_flags(working_set, flags_to_set)
Definition: internal.h:37
#define pe_err(fmt...)
Definition: internal.h:24
void add_hash_param(GHashTable *hash, const char *name, const char *value)
Definition: common.c:504
bool xml_contains_remote_node(xmlNode *xml)
Definition: remote.c:84
#define CRM_ASSERT(expr)
Definition: results.h:42
#define PCMK_RESOURCE_CLASS_STONITH
Definition: services.h:45
#define PCMK_RESOURCE_CLASS_OCF
Definition: services.h:39
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:931
@ 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 weight
Definition: pe_types.h:249
struct pe_node_shared_s * details
Definition: pe_types.h:252
GHashTable * attrs
Definition: pe_types.h:241
gboolean online
Definition: pe_types.h:220
const char * uname
Definition: pe_types.h:216
gboolean unclean
Definition: pe_types.h:224
GList * running_on
Definition: pe_types.h:380
GList * actions
Definition: pe_types.h:373
GList * rsc_location
Definition: pe_types.h:372
enum pe_obj_types variant
Definition: pe_types.h:345
GHashTable * meta
Definition: pe_types.h:387
GList * rsc_cons
Definition: pe_types.h:371
GList * rsc_cons_lhs
Definition: pe_types.h:370
GList * children
Definition: pe_types.h:391
GHashTable * known_on
Definition: pe_types.h:381
pe_working_set_t * cluster
Definition: pe_types.h:342
char * clone_name
Definition: pe_types.h:337
char * id
Definition: pe_types.h:336
xmlNode * xml
Definition: pe_types.h:338
GHashTable * utilization
Definition: pe_types.h:389
GHashTable * allowed_nodes
Definition: pe_types.h:382
GList * dangling_migrations
Definition: pe_types.h:392
GHashTable * parameter_cache
Definition: pe_types.h:406
pe_node_t * partial_migration_source
Definition: pe_types.h:379
GList * rsc_tickets
Definition: pe_types.h:374
pe_node_t * allocated_to
Definition: pe_types.h:377
void * variant_opaque
Definition: pe_types.h:346
unsigned long long flags
Definition: pe_types.h:362
char * pending_task
Definition: pe_types.h:360
pe_resource_t * parent
Definition: pe_types.h:343
GList * fillers
Definition: pe_types.h:395
xmlNode * orig_xml
Definition: pe_types.h:339
enum rsc_role_e next_role
Definition: pe_types.h:385
enum rsc_role_e role
Definition: pe_types.h:384
const char * standard
Definition: common.h:183
GHashTable * node_hash
Definition: common.h:194
int blocked_resources
Definition: pe_types.h:189
GHashTable * template_rsc_sets
Definition: pe_types.h:185
xmlNode * input
Definition: pe_types.h:144
int disabled_resources
Definition: pe_types.h:190
unsigned long long flags
Definition: pe_types.h:153
xmlNode * rsc_defaults
Definition: pe_types.h:174
enum pe_quorum_policy no_quorum_policy
Definition: pe_types.h:156
crm_time_t * now
Definition: pe_types.h:145
gboolean xml_has_children(const xmlNode *root)
Definition: xml.c:2028
xmlNode * find_xml_node(xmlNode *cib, const char *node_path, gboolean must_find)
Definition: xml.c:445
xmlNode * expand_idref(xmlNode *input, xmlNode *top)
Definition: xml.c:2867
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:824
xmlNode * add_node_copy(xmlNode *new_parent, xmlNode *xml_node)
Definition: xml.c:674
xmlNode * copy_xml(xmlNode *src_node)
Definition: xml.c:830
xmlNode * create_xml_node(xmlNode *parent, const char *name)
Definition: xml.c:696
xmlNode * pcmk__xe_match(xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
Definition: xml.c:495