feat(storcli2): cache options setter and JBOD setters#71
Conversation
|
|
LGTM — the changes are correct and safe. |
d242702 to
185c909
Compare
| "Disable JBOD on e${FIRST_ENCLOSURE}/s${FIRST_SLOT} (expected failure - drive in VD)" \ | ||
| "${OUTPUT_DIR}/physicaldrivegetter/testdata/storcli2/jbod/disable/fail.json" \ | ||
| "${OUTPUT_DIR}/jbodsetter/testdata/storcli2/jbod/disable/fail.json" \ | ||
| "${C}/e${FIRST_ENCLOSURE}/s${FIRST_SLOT}" delete jbod |
There was a problem hiding this comment.
The adapter's DisableJBOD now runs set uconf (storcli2UConfOption), but this capture command still runs delete jbod (the old storcli v1 syntax). The comments on the preceding lines also reference the old API (adapter.setJBOD(metadata, "delete")). When someone regenerates fixtures with this script, the disable fixture will capture the wrong command's output.
| "${C}/e${FIRST_ENCLOSURE}/s${FIRST_SLOT}" delete jbod | |
| "${C}/e${FIRST_ENCLOSURE}/s${FIRST_SLOT}" set uconf |
The comments above (lines 338-340) should also be updated to match, e.g.:
# Command: storcli2 /c0/e306/s0 set uconf J
# Used by: adapter.DisableJBOD(metadata) → runner.Run(["/c0/e306/s0", "set", "uconf"])
— Claude Code
| | `physicaldrivegetter` | `testdata/storcli2/show/e306s99_invalid.json` | drive not found | safe | | ||
| | `physicaldrivegetter` | `testdata/storcli2/show/e320s11_UGood.json` | drive in unconfigured-good state | destructive | | ||
| | `physicaldrivegetter` | `testdata/storcli2/jbod/{enable,disable}/fail.json` | `set jbod` / `delete jbod` | destructive | | ||
| | `jbodsetter` | `testdata/storcli2/jbod/{enable,disable}/fail.json` | `set jbod` / `delete jbod` | destructive | |
There was a problem hiding this comment.
The command column still says delete jbod for the disable fixture, but the adapter now uses set uconf.
| | `jbodsetter` | `testdata/storcli2/jbod/{enable,disable}/fail.json` | `set jbod` / `delete jbod` | destructive | | |
| | `jbodsetter` | `testdata/storcli2/jbod/{enable,disable}/fail.json` | `set jbod` / `set uconf` | destructive | |
— Claude Code
|
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>
Relocate the storcli2 JBOD setter and LV cache setter into their own packages named after their RAIDController port interfaces (jbodsetter, lvcachesetter), instead of folding them into physicaldrivegetter and logicalvolumemanager. This matches the decomposed one-package-per-port pattern already used by the getters and blinker, and makes each setter self-contained. Also document the conventions so future work follows suit: - CLAUDE.md: package layout mirrors the ports. - DESIGN.md: per-port packages; adapter token mapping expresses the per-controller settable subset (fails closed on new enum values); read-before-write emits only changed flags. - tests/testdata-tools: repoint fixture paths to the new packages. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
185c909 to
b218449
Compare
| type StorCLI2 struct { | ||
| ports.LogicalVolumesGetter | ||
|
|
||
| StorCLI2 commandrunner.CommandRunner |
There was a problem hiding this comment.
The field StorCLI2 commandrunner.CommandRunner shadows the struct type name StorCLI2. This makes s.StorCLI2 on line 115 read as if the struct is referencing itself. The sibling adapters (jbodsetter, physicaldrivegetter) name this field runner, which is clearer.
| StorCLI2 commandrunner.CommandRunner | |
| runner commandrunner.CommandRunner |
— Claude Code
| return errors.Wrapf(err, "failed to get logical volume %s", metadata.ID) | ||
| } | ||
|
|
||
| options, err := storcli2CacheOptions(current.CacheOptions, desired) |
There was a problem hiding this comment.
current.CacheOptions is a pointer (*CacheOptions) and will be nil if the getter returns a LogicalVolume without cache options populated — dereferencing it inside storcli2CacheOptions (lines 91, 100) would panic. The storcli2 getter currently always populates it, but since the getter is injected via the port interface, a nil guard here would be safer.
— Claude Code
| "Disable JBOD on e${FIRST_ENCLOSURE}/s${FIRST_SLOT} (expected failure - drive in VD)" \ | ||
| "${OUTPUT_DIR}/physicaldrivegetter/testdata/storcli2/jbod/disable/fail.json" \ | ||
| "${OUTPUT_DIR}/jbodsetter/testdata/storcli2/jbod/disable/fail.json" \ | ||
| "${C}/e${FIRST_ENCLOSURE}/s${FIRST_SLOT}" delete jbod |
There was a problem hiding this comment.
The capture command still uses the v1 delete jbod syntax, and the comment references the old setJBOD(metadata, "delete") API. The adapter now uses set uconf (storcli2UConfOption). When someone regenerates fixtures with this script, they will capture the output of the wrong command.
| "${C}/e${FIRST_ENCLOSURE}/s${FIRST_SLOT}" delete jbod | |
| "${C}/e${FIRST_ENCLOSURE}/s${FIRST_SLOT}" set uconf |
Lines 338-340 comments should also be updated to reference set uconf instead of delete jbod.
— Claude Code
|
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 independentset rdcache=/set wrcache=commands (storcli2 rejects the combined syntax and dropped the IO policy).EnableJBOD/DisableJBOD—/cx/ex/sx set jbodandset uconf, surfacing the in-JSON failure payload.storcli2envelope 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.Issue: ARTESCA-17649
🤖 Generated with Claude Code