# HG changeset patch
# User Alex Jones <[email protected]>
# Date 1409678402 14400
#      Tue Sep 02 13:20:02 2014 -0400
# Node ID 98bb99f081bbdc340a151425e94a418071390d59
# Parent  12251687a7e6ade049c5de9b3e4536b98e5b2091
plm: don't reset self during plms_ee_instantiate [#1031]

Active controller resets during OpenSAF startup when modeled as an HE with
dependent HEs in it.

If the active controller blade (modeled as an HE) has HE dependencies (some
other FRUs on the board), this blade/HE will only be brought in-service when
the other HEs on which it depends are brought in-service. At this point,
plms_ee_instantiate() is called and the controller ends up resetting itself.
plms_ent_enable() is called in plms_move_dep_ent_to_insvc(). This function,
plms_ent_enable(), is not called if there are no dependencies, and hardware
is not inserted. If the hardware is already present, and there are no
dependencies, plms_ent_enable() is not called, which means
plms_ee_instantiate() is not called. If the active controller blade/HE does
not depend on any other HEs, plms_ee_instantiate() is never called, and so
the blade can never reset itself.

The solution is to get the entity path from HPI, on which we are currently
running, and compare it to the HE which is the parent of the EE being reset.
If they are the same, then don't reset.

diff --git a/contrib/plmc/lib/utils/plmc_get_listening_ip_addr.c b/contrib/plmc/lib/utils/plmc_get_listening_ip_addr.c
--- a/contrib/plmc/lib/utils/plmc_get_listening_ip_addr.c
+++ b/contrib/plmc/lib/utils/plmc_get_listening_ip_addr.c
@@ -119,7 +119,6 @@ char * plmc_get_listening_ip_addr(char *
   s = socket(PF_INET, SOCK_DGRAM, 0);
   for(i = 0; i < nifaces; i++)
   {
-    strncpy(ifreqs[i].ifr_name, ifreqs[i].ifr_name, sizeof(ifreqs[i].ifr_name));
     if (ioctl(s, SIOCGIFADDR, &ifreqs[i]) >= 0) {
       struct sockaddr_in addr;
 
diff --git a/osaf/libs/common/plmsv/include/plms.h b/osaf/libs/common/plmsv/include/plms.h
--- a/osaf/libs/common/plmsv/include/plms.h
+++ b/osaf/libs/common/plmsv/include/plms.h
@@ -279,6 +279,7 @@ typedef struct
 typedef struct plms_cb
 {             
         SaNameT                   comp_name;     /* Component name - "PLMS"               */
+	SaStringT                 my_entity_path;
         SaAmfHAStateT             ha_state;      /* present AMF HA state of the component */
 	bool                  csi_assigned;
 	SaHpiDomainIdT     	  domain_id;
diff --git a/osaf/services/saf/plmsv/plms/hpi_intf/plms_hsm.c b/osaf/services/saf/plmsv/plms/hpi_intf/plms_hsm.c
--- a/osaf/services/saf/plmsv/plms/hpi_intf/plms_hsm.c
+++ b/osaf/services/saf/plmsv/plms/hpi_intf/plms_hsm.c
@@ -562,6 +562,11 @@ static void *plms_hsm(void)
 
 		TRACE("HSM:Receieved event for res_id:%u Evt type:%u ",rpt_entry.ResourceId,event.EventType);
 
+		if (event.EventType == SAHPI_ET_OEM) {
+			/* not currently supporting OEM events */
+			continue;
+		}
+
 		/* Get the Hotswap State model for this resource */
 		rc = hsm_get_hotswap_model(&rpt_entry,&hotswap_state_model);
 		if(rc == NCSCC_RC_FAILURE){
@@ -671,6 +676,9 @@ static void *plms_hsm(void)
 static SaUint32T hsm_discover_and_dispatch()
 {
 	PLMS_HSM_CB       *cb = hsm_cb;
+	PLMS_CB           *plmscb = plms_cb;
+	SaErrorT          hpirc = SA_OK;
+	SaHpiEntityPathT  my_entity_path;
 	SaHpiDomainInfoT  prev_domain_info;
 	SaHpiDomainInfoT  latest_domain_info;
 	SaHpiEntryIdT     current;
@@ -710,6 +718,20 @@ static SaUint32T hsm_discover_and_dispat
 		prev_domain_op_status = NCSCC_RC_FAILURE;
 	}
 
+	/* get our entity path */
+	hpirc = saHpiMyEntityPathGet(cb->session_id, &my_entity_path);
+
+	if (hpirc != SA_OK) {
+		LOG_ER("saHpiMyEntityPathGet failed: %d", hpirc);
+	}
+	else {
+		rc = convert_entitypath_to_string(&my_entity_path,
+                                               &plmscb->my_entity_path);
+		if (NCSCC_RC_FAILURE == rc) {
+			LOG_ER("failed to convert my_entity_path");
+		}
+	}
+
 	/* Process the list of RPT entries on this session */
 	next = SAHPI_FIRST_ENTRY;
 	do{
@@ -1069,7 +1091,7 @@ static SaUint32T hsm_get_idr_chassis_inf
         area_id = SAHPI_FIRST_ENTRY;
 
 	/* First make sure that we find the chassis info area */
-        while ((err == SA_OK) && (area_id != SAHPI_LAST_ENTRY)) {
+        while (area_id != SAHPI_LAST_ENTRY) {
                 /* get the chassis_info_area header */
                 err = saHpiIdrAreaHeaderGet(cb->session_id,
                                         rpt_entry->ResourceId,
@@ -1078,6 +1100,10 @@ static SaUint32T hsm_get_idr_chassis_inf
                                         area_id,
                                         &next_area,
                                         &area_info);
+
+		if (err != SA_OK)
+			return NCSCC_RC_FAILURE;
+
                 /* Check out what Area it is */
                 if (area_info.Type == SAHPI_IDR_AREATYPE_CHASSIS_INFO) {
                         break;
@@ -1156,7 +1182,7 @@ static SaUint32T hsm_get_idr_board_info(
 
 	/* get the BOARD_INFO area header for the given resource */
 	/* First we need to make sure we can find the board info */
-        while ((err == SA_OK) && (area_id != SAHPI_LAST_ENTRY)) {
+        while (area_id != SAHPI_LAST_ENTRY) {
                 err = saHpiIdrAreaHeaderGet(cb->session_id,
                                         rpt_entry->ResourceId,
                                         idr_id,
@@ -1164,6 +1190,10 @@ static SaUint32T hsm_get_idr_board_info(
                                         area_id,
                                         &next_area,
                                         &area_info);
+
+		if (err != SA_OK)
+			return NCSCC_RC_FAILURE;
+
                 /* Check out what Area it is */
                 if (area_info.Type == SAHPI_IDR_AREATYPE_BOARD_INFO) {
                         break;
@@ -1260,7 +1290,7 @@ static SaUint32T hsm_get_idr_product_inf
 
 	/* get the PRODUCT_INFO area header for the given resource */
 	/* First we need to make sure we can find the product info */
-        while ((err == SA_OK) && (area_id != SAHPI_LAST_ENTRY)) {
+        while (area_id != SAHPI_LAST_ENTRY) {
                 /* get the chassis_info_area header */
                 err = saHpiIdrAreaHeaderGet(cb->session_id,
                                         rpt_entry->ResourceId,
@@ -1269,6 +1299,10 @@ static SaUint32T hsm_get_idr_product_inf
                                         area_id,
                                         &next_area,
                                         &area_info);
+
+		if (err != SA_OK)
+			return NCSCC_RC_FAILURE;
+
                 /* Check out what Area it is */
                 if (area_info.Type == SAHPI_IDR_AREATYPE_PRODUCT_INFO) {
                         break;
diff --git a/osaf/services/saf/plmsv/plms/plms_plmc.c b/osaf/services/saf/plmsv/plms/plms_plmc.c
--- a/osaf/services/saf/plmsv/plms/plms_plmc.c
+++ b/osaf/services/saf/plmsv/plms/plms_plmc.c
@@ -2282,6 +2282,7 @@ SaUint32T plms_ee_reboot(PLMS_ENTITY *en
 SaUint32T plms_ee_instantiate(PLMS_ENTITY *ent,SaUint32T is_adm_op,SaUint32T mngt_cbk)
 {
 	SaUint32T ret_err,cbk = 0;
+	PLMS_CB *cb = plms_cb;
 	PLMS_ENTITY *parent_he;
 
 	if (PLMS_EE_ENTITY != ent->entity_type)
@@ -2309,6 +2310,17 @@ SaUint32T plms_ee_instantiate(PLMS_ENTIT
 						ent->dn_name_str);
 		ret_err = NCSCC_RC_FAILURE; 
 	}else{
+		/* don't reset if this is myself -- obviously we are already
+		running; just return success.  PLMCD message will handle
+		EE */
+		if (parent_he->entity_type == PLMS_HE_ENTITY &&
+			!strcmp(parent_he->entity.he_entity.saPlmHECurrEntityPath,
+				cb->my_entity_path))
+		{
+			TRACE("not resetting myself");
+			return NCSCC_RC_SUCCESS;
+		}
+
 		/* Reset the parent_he.*/
 		TRACE("Reset the parent HE %s(ee_inst).",
 						parent_he->dn_name_str);


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to