Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add controller, cache, and battery statuses to required sections #210

Merged
merged 1 commit into from
Sep 23, 2016
Merged

Add controller, cache, and battery statuses to required sections #210

merged 1 commit into from
Sep 23, 2016

Conversation

BlaineEXE
Copy link

There is a bug in the HPSSACLI parsing code that will not get the
key-value pair for (a) properties that are at the end of a section or
(b) properties that appear alone.

In testing, controller status may appear alone and needs to be
whitelisted by adding it to the required sections variable. In the
event that cache status or battery status appear at the end of the
section, I also added those to the whitelist. This fix is non-ideal,
but it needs to appear in the next release, which is very soon.

This issue may rear its head again later, so an overhaul of the
HPSSACLI parsing routine may be appropriate.

Signed-off-by: Blaine Gardner [email protected]

There is a bug in the HPSSACLI parsing code that will not get the
key-value pair for (a) properties that are at the end of a section or
(b) properties that appear alone.

In testing, controller status may appear alone and needs to be
whitelisted by adding it to the required sections variable. In the
event that cache status or battery status appear at the end of the
section, I also added those to the whitelist. This fix is non-ideal,
but it needs to appear in the next release, which is very soon.

This issue may rear its head again later, so an overhaul of the
HPSSACLI parsing routine may be appropriate.

Signed-off-by: Blaine Gardner <[email protected]>
@BlaineEXE
Copy link
Author

BlaineEXE commented Sep 19, 2016

Some output showing the issue.

ctrl all show status

From HPSSACLI

[root@bg-4520-1 hpsa]# hpssacli ctrl all show status

Smart HBA H244br in Slot 0 (Embedded) (RAID Mode)
   Controller Status: OK

In hpsa.py

hp_ctrl_status = {} # 'Controller Status' is absent

ctrl all show detail

From HPSSACLI

[root@bg-4520-1 hpsa]# hpssacli ctrl all show detail

Smart HBA H244br in Slot 0 (Embedded) (RAID Mode)
   Bus Interface: PCI  
   Slot: 0
   Serial Number: PDNMC%%LM8W07W
   Cache Serial Number: PDNMC%%LM8W07W
   Controller Status: OK
   Hardware Revision: B
   Firmware Version: 4.99-1
   Rebuild Priority: High
   Expand Priority: Medium
   Surface Scan Delay: 3 secs
   Surface Scan Mode: Idle
   Parallel Surface Scan Supported: Yes
   Current Parallel Surface Scan Count: 1
   Max Parallel Surface Scan Count: 16
   Queue Depth: Automatic
   Monitor and Performance Delay: 60  min
   Elevator Sort: Enabled
   Degraded Performance Optimization: Disabled
   Inconsistency Repair Policy: Disabled
   Wait for Cache Room: Disabled
   Surface Analysis Inconsistency Notification: Disabled
   Post Prompt Timeout: 15 secs
   Cache Board Present: False
   Drive Write Cache: Disabled
   Controller Memory Size: 256 MB
   SATA NCQ Supported: True
   Spare Activation Mode: Activate on physical drive failure (default)
   Controller Temperature (C): 42
   Cache Module Temperature (C): 21
   Number of Ports: 1 Internal only
   Encryption: Disabled
   Express Local Encryption: False
   Driver Name: hpsa   
   Driver Version: 3.4.14
   Driver Supports HPE SSD Smart Path: True
   PCI Address (Domain:Bus:Device.Function): 0000:04:00.0
   Negotiated PCIe Data Rate: PCIe 3.0 x4 (3940 MB/s)
   Controller Mode: RAID Mode
   Controller Mode Reboot: Not Required
   Latency Scheduler Setting: Disabled
   Current Power Mode: MaxPerformance
   Sanitize Erase Supported: True
   Primary Boot Volume: None
   Secondary Boot Volume: None

In hpsa.py

ctrl_all_show = {'Smart HBA H244br in Slot 0 (Embedded) (RAID Mode)':
{'Slot': '0', 
'Driver Name': 'hpsa', 
'SATA NCQ Supported': 'True', 
'Controller Memory Size': '256 MB', 
'Encryption': 'Disabled', 
'Expand Priority': 'Medium', 
'Sanitize Erase Supported': 'True', 
'Surface Scan Delay': '3 secs', 
'Drive Write Cache': 'Disabled', 
'Inconsistency Repair Policy': 'Disabled', 
'Surface Scan Mode': 'Idle', 
'Post Prompt Timeout': '15 secs', 
'Controller Status': 'OK', 
'Driver Supports HPE SSD Smart Path': 'True', 
'Current Power Mode': 'MaxPerformance', 
'Cache Board Present': 'False', 
'Express Local Encryption': 'False', 
'Queue Depth': 'Automatic', 
'Hardware Revision': 'B', 
'Serial Number': 'PDNMC%%LM8W07W', 
'Negotiated PCIe Data Rate': 'PCIe 3.0 x4 (3940 MB/s)', 
'Bus Interface': 'PCI', 
'Cache Module Temperature (C)': '22', 
'Wait for Cache Room': 'Disabled', 
'Current Parallel Surface Scan Count': '1', 
'Monitor and Performance Delay': '60  min', 
'Latency Scheduler Setting': 'Disabled', 
'Number of Ports': '1 Internal only', 
'Cache Serial Number': 'PDNMC%%LM8W07W', 
'Rebuild Priority': 'High', 
'Controller Mode': 'RAID Mode', 
'Firmware Version': '4.99-1', 
'Spare Activation Mode': 'Activate on physical drive failure (default)', 
'Elevator Sort': 'Enabled', 
'Surface Analysis Inconsistency Notification': 'Disabled', 
'Max Parallel Surface Scan Count': '16', 
'Controller Temperature (C)': '43', 
'Parallel Surface Scan Supported': 'Yes', 
'Degraded Performance Optimization': 'Disabled', 
'PCI Address (Domain:Bus:Device.Function)': '0000:04:00.0', 
'Primary Boot Volume': 'None', 
'Controller Mode Reboot': 'Not Required', 
'Driver Version': '3.4.14'}
}
# 'Secondary Boot Volume' is absent

