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

Function cib_replace_notify

cib/notify.c:301–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299}
300
301void
302cib_replace_notify(const char *origin, xmlNode * update, int result, xmlNode * diff)
303{
304 xmlNode *replace_msg = NULL;
305
306 int add_updates = 0;
307 int add_epoch = 0;
308 int add_admin_epoch = 0;
309
310 int del_updates = 0;
311 int del_epoch = 0;
312 int del_admin_epoch = 0;
313
314 if (diff == NULL) {
315 return;
316 }
317
318 cib_diff_version_details(diff, &add_admin_epoch, &add_epoch, &add_updates,
319 &del_admin_epoch, &del_epoch, &del_updates);
320
321 if(del_updates < 0) {
322 crm_log_xml_debug(diff, "Bad replace diff");
323 }
324
325 if (add_updates != del_updates) {
326 crm_info("Replaced: %d.%d.%d -> %d.%d.%d from %s",
327 del_admin_epoch, del_epoch, del_updates,
328 add_admin_epoch, add_epoch, add_updates, crm_str(origin));
329 } else if (diff != NULL) {
330 crm_info("Local-only Replace: %d.%d.%d from %s",
331 add_admin_epoch, add_epoch, add_updates, crm_str(origin));
332 }
333
334 replace_msg = create_xml_node(NULL, "notify-replace");
335 crm_xml_add(replace_msg, F_TYPE, T_CIB_NOTIFY);
336 crm_xml_add(replace_msg, F_SUBTYPE, T_CIB_REPLACE_NOTIFY);
337 crm_xml_add(replace_msg, F_CIB_OPERATION, CIB_OP_REPLACE);
338 crm_xml_add_int(replace_msg, F_CIB_RC, result);
339 attach_cib_generation(replace_msg, "cib-replace-generation", update);
340
341 crm_log_xml_trace(replace_msg, "CIB Replaced");
342
343 g_hash_table_foreach_remove(client_list, cib_notify_client, replace_msg);
344 free_xml(replace_msg);
345}

Callers 1

cib_process_commandFunction · 0.85

Calls 6

cib_diff_version_detailsFunction · 0.85
create_xml_nodeFunction · 0.85
crm_xml_addFunction · 0.85
crm_xml_add_intFunction · 0.85
attach_cib_generationFunction · 0.85
free_xmlFunction · 0.85

Tested by

no test coverage detected