| 299 | } |
| 300 | |
| 301 | void |
| 302 | cib_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 | } |
no test coverage detected