Skip to content

Commit 1b2266f

Browse files
committed
Fix: rhbz#1545449 - Do not perform notifications for events we know wont be executed
1 parent 373c057 commit 1b2266f

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

pengine/notif.c

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,12 +498,18 @@ collect_notification_data(resource_t * rsc, gboolean state, gboolean activity,
498498
action_t *op = (action_t *) gIter->data;
499499

500500
if (is_set(op->flags, pe_action_optional) == FALSE && op->node != NULL) {
501+
task = text2task(op->task);
502+
503+
if(task == stop_rsc && op->node->details->unclean) {
504+
/* Create one anyway,, some additional noise if op->node cannot be fenced */
505+
} else if(is_not_set(op->flags, pe_action_runnable)) {
506+
continue;
507+
}
501508

502509
entry = calloc(1, sizeof(notify_entry_t));
503510
entry->node = op->node;
504511
entry->rsc = rsc;
505512

506-
task = text2task(op->task);
507513
switch (task) {
508514
case start_rsc:
509515
n_data->start = g_list_prepend(n_data->start, entry);
@@ -656,8 +662,7 @@ create_notifications(resource_t * rsc, notify_data_t * n_data, pe_working_set_t
656662

657663
/* Copy notification details into standard ops */
658664

659-
gIter = rsc->actions;
660-
for (; gIter != NULL; gIter = gIter->next) {
665+
for (gIter = rsc->actions; gIter != NULL; gIter = gIter->next) {
661666
action_t *op = (action_t *) gIter->data;
662667

663668
if (is_set(op->flags, pe_action_optional) == FALSE && op->node != NULL) {
@@ -676,6 +681,35 @@ create_notifications(resource_t * rsc, notify_data_t * n_data, pe_working_set_t
676681
}
677682
}
678683

684+
switch (task) {
685+
case start_rsc:
686+
if(g_list_length(n_data->start) == 0) {
687+
pe_rsc_trace(rsc, "Skipping empty notification for: %s.%s (%s->%s)",
688+
n_data->action, rsc->id, role2text(rsc->role), role2text(rsc->next_role));
689+
return;
690+
}
691+
break;
692+
case action_promote:
693+
if(g_list_length(n_data->promote) == 0) {
694+
pe_rsc_trace(rsc, "Skipping empty notification for: %s.%s (%s->%s)",
695+
n_data->action, rsc->id, role2text(rsc->role), role2text(rsc->next_role));
696+
return;
697+
}
698+
break;
699+
case action_demote:
700+
if(g_list_length(n_data->demote) == 0) {
701+
pe_rsc_trace(rsc, "Skipping empty notification for: %s.%s (%s->%s)",
702+
n_data->action, rsc->id, role2text(rsc->role), role2text(rsc->next_role));
703+
return;
704+
}
705+
break;
706+
default:
707+
/* We cannot do the same for stop_rsc/n_data->stop at it
708+
* might be implied by fencing
709+
*/
710+
break;
711+
}
712+
679713
pe_rsc_trace(rsc, "Creating notifications for: %s.%s (%s->%s)",
680714
n_data->action, rsc->id, role2text(rsc->role), role2text(rsc->next_role));
681715

0 commit comments

Comments
 (0)