feat(storcli2): logical volume create and delete#69
Conversation
185c909 to
b218449
Compare
e5ba890 to
063bd83
Compare
|
063bd83 to
7de356c
Compare
|
Move ReadCacheToken/WriteCacheToken into pkg/implementation/storcli2 so both the cache setter (lvcachesetter) and the upcoming create path (logicalvolumemanager) share one source of truth for the policy→CLI-token mapping, instead of each emitting its own (and the create path leaking the domain enum's string representation as the token). The mapping fails closed on any unmappable policy via an exhaustive switch default. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7de356c to
ddc8be4
Compare
|
ddc8be4 to
13d1232
Compare
|
1 issue found:
Looks good otherwise: error handling follows the Review by Claude Code |
|
Implement the create/delete part of ports.LogicalVolumesManager on the storcli2/perccli2 logical-volume manager: - CreateLV fills the request drives through the physical-drive getter, validates the RAID creation, formats a single-enclosure "drives=e:s,..." list (rejecting multi-enclosure requests), issues "add vd" with the bare RAID-level and cache tokens, and rediscovers the new volume by its physical-drive set. - DeleteLV issues "/cx/vx delete" and surfaces the in-JSON failure payload. The manager now also takes a PhysicalDrivesGetter; command verbs follow the storcli2 command map documented in DESIGN.md. Issue: ARTESCA-17647
The decomposed storcli2 adapters store the injected commandrunner as an unexported `runner` field; reviews kept flagging the exported type-name form (StorCLI2/SSACLI). Document it next to the package-layout principle so future adapters follow it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
e2a38b2 to
cae6f00
Compare
Complete ports.LogicalVolumesManager on the storcli2/perccli2 manager:
- AddPDsToLV grows a volume through "expand drives=e:s,..." (online capacity
expansion). storcli2 dropped "start migrate", so expansion is the only
supported growth path; the firmware preserves the RAID level. Drives
spanning multiple enclosures are rejected.
- DeletePDsFromLV returns ErrFunctionNotSupportedByImplementation: the
storcli-to-storcli2 command map drops "start migrate" with no replacement
for removing drives from a volume (see DESIGN.md).
Replace the stale plain-text migrate/fail.json fixture (captured with the
v1 grammar that storcli2 rejects) with proper expand/{success,fail}.json
fixtures, and update the collection script and testdata README accordingly.
Issue: ARTESCA-17648
revive's unused-receiver rule flagged the named 's' receiver, which the not-supported stub never references. Issue: ARTESCA-17648
|
Implement ports.Blinker on the storcli2/perccli2 adapter: - StartBlink / StopBlink issue "/cx/ex/sx start locate" / "stop locate" (same grammar as storcli), choosing the enclosure or no-enclosure selector form from the drive's parsed slot, and surface the in-JSON failure payload via storcli2.Decode. A single implementation serves both binaries; the runner is injected. Issue: ARTESCA-17650
feat(storcli2): physical drive blinker
…mbership feat(storcli2): logical volume drive add (expand) and remove
| runner commandrunner.CommandRunner | ||
| } | ||
|
|
||
| var _ ports.LogicalVolumesManager = &StorCLI2{} |
There was a problem hiding this comment.
The ports.LogicalVolumesManager interface does not embed PhysicalDrivesGetter or LogicalVolumesGetter, so the compile-time assertion on this line only checks the four manager methods. But the struct embeds both getter interfaces, which means it also satisfies PhysicalDrivesGetter and LogicalVolumesGetter — and its PhysicalDrives method (from the embedded getter) is callable by external callers even though it's not part of the manager's contract.
This is consistent with how SSACLI and MDADM do it in the same package, so it's not a regression — just noting that the embedded getter interfaces leak as public API. If that's intentional (e.g. a composite RAIDController wires these together), it's fine.
— Claude Code
| // storcli2ControllerSelector addresses a whole controller (used by "add vd"). | ||
| storcli2ControllerSelector = "/c%d" | ||
| // storcli2VolumeSelector addresses a single virtual drive by its number. | ||
| storcli2VolumeSelector = "/c%d/v%s" |
There was a problem hiding this comment.
storcli2VolumeSelector is defined identically in both this file and lvcachesetter/storcli2.go (line 18). Consider moving it to the shared storcli2 package alongside Decode and the cache-token helpers, since it's a common storcli2 addressing convention reused across adapters.
— Claude Code
|
LGTM — clean implementation. Two minor observations posted as inline comments:
Error handling is thorough (all paths wrapped with context), test coverage is solid across create/delete/expand/unsupported-ops, cache-token extraction was cleanly refactored into the shared Review by Claude Code |
Summary
Implements the create/delete part of
ports.LogicalVolumesManageron the storcli2/perccli2 logical-volume manager (ARTESCA-17647).CreateLV— fills the request drives through the physical-drive getter, validates the RAID creation, formats a single-enclosuredrives=e:s,...list (rejecting multi-enclosure requests), issuesadd vdwith the bare RAID-level and cache tokens, and rediscovers the new volume by its physical-drive set.DeleteLV— issues/cx/vx deleteand surfaces the in-JSON failure payload.PhysicalDrivesGetter; command verbs follow the storcli2 command map documented inDESIGN.md.Testing
go build,go vet,gofmt, and the package test suite pass. New tests cover the create happy path, command-failure, multi-enclosure rejection, and a table-driven delete (success / invalid VD / nonexistent VD).Issue: ARTESCA-17647
🤖 Generated with Claude Code