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

Function merge_weights

lib/pengine/common.c:386–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384}
385
386int
387merge_weights(int w1, int w2)
388{
389 int result = w1 + w2;
390
391 if (w1 <= -INFINITY || w2 <= -INFINITY) {
392 if (w1 >= INFINITY || w2 >= INFINITY) {
393 crm_trace("-INFINITY + INFINITY == -INFINITY");
394 }
395 return -INFINITY;
396
397 } else if (w1 >= INFINITY || w2 >= INFINITY) {
398 return INFINITY;
399 }
400
401 /* detect wrap-around */
402 if (result > 0) {
403 if (w1 <= 0 && w2 < 0) {
404 result = -INFINITY;
405 }
406
407 } else if (w1 > 0 && w2 > 0) {
408 result = INFINITY;
409 }
410
411 /* detect +/- INFINITY */
412 if (result >= INFINITY) {
413 result = INFINITY;
414
415 } else if (result <= -INFINITY) {
416 result = -INFINITY;
417 }
418
419 crm_trace("%d + %d = %d", w1, w2, result);
420 return result;
421}
422
423void
424add_hash_param(GHashTable * hash, const char *name, const char *value)

Callers 14

node_list_excludeFunction · 0.85
resource_node_scoreFunction · 0.85
common_update_scoreFunction · 0.85
rsc2node_newFunction · 0.85
calculate_system_healthFunction · 0.85
master_promotion_orderFunction · 0.85
apply_master_prefsFunction · 0.85
node_hash_update_oneFunction · 0.85
master_rsc_colocation_rhFunction · 0.85
generate_location_ruleFunction · 0.85
node_hash_updateFunction · 0.85
influence_priorityFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected