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

Function sort_rsc_process_order

pengine/allocate.c:969–1097  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

967}
968
969static gint
970sort_rsc_process_order(gconstpointer a, gconstpointer b, gpointer data)
971{
972 int rc = 0;
973 int r1_weight = -INFINITY;
974 int r2_weight = -INFINITY;
975
976 const char *reason = "existance";
977
978 const GListPtr nodes = (GListPtr) data;
979 resource_t *resource1 = (resource_t *) convert_const_pointer(a);
980 resource_t *resource2 = (resource_t *) convert_const_pointer(b);
981
982 node_t *node = NULL;
983 GListPtr gIter = NULL;
984 GHashTable *r1_nodes = NULL;
985 GHashTable *r2_nodes = NULL;
986
987 if (a == NULL && b == NULL) {
988 goto done;
989 }
990 if (a == NULL) {
991 return 1;
992 }
993 if (b == NULL) {
994 return -1;
995 }
996
997 reason = "priority";
998 r1_weight = resource1->priority;
999 r2_weight = resource2->priority;
1000
1001 if (r1_weight > r2_weight) {
1002 rc = -1;
1003 goto done;
1004 }
1005
1006 if (r1_weight < r2_weight) {
1007 rc = 1;
1008 goto done;
1009 }
1010
1011 reason = "no node list";
1012 if (nodes == NULL) {
1013 goto done;
1014 }
1015
1016 r1_nodes =
1017 rsc_merge_weights(resource1, resource1->id, NULL, NULL, 1,
1018 pe_weights_forward | pe_weights_init);
1019 dump_node_scores(LOG_TRACE, NULL, resource1->id, r1_nodes);
1020 r2_nodes =
1021 rsc_merge_weights(resource2, resource2->id, NULL, NULL, 1,
1022 pe_weights_forward | pe_weights_init);
1023 dump_node_scores(LOG_TRACE, NULL, resource2->id, r2_nodes);
1024
1025 /* Current location score */
1026 reason = "current location";

Callers

nothing calls this directly

Calls 2

convert_const_pointerFunction · 0.85
rsc_merge_weightsFunction · 0.85

Tested by

no test coverage detected