| 1387 | } |
| 1388 | |
| 1389 | gboolean |
| 1390 | get_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 | |
| 1425 | gboolean |
| 1426 | order_actions(action_t * lh_action, action_t * rh_action, enum pe_ordering order) |
no test coverage detected