| 1337 | } |
| 1338 | |
| 1339 | static void |
| 1340 | influence_priority(resource_t * rsc_lh, resource_t * rsc_rh, rsc_colocation_t * constraint) |
| 1341 | { |
| 1342 | const char *rh_value = NULL; |
| 1343 | const char *lh_value = NULL; |
| 1344 | const char *attribute = "#id"; |
| 1345 | int score_multiplier = 1; |
| 1346 | |
| 1347 | if (constraint->node_attribute != NULL) { |
| 1348 | attribute = constraint->node_attribute; |
| 1349 | } |
| 1350 | |
| 1351 | if (!rsc_rh->allocated_to || !rsc_lh->allocated_to) { |
| 1352 | return; |
| 1353 | } |
| 1354 | |
| 1355 | lh_value = g_hash_table_lookup(rsc_lh->allocated_to->details->attrs, attribute); |
| 1356 | rh_value = g_hash_table_lookup(rsc_rh->allocated_to->details->attrs, attribute); |
| 1357 | |
| 1358 | if (!safe_str_eq(lh_value, rh_value)) { |
| 1359 | return; |
| 1360 | } |
| 1361 | |
| 1362 | if (constraint->role_rh && |
| 1363 | (constraint->role_rh != rsc_rh->next_role)) { |
| 1364 | return; |
| 1365 | } |
| 1366 | |
| 1367 | if (constraint->role_lh == RSC_ROLE_SLAVE) { |
| 1368 | score_multiplier = -1; |
| 1369 | } |
| 1370 | |
| 1371 | rsc_lh->priority = merge_weights(score_multiplier * constraint->score, rsc_lh->priority); |
| 1372 | } |
| 1373 | |
| 1374 | static void |
| 1375 | colocation_match(resource_t * rsc_lh, resource_t * rsc_rh, rsc_colocation_t * constraint) |
no test coverage detected