ACK,
Mathi.

>-----Original Message-----
>From: Alex Jones [mailto:[email protected]]
>Sent: Saturday, June 21, 2014 1:26 AM
>To: Mathivanan Naickan Palanivelu
>Cc: [email protected]
>Subject: [PATCH 1 of 1] plm: plm does not always get correct inventory RDR
>from HPI [#880]
>
> osaf/services/saf/plmsv/plms/hpi_intf/plms_hrb.c |  36
>+++++++++++++++++++----
> osaf/services/saf/plmsv/plms/hpi_intf/plms_hsm.c |   2 +-
> osaf/services/saf/plmsv/plms/plms_he_pres_fsm.c  |   2 +-
> 3 files changed, 31 insertions(+), 9 deletions(-)
>
>
>Jun 20 13:47:58 linux-po6q osafplmd[4923]: ER HSM:RDR table is empty
>
>The use of saHpiRdrGet() in hsm_get_idr_info is not correct.
>SAHPI_LAST_ENTRY will be returned with the last entry.  In the current code,
>if the Inventory RDR is the last entry, the code thinks that the table is 
>empty,
>which is incorrect.
>Also, the path comparison in hrb_get_resourceid is not correct, either.  The
>memcmp is only comparing one part of the path, and not the entire path.
>
>For the first problem, after the while loop, we replace the check for
>SAHPI_LAST_ENTRY with a test for the RDR entry being an Inventory RDR.  For
>the second problem we replace the memcmp with a for loop which compares
>each entity in the entity path.  It is not enough to use a memcmp here,
>because HPI is not guaranteed to initialize the whole SaHpiEntityPathT
>structure.
>
>diff --git a/osaf/services/saf/plmsv/plms/hpi_intf/plms_hrb.c
>b/osaf/services/saf/plmsv/plms/hpi_intf/plms_hrb.c
>--- a/osaf/services/saf/plmsv/plms/hpi_intf/plms_hrb.c
>+++ b/osaf/services/saf/plmsv/plms/hpi_intf/plms_hrb.c
>@@ -423,10 +423,13 @@ static SaUint32T hrb_get_resourceid(SaIn
>               return NCSCC_RC_FAILURE;
>       }
>
>+      *resourceid = 0;
>+
>       /* Iterate through the RPT table to get the resource_id of the
>       corresponding entity_path */
>       next = SAHPI_FIRST_ENTRY;
>       do{
>+              int i = 0;
>               current = next;
>               rc = saHpiRptEntryGet(cb->session_id, current,
>                               &next, &rpt_entry);
>@@ -438,15 +441,34 @@ static SaUint32T hrb_get_resourceid(SaIn
>                 }
>
>               /* got the entry, check for matching entity path */
>-              if (memcmp(&epath, (int8_t
>*)&rpt_entry.ResourceEntity.Entry,
>-                      sizeof(SaHpiEntityT))){
>-                      continue;
>+              for (i=0; i < SAHPI_MAX_ENTITY_PATH; i++) {
>+                      if (epath.Entry[i].EntityType !=
>+                              rpt_entry.ResourceEntity.Entry[i].EntityType
>||
>+                              epath.Entry[i].EntityLocation !=
>+
>       rpt_entry.ResourceEntity.Entry[i].EntityLocation)
>+                      {
>+                              /* not it */
>+                              break;
>+                      }
>+                      else if (epath.Entry[i].EntityType == SAHPI_ENT_ROOT
>&&
>+
>       rpt_entry.ResourceEntity.Entry[i].EntityType == SAHPI_ENT_ROOT)
>+                      {
>+                              *resourceid = rpt_entry.ResourceId;
>+                              entry = &rpt_entry;
>+                              TRACE("found resourceid %d for epath:%s",
>+                                      *resourceid, epath_str);
>+                              break;
>+                      }
>+                      else if (epath.Entry[i].EntityType == SAHPI_ENT_ROOT
>||
>+
>       rpt_entry.ResourceEntity.Entry[i].EntityType == SAHPI_ENT_ROOT)
>+                      {
>+                              /* if one of them is ROOT, not the same */
>+                              break;
>+                      }
>               }
>-              else{
>-                      *resourceid = rpt_entry.ResourceId;
>-                      entry = &rpt_entry;
>+
>+              if (*resourceid)
>                       break;
>-              }
>       } while (next != SAHPI_LAST_ENTRY);
>
>       return rc;
>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
>@@ -1426,7 +1426,7 @@ SaUint32T hsm_get_idr_info(SaHpiRptEntry
>               }
>       } while(next_entry  != SAHPI_LAST_ENTRY);
>
>-      if(next_entry  == SAHPI_LAST_ENTRY){
>+      if (rdr.RdrType != SAHPI_INVENTORY_RDR) {
>               LOG_ER("HSM:RDR table is empty ");
>               return NCSCC_RC_FAILURE;
>       }
>diff --git a/osaf/services/saf/plmsv/plms/plms_he_pres_fsm.c
>b/osaf/services/saf/plmsv/plms/plms_he_pres_fsm.c
>--- a/osaf/services/saf/plmsv/plms/plms_he_pres_fsm.c
>+++ b/osaf/services/saf/plmsv/plms/plms_he_pres_fsm.c
>@@ -3565,7 +3565,7 @@ static SaUint32T plms_inv_data_compare(P
>                       LOG_ER("Product_info->product name did not
>match.\
>                       Conf: %d, Published: %d",
>                       conf_inv.product_area.product_name.DataLength,
>-                      conf_inv.product_area.product_name.DataLength);
>+                      hpi_inv.product_area.product_name.DataLength);
>                       return NCSCC_RC_FAILURE;
>               }
>               if (0 == memcmp(conf_inv.product_area.product_name.Data,
>

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to