MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / unpack_instance_attributes

Function unpack_instance_attributes

lib/pengine/rules.c:677–726  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

675}
676
677void
678unpack_instance_attributes(xmlNode * top, xmlNode * xml_obj, const char *set_name,
679 GHashTable * node_hash, GHashTable * hash, const char *always_first,
680 gboolean overwrite, crm_time_t * now)
681{
682 GListPtr sorted = NULL;
683 GListPtr unsorted = NULL;
684 const char *score = NULL;
685 sorted_set_t *pair = NULL;
686 struct unpack_data_s data;
687 xmlNode *attr_set = NULL;
688
689 if (xml_obj == NULL) {
690 crm_trace("No instance attributes");
691 return;
692 }
693
694 crm_trace("Checking for attributes");
695 for (attr_set = __xml_first_child(xml_obj); attr_set != NULL; attr_set = __xml_next(attr_set)) {
696 /* Uncertain if set_name == NULL check is strictly necessary here */
697 if (set_name == NULL || crm_str_eq((const char *)attr_set->name, set_name, TRUE)) {
698 pair = NULL;
699 attr_set = expand_idref(attr_set, top);
700 if (attr_set == NULL) {
701 continue;
702 }
703
704 pair = calloc(1, sizeof(sorted_set_t));
705 pair->name = ID(attr_set);
706 pair->special_name = always_first;
707 pair->attr_set = attr_set;
708
709 score = crm_element_value(attr_set, XML_RULE_ATTR_SCORE);
710 pair->score = char2score(score);
711
712 unsorted = g_list_prepend(unsorted, pair);
713 }
714 }
715
716 if (pair != NULL) {
717 data.hash = hash;
718 data.node_hash = node_hash;
719 data.now = now;
720 data.overwrite = overwrite;
721 }
722
723 sorted = g_list_sort(unsorted, sort_pairs);
724 g_list_foreach(sorted, unpack_attr_set, &data);
725 g_list_free_full(sorted, free);
726}

Callers 12

dump_resource_attrFunction · 0.85
cib_read_configFunction · 0.85
custom_actionFunction · 0.85
unpack_operationFunction · 0.85
unpack_configFunction · 0.85
unpack_nodesFunction · 0.85
unpack_statusFunction · 0.85
add_node_attrsFunction · 0.85
get_meta_attributesFunction · 0.85
get_rsc_attributesFunction · 0.85
common_unpackFunction · 0.85
config_query_callbackFunction · 0.85

Calls 7

__xml_first_childFunction · 0.85
__xml_nextFunction · 0.85
crm_str_eqFunction · 0.85
expand_idrefFunction · 0.85
crm_element_valueFunction · 0.85
char2scoreFunction · 0.85
g_list_free_fullFunction · 0.85

Tested by

no test coverage detected