| 1709 | } |
| 1710 | |
| 1711 | static action_t * |
| 1712 | pe_notify(resource_t * rsc, node_t * node, action_t * op, action_t * confirm, |
| 1713 | notify_data_t * n_data, pe_working_set_t * data_set) |
| 1714 | { |
| 1715 | char *key = NULL; |
| 1716 | action_t *trigger = NULL; |
| 1717 | const char *value = NULL; |
| 1718 | const char *task = NULL; |
| 1719 | |
| 1720 | if (op == NULL || confirm == NULL) { |
| 1721 | pe_rsc_trace(rsc, "Op=%p confirm=%p", op, confirm); |
| 1722 | return NULL; |
| 1723 | } |
| 1724 | |
| 1725 | CRM_CHECK(node != NULL, return NULL); |
| 1726 | |
| 1727 | if (node->details->online == FALSE) { |
| 1728 | pe_rsc_trace(rsc, "Skipping notification for %s: node offline", rsc->id); |
| 1729 | return NULL; |
| 1730 | } else if (is_set(op->flags, pe_action_runnable) == FALSE) { |
| 1731 | pe_rsc_trace(rsc, "Skipping notification for %s: not runnable", op->uuid); |
| 1732 | return NULL; |
| 1733 | } |
| 1734 | |
| 1735 | value = g_hash_table_lookup(op->meta, "notify_type"); |
| 1736 | task = g_hash_table_lookup(op->meta, "notify_operation"); |
| 1737 | |
| 1738 | pe_rsc_trace(rsc, "Creating notify actions for %s: %s (%s-%s)", op->uuid, rsc->id, value, task); |
| 1739 | |
| 1740 | key = generate_notify_key(rsc->id, value, task); |
| 1741 | trigger = custom_action(rsc, key, op->task, node, |
| 1742 | is_set(op->flags, pe_action_optional), TRUE, data_set); |
| 1743 | g_hash_table_foreach(op->meta, dup_attr, trigger->meta); |
| 1744 | g_hash_table_foreach(n_data->keys, dup_attr, trigger->meta); |
| 1745 | |
| 1746 | /* pseudo_notify before notify */ |
| 1747 | pe_rsc_trace(rsc, "Ordering %s before %s (%d->%d)", op->uuid, trigger->uuid, trigger->id, op->id); |
| 1748 | |
| 1749 | order_actions(op, trigger, pe_order_optional); |
| 1750 | order_actions(trigger, confirm, pe_order_optional); |
| 1751 | return trigger; |
| 1752 | } |
| 1753 | |
| 1754 | static void |
| 1755 | pe_post_notify(resource_t * rsc, node_t * node, notify_data_t * n_data, pe_working_set_t * data_set) |
no test coverage detected