| 1907 | } |
| 1908 | |
| 1909 | void |
| 1910 | collect_notification_data(resource_t * rsc, gboolean state, gboolean activity, |
| 1911 | notify_data_t * n_data) |
| 1912 | { |
| 1913 | |
| 1914 | if (rsc->children) { |
| 1915 | GListPtr gIter = rsc->children; |
| 1916 | |
| 1917 | for (; gIter != NULL; gIter = gIter->next) { |
| 1918 | resource_t *child = (resource_t *) gIter->data; |
| 1919 | |
| 1920 | collect_notification_data(child, state, activity, n_data); |
| 1921 | } |
| 1922 | return; |
| 1923 | } |
| 1924 | |
| 1925 | if (state) { |
| 1926 | notify_entry_t *entry = NULL; |
| 1927 | |
| 1928 | entry = calloc(1, sizeof(notify_entry_t)); |
| 1929 | entry->rsc = rsc; |
| 1930 | if (rsc->running_on) { |
| 1931 | /* we only take the first one */ |
| 1932 | entry->node = rsc->running_on->data; |
| 1933 | } |
| 1934 | |
| 1935 | pe_rsc_trace(rsc, "%s state: %s", rsc->id, role2text(rsc->role)); |
| 1936 | |
| 1937 | switch (rsc->role) { |
| 1938 | case RSC_ROLE_STOPPED: |
| 1939 | n_data->inactive = g_list_prepend(n_data->inactive, entry); |
| 1940 | break; |
| 1941 | case RSC_ROLE_STARTED: |
| 1942 | n_data->active = g_list_prepend(n_data->active, entry); |
| 1943 | break; |
| 1944 | case RSC_ROLE_SLAVE: |
| 1945 | n_data->slave = g_list_prepend(n_data->slave, entry); |
| 1946 | break; |
| 1947 | case RSC_ROLE_MASTER: |
| 1948 | n_data->master = g_list_prepend(n_data->master, entry); |
| 1949 | break; |
| 1950 | default: |
| 1951 | crm_err("Unsupported notify role"); |
| 1952 | free(entry); |
| 1953 | break; |
| 1954 | } |
| 1955 | } |
| 1956 | |
| 1957 | if (activity) { |
| 1958 | notify_entry_t *entry = NULL; |
| 1959 | enum action_tasks task; |
| 1960 | |
| 1961 | GListPtr gIter = rsc->actions; |
| 1962 | |
| 1963 | for (; gIter != NULL; gIter = gIter->next) { |
| 1964 | action_t *op = (action_t *) gIter->data; |
| 1965 | |
| 1966 | if (is_set(op->flags, pe_action_optional) == FALSE && op->node != NULL) { |
no test coverage detected