| 59 | gboolean process_pe_message(xmlNode * msg, xmlNode * xml_data, qb_ipcs_connection_t* sender); |
| 60 | |
| 61 | gboolean |
| 62 | process_pe_message(xmlNode * msg, xmlNode * xml_data, qb_ipcs_connection_t* sender) |
| 63 | { |
| 64 | static char *last_digest = NULL; |
| 65 | |
| 66 | const char *sys_to = crm_element_value(msg, F_CRM_SYS_TO); |
| 67 | const char *op = crm_element_value(msg, F_CRM_TASK); |
| 68 | const char *ref = crm_element_value(msg, F_CRM_REFERENCE); |
| 69 | |
| 70 | crm_trace("Processing %s op (ref=%s)...", op, ref); |
| 71 | |
| 72 | if (op == NULL) { |
| 73 | /* error */ |
| 74 | |
| 75 | } else if (strcasecmp(op, CRM_OP_HELLO) == 0) { |
| 76 | /* ignore */ |
| 77 | |
| 78 | } else if (safe_str_eq(crm_element_value(msg, F_CRM_MSG_TYPE), XML_ATTR_RESPONSE)) { |
| 79 | /* ignore */ |
| 80 | |
| 81 | } else if (sys_to == NULL || strcasecmp(sys_to, CRM_SYSTEM_PENGINE) != 0) { |
| 82 | crm_trace("Bad sys-to %s", crm_str(sys_to)); |
| 83 | return FALSE; |
| 84 | |
| 85 | } else if (strcasecmp(op, CRM_OP_PECALC) == 0) { |
| 86 | int seq = -1; |
| 87 | int series_id = 0; |
| 88 | int series_wrap = 0; |
| 89 | char *digest = NULL; |
| 90 | const char *value = NULL; |
| 91 | pe_working_set_t data_set; |
| 92 | xmlNode *converted = NULL; |
| 93 | xmlNode *reply = NULL; |
| 94 | gboolean is_repoke = FALSE; |
| 95 | gboolean process = TRUE; |
| 96 | char *filename = NULL; |
| 97 | |
| 98 | crm_config_error = FALSE; |
| 99 | crm_config_warning = FALSE; |
| 100 | |
| 101 | was_processing_error = FALSE; |
| 102 | was_processing_warning = FALSE; |
| 103 | |
| 104 | set_working_set_defaults(&data_set); |
| 105 | |
| 106 | digest = calculate_xml_versioned_digest(xml_data, FALSE, FALSE, CRM_FEATURE_SET); |
| 107 | converted = copy_xml(xml_data); |
| 108 | if (cli_config_update(&converted, NULL, TRUE) == FALSE) { |
| 109 | data_set.graph = create_xml_node(NULL, XML_TAG_GRAPH); |
| 110 | crm_xml_add_int(data_set.graph, "transition_id", 0); |
| 111 | crm_xml_add_int(data_set.graph, "cluster-delay", 0); |
| 112 | process = FALSE; |
| 113 | free(digest); |
| 114 | |
| 115 | } else if (safe_str_eq(digest, last_digest)) { |
| 116 | crm_info("Input has not changed since last time, not saving to disk"); |
| 117 | is_repoke = TRUE; |
| 118 | free(digest); |
no test coverage detected