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

Function get_target_role

lib/pengine/utils.c:1389–1423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1387}
1388
1389gboolean
1390get_target_role(resource_t * rsc, enum rsc_role_e * role)
1391{
1392 enum rsc_role_e local_role = RSC_ROLE_UNKNOWN;
1393 const char *value = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_TARGET_ROLE);
1394
1395 CRM_CHECK(role != NULL, return FALSE);
1396
1397 if (value == NULL || safe_str_eq("started", value)
1398 || safe_str_eq("default", value)) {
1399 return FALSE;
1400 }
1401
1402 local_role = text2role(value);
1403 if (local_role == RSC_ROLE_UNKNOWN) {
1404 crm_config_err("%s: Unknown value for %s: %s", rsc->id, XML_RSC_ATTR_TARGET_ROLE, value);
1405 return FALSE;
1406
1407 } else if (local_role > RSC_ROLE_STARTED) {
1408 if (uber_parent(rsc)->variant == pe_master) {
1409 if (local_role > RSC_ROLE_SLAVE) {
1410 /* This is what we'd do anyway, just leave the default to avoid messing up the placement algorithm */
1411 return FALSE;
1412 }
1413
1414 } else {
1415 crm_config_err("%s is not part of a master/slave resource, a %s of '%s' makes no sense",
1416 rsc->id, XML_RSC_ATTR_TARGET_ROLE, value);
1417 return FALSE;
1418 }
1419 }
1420
1421 *role = local_role;
1422 return TRUE;
1423}
1424
1425gboolean
1426order_actions(action_t * lh_action, action_t * rh_action, enum pe_ordering order)

Callers 2

unpack_lrm_rsc_stateFunction · 0.85
common_unpackFunction · 0.85

Calls 2

text2roleFunction · 0.85
uber_parentFunction · 0.85

Tested by

no test coverage detected