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

Function do_cib_notify

cib/notify.c:241–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241void
242do_cib_notify(int options, const char *op, xmlNode * update,
243 int result, xmlNode * result_data, const char *msg_type)
244{
245 xmlNode *update_msg = NULL;
246 const char *id = NULL;
247
248 update_msg = create_xml_node(NULL, "notify");
249
250 if (result_data != NULL) {
251 id = crm_element_value(result_data, XML_ATTR_ID);
252 }
253
254 crm_xml_add(update_msg, F_TYPE, T_CIB_NOTIFY);
255 crm_xml_add(update_msg, F_SUBTYPE, msg_type);
256 crm_xml_add(update_msg, F_CIB_OPERATION, op);
257 crm_xml_add_int(update_msg, F_CIB_RC, result);
258
259 if (id != NULL) {
260 crm_xml_add(update_msg, F_CIB_OBJID, id);
261 }
262
263 if (update != NULL) {
264 crm_trace("Setting type to update->name: %s", crm_element_name(update));
265 crm_xml_add(update_msg, F_CIB_OBJTYPE, crm_element_name(update));
266
267 } else if (result_data != NULL) {
268 crm_trace("Setting type to new_obj->name: %s", crm_element_name(result_data));
269 crm_xml_add(update_msg, F_CIB_OBJTYPE, crm_element_name(result_data));
270
271 } else {
272 crm_trace("Not Setting type");
273 }
274
275 attach_cib_generation(update_msg, "cib_generation", the_cib);
276 if (update != NULL) {
277 add_message_xml(update_msg, F_CIB_UPDATE, update);
278 }
279 if (result_data != NULL) {
280 add_message_xml(update_msg, F_CIB_UPDATE_RESULT, result_data);
281 }
282
283 crm_trace("Notifying clients");
284 g_hash_table_foreach_remove(client_list, cib_notify_client, update_msg);
285 free_xml(update_msg);
286 crm_trace("Notify complete");
287}
288
289void
290attach_cib_generation(xmlNode * msg, const char *field, xmlNode * a_cib)

Callers 2

cib_post_notifyFunction · 0.85
cib_diff_notifyFunction · 0.85

Calls 7

create_xml_nodeFunction · 0.85
crm_element_valueFunction · 0.85
crm_xml_addFunction · 0.85
crm_xml_add_intFunction · 0.85
attach_cib_generationFunction · 0.85
add_message_xmlFunction · 0.85
free_xmlFunction · 0.85

Tested by

no test coverage detected