MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / cibmon_diff

Function cibmon_diff

cib/cibmon.c:197–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197void
198cibmon_diff(const char *event, xmlNode * msg)
199{
200 int rc = -1;
201 const char *op = NULL;
202 unsigned int log_level = LOG_INFO;
203
204 xmlNode *diff = NULL;
205 xmlNode *cib_last = NULL;
206 xmlNode *update = get_message_xml(msg, F_CIB_UPDATE);
207
208 if (msg == NULL) {
209 crm_err("NULL update");
210 return;
211 }
212
213 crm_element_value_int(msg, F_CIB_RC, &rc);
214 op = crm_element_value(msg, F_CIB_OPERATION);
215 diff = get_message_xml(msg, F_CIB_UPDATE_RESULT);
216
217 if (rc < pcmk_ok) {
218 log_level = LOG_WARNING;
219 do_crm_log(log_level, "[%s] %s ABORTED: %s", event, op, pcmk_strerror(rc));
220 return;
221 }
222
223 if (log_diffs) {
224 log_cib_diff(log_level, diff, op);
225 }
226
227 if (log_updates && update != NULL) {
228 crm_log_xml_trace(update, "raw_update");
229 }
230
231 if (cib_copy != NULL) {
232 cib_last = cib_copy;
233 cib_copy = NULL;
234 rc = cib_process_diff(op, cib_force_diff, NULL, NULL, diff, cib_last, &cib_copy, NULL);
235
236 if (rc != pcmk_ok) {
237 crm_debug("Update didn't apply, requesting full copy: %s", pcmk_strerror(rc));
238 free_xml(cib_copy);
239 cib_copy = NULL;
240 }
241 }
242
243 if (cib_copy == NULL) {
244 cib_copy = get_cib_copy(cib);
245 }
246
247 free_xml(cib_last);
248}
249
250void
251cibmon_shutdown(int nsig)

Callers

nothing calls this directly

Calls 8

get_message_xmlFunction · 0.85
crm_element_value_intFunction · 0.85
crm_element_valueFunction · 0.85
pcmk_strerrorFunction · 0.85
log_cib_diffFunction · 0.85
cib_process_diffFunction · 0.85
free_xmlFunction · 0.85
get_cib_copyFunction · 0.85

Tested by

no test coverage detected