Skip to content

feat(storcli2): cache options setter and JBOD setters#71

Open
g-carre wants to merge 2 commits into
mainfrom
improvement/storcli2-cache-jbod-setter
Open

feat(storcli2): cache options setter and JBOD setters#71
g-carre wants to merge 2 commits into
mainfrom
improvement/storcli2-cache-jbod-setter

Conversation

@g-carre

@g-carre g-carre commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Write path of the storcli2/perccli2 adapter (ARTESCA-17649): the logical-volume cache setter and the per-drive JBOD setters.

  • SetLVCacheOptions — reads the current state through the logical-volume getter and emits only the policies that changed, as two independent set rdcache= / set wrcache= commands (storcli2 rejects the combined syntax and dropped the IO policy).
  • EnableJBOD / DisableJBOD/cx/ex/sx set jbod and set uconf, surfacing the in-JSON failure payload.
  • Minor storcli2 envelope adjustment to support the setter error paths.

Testing

go build, go vet, gofmt, and the package test suite pass. Tests cover the only-changed-flag behavior (rdcache-only / wrcache-only / both / none), getter-error and command-error paths, and the JBOD enable/disable paths.

JBOD …/success.json fixtures still need a hardware capture via collect_storcli2_testdata.sh (noted in the ticket); the failure paths are covered.

Issue: ARTESCA-17649

🤖 Generated with Claude Code

g-carre and others added 2 commits June 16, 2026 17:05
Implement the storcli2/perccli2 write path for ARTESCA-17649:

- SetLVCacheOptions on the logicalvolumemanager StorCLI2: diffs current vs
  desired and emits only the changed rdcache/wrcache flags as separate "set"
  commands (storcli2 rejects the combined syntax and dropped the IO policy).
- EnableJBOD / DisableJBOD on the physicaldrivegetter StorCLI2 via
  "set jbod" / "set uconf" (storcli's "delete jbod" no longer parses).

Both surface in-JSON failures through storcli2.Decode regardless of exit code.
Widen the shared envelope's DetailedStatus.ErrCd to "any": storcli2 reports it
as an int on failure and the string "-" on success, mirroring PID/VD.

Issue: ARTESCA-17649

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@g-carre g-carre requested a review from a team as a code owner June 25, 2026 09:26
return errors.Wrapf(err, "failed to get logical volume %s", metadata.ID)
}

options, err := storcli2CacheOptions(current.CacheOptions, desired)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

current.CacheOptions is a pointer field on LogicalVolume. If the getter ever returns a volume without cache metadata (e.g. a volume type that doesn't support caching), this will nil-pointer panic. A guard before the call would make the setter robust against upstream getter changes.

Suggested change
options, err := storcli2CacheOptions(current.CacheOptions, desired)
if current.CacheOptions == nil {
return errors.Errorf("logical volume %s has no cache options", metadata.ID)
}
options, err := storcli2CacheOptions(current.CacheOptions, desired)

— Claude Code

// LogicalVolumesGetter so setters only emit the flags that actually change.
type StorCLI2 struct {
ports.LogicalVolumesGetter

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The exported field StorCLI2 shadows the struct type name, which makes usage sites (e.g. s.StorCLI2.Run(...)) ambiguous to read. The existing physicaldrivegetter.StorCLI2 uses an unexported runner field for the same role — matching that convention would be more consistent and keep the command runner out of the public API surface.

Suggested change
runner commandrunner.CommandRunner

— Claude Code

@claude

claude Bot commented Jun 25, 2026

Copy link
Copy Markdown
  • logicalvolumemanager/storcli2.go:63 — current.CacheOptions (pointer) is passed to storcli2CacheOptions without a nil guard; a nil-returning getter would cause a panic
    - logicalvolumemanager/storcli2.go:31 — exported field StorCLI2 shadows the struct type name; physicaldrivegetter uses unexported runner for the same role

    Overall: clean implementation with good test coverage and proper error wrapping. The envelope.go ErrCd change from int to any is correct — storcli2 returns "-" on success which would break int unmarshalling. The delta-only cache-set approach (only emitting changed flags) is well-designed and well-tested.

    Review by Claude Code

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.

1 participant