| 2123 | } |
| 2124 | |
| 2125 | void |
| 2126 | crm_diff_update(const char *event, xmlNode * msg) |
| 2127 | { |
| 2128 | int rc = -1; |
| 2129 | long now = time(NULL); |
| 2130 | const char *op = NULL; |
| 2131 | |
| 2132 | print_dot(); |
| 2133 | |
| 2134 | if (current_cib != NULL) { |
| 2135 | xmlNode *cib_last = current_cib; |
| 2136 | current_cib = NULL; |
| 2137 | |
| 2138 | rc = cib_apply_patch_event(msg, cib_last, ¤t_cib, LOG_DEBUG); |
| 2139 | free_xml(cib_last); |
| 2140 | |
| 2141 | switch(rc) { |
| 2142 | case pcmk_err_diff_resync: |
| 2143 | case pcmk_err_diff_failed: |
| 2144 | crm_warn("[%s] %s Patch aborted: %s (%d)", event, op, pcmk_strerror(rc), rc); |
| 2145 | case pcmk_ok: |
| 2146 | break; |
| 2147 | default: |
| 2148 | crm_warn("[%s] %s ABORTED: %s (%d)", event, op, pcmk_strerror(rc), rc); |
| 2149 | return; |
| 2150 | } |
| 2151 | } |
| 2152 | |
| 2153 | if (current_cib == NULL) { |
| 2154 | current_cib = get_cib_copy(cib); |
| 2155 | } |
| 2156 | |
| 2157 | if (crm_mail_to || snmp_target || external_agent) { |
| 2158 | /* Process operation updates */ |
| 2159 | xmlXPathObject *xpathObj = |
| 2160 | xpath_search(msg, |
| 2161 | "//" F_CIB_UPDATE_RESULT "//" XML_TAG_DIFF_ADDED "//" XML_LRM_TAG_RSC_OP); |
| 2162 | if (xpathObj && xpathObj->nodesetval->nodeNr > 0) { |
| 2163 | int lpc = 0, max = xpathObj->nodesetval->nodeNr; |
| 2164 | |
| 2165 | for (lpc = 0; lpc < max; lpc++) { |
| 2166 | xmlNode *rsc_op = getXpathResult(xpathObj, lpc); |
| 2167 | |
| 2168 | handle_rsc_op(rsc_op); |
| 2169 | } |
| 2170 | } |
| 2171 | if (xpathObj) { |
| 2172 | xmlXPathFreeObject(xpathObj); |
| 2173 | } |
| 2174 | } |
| 2175 | |
| 2176 | if ((now - last_refresh) > (reconnect_msec / 1000)) { |
| 2177 | /* Force a refresh */ |
| 2178 | mon_refresh_display(NULL); |
| 2179 | |
| 2180 | } else { |
| 2181 | mainloop_set_trigger(refresh_trigger); |
| 2182 | } |
nothing calls this directly
no test coverage detected