| 945 | } |
| 946 | |
| 947 | void |
| 948 | graph_element_from_action(action_t * action, pe_working_set_t * data_set) |
| 949 | { |
| 950 | GListPtr lpc = NULL; |
| 951 | int last_action = -1; |
| 952 | int synapse_priority = 0; |
| 953 | xmlNode *syn = NULL; |
| 954 | xmlNode *set = NULL; |
| 955 | xmlNode *in = NULL; |
| 956 | xmlNode *input = NULL; |
| 957 | xmlNode *xml_action = NULL; |
| 958 | |
| 959 | if (should_dump_action(action) == FALSE) { |
| 960 | return; |
| 961 | } |
| 962 | |
| 963 | set_bit(action->flags, pe_action_dumped); |
| 964 | |
| 965 | syn = create_xml_node(data_set->graph, "synapse"); |
| 966 | set = create_xml_node(syn, "action_set"); |
| 967 | in = create_xml_node(syn, "inputs"); |
| 968 | |
| 969 | crm_xml_add_int(syn, XML_ATTR_ID, data_set->num_synapse); |
| 970 | data_set->num_synapse++; |
| 971 | |
| 972 | if (action->rsc != NULL) { |
| 973 | synapse_priority = action->rsc->priority; |
| 974 | } |
| 975 | if (action->priority > synapse_priority) { |
| 976 | synapse_priority = action->priority; |
| 977 | } |
| 978 | if (synapse_priority > 0) { |
| 979 | crm_xml_add_int(syn, XML_CIB_ATTR_PRIORITY, synapse_priority); |
| 980 | } |
| 981 | |
| 982 | xml_action = action2xml(action, FALSE); |
| 983 | add_node_nocopy(set, crm_element_name(xml_action), xml_action); |
| 984 | |
| 985 | action->actions_before = g_list_sort(action->actions_before, sort_action_id); |
| 986 | |
| 987 | for (lpc = action->actions_before; lpc != NULL; lpc = lpc->next) { |
| 988 | action_wrapper_t *wrapper = (action_wrapper_t *) lpc->data; |
| 989 | |
| 990 | if (should_dump_input(last_action, action, wrapper) == FALSE) { |
| 991 | continue; |
| 992 | } |
| 993 | |
| 994 | wrapper->state = pe_link_dumped; |
| 995 | CRM_CHECK(last_action < wrapper->action->id,; |
| 996 | ); |
| 997 | last_action = wrapper->action->id; |
| 998 | input = create_xml_node(in, "trigger"); |
| 999 | |
| 1000 | xml_action = action2xml(wrapper->action, TRUE); |
| 1001 | add_node_nocopy(input, crm_element_name(xml_action), xml_action); |
| 1002 | } |
| 1003 | } |
no test coverage detected