If an EE goes down during a controller switchover the TERMINATED message
sent by plmc to plmd may not be received because of the switch over.

In this case the EE will be stuck in terminating presence state.

If any parent of the EE is in OOS, then we can definitely set the presence
state to UNINSTANTIATED after the switchover. If not, then we can just set
the management-lost flag because we don't know whether or not the EE
terminated.
---
 src/plm/plmd/plms_stdby.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++
 src/plm/plmd/plms_utils.c | 53 ++++++++++++++++++++++++----------
 2 files changed, 110 insertions(+), 15 deletions(-)

diff --git a/src/plm/plmd/plms_stdby.c b/src/plm/plmd/plms_stdby.c
index d1a0d27..52f5701 100644
--- a/src/plm/plmd/plms_stdby.c
+++ b/src/plm/plmd/plms_stdby.c
@@ -56,6 +56,76 @@ plms_perform_pending_admin_clbk(PLMS_ENTITY_GROUP_INFO_LIST 
*grp_list,
                                PLMS_CKPT_TRACK_STEP_INFO *track_step);
 void plms_process_client_down_list();
 
+static void modify_presence_state(PLMS_ENTITY *ee)
+{
+       bool set = false;
+       PLMS_ENTITY *parent = ee->parent;
+
+       TRACE_ENTER();
+
+       while (parent) {
+               if ((parent->entity_type == PLMS_EE_ENTITY &&
+                       parent->entity.ee_entity.saPlmEEReadinessState ==
+                               SA_PLM_READINESS_OUT_OF_SERVICE) ||
+                       (parent->entity_type == PLMS_HE_ENTITY &&
+                       parent->entity.he_entity.saPlmHEReadinessState ==
+                               SA_PLM_READINESS_OUT_OF_SERVICE)) {
+                       plms_presence_state_set(ee,
+                                       SA_PLM_EE_PRESENCE_UNINSTANTIATED,
+                                       parent,
+                                       SA_NTF_OBJECT_OPERATION,
+                                       SA_PLM_NTFID_STATE_CHANGE_ROOT);
+                       set = true;
+                       break;
+               }
+
+               parent = parent->parent;
+       }
+
+       if (!set) {
+               plms_readiness_flag_mark_unmark(ee,
+                                       SA_PLM_RF_MANAGEMENT_LOST,
+                                       true,
+                                       ee,
+                                       SA_NTF_OBJECT_OPERATION,
+                                       SA_PLM_NTFID_STATE_CHANGE_ROOT);
+       }
+
+       TRACE_LEAVE();
+}
+
+static void check_presence_state(void)
+{
+       /*
+        * If an EE was in the middle of terminating, and we switchover, we may
+        * not get the notification from the EE that it has terminated. It's
+        * probably not a good idea to restart the termination-failed timer
+        * because we don't know if the EE already terminated. If there is a
+        * parent, and it is OOS, then we can definitely set the state to
+        * UNINSTANTIATED. Otherwise, let's just set the readiness flag to
+        * management-lost.
+        */
+       PLMS_CB *cb = plms_cb;
+       PLMS_ENTITY *plm_ent = (PLMS_ENTITY *)ncs_patricia_tree_getnext(
+                       &cb->entity_info, 0);
+
+       TRACE_ENTER();
+
+       while (plm_ent) {
+               if (plm_ent->entity_type == PLMS_EE_ENTITY) {
+                       if (plm_ent->entity.ee_entity.saPlmEEPresenceState ==
+                                       SA_PLM_EE_PRESENCE_TERMINATING) {
+                               modify_presence_state(plm_ent);
+                       }
+               }
+
+               plm_ent = (PLMS_ENTITY *)ncs_patricia_tree_getnext(
+                   &cb->entity_info, (SaUint8T *)&plm_ent->dn_name);
+       }
+
+       TRACE_LEAVE();
+}
+
 /***********************************************************************
  * Name          :plms_proc_standby_active_role_change
  *
@@ -89,6 +159,8 @@ SaUint32T plms_proc_standby_active_role_change()
 
        plms_process_client_down_list();
 
+       check_presence_state();
+
        cb->is_initialized = true;
 
        TRACE_LEAVE();
diff --git a/src/plm/plmd/plms_utils.c b/src/plm/plmd/plms_utils.c
index d09d94e..d3479e4 100644
--- a/src/plm/plmd/plms_utils.c
+++ b/src/plm/plmd/plms_utils.c
@@ -3009,9 +3009,14 @@ void plms_move_chld_ent_to_insvc(PLMS_ENTITY *chld_ent,
                                 SaUint8T inst_chld_ee, SaUint8T inst_dep_ee)
 {
        SaUint32T ret_err;
+
+       TRACE_ENTER();
+
        /* Terminating condition. */
