controllergetter: add storcli2 controller getter#57
Open
ezekiel-alexrod wants to merge 1 commit into
Open
Conversation
Comment on lines
+159
to
+160
| IsJBODSupported: strings.EqualFold(operations.SupportPersonality, storcli2Yes), | ||
| IsJBODEnabled: strings.EqualFold(status.Personality, storcli2JBODPersonality), |
Contributor
There was a problem hiding this comment.
Are you sure it's the right way to check if JBOD is supported ?
Btw I wonder what does it mean "JBODEnabled" on a controller ?
Implement ports.ControllersGetter for storcli2 / perccli2, mirroring the ssacli getter and the megaraid v1 controller parsing. Controllers() lists controllers from the global "show all" System Overview and resolves each one through Controller(), which decodes "/cN show all" into a RAIDController: Name and Serial from Basics, JBOD support from "Supported Controller operations".Support Personality, and JBOD enabled from Status."Controller Personality". A single implementation serves both binaries through the injected commandrunner.CommandRunner interface. Section structs live in the getter file (mirroring mdadm/ssacli) and consume the shared storcli2.Decode helper plus utils.UnmarshalTo* for nested-key lookups.
b13bd15 to
315a137
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements
ports.ControllersGetterfor storcli2 / perccli2 (controllergetter/storcli2.go), mirroring the ssacli getter.How
Controllers()→show all→System Overview→ resolves each controller viaController().Controller(meta)builds aRAIDControllerfrom three commands:/cN show all→Name/Serial(Basics)/cN show aso→IsJBODSupported/cN show autoconfig→IsJBODEnabledcommandrunner.CommandRunner. Section structs live in the getter file and consume the sharedstorcli2.Decode+utils.UnmarshalTo*.JBOD detection
storcli2 dropped storcli1's controller-level
Support JBOD/Enable JBODfields, so JBOD is not read from the controller personality (there is no JBOD personality —Controller PersonalityreportsRAID/eHBA). Verified against a realMegaRAID 9660-16i:IsJBODSupported= a non-expiredJBODAdvanced Software Option (the JBOD license), fromshow aso.IsJBODEnabled= the primary auto-configure behavior exposes new drives as JBOD (JBODorSecureJBOD), fromshow autoconfig.Per-drive JBOD is orthogonal to the controller personality and is surfaced by the physical-drive getter (drive
State == JBOD).Tests
Table-driven
storcli2_test.go, reusing the testify mock runner and thetestdata/storcli2/fixtures (real server captures, includingc0_aso.json/c0_autoconfig.json). Cases: controller list, single controller, controller-not-found, and the JBOD capability/state mapping (licensed/expired,JBOD/SecureJBODactive, no license).make tests/make lintgreen.