CLM tracking clients have no context for the tracking callback.

PLM rootCauseEntity is not passed by CLM to its own tracking clients.

When CLM tracking is invoked because of PLM tracking, pass on the
rootCauseEntity.
---
 src/clm/clmd/clms_evt.cc  |  4 +--
 src/clm/clmd/clms_imm.cc  | 80 ++++++++++++++++++++++++++++++-----------------
 src/clm/clmd/clms_imm.h   |  9 ++++--
 src/clm/clmd/clms_plm.cc  |  3 +-
 src/clm/clmd/clms_util.cc | 13 ++++----
 5 files changed, 69 insertions(+), 40 deletions(-)

diff --git a/src/clm/clmd/clms_evt.cc b/src/clm/clmd/clms_evt.cc
index 5c1ca992c..c7d2f4ceb 100644
--- a/src/clm/clmd/clms_evt.cc
+++ b/src/clm/clmd/clms_evt.cc
@@ -692,7 +692,7 @@ uint32_t proc_node_up_msg(CLMS_CB *cb, CLMSV_CLMS_EVT *evt) 
{
       node->init_view = ++(clms_cb->cluster_view_num);
       TRACE("node->init_view %llu", node->init_view);
       node->change = SA_CLM_NODE_JOINED;
-      clms_send_track(clms_cb, node, SA_CLM_CHANGE_COMPLETED, false);
+      clms_send_track(clms_cb, node, SA_CLM_CHANGE_COMPLETED, false, 0);
       /* Clear node->stat_change after sending the callback to
        * its clients */
       node->stat_change = SA_FALSE;
@@ -766,7 +766,7 @@ void clms_track_send_node_down(CLMS_CLUSTER_NODE *node) {
   node->stat_change = SA_TRUE;
   node->change = SA_CLM_NODE_LEFT;
   ++(clms_cb->cluster_view_num);
-  clms_send_track(clms_cb, node, SA_CLM_CHANGE_COMPLETED, true);
+  clms_send_track(clms_cb, node, SA_CLM_CHANGE_COMPLETED, true, 0);
   /* Clear node->stat_change after sending the callback to its clients */
   node->stat_change = SA_FALSE;
 
diff --git a/src/clm/clmd/clms_imm.cc b/src/clm/clmd/clms_imm.cc
index 65a6ae11e..190509b05 100644
--- a/src/clm/clmd/clms_imm.cc
+++ b/src/clm/clmd/clms_imm.cc
@@ -1216,7 +1216,8 @@ static void clms_create_track_resp_list(CLMS_CLUSTER_NODE 
*node,
  * @param[in] step    CLM step for which to send the callback
  */
 void clms_send_track(CLMS_CB *cb, CLMS_CLUSTER_NODE *node,
-                     SaClmChangeStepT step, bool node_reboot) {
+                     SaClmChangeStepT step, bool node_reboot,
+                     const SaNameT *rootCauseEntity) {
   CLMS_CLIENT_INFO *rec;
   uint32_t client_id = 0;
   SaClmClusterNotificationT_4 *notify_changes = nullptr;
@@ -1254,24 +1255,27 @@ void clms_send_track(CLMS_CB *cb, CLMS_CLUSTER_NODE 
*node,
             if (node_id == node->node_id) {
               /*Implies the change is
                * on this local node */
-              rc = clms_send_track_local(node, rec, SA_CLM_CHANGE_START);
+              rc = clms_send_track_local(node, rec, SA_CLM_CHANGE_START,
+                                         rootCauseEntity);
             }
 
           } else
             rc = clms_prep_and_send_track(cb, node, rec, SA_CLM_CHANGE_START,
-                                          notify_changes_only);
+                                          notify_changes_only,
+                                          rootCauseEntity);
 
         } else if (rec->track_flags & SA_TRACK_CHANGES) {
           if (rec->track_flags & SA_TRACK_LOCAL) {
             if (node_id == node->node_id) {
               /*Implies the change is
                * on this local node */
-              rc = clms_send_track_local(node, rec, SA_CLM_CHANGE_START);
+              rc = clms_send_track_local(node, rec, SA_CLM_CHANGE_START,
+                                         rootCauseEntity);
             }
 
           } else
             rc = clms_prep_and_send_track(cb, node, rec, SA_CLM_CHANGE_START,
-                                          notify_changes);
+                                          notify_changes, rootCauseEntity);
         }
 
         if (rc != NCSCC_RC_SUCCESS) {
@@ -1295,24 +1299,26 @@ void clms_send_track(CLMS_CB *cb, CLMS_CLUSTER_NODE 
*node,
             if (node_id == node->node_id) {
               /*Implies the change is
                * on this local node */
-              rc = clms_send_track_local(node, rec, SA_CLM_CHANGE_VALIDATE);
+              rc = clms_send_track_local(node, rec, SA_CLM_CHANGE_VALIDATE,
+                                         rootCauseEntity);
             }
 
           } else
             rc = clms_prep_and_send_track(cb, node, rec, 
SA_CLM_CHANGE_VALIDATE,
-                                          notify_changes_only);
+                                          notify_changes_only, 
rootCauseEntity);
 
         } else if (rec->track_flags & SA_TRACK_CHANGES) {
           if (rec->track_flags & SA_TRACK_LOCAL) {
             if (node_id == node->node_id) {
               /*Implies the change is
                * on this local node */
-              rc = clms_send_track_local(node, rec, SA_CLM_CHANGE_VALIDATE);
+              rc = clms_send_track_local(node, rec, SA_CLM_CHANGE_VALIDATE,
+                                         rootCauseEntity);
             }
 
           } else
             rc = clms_prep_and_send_track(cb, node, rec, 
SA_CLM_CHANGE_VALIDATE,
-                                          notify_changes);
+                                          notify_changes, rootCauseEntity);
         }
 
         if (rc != NCSCC_RC_SUCCESS) {
@@ -1334,7 +1340,8 @@ void clms_send_track(CLMS_CB *cb, CLMS_CLUSTER_NODE *node,
           if (node_id == node->node_id) {
             /*Implies the change is on this
              * local node */
-            rc = clms_send_track_local(node, rec, SA_CLM_CHANGE_COMPLETED);
+            rc = clms_send_track_local(node, rec, SA_CLM_CHANGE_COMPLETED,
+                                       rootCauseEntity);
           }
         } else {
           /* In the COMPLETED step and when the
@@ -1348,7 +1355,8 @@ void clms_send_track(CLMS_CB *cb, CLMS_CLUSTER_NODE *node,
                 node_id);
           } else {
             rc = clms_prep_and_send_track(
-                cb, node, rec, SA_CLM_CHANGE_COMPLETED, notify_changes_only);
+                cb, node, rec, SA_CLM_CHANGE_COMPLETED, notify_changes_only,
+                rootCauseEntity);
           }
         }
       } else if (rec->track_flags & SA_TRACK_CHANGES) {
@@ -1356,7 +1364,8 @@ void clms_send_track(CLMS_CB *cb, CLMS_CLUSTER_NODE *node,
           if (node_id == node->node_id) {
             /*Implies the change is on this
              * local node */
-            rc = clms_send_track_local(node, rec, SA_CLM_CHANGE_COMPLETED);
+            rc = clms_send_track_local(node, rec, SA_CLM_CHANGE_COMPLETED,
+                                       rootCauseEntity);
           }
         } else {
           /* In the COMPLETED step and when there
@@ -1370,7 +1379,8 @@ void clms_send_track(CLMS_CB *cb, CLMS_CLUSTER_NODE *node,
                 node_id);
           } else {
             rc = clms_prep_and_send_track(
-                cb, node, rec, SA_CLM_CHANGE_COMPLETED, notify_changes);
+                cb, node, rec, SA_CLM_CHANGE_COMPLETED, notify_changes,
+                rootCauseEntity);
           }
         }
       }
@@ -1388,10 +1398,10 @@ void clms_send_track(CLMS_CB *cb, CLMS_CLUSTER_NODE 
*node,
 
         if (rec->track_flags & SA_TRACK_CHANGES_ONLY)
           rc = clms_prep_and_send_track(cb, node, rec, SA_CLM_CHANGE_ABORTED,
-                                        notify_changes_only);
+                                        notify_changes_only, rootCauseEntity);
         else if (rec->track_flags & SA_TRACK_CHANGES)
           rc = clms_prep_and_send_track(cb, node, rec, SA_CLM_CHANGE_ABORTED,
-                                        notify_changes);
+                                        notify_changes, rootCauseEntity);
 
         if (rc != NCSCC_RC_SUCCESS) {
           TRACE("Sending track callback failed for SA_CLM_CHANGE_ABORTED");
@@ -1403,10 +1413,10 @@ void clms_send_track(CLMS_CB *cb, CLMS_CLUSTER_NODE 
*node,
 
         if (rec->track_flags & SA_TRACK_CHANGES_ONLY)
           rc = clms_prep_and_send_track(cb, node, rec, SA_CLM_CHANGE_ABORTED,
-                                        notify_changes_only);
+                                        notify_changes_only, rootCauseEntity);
         else if (rec->track_flags & SA_TRACK_CHANGES)
           rc = clms_prep_and_send_track(cb, node, rec, SA_CLM_CHANGE_ABORTED,
-                                        notify_changes);
+                                        notify_changes, rootCauseEntity);
 
         if (rc != NCSCC_RC_SUCCESS) {
           TRACE("Sending track callback failed for SA_CLM_CHANGE_ABORTED");
@@ -1427,7 +1437,8 @@ void clms_send_track(CLMS_CB *cb, CLMS_CLUSTER_NODE *node,
  */
 uint32_t clms_send_track_local(CLMS_CLUSTER_NODE *node,
                                CLMS_CLIENT_INFO *client,
-                               SaClmChangeStepT step) {
+                               SaClmChangeStepT step,
+                               const SaNameT *rootCauseEntity) {
   CLMSV_MSG msg;
   uint32_t rc = NCSCC_RC_SUCCESS;
 
@@ -1447,7 +1458,13 @@ uint32_t clms_send_track_local(CLMS_CLUSTER_NODE *node,
   msg.info.cbk_info.param.track.root_cause_ent =
       (SaNameT *)malloc(sizeof(SaNameT));
 
-  if (node->admin_op != PLM) {
+  if (rootCauseEntity) {
+    msg.info.cbk_info.param.track.root_cause_ent->length =
+        rootCauseEntity->length;
+    memcpy(msg.info.cbk_info.param.track.root_cause_ent->value,
+           rootCauseEntity->value,
+           rootCauseEntity->length);
+  } else if (node->admin_op != PLM) {
     msg.info.cbk_info.param.track.root_cause_ent->length =
         node->node_name.length;
     memcpy(msg.info.cbk_info.param.track.root_cause_ent->value,
@@ -1562,7 +1579,8 @@ uint32_t clms_send_track_local(CLMS_CLUSTER_NODE *node,
 uint32_t clms_prep_and_send_track(CLMS_CB *cb, CLMS_CLUSTER_NODE *node,
                                   CLMS_CLIENT_INFO *client,
                                   SaClmChangeStepT step,
-                                  SaClmClusterNotificationT_4 *notify) {
+                                  SaClmClusterNotificationT_4 *notify,
+                                  const SaNameT *rootCauseEntity) {
   CLMSV_MSG msg;
   uint32_t rc = NCSCC_RC_SUCCESS;
 
@@ -1582,7 +1600,13 @@ uint32_t clms_prep_and_send_track(CLMS_CB *cb, 
CLMS_CLUSTER_NODE *node,
   msg.info.cbk_info.param.track.root_cause_ent =
       (SaNameT *)malloc(sizeof(SaNameT));
 
-  if (node->admin_op != PLM) {
+  if (rootCauseEntity) {
+    msg.info.cbk_info.param.track.root_cause_ent->length =
+        rootCauseEntity->length;
+    memcpy(msg.info.cbk_info.param.track.root_cause_ent->value,
+           rootCauseEntity->value,
+           rootCauseEntity->length);
+  } else if (node->admin_op != PLM) {
     msg.info.cbk_info.param.track.root_cause_ent->length =
         node->node_name.length;
     memcpy(msg.info.cbk_info.param.track.root_cause_ent->value,
@@ -1988,7 +2012,7 @@ SaAisErrorT 
clms_node_ccb_apply_modify(CcbUtilOperationData_t *opdata) {
   ++(clms_cb->cluster_view_num);
   /*Send track callback with saClmClusterChangesT=
    * SA_CLM_NODE_RECONFIGURED */
-  clms_send_track(clms_cb, node, SA_CLM_CHANGE_COMPLETED, false);
+  clms_send_track(clms_cb, node, SA_CLM_CHANGE_COMPLETED, false, 0);
   /*Clear admin_op and stat_change */
   node->admin_op = ADMIN_OP{};
   node->stat_change = SA_FALSE;
@@ -2311,7 +2335,7 @@ static uint32_t 
clms_lock_send_no_start_cbk(CLMS_CLUSTER_NODE *nodeop) {
   clms_node_update_rattr(nodeop);
   clms_cluster_update_rattr(osaf_cluster);
 
-  clms_send_track(clms_cb, nodeop, SA_CLM_CHANGE_COMPLETED, false);
+  clms_send_track(clms_cb, nodeop, SA_CLM_CHANGE_COMPLETED, false, 0);
 
   /*Clear admin_op and stat_change */
   nodeop->admin_op = ADMIN_OP{};
@@ -2446,7 +2470,7 @@ uint32_t clms_imm_node_unlock(CLMS_CLUSTER_NODE *nodeop) {
         clms_cluster_update_rattr(osaf_cluster);
 
         /*Send Callback to its clienst */
-        clms_send_track(clms_cb, nodeop, SA_CLM_CHANGE_COMPLETED, false);
+        clms_send_track(clms_cb, nodeop, SA_CLM_CHANGE_COMPLETED, false, 0);
 
         /*Send node join notification */
         clms_node_join_ntf(clms_cb, nodeop);
@@ -2480,7 +2504,7 @@ uint32_t clms_imm_node_unlock(CLMS_CLUSTER_NODE *nodeop) {
         clms_cluster_update_rattr(osaf_cluster);
 
         /*Send Callback to its clients */
-        clms_send_track(clms_cb, nodeop, SA_CLM_CHANGE_COMPLETED, false);
+        clms_send_track(clms_cb, nodeop, SA_CLM_CHANGE_COMPLETED, false, 0);
 
         /*Send node join notification */
         clms_node_join_ntf(clms_cb, nodeop);
@@ -2566,7 +2590,7 @@ uint32_t clms_imm_node_shutdown(CLMS_CLUSTER_NODE 
*nodeop) {
       nodeop->admin_state = SA_CLM_ADMIN_SHUTTING_DOWN;
       nodeop->stat_change = SA_TRUE;
       nodeop->change = SA_CLM_NODE_SHUTDOWN;
-      clms_send_track(clms_cb, nodeop, SA_CLM_CHANGE_START, false);
+      clms_send_track(clms_cb, nodeop, SA_CLM_CHANGE_START, false, 0);
 
       clms_node_admin_state_change_ntf(clms_cb, nodeop,
                                        SA_CLM_ADMIN_SHUTTING_DOWN);
@@ -2591,7 +2615,7 @@ uint32_t clms_imm_node_shutdown(CLMS_CLUSTER_NODE 
*nodeop) {
       clms_node_update_rattr(nodeop);
       clms_cluster_update_rattr(osaf_cluster);
 
-      clms_send_track(clms_cb, nodeop, SA_CLM_CHANGE_COMPLETED, false);
+      clms_send_track(clms_cb, nodeop, SA_CLM_CHANGE_COMPLETED, false, 0);
 
       /*Clear Admin_op and stat_change */
       nodeop->admin_op = ADMIN_OP{};
@@ -2647,7 +2671,7 @@ static void clms_lock_send_start_cbk(CLMS_CLUSTER_NODE 
*nodeop) {
   nodeop->change = SA_CLM_NODE_LEFT;
   nodeop->stat_change = SA_TRUE;
 
-  clms_send_track(clms_cb, nodeop, SA_CLM_CHANGE_START, false);
+  clms_send_track(clms_cb, nodeop, SA_CLM_CHANGE_START, false, 0);
   if (sigaction(SIGALRM, &act, nullptr) != 0) {
     TRACE("Sigaction failed");
     osafassert(0);
diff --git a/src/clm/clmd/clms_imm.h b/src/clm/clmd/clms_imm.h
index e30e78ab8..40f9d0666 100644
--- a/src/clm/clmd/clms_imm.h
+++ b/src/clm/clmd/clms_imm.h
@@ -29,7 +29,8 @@ extern void clms_imm_impl_set(CLMS_CB *cb);
 extern CLMS_CLUSTER_NODE *clms_node_new(SaNameT *name,
                                         const SaImmAttrValuesT_2 **attrs);
 extern void clms_send_track(CLMS_CB *cb, CLMS_CLUSTER_NODE *node,
-                            SaClmChangeStepT step, bool node_reboot);
+                            SaClmChangeStepT step, bool node_reboot,
+                            const SaNameT *rootCauseEntity);
 extern uint32_t clms_node_dn_chk(SaNameT *objName);
 extern SaAisErrorT clms_cluster_config_get();
 extern SaAisErrorT clms_node_create_config();
@@ -48,10 +49,12 @@ extern CLMS_CLUSTER_NODE *clms_node_get_by_eename(SaNameT 
*name);
 extern uint32_t clms_prep_and_send_track(CLMS_CB *cb, CLMS_CLUSTER_NODE *node,
                                          CLMS_CLIENT_INFO *client,
                                          SaClmChangeStepT step,
-                                         SaClmClusterNotificationT_4 *notify);
+                                         SaClmClusterNotificationT_4 *notify,
+                                         const SaNameT *rootCauseEntity);
 extern uint32_t clms_send_track_local(CLMS_CLUSTER_NODE *node,
                                       CLMS_CLIENT_INFO *client,
-                                      SaClmChangeStepT step);
+                                      SaClmChangeStepT step,
+                                      const SaNameT *rootCauseEntity);
 extern void clms_trackresp_patricia_init(CLMS_CLUSTER_NODE *node);
 extern void clms_switchoff_all_pending_rtupdates();
 extern void clms_switchon_all_pending_rtupdates();
diff --git a/src/clm/clmd/clms_plm.cc b/src/clm/clmd/clms_plm.cc
index be4a5b466..9c3076aa9 100644
--- a/src/clm/clmd/clms_plm.cc
+++ b/src/clm/clmd/clms_plm.cc
@@ -264,7 +264,8 @@ static void clms_plm_readiness_track_callback(
           clms_cluster_update_rattr(osaf_cluster);
         }
         clms_send_track(clms_cb, node, static_cast<SaClmChangeStepT>(step),
-                        SA_FALSE); /*dude you need to checkpoint
+                        SA_FALSE,
+                        rootCauseEntity); /*dude you need to checkpoint
                                    admin_op admin_state when track
                                    is complete or not decide */
       }
diff --git a/src/clm/clmd/clms_util.cc b/src/clm/clmd/clms_util.cc
index 9b7a2d0ed..dde88788e 100644
--- a/src/clm/clmd/clms_util.cc
+++ b/src/clm/clmd/clms_util.cc
@@ -642,7 +642,7 @@ void clms_clmresp_error_timeout(CLMS_CB *cb, 
CLMS_CLUSTER_NODE *node) {
   clms_admin_state_update_rattr(node);
   clms_cluster_update_rattr(osaf_cluster);
 
-  clms_send_track(clms_cb, node, SA_CLM_CHANGE_COMPLETED, false);
+  clms_send_track(clms_cb, node, SA_CLM_CHANGE_COMPLETED, false, 0);
 
   node->stat_change = SA_FALSE;
   node->admin_op = ADMIN_OP{};
@@ -1052,7 +1052,7 @@ void clms_adminop_pending() {
     if ((node->admin_op != PLM) && (node->admin_op != 0)) {
       /* force set flag to true, the node might have rebooted
        * and come up again */
-      clms_send_track(clms_cb, node, SA_CLM_CHANGE_ABORTED, true);
+      clms_send_track(clms_cb, node, SA_CLM_CHANGE_ABORTED, true, 0);
       node->admin_op = ADMIN_OP{};
     }
   }
@@ -1091,12 +1091,12 @@ uint32_t clms_send_cbk_start_sub(CLMS_CB *cb, 
CLMS_CLUSTER_NODE *node) {
           if (node_id == node->node_id) {
             /*Implies the change is on this
              * local node */
-            rc = clms_send_track_local(node, rec, SA_CLM_CHANGE_COMPLETED);
+            rc = clms_send_track_local(node, rec, SA_CLM_CHANGE_COMPLETED, 0);
           }
         } else {
           if (notify_changes_only != nullptr) {
             rc = clms_prep_and_send_track(cb, node, rec, step,
-                                          notify_changes_only);
+                                          notify_changes_only, 0);
           } else {
             LOG_ER(
                 "Inconsistent node db,Unable to send track callback for 
SA_TRACK_CHANGES_ONLY clients");
@@ -1107,11 +1107,12 @@ uint32_t clms_send_cbk_start_sub(CLMS_CB *cb, 
CLMS_CLUSTER_NODE *node) {
           if (node_id == node->node_id) {
             /*Implies the change is on this
              * local node */
-            rc = clms_send_track_local(node, rec, SA_CLM_CHANGE_COMPLETED);
+            rc = clms_send_track_local(node, rec, SA_CLM_CHANGE_COMPLETED, 0);
           }
         } else {
           if (notify_changes != nullptr) {
-            rc = clms_prep_and_send_track(cb, node, rec, step, notify_changes);
+            rc = clms_prep_and_send_track(cb, node, rec, step, notify_changes,
+                                          0);
           } else {
             LOG_ER(
                 "Inconsistent node db,Unable to send track callback for 
SA_TRACK_CHANGES clients");
-- 
2.13.6


------------------------------------------------------------------------------
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
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to