| 686 | } |
| 687 | |
| 688 | static void |
| 689 | create_dotfile(pe_working_set_t * data_set, const char *dot_file, gboolean all_actions) |
| 690 | { |
| 691 | GListPtr gIter = NULL; |
| 692 | FILE *dot_strm = fopen(dot_file, "w"); |
| 693 | |
| 694 | if (dot_strm == NULL) { |
| 695 | crm_perror(LOG_ERR, "Could not open %s for writing", dot_file); |
| 696 | return; |
| 697 | } |
| 698 | |
| 699 | fprintf(dot_strm, " digraph \"g\" {\n"); |
| 700 | for (gIter = data_set->actions; gIter != NULL; gIter = gIter->next) { |
| 701 | action_t *action = (action_t *) gIter->data; |
| 702 | const char *style = "dashed"; |
| 703 | const char *font = "black"; |
| 704 | const char *color = "black"; |
| 705 | char *action_name = create_action_name(action); |
| 706 | |
| 707 | crm_trace("Action %d: %p", action->id, action); |
| 708 | |
| 709 | if (is_set(action->flags, pe_action_pseudo)) { |
| 710 | font = "orange"; |
| 711 | } |
| 712 | |
| 713 | if (is_set(action->flags, pe_action_dumped)) { |
| 714 | style = "bold"; |
| 715 | color = "green"; |
| 716 | |
| 717 | } else if (action->rsc != NULL && is_not_set(action->rsc->flags, pe_rsc_managed)) { |
| 718 | color = "red"; |
| 719 | font = "purple"; |
| 720 | if (all_actions == FALSE) { |
| 721 | goto dont_write; |
| 722 | } |
| 723 | |
| 724 | } else if (is_set(action->flags, pe_action_optional)) { |
| 725 | color = "blue"; |
| 726 | if (all_actions == FALSE) { |
| 727 | goto dont_write; |
| 728 | } |
| 729 | |
| 730 | } else { |
| 731 | color = "red"; |
| 732 | CRM_CHECK(is_set(action->flags, pe_action_runnable) == FALSE,; |
| 733 | ); |
| 734 | } |
| 735 | |
| 736 | set_bit(action->flags, pe_action_dumped); |
| 737 | fprintf(dot_strm, "\"%s\" [ style=%s color=\"%s\" fontcolor=\"%s\"]\n", |
| 738 | action_name, style, color, font); |
| 739 | dont_write: |
| 740 | free(action_name); |
| 741 | } |
| 742 | |
| 743 | for (gIter = data_set->actions; gIter != NULL; gIter = gIter->next) { |
| 744 | action_t *action = (action_t *) gIter->data; |
| 745 |
no test coverage detected