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

Function common_unpack

lib/pengine/complex.c:336–621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334}
335
336gboolean
337common_unpack(xmlNode * xml_obj, resource_t ** rsc,
338 resource_t * parent, pe_working_set_t * data_set)
339{
340 xmlNode *expanded_xml = NULL;
341 xmlNode *ops = NULL;
342 resource_t *top = NULL;
343 const char *value = NULL;
344 const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
345 const char *class = crm_element_value(xml_obj, XML_AGENT_ATTR_CLASS);
346
347 crm_log_xml_trace(xml_obj, "Processing resource input...");
348
349 if (id == NULL) {
350 pe_err("Must specify id tag in <resource>");
351 return FALSE;
352
353 } else if (rsc == NULL) {
354 pe_err("Nowhere to unpack resource into");
355 return FALSE;
356
357 }
358
359 if (unpack_template(xml_obj, &expanded_xml, data_set) == FALSE) {
360 return FALSE;
361 }
362
363 *rsc = calloc(1, sizeof(resource_t));
364
365 if (expanded_xml) {
366 crm_log_xml_trace(expanded_xml, "Expanded resource...");
367 (*rsc)->xml = expanded_xml;
368 (*rsc)->orig_xml = xml_obj;
369
370 } else {
371 (*rsc)->xml = xml_obj;
372 (*rsc)->orig_xml = NULL;
373 }
374
375 (*rsc)->parent = parent;
376
377 ops = find_xml_node((*rsc)->xml, "operations", FALSE);
378 (*rsc)->ops_xml = expand_idref(ops, data_set->input);
379
380 (*rsc)->variant = get_resource_type(crm_element_name(xml_obj));
381 if ((*rsc)->variant == pe_unknown) {
382 pe_err("Unknown resource type: %s", crm_element_name(xml_obj));
383 free(*rsc);
384 return FALSE;
385 }
386
387 (*rsc)->parameters =
388 g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str);
389
390 (*rsc)->meta =
391 g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str);
392
393 (*rsc)->allowed_nodes =

Callers 5

create_child_cloneFunction · 0.85
clone_unpackFunction · 0.85
unpack_resourcesFunction · 0.85
create_fake_resourceFunction · 0.85
group_unpackFunction · 0.85

Calls 15

crm_element_valueFunction · 0.85
unpack_templateFunction · 0.85
find_xml_nodeFunction · 0.85
expand_idrefFunction · 0.85
get_resource_typeFunction · 0.85
crm_concatFunction · 0.85
add_hash_paramFunction · 0.85
get_meta_attributesFunction · 0.85
is_setFunction · 0.85
crm_parse_intFunction · 0.85
crm_is_trueFunction · 0.85
safe_str_neqFunction · 0.85

Tested by

no test coverage detected