ha_msg_add(update_msg, F_TYPE, T_CIB_NOTIFY); ha_msg_add(update_msg, F_SUBTYPE, T_CIB_POST_NOTIFY); ha_msg_add(update_msg, F_CIB_OPERATION, op); ha_msg_add_int(update_msg, F_CIB_RC, result);  if(id != NULL) { ha_msg_add(update_msg, F_CIB_OBJID, id); }  if(update != NULL) { crm_debug_4("Setting type to update->name: %s", crm_element_name(update)); ha_msg_add(update_msg, F_CIB_OBJTYPE, crm_element_name(update)); type = crm_strdup(crm_element_name(update));  } else if(new_obj != NULL) { crm_debug_4("Setting type to new_obj->name: %s", crm_element_name(new_obj)); ha_msg_add(update_msg, F_CIB_OBJTYPE, crm_element_name(new_obj)); type = crm_strdup(crm_element_name(new_obj));  } else { crm_debug_4("Not Setting type"); }   attach_cib_generation(update_msg, "cib_generation", the_cib); if(update != NULL) { add_message_xml(update_msg, F_CIB_UPDATE, update);  } if(new_obj != NULL) { add_message_xml(update_msg, F_CIB_UPDATE_RESULT, new_obj); }  crm_debug_3("Notifying clients"); g_hash_table_foreach(client_list, cib_notify_client, update_msg);  pending_updates--;  if(pending_updates == 0) { ha_msg_mod(update_msg, F_SUBTYPE, T_CIB_UPDATE_CONFIRM); crm_debug_3("Sending confirmation to clients"); g_hash_table_foreach(client_list, cib_notify_client, update_msg); }  if(update == NULL) { if(result == cib_ok) { crm_debug_2("Operation %s (on section=%s) completed", op, crm_str(type));  } else { crm_warn("Operation %s (on section=%s) FAILED: (%d) %s", op, crm_str(type), result, cib_error2string(result)); }  } else { if(result == cib_ok) { crm_debug_2("Completed %s of <%s %s%s>", op, crm_str(type), id?"id=":"", id?id:"");  } else { crm_warn("%s of <%s %s%s> FAILED: %s", op,crm_str(type), id?"id=":"", id?id:"", cib_error2string(result)); } }  crm_free(id); crm_free(type); crm_msg_del(update_msg);  crm_debug_3("Notify complete");
do_cib_notify( options, op, update, result, new_obj, T_CIB_UPDATE_CONFIRM);
cib_post_notify(	const char *op, crm_data_t *update, enum cib_errors result, crm_data_t *new_obj) {	HA_Message *update_msg = ha_msg_new(8);	char *type = NULL;	char *id = NULL;	if(update != NULL && crm_element_value(new_obj, XML_ATTR_ID) != NULL){		id = crm_element_value_copy(new_obj, XML_ATTR_ID);	}		ha_msg_add(update_msg, F_TYPE, T_CIB_NOTIFY);	ha_msg_add(update_msg, F_SUBTYPE, T_CIB_POST_NOTIFY);	ha_msg_add(update_msg, F_CIB_OPERATION, op);	ha_msg_add_int(update_msg, F_CIB_RC, result);		if(id != NULL) {		ha_msg_add(update_msg, F_CIB_OBJID, id);	}	if(update != NULL) {		crm_debug_4("Setting type to update->name: %s",			    crm_element_name(update));		ha_msg_add(update_msg, F_CIB_OBJTYPE, crm_element_name(update));		type = crm_strdup(crm_element_name(update));	} else if(new_obj != NULL) {		crm_debug_4("Setting type to new_obj->name: %s",			    crm_element_name(new_obj));		ha_msg_add(update_msg, F_CIB_OBJTYPE, crm_element_name(new_obj));		type = crm_strdup(crm_element_name(new_obj));			} else {		crm_debug_4("Not Setting type");	}		attach_cib_generation(update_msg, "cib_generation", the_cib);	if(update != NULL) {		add_message_xml(update_msg, F_CIB_UPDATE, update);	}	if(new_obj != NULL) {		add_message_xml(update_msg, F_CIB_UPDATE_RESULT, new_obj);	}	crm_debug_3("Notifying clients");	g_hash_table_foreach(client_list, cib_notify_client, update_msg);		pending_updates--;	if(pending_updates == 0) {		ha_msg_mod(update_msg, F_SUBTYPE, T_CIB_UPDATE_CONFIRM);		crm_debug_3("Sending confirmation to clients");		g_hash_table_foreach(client_list, cib_notify_client, update_msg);	}	if(update == NULL) {		if(result == cib_ok) {			crm_debug_2("Operation %s (on section=%s) completed",				    op, crm_str(type));					} else {			crm_warn("Operation %s (on section=%s) FAILED: (%d) %s",				 op, crm_str(type), result,				 cib_error2string(result));		}			} else {		if(result == cib_ok) {			crm_debug_2("Completed %s of <%s %s%s>",				    op, crm_str(type), id?"id=":"", id?id:"");					} else {			crm_warn("%s of <%s %s%s> FAILED: %s", op,crm_str(type),				 id?"id=":"", id?id:"", cib_error2string(result));		}	}	crm_free(id);	crm_free(type);	crm_msg_del(update_msg);	crm_debug_3("Notify complete");}