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

Function unpack_find_resource

lib/pengine/unpack.c:1120–1171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1118}
1119
1120static resource_t *
1121unpack_find_resource(pe_working_set_t * data_set, node_t * node, const char *rsc_id,
1122 xmlNode * rsc_entry)
1123{
1124 resource_t *rsc = NULL;
1125 resource_t *parent = NULL;
1126
1127 crm_trace("looking for %s", rsc_id);
1128 rsc = pe_find_resource(data_set->resources, rsc_id);
1129
1130 /* no match */
1131 if (rsc == NULL) {
1132 /* Even when clone-max=0, we still create a single :0 orphan to match against */
1133 char *tmp = clone_zero(rsc_id);
1134 resource_t *clone0 = pe_find_resource(data_set->resources, tmp);
1135
1136 if(clone0 && is_not_set(clone0->flags, pe_rsc_unique)) {
1137 rsc = clone0;
1138 } else {
1139 crm_trace("%s is not known as %s either", rsc_id, tmp);
1140 }
1141
1142 parent = uber_parent(clone0);
1143 free(tmp);
1144
1145 crm_trace("%s not found: %s", rsc_id, parent ? parent->id : "orphan");
1146
1147 } else if (rsc->variant > pe_native) {
1148 crm_trace("%s is no longer a primitve resource, the lrm_resource entry is obsolete", rsc_id);
1149 return NULL;
1150
1151 } else {
1152 parent = uber_parent(rsc);
1153 }
1154
1155 if (parent
1156 && parent->variant > pe_group) {
1157 if(is_not_set(parent->flags, pe_rsc_unique)) {
1158 char *base = clone_strip(rsc_id);
1159 rsc = find_anonymous_clone(data_set, node, parent, base);
1160 CRM_ASSERT(rsc != NULL);
1161 free(base);
1162 }
1163
1164 if (rsc && safe_str_neq(rsc_id, rsc->id)) {
1165 free(rsc->clone_name);
1166 rsc->clone_name = strdup(rsc_id);
1167 }
1168 }
1169
1170 return rsc;
1171}
1172
1173static resource_t *
1174process_orphan_resource(xmlNode * rsc_entry, node_t * node, pe_working_set_t * data_set)

Callers 1

unpack_lrm_rsc_stateFunction · 0.85

Calls 7

pe_find_resourceFunction · 0.85
clone_zeroFunction · 0.85
is_not_setFunction · 0.85
uber_parentFunction · 0.85
clone_stripFunction · 0.85
find_anonymous_cloneFunction · 0.85
safe_str_neqFunction · 0.85

Tested by

no test coverage detected