| 1789 | } |
| 1790 | |
| 1791 | notify_data_t * |
| 1792 | create_notification_boundaries(resource_t * rsc, const char *action, action_t * start, |
| 1793 | action_t * end, pe_working_set_t * data_set) |
| 1794 | { |
| 1795 | /* Create the pseudo ops that preceed and follow the actual notifications */ |
| 1796 | |
| 1797 | /* |
| 1798 | * Creates two sequences (conditional on start and end being supplied): |
| 1799 | * pre_notify -> pre_notify_complete -> start, and |
| 1800 | * end -> post_notify -> post_notify_complete |
| 1801 | * |
| 1802 | * 'start' and 'end' may be the same event or ${X} and ${X}ed as per clones |
| 1803 | */ |
| 1804 | char *key = NULL; |
| 1805 | notify_data_t *n_data = NULL; |
| 1806 | |
| 1807 | if (is_not_set(rsc->flags, pe_rsc_notify)) { |
| 1808 | return NULL; |
| 1809 | } |
| 1810 | |
| 1811 | n_data = calloc(1, sizeof(notify_data_t)); |
| 1812 | n_data->action = action; |
| 1813 | n_data->keys = |
| 1814 | g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str); |
| 1815 | |
| 1816 | if (start) { |
| 1817 | /* create pre-event notification wrappers */ |
| 1818 | key = generate_notify_key(rsc->id, "pre", start->task); |
| 1819 | n_data->pre = |
| 1820 | custom_action(rsc, key, RSC_NOTIFY, NULL, is_set(start->flags, pe_action_optional), |
| 1821 | TRUE, data_set); |
| 1822 | |
| 1823 | update_action_flags(n_data->pre, pe_action_pseudo); |
| 1824 | update_action_flags(n_data->pre, pe_action_runnable); |
| 1825 | |
| 1826 | add_hash_param(n_data->pre->meta, "notify_type", "pre"); |
| 1827 | add_hash_param(n_data->pre->meta, "notify_operation", n_data->action); |
| 1828 | |
| 1829 | add_hash_param(n_data->pre->meta, "notify_key_type", "pre"); |
| 1830 | add_hash_param(n_data->pre->meta, "notify_key_operation", start->task); |
| 1831 | |
| 1832 | /* create pre_notify_complete */ |
| 1833 | key = generate_notify_key(rsc->id, "confirmed-pre", start->task); |
| 1834 | n_data->pre_done = |
| 1835 | custom_action(rsc, key, RSC_NOTIFIED, NULL, is_set(start->flags, pe_action_optional), |
| 1836 | TRUE, data_set); |
| 1837 | |
| 1838 | update_action_flags(n_data->pre_done, pe_action_pseudo); |
| 1839 | update_action_flags(n_data->pre_done, pe_action_runnable); |
| 1840 | |
| 1841 | add_hash_param(n_data->pre_done->meta, "notify_type", "pre"); |
| 1842 | add_hash_param(n_data->pre_done->meta, "notify_operation", n_data->action); |
| 1843 | |
| 1844 | add_hash_param(n_data->pre_done->meta, "notify_key_type", "confirmed-pre"); |
| 1845 | add_hash_param(n_data->pre_done->meta, "notify_key_operation", start->task); |
| 1846 | |
| 1847 | order_actions(n_data->pre_done, start, pe_order_optional); |
| 1848 | order_actions(n_data->pre, n_data->pre_done, pe_order_optional); |
no test coverage detected