ibm-openbmc / openpower-hw-isolation

Apache License 2.0
0 stars 10 forks source link

Remove SERVICEABLE_EVENT section if it is empty #75

Closed SwethaParasa closed 9 months ago

SwethaParasa commented 11 months ago

Even without guard records and pels, SERVICEABLE_EVENT is displayed in faultlog. Removing the SERVICEABLE_EVENT section if there is no data in it.

Before:

root@p10bmc:/tmp# guard -l
No Records to display
root@p10bmc:/tmp# peltool -l
{}
root@p10bmc:/tmp# faultlog -f
<6> faultlog app to collect deconfig/guard records details <6> Latest chassis poweron time read is :12/06/2023 06:39:33 [
  {
    "SYSTEM": {
      "SYSTEM_TYPE": "9105-22B"
    }
  },
  {
    "POLICY": {
      "FCO_VALUE": 0,
      "MASTER": true,
      "PREDICTIVE": true
    }
  },
  {
    "SERVICEABLE_EVENT": []  ----> It is displayed even if it is empty
  }
]
root@p10bmc:/tmp# faultlog -u
<6> faultlog app to collect deconfig/guard records details <6> Latest chassis poweron time read is :12/06/2023 06:39:33 [
  {
    "SYSTEM": {
      "SYSTEM_TYPE": "9105-22B"
    }
  },
  {
    "SERVICEABLE_EVENT": []  ----> It is displayed even if it is empty
  }
]
root@p10bmc:/tmp# faultlog -g
<6> faultlog app to collect deconfig/guard records details [
  {
    "SYSTEM": {
      "SYSTEM_TYPE": "9105-22B"
    }
  },
  {
    "SERVICEABLE_EVENT": []  ----> It is displayed even if it is empty
  }
]

Test Results:

root@p10bmc:/tmp/test# guard -l
No Records to display
root@p10bmc:/tmp/test# peltool -l
{}
root@p10bmc:/tmp/test# faultlog -f
<6> faultlog app to collect deconfig/guard records details <6> Latest chassis poweron time read is :12/06/2023 06:39:33 [
  {
    "SYSTEM": {
      "SYSTEM_TYPE": "9105-22B"
    }
  },
  {
    "POLICY": {
      "FCO_VALUE": 0,
      "MASTER": true,
      "PREDICTIVE": true
    }
  }
]
root@p10bmc:/tmp/test# faultlog -g
<6> faultlog app to collect deconfig/guard records details [
  {
    "SYSTEM": {
      "SYSTEM_TYPE": "9105-22B"
    }
  }
]
root@p10bmc:/tmp/test# faultlog -u
<6> faultlog app to collect deconfig/guard records details <6> Latest chassis poweron time read is :12/06/2023 06:39:33 [
  {
    "SYSTEM": {
      "SYSTEM_TYPE": "9105-22B"
    }
  }
]

Change-Id: Ifbf1704fbd0a87a2b7ca2615d471e559be9008f8 Signed-off-by: Parasa Swetha Parasa.Swetha1@ibm.com