osaf/services/saf/amf/amfd/chkop.cc | 1 + osaf/services/saf/amf/amfd/include/ntf.h | 14 +++++++- osaf/services/saf/amf/amfd/ntf.cc | 54 ++++++++++++++++++++++++++++++- 3 files changed, 64 insertions(+), 5 deletions(-)
This is enhancement that standby amfd sends notification when the cold sync is completed. The fact that we can't add a new AMF state change notification under SAF vendor, but we can defines this cold sync as state change notification under OpenSAF vendor. The patch adds new OpenSaf vendor Id, and new cold sync state change function to be called where the cold sync is completed. diff --git a/osaf/services/saf/amf/amfd/chkop.cc b/osaf/services/saf/amf/amfd/chkop.cc --- a/osaf/services/saf/amf/amfd/chkop.cc +++ b/osaf/services/saf/amf/amfd/chkop.cc @@ -439,6 +439,7 @@ ignore_msg: ** when in a more critical state */ saflog(LOG_NOTICE, amfSvcUsrName, "Cold sync complete at %x", cb->node_id_avd); cb->stby_sync_state = AVD_STBY_IN_SYNC; + send_cold_sync_state_chg_ntf(SA_AMF_COLD_SYNC_COMPLETED); } cb->synced_reo_type = arg->info.decode.i_reo_type; diff --git a/osaf/services/saf/amf/amfd/include/ntf.h b/osaf/services/saf/amf/amfd/include/ntf.h --- a/osaf/services/saf/amf/amfd/include/ntf.h +++ b/osaf/services/saf/amf/amfd/include/ntf.h @@ -33,6 +33,12 @@ #define ADDITION_TEXT_LENGTH 320 #define AMF_NTF_SENDER "safApp=safAmfService" +#define SA_NTF_VENDOR_ID_OPENSAF 32993 +#define SA_AMF_COLD_SYNC_STATE (SA_AMF_HA_READINESS_STATE + 1) + +typedef enum { + SA_AMF_COLD_SYNC_COMPLETED = 1, +} SaAmfSyncStateT; /* Alarms */ void avd_send_comp_inst_failed_alarm(const SaNameT *comp_name, const SaNameT *node_name); @@ -57,11 +63,13 @@ void avd_send_si_assigned_ntf(const SaNa void avd_send_comp_proxy_status_proxied_ntf(const SaNameT *comp_name, SaAmfProxyStatusT old_state, SaAmfProxyStatusT new_state); +void send_cold_sync_state_chg_ntf(SaAmfSyncStateT new_state); /* general functions */ SaAisErrorT fill_ntf_header_part(SaNtfNotificationHeaderT *notificationHeader, SaNtfEventTypeT eventType, SaNameT *comp_name, SaUint8T *add_text, + SaUint16T vendorId, SaUint16T majorId, SaUint16T minorId, SaInt8T *avnd_name, @@ -76,7 +84,8 @@ uint32_t sendAlarmNotificationAvd(AVD_CL uint32_t probableCause, uint32_t perceivedSeverity, NCSCONTEXT add_info, - int type); /* add_info 0 --> no, 1--> node_name, 2--> si_name*/ + int type, /* add_info 0 --> no, 1--> node_name, 2--> si_name*/ + SaUint16T vendorId = SA_NTF_VENDOR_ID_SAF); uint32_t sendStateChangeNotificationAvd(AVD_CL_CB *avd_cb, SaNameT comp_name, @@ -87,7 +96,8 @@ uint32_t sendStateChangeNotificationAvd( SaUint16T stateId, SaUint16T newState, NCSCONTEXT add_info, - int type); /* add_info 0 --> no, 1--> node_name, 2--> si_name*/ + int type, /* add_info 0 --> no, 1--> node_name, 2--> si_name*/ + SaUint16T vendorId = SA_NTF_VENDOR_ID_SAF); /* Clearing of alarms */ void avd_alarm_clear(const SaNameT *name, SaUint16T minorId, uint32_t probableCause); diff --git a/osaf/services/saf/amf/amfd/ntf.cc b/osaf/services/saf/amf/amfd/ntf.cc --- a/osaf/services/saf/amf/amfd/ntf.cc +++ b/osaf/services/saf/amf/amfd/ntf.cc @@ -437,6 +437,49 @@ void avd_send_comp_proxy_status_proxied_ } /***************************************************************************** + Name : send_cold_sync_state_chg_ntf + + Description : This function sends a 'Cold Sync state change' notification + + Arguments : new_state: Present cold sync status + + Return Values : + + Notes : +*****************************************************************************/ +void send_cold_sync_state_chg_ntf(SaAmfSyncStateT new_state) +{ + char add_text[ADDITION_TEXT_LENGTH]; + AVD_AVND *node = NULL; + TRACE_ENTER(); + + if ((node = avd_node_find_nodeid(avd_cb->node_id_avd)) == NULL) { + LOG_ER("%s: node not found", __FUNCTION__); + return; + } + + if (new_state == SA_AMF_COLD_SYNC_COMPLETED) + snprintf(add_text, ADDITION_TEXT_LENGTH, "Cold sync of %s completed", + node->name.value); + else { + TRACE("Unknown sync state"); + return; + } + + sendStateChangeNotificationAvd(avd_cb, + node->name, + (SaUint8T*)add_text, + SA_SVC_AMF, + SA_AMF_NTFID_NODE_OP_STATE, + SA_NTF_UNKNOWN_OPERATION, + SA_AMF_COLD_SYNC_STATE, + new_state, + NULL, + 0, + SA_NTF_VENDOR_ID_OPENSAF); +} + +/***************************************************************************** Name : avd_alarm_clear Description : This function sends a alarm clear for a specific previous @@ -472,6 +515,7 @@ SaAisErrorT fill_ntf_header_part_avd(SaN SaNtfEventTypeT eventType, SaNameT comp_name, SaUint8T *add_text, + SaUint16T vendorId, SaUint16T majorId, SaUint16T minorId, SaInt8T *avd_name, @@ -489,7 +533,7 @@ SaAisErrorT fill_ntf_header_part_avd(SaN notificationHeader->notifyingObject->length = strlen(avd_name); (void)memcpy(notificationHeader->notifyingObject->value, avd_name, strlen(avd_name)); - notificationHeader->notificationClassId->vendorId = SA_NTF_VENDOR_ID_SAF; + notificationHeader->notificationClassId->vendorId = vendorId; notificationHeader->notificationClassId->majorId = majorId; notificationHeader->notificationClassId->minorId = minorId; @@ -535,7 +579,8 @@ uint32_t sendAlarmNotificationAvd(AVD_CL uint32_t probableCause, uint32_t perceivedSeverity, NCSCONTEXT add_info, - int type) + int type, + SaUint16T vendorId) { uint32_t status = NCSCC_RC_FAILURE; SaNtfAlarmNotificationT myAlarmNotification; @@ -578,6 +623,7 @@ uint32_t sendAlarmNotificationAvd(AVD_CL SA_NTF_ALARM_PROCESSING, ntf_object, add_text, + vendorId, majorId, minorId, const_cast<SaInt8T*>(AMF_NTF_SENDER), @@ -622,7 +668,8 @@ uint32_t sendStateChangeNotificationAvd( SaUint16T stateId, SaUint16T newState, NCSCONTEXT add_info, - int type) + int type, + SaUint16T vendorId) { uint32_t status = NCSCC_RC_FAILURE; SaNtfStateChangeNotificationT myStateNotification; @@ -662,6 +709,7 @@ uint32_t sendStateChangeNotificationAvd( SA_NTF_OBJECT_STATE_CHANGE, ntf_object, add_text, + vendorId, majorId, minorId, const_cast<SaInt8T*>(AMF_NTF_SENDER), ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel