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

Function expand_notification_data

pengine/allocate.c:1995–2085  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1993}
1994
1995gboolean
1996expand_notification_data(notify_data_t * n_data)
1997{
1998 /* Expand the notification entries into a key=value hashtable
1999 * This hashtable is later used in action2xml()
2000 */
2001 gboolean required = FALSE;
2002 char *rsc_list = NULL;
2003 char *node_list = NULL;
2004
2005 if (n_data->stop) {
2006 n_data->stop = g_list_sort(n_data->stop, sort_notify_entries);
2007 }
2008 expand_list(n_data->stop, &rsc_list, &node_list);
2009 if (rsc_list != NULL && safe_str_neq(" ", rsc_list)) {
2010 if (safe_str_eq(n_data->action, RSC_STOP)) {
2011 required = TRUE;
2012 }
2013 }
2014 g_hash_table_insert(n_data->keys, strdup("notify_stop_resource"), rsc_list);
2015 g_hash_table_insert(n_data->keys, strdup("notify_stop_uname"), node_list);
2016
2017 if (n_data->start) {
2018 n_data->start = g_list_sort(n_data->start, sort_notify_entries);
2019 if (rsc_list && safe_str_eq(n_data->action, RSC_START)) {
2020 required = TRUE;
2021 }
2022 }
2023 expand_list(n_data->start, &rsc_list, &node_list);
2024 g_hash_table_insert(n_data->keys, strdup("notify_start_resource"), rsc_list);
2025 g_hash_table_insert(n_data->keys, strdup("notify_start_uname"), node_list);
2026
2027 if (n_data->demote) {
2028 n_data->demote = g_list_sort(n_data->demote, sort_notify_entries);
2029 if (safe_str_eq(n_data->action, RSC_DEMOTE)) {
2030 required = TRUE;
2031 }
2032 }
2033
2034 expand_list(n_data->demote, &rsc_list, &node_list);
2035 g_hash_table_insert(n_data->keys, strdup("notify_demote_resource"), rsc_list);
2036 g_hash_table_insert(n_data->keys, strdup("notify_demote_uname"), node_list);
2037
2038 if (n_data->promote) {
2039 n_data->promote = g_list_sort(n_data->promote, sort_notify_entries);
2040 if (safe_str_eq(n_data->action, RSC_PROMOTE)) {
2041 required = TRUE;
2042 }
2043 }
2044 expand_list(n_data->promote, &rsc_list, &node_list);
2045 g_hash_table_insert(n_data->keys, strdup("notify_promote_resource"), rsc_list);
2046 g_hash_table_insert(n_data->keys, strdup("notify_promote_uname"), node_list);
2047
2048 if (n_data->active) {
2049 n_data->active = g_list_sort(n_data->active, sort_notify_entries);
2050 }
2051 expand_list(n_data->active, &rsc_list, &node_list);
2052 g_hash_table_insert(n_data->keys, strdup("notify_active_resource"), rsc_list);

Callers 1

clone_expandFunction · 0.85

Calls 3

expand_listFunction · 0.85
safe_str_neqFunction · 0.85
update_action_flagsFunction · 0.85

Tested by

no test coverage detected