| 366 | } |
| 367 | |
| 368 | gboolean |
| 369 | unpack_resources(xmlNode * xml_resources, pe_working_set_t * data_set) |
| 370 | { |
| 371 | xmlNode *xml_obj = NULL; |
| 372 | |
| 373 | data_set->template_rsc_sets = |
| 374 | g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, |
| 375 | destroy_template_rsc_set); |
| 376 | |
| 377 | for (xml_obj = __xml_first_child(xml_resources); xml_obj != NULL; xml_obj = __xml_next(xml_obj)) { |
| 378 | resource_t *new_rsc = NULL; |
| 379 | |
| 380 | if (crm_str_eq((const char *)xml_obj->name, XML_CIB_TAG_RSC_TEMPLATE, TRUE)) { |
| 381 | const char *template_id = ID(xml_obj); |
| 382 | |
| 383 | if (template_id && g_hash_table_lookup_extended(data_set->template_rsc_sets, |
| 384 | template_id, NULL, NULL) == FALSE) { |
| 385 | /* Record the template's ID for the knowledge of its existence anyway. */ |
| 386 | g_hash_table_insert(data_set->template_rsc_sets, strdup(template_id), NULL); |
| 387 | } |
| 388 | continue; |
| 389 | } |
| 390 | |
| 391 | crm_trace("Beginning unpack... <%s id=%s... >", crm_element_name(xml_obj), ID(xml_obj)); |
| 392 | if (common_unpack(xml_obj, &new_rsc, NULL, data_set)) { |
| 393 | data_set->resources = g_list_append(data_set->resources, new_rsc); |
| 394 | |
| 395 | print_resource(LOG_DEBUG_3, "Added", new_rsc, FALSE); |
| 396 | |
| 397 | } else { |
| 398 | crm_config_err("Failed unpacking %s %s", |
| 399 | crm_element_name(xml_obj), crm_element_value(xml_obj, XML_ATTR_ID)); |
| 400 | if (new_rsc != NULL && new_rsc->fns != NULL) { |
| 401 | new_rsc->fns->free(new_rsc); |
| 402 | } |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | data_set->resources = g_list_sort(data_set->resources, sort_rsc_priority); |
| 407 | |
| 408 | if (is_set(data_set->flags, pe_flag_stonith_enabled) |
| 409 | && is_set(data_set->flags, pe_flag_have_stonith_resource) == FALSE) { |
| 410 | crm_config_err("Resource start-up disabled since no STONITH resources have been defined"); |
| 411 | crm_config_err("Either configure some or disable STONITH with the stonith-enabled option"); |
| 412 | crm_config_err("NOTE: Clusters with shared data need STONITH to ensure data integrity"); |
| 413 | } |
| 414 | |
| 415 | return TRUE; |
| 416 | } |
| 417 | |
| 418 | /* The ticket state section: |
| 419 | * "/cib/status/tickets/ticket_state" */ |
no test coverage detected