| 439 | } |
| 440 | |
| 441 | static int |
| 442 | get_node_score(const char *rule, const char *score, gboolean raw, node_t * node) |
| 443 | { |
| 444 | int score_f = 0; |
| 445 | |
| 446 | if (score == NULL) { |
| 447 | pe_err("Rule %s: no score specified. Assuming 0.", rule); |
| 448 | |
| 449 | } else if (raw) { |
| 450 | score_f = char2score(score); |
| 451 | |
| 452 | } else { |
| 453 | const char *attr_score = g_hash_table_lookup(node->details->attrs, score); |
| 454 | |
| 455 | if (attr_score == NULL) { |
| 456 | crm_debug("Rule %s: node %s did not have a value for %s", |
| 457 | rule, node->details->uname, score); |
| 458 | score_f = -INFINITY; |
| 459 | |
| 460 | } else { |
| 461 | crm_debug("Rule %s: node %s had value %s for %s", |
| 462 | rule, node->details->uname, attr_score, score); |
| 463 | score_f = char2score(attr_score); |
| 464 | } |
| 465 | } |
| 466 | return score_f; |
| 467 | } |
| 468 | |
| 469 | rsc_to_node_t * |
| 470 | generate_location_rule(resource_t * rsc, xmlNode * rule_xml, pe_working_set_t * data_set) |
no test coverage detected