Skip to content

controllergetter: add storcli2 controller getter#57

Open
ezekiel-alexrod wants to merge 1 commit into
mainfrom
feature/storcli2-controller-getter
Open

controllergetter: add storcli2 controller getter#57
ezekiel-alexrod wants to merge 1 commit into
mainfrom
feature/storcli2-controller-getter

Conversation

@ezekiel-alexrod

@ezekiel-alexrod ezekiel-alexrod commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

What

Implements ports.ControllersGetter for storcli2 / perccli2 (controllergetter/storcli2.go), mirroring the ssacli getter.

How

  • Controllers()show allSystem Overview → resolves each controller via Controller().
  • Controller(meta) builds a RAIDController from three commands:
    • /cN show allName / Serial (Basics)
    • /cN show asoIsJBODSupported
    • /cN show autoconfigIsJBODEnabled
  • One implementation serves both binaries via an injected commandrunner.CommandRunner. Section structs live in the getter file and consume the shared storcli2.Decode + utils.UnmarshalTo*.

JBOD detection

storcli2 dropped storcli1's controller-level Support JBOD / Enable JBOD fields, so JBOD is not read from the controller personality (there is no JBOD personality — Controller Personality reports RAID/eHBA). Verified against a real MegaRAID 9660-16i:

  • IsJBODSupported = a non-expired JBOD Advanced Software Option (the JBOD license), from show aso.
  • IsJBODEnabled = the primary auto-configure behavior exposes new drives as JBOD (JBOD or SecureJBOD), from show 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 the testdata/storcli2/ fixtures (real server captures, including c0_aso.json / c0_autoconfig.json). Cases: controller list, single controller, controller-not-found, and the JBOD capability/state mapping (licensed/expired, JBOD/SecureJBOD active, no license).

make tests / make lint green.

@ezekiel-alexrod ezekiel-alexrod requested a review from a team as a code owner June 8, 2026 12:59
Comment on lines +159 to +160
IsJBODSupported: strings.EqualFold(operations.SupportPersonality, storcli2Yes),
IsJBODEnabled: strings.EqualFold(status.Personality, storcli2JBODPersonality),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@ezekiel-alexrod ezekiel-alexrod force-pushed the feature/storcli2-controller-getter branch from b13bd15 to 315a137 Compare June 9, 2026 16:39
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.

2 participants