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

Function unpack_rsc_ticket

pengine/constraints.c:2314–2384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2312}
2313
2314gboolean
2315unpack_rsc_ticket(xmlNode * xml_obj, pe_working_set_t * data_set)
2316{
2317 xmlNode *set = NULL;
2318 gboolean any_sets = FALSE;
2319
2320 const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
2321 const char *ticket_str = crm_element_value(xml_obj, XML_TICKET_ATTR_TICKET);
2322 const char *loss_policy = crm_element_value(xml_obj, XML_TICKET_ATTR_LOSS_POLICY);
2323
2324 ticket_t *ticket = NULL;
2325
2326 xmlNode *orig_xml = NULL;
2327 xmlNode *expanded_xml = NULL;
2328
2329 gboolean rc = TRUE;
2330
2331 if (xml_obj == NULL) {
2332 crm_config_err("No rsc_ticket constraint object to process.");
2333 return FALSE;
2334 }
2335
2336 if (id == NULL) {
2337 crm_config_err("%s constraint must have an id", crm_element_name(xml_obj));
2338 return FALSE;
2339 }
2340
2341 if (ticket_str == NULL) {
2342 crm_config_err("Invalid constraint '%s': No ticket specified", id);
2343 return FALSE;
2344 } else {
2345 ticket = g_hash_table_lookup(data_set->tickets, ticket_str);
2346 }
2347
2348 if (ticket == NULL) {
2349 ticket = ticket_new(ticket_str, data_set);
2350 if (ticket == NULL) {
2351 return FALSE;
2352 }
2353 }
2354
2355 rc = unpack_rsc_ticket_template(xml_obj, &expanded_xml, data_set);
2356 if(expanded_xml) {
2357 orig_xml = xml_obj;
2358 xml_obj = expanded_xml;
2359
2360 } else if (rc == FALSE) {
2361 return FALSE;
2362 }
2363
2364 for (set = __xml_first_child(xml_obj); set != NULL; set = __xml_next(set)) {
2365 if (crm_str_eq((const char *)set->name, XML_CONS_TAG_RSC_SET, TRUE)) {
2366 any_sets = TRUE;
2367 set = expand_idref(set, data_set->input);
2368 if (unpack_rsc_ticket_set(set, ticket, loss_policy, data_set) == FALSE) {
2369 return FALSE;
2370 }
2371 }

Callers 1

unpack_constraintsFunction · 0.85

Calls 10

crm_element_valueFunction · 0.85
ticket_newFunction · 0.85
__xml_first_childFunction · 0.85
__xml_nextFunction · 0.85
crm_str_eqFunction · 0.85
expand_idrefFunction · 0.85
unpack_rsc_ticket_setFunction · 0.85
free_xmlFunction · 0.85
unpack_simple_rsc_ticketFunction · 0.85

Tested by

no test coverage detected