Ack,
Mathi.

> -----Original Message-----
> From: Alex Jones [mailto:ajo...@genband.com]
> Sent: Tuesday, October 11, 2016 8:09 PM
> To: Mathivanan Naickan Palanivelu
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 1 of 1] plm: log entity path for failed HPI calls [#2109]
> 
>  osaf/libs/common/plmsv/include/plms_hsm.h               |   2 +-
>  osaf/services/saf/plmsv/plms/hpi_intf/plms_epath_util.c |   8 +-
>  osaf/services/saf/plmsv/plms/hpi_intf/plms_hrb.c        |   7 +-
>  osaf/services/saf/plmsv/plms/hpi_intf/plms_hsm.c        |  89
> ++++++++++++++--
>  4 files changed, 86 insertions(+), 20 deletions(-)
> 
> 
> Sep 27 00:34:10 q50-s2 osafplmd[10184]: ER failed to get resource id: -1011
> 
> When an HPI call fails for a specific resource id or entity path, the 
> resource id
> or entity path is not always printed out.
> 
> Print out the resource id or entity path if the HPI call fails.
> 
> diff --git a/osaf/libs/common/plmsv/include/plms_hsm.h
> b/osaf/libs/common/plmsv/include/plms_hsm.h
> --- a/osaf/libs/common/plmsv/include/plms_hsm.h
> +++ b/osaf/libs/common/plmsv/include/plms_hsm.h
> @@ -57,7 +57,7 @@ SaUint32T plms_hsm_finalize(void);  SaUint32T
> hsm_get_idr_info(SaHpiRptEntryT  *rpt_entry,
>                                  PLMS_INV_DATA  *inv_data);
> 
> -SaUint32T convert_entitypath_to_string(SaHpiEntityPathT *entity_path,
> +SaUint32T convert_entitypath_to_string(const SaHpiEntityPathT
> +*entity_path,
>                                          SaInt8T **ent_path_str);  SaUint32T
> plms_hsm_session_close();
>  #endif   /* PLMS_HSM_H */
> diff --git a/osaf/services/saf/plmsv/plms/hpi_intf/plms_epath_util.c
> b/osaf/services/saf/plmsv/plms/hpi_intf/plms_epath_util.c
> --- a/osaf/services/saf/plmsv/plms/hpi_intf/plms_epath_util.c
> +++ b/osaf/services/saf/plmsv/plms/hpi_intf/plms_epath_util.c
> @@ -53,13 +53,13 @@ typedef struct
> 
> /**********************************************************
> *************
>  *   FUNCTION PROTOTYPES
> 
> **********************************************************
> *************/
> -SaUint32T convert_entitypath_to_string(SaHpiEntityPathT *entity_path,
> +SaUint32T convert_entitypath_to_string(const SaHpiEntityPathT
> +*entity_path,
>                                       SaInt8T **ent_path_str);
>  SaUint32T convert_string_to_epath(SaInt8T *epath_str,
>                                             SaHpiEntityPathT *epath_ptr);  
> static void
> remove_spaces(SaInt8T **tok);
> 
> -static SaUint32T convert_entity_types(SaHpiEntityPathT *entity_path,
> +static SaUint32T convert_entity_types(const SaHpiEntityPathT
> +*entity_path,
>                               SaInt8T *ent_path_str,
>                               SaUint32T
> index_array[SAHPI_MAX_ENTITY_PATH]);
> 
> @@ -204,7 +204,7 @@ static PLMS_ENTITY_TYPE_LIST  hpi_ent_ty
>   *
>   * Notes         : None.
> 
> **********************************************************
> **************/
> -SaUint32T convert_entitypath_to_string(SaHpiEntityPathT *entity_path,
> +SaUint32T convert_entitypath_to_string(const SaHpiEntityPathT
> +*entity_path,
>                       SaInt8T **ent_path_str)
>  {
>          SaUint32T  i     = 0;
> @@ -336,7 +336,7 @@ SaUint32T convert_entitypath_to_string(S
>  *
>  * Notes         : None.
> 
> **********************************************************
> *******************/
> -static SaUint32T convert_entity_types(SaHpiEntityPathT *entity_path,
> +static SaUint32T convert_entity_types(const SaHpiEntityPathT
> +*entity_path,
>                               SaInt8T *ent_path_str,
>                               SaUint32T
> index_array[SAHPI_MAX_ENTITY_PATH])
>  {
> 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
> @@ -375,8 +375,13 @@ static SaUint32T hrb_process_hpi_req( PL
>       TRACE("Processing Status for hpi request for res:%u HPI resp:%i",
>                       resourceid,hpirc);
> 
> -     if(hpirc != SA_OK)
> +     if(hpirc != SA_OK) {
> +              LOG_ER("PLMS HPI cmd: %d failed for res: %d err: %i",
> +                     hpi_req->cmd,
> +                     resourceid,
> +                     hpirc);
>                response->ret_val = NCSCC_RC_FAILURE;
> +      }
>       else
>               response->ret_val  = NCSCC_RC_SUCCESS;
> 
> 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
> @@ -261,8 +261,45 @@ SaUint32T plms_get_hotswap_model(const S
>                                                       &rptUpdateCount);
> 
>               if (hpirc != SA_OK) {
> -                     LOG_ER("failed to get resource id: %i", hpirc);
> +                     SaInt8T *entityPathStr = 0;
> +
> +                     if (convert_entitypath_to_string(epath_ptr,
> +                                                     &entityPathStr) !=
> +                             NCSCC_RC_SUCCESS) {
> +                             /*
> +                              * For some reason couldn't convert to string
> +                              * so just write out the enums
> +                              */
> +                             int i;
> +                             entityPathStr = malloc(256);
> +                             memset(entityPathStr, 0, 256);
> +
> +                             for (i = 0; i < SAHPI_MAX_ENTITY_PATH; i++)
> {
> +
>       sprintf(&entityPathStr[strlen(entityPathStr)],
> +                                             "%i",
> +                                             epath_ptr-
> >Entry[i].EntityType);
> +
> +
>       sprintf(&entityPathStr[strlen(entityPathStr)],
> +                                             ".%i",
> +                                             epath_ptr-
> >Entry[i].EntityLocation);
> +
> +                                     if (epath_ptr->Entry[i].EntityType ==
> +                                             SAHPI_ENT_ROOT)
> +                                             break;
> +                                     else
> +
>       sprintf(&entityPathStr[strlen(entityPathStr)],
> +                                                     ",");
> +                             }
> +                     }
> +
> +                     LOG_ER("failed to get resource id for entity: %s: %i",
> +                             entityPathStr,
> +                             hpirc);
>                       rc = NCSCC_RC_FAILURE;
> +
> +                     if (entityPathStr)
> +                             free(entityPathStr);
> +
>                       break;
>               }
> 
> @@ -273,7 +310,9 @@ SaUint32T plms_get_hotswap_model(const S
>                                                       &rptEntry);
> 
>               if (hpirc != SA_OK) {
> -                     LOG_ER("failed to get rpt entry id: %i", hpirc);
> +                     LOG_ER("failed to get rpt entry id for res: %d: %i",
> +                             resourceId,
> +                             hpirc);
>                       rc = NCSCC_RC_FAILURE;
>                       break;
>               }
> @@ -816,7 +855,9 @@ static SaUint32T hsm_discover_and_dispat
>                       rc = saHpiEventLogClear(cb->session_id,
>                                             rpt_entry.ResourceId);
>                       if (SA_OK != rc)
> -                             LOG_ER("saHpiEventLogClear failed ret
> val:%u",rc);
> +                             LOG_ER("saHpiEventLogClear for res: %d
> failed ret val:%d",
> +                                     rpt_entry.ResourceId,
> +                                     rc);
>               }
> 
>               /* Get the Hotswap State model for this resource */ @@ -
> 1201,7 +1242,7 @@ static SaUint32T hsm_get_idr_chassis_inf
>          SaHpiIdrAreaHeaderT  area_info;
>          SaHpiIdrFieldT       thisField;
>          PLMS_HSM_CB          *cb = hsm_cb;
> -        SaUint32T            err = SA_OK;
> +        SaErrorT             err = SA_OK;
>          SaHpiEntryIdT        fieldId;
>          area_id = SAHPI_FIRST_ENTRY;
> 
> @@ -1216,8 +1257,12 @@ static SaUint32T hsm_get_idr_chassis_inf
>                                          &next_area,
>                                          &area_info);
> 
> -             if (err != SA_OK)
> +             if (err != SA_OK) {
> +                     LOG_ER("saHpiIdrAreaHeaderGet failed for res: %d
> err: %d",
> +                             rpt_entry->ResourceId,
> +                             err);
>                       return NCSCC_RC_FAILURE;
> +             }
> 
>                  /* Check out what Area it is */
>                  if (area_info.Type == SAHPI_IDR_AREATYPE_CHASSIS_INFO) { @@ -
> 1262,7 +1307,9 @@ static SaUint32T hsm_get_idr_chassis_inf
> 
>                          }
>                  } else {
> -                        LOG_ER("hsm_get_idr_chassis_info failed error val 
> is:%d",err);
> +                        LOG_ER("saHpiIdrFieldGet failed for res: %d error 
> val is:%d",
> +                             rpt_entry->ResourceId,
> +                             err);
>                          return NCSCC_RC_FAILURE;
>                  }
>                  fieldId = next_field;
> @@ -1292,7 +1339,7 @@ static SaUint32T hsm_get_idr_board_info(
>       SaHpiIdrAreaHeaderT area_info;
>       SaHpiIdrFieldT thisField;
>       SaHpiEntryIdT  fieldId;
> -     SaUint32T      err = SA_OK;
> +     SaErrorT       err = SA_OK;
>       area_id = SAHPI_FIRST_ENTRY;
> 
>       /* get the BOARD_INFO area header for the given resource */ @@ -
> 1306,8 +1353,12 @@ static SaUint32T hsm_get_idr_board_info(
>                                          &next_area,
>                                          &area_info);
> 
> -             if (err != SA_OK)
> +             if (err != SA_OK) {
> +                     LOG_ER("saHpiIdrAreaHeaderGet failed for res: %d
> err: %d",
> +                             rpt_entry->ResourceId,
> +                             err);
>                       return NCSCC_RC_FAILURE;
> +             }
> 
>                  /* Check out what Area it is */
>                  if (area_info.Type == SAHPI_IDR_AREATYPE_BOARD_INFO) { @@ -
> 1374,7 +1425,9 @@ static SaUint32T hsm_get_idr_board_info(
>                                          board_area.fru_field_id.DataLength);
>                          }
>                  } else {
> -                        LOG_ER("hsm_get_idr_board_info failed error val 
> is:%d",err);
> +                        LOG_ER("saHpiIdrFieldGet failed for res: %d error 
> val is:%d",
> +                             rpt_entry->ResourceId,
> +                             err);
>                          return NCSCC_RC_FAILURE;
>                  }
>                  fieldId = next_field;
> @@ -1400,7 +1453,7 @@ static SaUint32T hsm_get_idr_product_inf
>       SaHpiIdrAreaHeaderT area_info;
>       SaHpiIdrFieldT thisField;
>       SaHpiEntryIdT  fieldId;
> -     SaUint32T      err = SA_OK;
> +     SaErrorT       err = SA_OK;
>       area_id = SAHPI_FIRST_ENTRY;
> 
>       /* get the PRODUCT_INFO area header for the given resource */
> @@ -1415,8 +1468,12 @@ static SaUint32T hsm_get_idr_product_inf
>                                          &next_area,
>                                          &area_info);
> 
> -             if (err != SA_OK)
> +             if (err != SA_OK) {
> +                     LOG_ER("saHpiIdrAreaHeaderGet failed for res: %d
> err: %d",
> +                             rpt_entry->ResourceId,
> +                             err);
>                       return NCSCC_RC_FAILURE;
> +             }
> 
>                  /* Check out what Area it is */
>                  if (area_info.Type == SAHPI_IDR_AREATYPE_PRODUCT_INFO) { @@
> -1505,7 +1562,9 @@ static SaUint32T hsm_get_idr_product_inf
>                                          
> product_area.fru_field_id.DataLength);
>                          }
>                  } else {
> -                        LOG_ER("hsm_get_idr_board_info failed error val 
> is:%d",err);
> +                        LOG_ER("saHpiIdrFieldGet failed for res: %d error 
> val is:%d",
> +                             rpt_entry->ResourceId,
> +                             err);
>                          return NCSCC_RC_FAILURE;
>                  }
>                  fieldId = next_field;
> @@ -1562,7 +1621,7 @@ SaUint32T hsm_get_idr_info(SaHpiRptEntry
>       SaHpiRdrT       rdr;
>  /*   SaHpiIdrInfoT   idr_info; */
>       SaHpiIdrIdT     idr_id;
> -     SaUint32T       err;
> +     SaErrorT        err;
> 
>       TRACE_ENTER();
> 
> @@ -1577,7 +1636,9 @@ SaUint32T hsm_get_idr_info(SaHpiRptEntry
>               err = saHpiRdrGet(cb->session_id, rpt_entry->ResourceId,
>                               current_entry, &next_entry, &rdr);
>               if (SA_OK != err){
> -                     LOG_ER("HSM:RDR get failed with err:%d",err);
> +                     LOG_ER("HSM:RDR get (saHpiRdrGet) failed for res:
> %d with err:%d",
> +                             rpt_entry->ResourceId,
> +                             err);
>                       if(SA_ERR_HPI_CAPABILITY == err){
>                               LOG_ER("HSM:RDR table is empty ");
>                               return NCSCC_RC_FAILURE;
> 

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