@@ -344,9 +344,10 @@ process_utilization(resource_t * rsc, node_t ** prefer, pe_working_set_t * data_
344
344
int alloc_details = scores_log_level + 1 ;
345
345
346
346
if (safe_str_neq (data_set -> placement_strategy , "default" )) {
347
- GListPtr gIter = NULL ;
347
+ GHashTableIter iter ;
348
348
GListPtr colocated_rscs = NULL ;
349
349
gboolean any_capable = FALSE;
350
+ node_t * node = NULL ;
350
351
351
352
colocated_rscs = find_colocated_rscs (colocated_rscs , rsc , rsc );
352
353
if (colocated_rscs ) {
@@ -356,8 +357,11 @@ process_utilization(resource_t * rsc, node_t ** prefer, pe_working_set_t * data_
356
357
357
358
unallocated_utilization = sum_unallocated_utilization (rsc , colocated_rscs );
358
359
359
- for (gIter = data_set -> nodes ; gIter != NULL ; gIter = gIter -> next ) {
360
- node_t * node = (node_t * ) gIter -> data ;
360
+ g_hash_table_iter_init (& iter , rsc -> allowed_nodes );
361
+ while (g_hash_table_iter_next (& iter , NULL , (void * * )& node )) {
362
+ if (can_run_resources (node ) == FALSE || node -> weight < 0 ) {
363
+ continue ;
364
+ }
361
365
362
366
if (have_enough_capacity (node , rscs_id , unallocated_utilization )) {
363
367
any_capable = TRUE;
@@ -371,8 +375,11 @@ process_utilization(resource_t * rsc, node_t ** prefer, pe_working_set_t * data_
371
375
}
372
376
373
377
if (any_capable ) {
374
- for (gIter = data_set -> nodes ; gIter != NULL ; gIter = gIter -> next ) {
375
- node_t * node = (node_t * ) gIter -> data ;
378
+ g_hash_table_iter_init (& iter , rsc -> allowed_nodes );
379
+ while (g_hash_table_iter_next (& iter , NULL , (void * * )& node )) {
380
+ if (can_run_resources (node ) == FALSE || node -> weight < 0 ) {
381
+ continue ;
382
+ }
376
383
377
384
if (have_enough_capacity (node , rscs_id , unallocated_utilization ) == FALSE) {
378
385
pe_rsc_debug (rsc , "Resource %s and its colocated resources cannot be allocated to node %s: no enough capacity" ,
@@ -394,8 +401,11 @@ process_utilization(resource_t * rsc, node_t ** prefer, pe_working_set_t * data_
394
401
}
395
402
396
403
if (any_capable == FALSE) {
397
- for (gIter = data_set -> nodes ; gIter != NULL ; gIter = gIter -> next ) {
398
- node_t * node = (node_t * ) gIter -> data ;
404
+ g_hash_table_iter_init (& iter , rsc -> allowed_nodes );
405
+ while (g_hash_table_iter_next (& iter , NULL , (void * * )& node )) {
406
+ if (can_run_resources (node ) == FALSE || node -> weight < 0 ) {
407
+ continue ;
408
+ }
399
409
400
410
if (have_enough_capacity (node , rsc -> id , rsc -> utilization ) == FALSE) {
401
411
pe_rsc_debug (rsc , "Resource %s cannot be allocated to node %s: no enough capacity" ,
0 commit comments