@joehandzik
Copy link
Member

@cathay4t We'll want you to take a look at this one and pull it in if you agree. Always helps to have a set of less biased eyes on this sort of change. :)

@cathay4t
Copy link
Contributor

@joehandzik Sure. I will take a look on this and perform some tests today.

@cathay4t
Copy link
Contributor

@BlaineEXE We might need to fix this again if any new entry was added to hpssacli ctrl all show status. In stead of add more required_sections, could you fix the properties that are at the end of a section or (b) properties that appear alone issue in stead?

@BlaineEXE
Copy link
Author

@cathay4t, this fix will still work if new entries are added to hpssacli ctrl all show status from the HPSSACLI side. From the libstoragemgmt side, you are correct.

This issue may rear its head again later, so an overhaul of the
HPSSACLI parsing routine may be appropriate.

For me it boils down to a few ideas. This fix is non-ideal, but it is functional for the time being. What really needs to happen is an entire overhaul of how HPSSACLI is parsed in order to collect lone properties. In the parsing code, it implicitly assumes that a line is a valid property if and only if it has another line below it with the same indentation level. It also hinges on the idea of required sections and setting whether a section or property is required using several rules with unclear purposes. Trying to work the fix in with these in place or overhauling could take several days to two weeks, and this bug will not be fixed in 1.4.0.

I would propose that this fix be accepted now since it does fix the bug in 1.4.0. There is risk that future additions to libstoragemgmt may bring the root issues back to light, so work will begin after 1.4.0 release to overhaul the HPSSACLI parsing to improve robustness.

@cathay4t
Copy link
Contributor

I will try to fix the parser, it seems not that hard for me. If I failed to do so, I will take your PR.

BTW, how hard is HPSSACLI to support output in JSON? MegaRAID already support JSON output for quit a while.

@tasleson
Copy link
Member

+1 on adding json output

@joehandzik
Copy link
Member

joehandzik commented Sep 21, 2016

@tasleson @cathay4t

Two things:

  1. We don't actually own the development of HPSSACLI anymore. That is from Microsemi. And
  2. I have been asking for JSON output since we started working here on libstoragemgmt in July of 2015. To say that I'm frustrated that I still don't have it is an understatement. :(

@cathay4t
Copy link
Contributor

@BlaineEXE I fixed the parser. Please test this patch instead cathay4t@a9a72eb

@BlaineEXE
Copy link
Author

BlaineEXE commented Sep 22, 2016

@cathay4t, the patch you linked will fix only the case where a property is the very last item in HPSSACLI output (EOF). Although this is also an issue, it doesn't resolve the issue of properties being missed when they are alone or in at the end of a 'section' in the middle of HPSSACLI output.

In my examples in the comment above, I simplified the output by copying only one of the sections.

This is the full output:

[root@bg-4520-1 hpsa]# hpssacli ctrl all show status

Smart HBA H244br in Slot 0 (Embedded) (RAID Mode)
   Controller Status: OK

Smart HBA H240 in Slot 1 (HBA Mode)
   Controller Status: OK

Smart HBA H241 in Slot 2 (HBA Mode)
   Controller Status: OK

@BlaineEXE
Copy link
Author

BlaineEXE commented Sep 22, 2016

The HPSSACLI parsing code has technical debt. It needs to be overhauled. Coding the effort might take a few days, but to adequately test that the changes work on all configurations and don't introduce bugs is going to extend the effort to 2-3 weeks. Any patch we can generate now on the current code to fix issues (a) and (b) is going to be sufficiently complex that the fix will also add undue risk of introducing bugs, and it would be advisable to run the same 1-2 week test for the hotfix that would be done for the overhaul.

The fix I've proposed is the least likely to introduce new bugs and fixes the only known occurrence of (b) while also fixing occurrences of (a) for controller battery status and cache status should they appear. (a) does not affect parsing of hpssacli ctrl all show config detail for other resourcese unless HPSSACLI's output is reordered; because of how HPSSACLI is updated and maintained, the chances of this are nearly 0%.

@cathay4t
Copy link
Contributor

OK. Merged with issue #214 for future tracking.

@cathay4t cathay4t merged commit 58d9ab2 into libstorage:master Sep 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants