Add syslogs to smfd and smfnd to log MDS handling so that initializing, role
change MDS events etc. All of these logs will be tagged with 'MDS ' to make
it possible to grep. There will be a number of new logs added to syslog but
all of these logs will only be written at special occasions like start up,
service down / up etc.
---
 src/smf/smfd/smfd_amf.cc   |  2 ++
 src/smf/smfd/smfd_main.cc  |  5 ++++-
 src/smf/smfd/smfd_mds.c    | 35 +++++++++++++++++++++++++++--------
 src/smf/smfnd/smfnd_main.c |  1 +
 src/smf/smfnd/smfnd_mds.c  | 18 ++++++++++++++----
 5 files changed, 48 insertions(+), 13 deletions(-)

diff --git a/src/smf/smfd/smfd_amf.cc b/src/smf/smfd/smfd_amf.cc
index 9f616443e..ee042b98d 100644
--- a/src/smf/smfd/smfd_amf.cc
+++ b/src/smf/smfd/smfd_amf.cc
@@ -150,6 +150,7 @@ static SaAisErrorT amf_quiesced_state_handler(smfd_cb_t *cb,
    */
   mds_role = cb->mds_role;
   cb->mds_role = V_DEST_RL_QUIESCED;
+  LOG_NO("MDS %s: smfd_mds_change_role()", __FUNCTION__);
   if ((ncscc_rc = smfd_mds_change_role(cb)) != NCSCC_RC_SUCCESS) {
     LOG_ER("smfd_mds_change_role [V_DEST_RL_QUIESCED] FAILED");
     ais_rc = SA_AIS_ERR_FAILED_OPERATION;
@@ -275,6 +276,7 @@ static void amf_csi_set_callback(SaInvocationT invocation,
     role_change = false;
 
   if (role_change == true) {
+    LOG_NO("MDS %s: smfd_mds_change_role()", __FUNCTION__);
     if ((rc = smfd_mds_change_role(smfd_cb)) != NCSCC_RC_SUCCESS) {
       TRACE("smfd_mds_change_role FAILED");
       error = SA_AIS_ERR_FAILED_OPERATION;
diff --git a/src/smf/smfd/smfd_main.cc b/src/smf/smfd/smfd_main.cc
index 2c8cd204b..3083ab521 100644
--- a/src/smf/smfd/smfd_main.cc
+++ b/src/smf/smfd/smfd_main.cc
@@ -292,10 +292,13 @@ uint32_t initialize_for_assignment(smfd_cb_t *cb, 
SaAmfHAStateT ha_state) {
   if (cb->fully_initialized || ha_state == SA_AMF_HA_QUIESCED) {
     goto done;
   }
+
+  LOG_NO("MDS %s: smfd_mds_init()", __FUNCTION__);
   if ((rc = smfd_mds_init(cb)) != NCSCC_RC_SUCCESS) {
-    LOG_ER("clms_mds_init FAILED %d", rc);
+    LOG_ER("MDS %s: clms_mds_init FAILED %d", __FUNCTION__, rc);
     goto done;
   }
+  LOG_NO("%s: smfd_mds_init() Done", __FUNCTION__);
   cb->fully_initialized = true;
 done:
   TRACE_LEAVE2("rc = %u", rc);
diff --git a/src/smf/smfd/smfd_mds.c b/src/smf/smfd/smfd_mds.c
index 00ef9b9e7..a3d445c35 100644
--- a/src/smf/smfd/smfd_mds.c
+++ b/src/smf/smfd/smfd_mds.c
@@ -389,9 +389,11 @@ static uint32_t mds_vdest_create(smfd_cb_t *cb)
        /* Create VDEST */
        uint32_t rc = ncsvda_api(&arg);
        if (NCSCC_RC_SUCCESS != rc) {
-               LOG_ER("mds_vdest_create: create vdest for SMFD FAILED\n");
+               LOG_ER("MDS %s: mds_vdest_create: create vdest for SMFD FAILED",
+                       __FUNCTION__);
                return rc;
        }
+       LOG_NO("MDS %s: VDEST created", __FUNCTION__);
 
        cb->mds_handle = arg.info.vdest_create.o_mds_pwe1_hdl;
        return rc;
@@ -432,7 +434,8 @@ uint32_t mds_register(smfd_cb_t *cb)
            SMFD_MDS_PVT_SUBPART_VERSION;
 
        if (ncsmds_api(&svc_info) == NCSCC_RC_FAILURE) {
-               LOG_ER("smfd_mds_register: mds install SMFD FAILED\n");
+               LOG_ER("MDS %s: smfd_mds_register: mds install SMFD FAILED",
+                       __FUNCTION__);
                return NCSCC_RC_FAILURE;
        }
 
@@ -446,8 +449,9 @@ uint32_t mds_register(smfd_cb_t *cb)
        svc_info.info.svc_subscribe.i_svc_ids = smfd_id;
 
        if (ncsmds_api(&svc_info) == NCSCC_RC_FAILURE) {
-               LOG_ER(
-                   "smfd_mds_register: MDS Subscribe for redundancy Failed");
+               LOG_ER("MDS %s: smfd_mds_register: MDS Subscribe for redundancy"
+                       " Failed", __FUNCTION__);
+               LOG_NO("MDS %s: 1. mds_unregister()", __FUNCTION__);
                mds_unregister(cb);
                return NCSCC_RC_FAILURE;
        }
@@ -462,11 +466,14 @@ uint32_t mds_register(smfd_cb_t *cb)
        svc_info.info.svc_subscribe.i_svc_ids = smfnd_id;
 
        if (ncsmds_api(&svc_info) == NCSCC_RC_FAILURE) {
-               LOG_ER("smfd_mds_register: mds subscribe SMFD FAILED\n");
+               LOG_ER("MDS %s: smfd_mds_register: mds subscribe SMFD FAILED",
+                       __FUNCTION__);
+               LOG_NO("MDS %s: 2. mds_unregister()", __FUNCTION__);
                mds_unregister(cb);
                return NCSCC_RC_FAILURE;
        }
 
+       LOG_NO("MDS %s: mds registration is done", __FUNCTION__);
        return NCSCC_RC_SUCCESS;
 }
 
@@ -495,7 +502,10 @@ void mds_unregister(smfd_cb_t *cb)
        arg.i_op = MDS_UNINSTALL;
 
        if (ncsmds_api(&arg) != NCSCC_RC_SUCCESS) {
-               LOG_ER("smfd_mds_unregister: mds uninstall FAILED\n");
+               LOG_ER("MDS %s: smfd_mds_unregister: mds uninstall FAILED",
+                       __FUNCTION__);
+       } else {
+               LOG_NO("MDS %s: mds is unregistered", __FUNCTION__);
        }
        return;
 }
@@ -518,6 +528,7 @@ uint32_t smfd_mds_init(smfd_cb_t *cb)
        TRACE_ENTER();
 
        /* Create the VDEST for SMFD */
+       LOG_NO("MDS %s: mds_vdest_create()", __FUNCTION__);
        rc = mds_vdest_create(cb);
        if (rc != NCSCC_RC_SUCCESS) {
                LOG_ER(" smfd_mds_init: named vdest create FAILED\n");
@@ -525,9 +536,11 @@ uint32_t smfd_mds_init(smfd_cb_t *cb)
        }
 
        /* Register MDS communication */
+       LOG_NO("MDS %s: mds_register()", __FUNCTION__);
        rc = mds_register(cb);
        if (rc != NCSCC_RC_SUCCESS) {
-               LOG_ER(" smfd_mds_init: mds register FAILED\n");
+               LOG_ER("MDS %s: smfd_mds_init: mds register FAILED",
+                       __FUNCTION__);
                goto done;
        }
 
@@ -537,6 +550,7 @@ uint32_t smfd_mds_init(smfd_cb_t *cb)
        else
                cb->mds_role = V_DEST_RL_STANDBY;
 
+       LOG_NO("MDS %s: smfd_mds_change_role()", __FUNCTION__);
        rc = smfd_mds_change_role(cb);
        if (rc != NCSCC_RC_SUCCESS) {
                LOG_ER("MDS role change to %d FAILED\n", cb->mds_role);
@@ -568,8 +582,11 @@ uint32_t smfd_mds_change_role(smfd_cb_t *cb)
        arg.req = NCSVDA_VDEST_CHG_ROLE;
        arg.info.vdest_chg_role.i_vdest = cb->mds_dest;
        arg.info.vdest_chg_role.i_new_role = cb->mds_role;
+       uint32_t rc = ncsvda_api(&arg);
+       LOG_NO("MDS %s: Setting; arg.info.vdest_chg_role.i_vdest = 0x%" PRIx64
+               ", ncsvda_api() rc = %d", __FUNCTION__, cb->mds_dest, rc);
 
-       return ncsvda_api(&arg);
+       return rc;
 }
 
 /****************************************************************************
@@ -596,6 +613,7 @@ static uint32_t mds_vdest_destroy(smfd_cb_t *cb)
                LOG_ER("NCSVDA_VDEST_DESTROY failed");
                return rc;
        }
+       LOG_NO("%s: VDEST Destroyed", __FUNCTION__);
 
        return rc;
 }
@@ -616,6 +634,7 @@ uint32_t smfd_mds_finalize(smfd_cb_t *cb)
        uint32_t rc;
 
        /* Destroy the virtual Destination of SMFD */
+       LOG_NO("MDS %s: mds_vdest_destroy()", __FUNCTION__);
        rc = mds_vdest_destroy(cb);
        return rc;
 }
diff --git a/src/smf/smfnd/smfnd_main.c b/src/smf/smfnd/smfnd_main.c
index 0709bd356..8f71e8768 100644
--- a/src/smf/smfnd/smfnd_main.c
+++ b/src/smf/smfnd/smfnd_main.c
@@ -125,6 +125,7 @@ static uint32_t initialize_smfnd(void)
        }
 
        /* Initialize mds communication */
+       LOG_NO("MDS %s: smfnd_mds_init()", __FUNCTION__);
        if ((rc = smfnd_mds_init(smfnd_cb)) != NCSCC_RC_SUCCESS) {
                TRACE("smfnd_mds_init FAILED %d", rc);
                return rc;
diff --git a/src/smf/smfnd/smfnd_mds.c b/src/smf/smfnd/smfnd_mds.c
index adb66a6e8..e9183b75a 100644
--- a/src/smf/smfnd/smfnd_mds.c
+++ b/src/smf/smfnd/smfnd_mds.c
@@ -248,6 +248,8 @@ static uint32_t mds_svc_event(struct ncsmds_callback_info 
*info)
                        if (m_MDS_DEST_IS_AN_ADEST(svc_evt->i_dest))
                                return NCSCC_RC_SUCCESS;
                        cb->smfd_dest = svc_evt->i_dest;
+                       LOG_NO("MDS %s: NCSMDS_UP i_dest = 0x%" PRIx64,
+                               __FUNCTION__, svc_evt->i_dest);
                }
                break;
 
@@ -265,6 +267,8 @@ static uint32_t mds_svc_event(struct ncsmds_callback_info 
*info)
                        if (m_MDS_DEST_IS_AN_ADEST(svc_evt->i_dest))
                                return NCSCC_RC_SUCCESS;
                        cb->smfd_dest = 0;
+                       LOG_NO("MDS %s: NCSMDS_DOWN smfd_dest = 0",
+                               __FUNCTION__);
                }
                break;
        default:
@@ -348,10 +352,11 @@ uint32_t mds_get_handle(smfnd_cb_t *cb)
        rc = ncsada_api(&arg);
 
        if (rc != NCSCC_RC_SUCCESS) {
-               LOG_ER("mds_get_handle: get handle FAILED\n");
+               LOG_ER("MDS %s: get handle FAILED", __FUNCTION__);
                return rc;
        }
        cb->mds_handle = arg.info.adest_get_hdls.o_mds_pwe1_hdl;
+       LOG_NO("MDS %s: Done", __FUNCTION__);
        return rc;
 }
 
@@ -434,8 +439,9 @@ void mds_unregister(smfnd_cb_t *cb)
        arg.i_op = MDS_UNINSTALL;
 
        if (ncsmds_api(&arg) != NCSCC_RC_SUCCESS) {
-               LOG_ER("mds_unregister: uninstall adest FAILED\n");
+               LOG_ER("MDS %s: uninstall adest FAILED", __FUNCTION__);
        }
+       LOG_NO("MDS %s: Done", __FUNCTION__);
        return;
 }
 
@@ -456,21 +462,24 @@ uint32_t smfnd_mds_init(smfnd_cb_t *cb)
 
        TRACE_ENTER();
 
+       LOG_NO("MDS %s: mds_get_handle()", __FUNCTION__);
        rc = mds_get_handle(cb);
 
        if (rc != NCSCC_RC_SUCCESS) {
-               LOG_ER("smfnd_mds_init: get mds handle FAILED\n");
+               LOG_ER("MDS %s: get mds handle FAILED", __FUNCTION__);
                goto done;
        }
 
+       LOG_NO("MDS %s: mds_register()", __FUNCTION__);
        rc = mds_register(cb);
 
        if (rc != NCSCC_RC_SUCCESS) {
-               LOG_ER("smfnd_mds_init: mds register FAILED\n");
+               LOG_ER("MDS %s: mds register FAILED", __FUNCTION__);
                goto done;
        }
 
 done:
+       LOG_NO("MDS %s: Done", __FUNCTION__);
        TRACE_LEAVE();
        return rc;
 }
@@ -489,6 +498,7 @@ done:
 uint32_t smfnd_mds_finalize(smfnd_cb_t *cb)
 {
        /* Destroy the Destination of SMFND */
+       LOG_NO("MDS %s: mds_unregister()", __FUNCTION__);
        mds_unregister(cb);
        return NCSCC_RC_SUCCESS;
 }
-- 
2.15.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to