-       if (NULL == chld_ent)
+       if (NULL == chld_ent) {
+               TRACE_LEAVE();
                return;
+       }
 
        /* If chld_ent is already insvc then return.*/
        if (plms_is_rdness_state_set(chld_ent, SA_PLM_READINESS_IN_SERVICE)) {
@@ -3040,6 +3045,7 @@ void plms_move_chld_ent_to_insvc(PLMS_ENTITY *chld_ent,
                LOG_ER("Entity %s can not be moved to insvc, as parent is \
                not in service",
                       chld_ent->dn_name_str);
+               TRACE_LEAVE();
                return;
        }
        /* If the min dependency condition is matched.
@@ -3068,16 +3074,19 @@ void plms_move_chld_ent_to_insvc(PLMS_ENTITY *chld_ent,
                       chld_ent->dn_name_str);
                /* Min dependency condition is not matched. Hence
                can not go insvc. So return from here.*/
+               TRACE_LEAVE();
                return;
        }
        /* If adm state is not unlock. */
        if ((PLMS_HE_ENTITY == chld_ent->entity_type) &&
            (SA_PLM_HE_ADMIN_UNLOCKED !=
             chld_ent->entity.he_entity.saPlmHEAdminState)) {
+               TRACE_LEAVE();
                return;
        } else if ((PLMS_EE_ENTITY == chld_ent->entity_type) &&
                   (SA_PLM_EE_ADMIN_UNLOCKED !=
                    chld_ent->entity.ee_entity.saPlmEEAdminState)) {
+               TRACE_LEAVE();
                return;
        }
 
@@ -3085,10 +3094,12 @@ void plms_move_chld_ent_to_insvc(PLMS_ENTITY *chld_ent,
        if ((PLMS_HE_ENTITY == chld_ent->entity_type) &&
            (SA_PLM_OPERATIONAL_DISABLED ==
             chld_ent->entity.he_entity.saPlmHEOperationalState)) {
+               TRACE_LEAVE();
                return;
        } else if ((PLMS_EE_ENTITY == chld_ent->entity_type) &&
                   (SA_PLM_OPERATIONAL_DISABLED ==
                    chld_ent->entity.ee_entity.saPlmEEOperationalState)) {
+               TRACE_LEAVE();
                return;
        }
        /* If the presence state of the HE is either active or deactivating
@@ -3098,26 +3109,37 @@ void plms_move_chld_ent_to_insvc(PLMS_ENTITY *chld_ent,
              chld_ent->entity.he_entity.saPlmHEPresenceState) &&
             (SA_PLM_HE_PRESENCE_DEACTIVATING !=
              chld_ent->entity.he_entity.saPlmHEPresenceState))) {
+               TRACE_LEAVE();
                return;
        }
        /* If the presence state of the EE is either instantiated or
        terminating.*/
-       if ((PLMS_EE_ENTITY == chld_ent->entity_type) &&
-           (SA_PLM_EE_PRESENCE_INSTANTIATED !=
-            chld_ent->entity.ee_entity.saPlmEEPresenceState) &&
-           (SA_PLM_EE_PRESENCE_TERMINATING !=
-            chld_ent->entity.ee_entity.saPlmEEPresenceState)) {
-               if (inst_chld_ee) {
-                       ret_err =
-                           plms_ent_enable(chld_ent, false, 0 /*mngt_cbk*/);
-                       if (NCSCC_RC_SUCCESS != ret_err) {
-                               LOG_ER("EE Instantiation failed, EE: %s",
-                                      chld_ent->dn_name_str);
+       if (PLMS_EE_ENTITY == chld_ent->entity_type) {
+               if ((SA_PLM_EE_PRESENCE_INSTANTIATED !=
+                       chld_ent->entity.ee_entity.saPlmEEPresenceState) &&
+                       (SA_PLM_EE_PRESENCE_TERMINATING !=
+                       chld_ent->entity.ee_entity.saPlmEEPresenceState)) {
+                       if (inst_chld_ee) {
+                               ret_err = plms_ent_enable(chld_ent,
+                                               false,
+                                               0 /*mngt_cbk*/);
+                               if (NCSCC_RC_SUCCESS != ret_err) {
+                                       LOG_ER("EE Instantiation failed, EE: "
+                                                       "%s",
+                                                       chld_ent->dn_name_str);
+                               }
                        }
+                       /* Even if the EE instantiattion is successful,
+                       dont take it to insvc. Wait for the instantiated msg.*/
+                       TRACE_LEAVE();
+                       return;
+               } else {
+                       /*
+                        * EE is either INSTANTIATED or TERMINATING; just return
+                        */
+                       TRACE_LEAVE();
+                       return;
                }
-               /* Even if the EE instantiattion is successful,
-               dont take it to insvc. Wait for the instantiated msg.*/
-               return;
        }
 
        /* All conditioned are matched. Move the ent to InSvc. */
@@ -3136,6 +3158,7 @@ void plms_move_chld_ent_to_insvc(PLMS_ENTITY *chld_ent,
        plms_move_chld_ent_to_insvc(chld_ent->leftmost_child, ent_list,
                                    inst_chld_ee, inst_dep_ee);
 
+       TRACE_LEAVE();
        return;
 }
 /******************************************************************************
-- 
2.9.5


------------------------------------------------------------------------------
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