-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RAID Controller (StorageController) support; Marvell CLI (mvcli) #54
Conversation
@splaspood if you rebase this branch on main, the linting should go through. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work here, looks pretty good overall 🚀
Could you add some examples for vdisk create, delete in https://github.com/metal-toolbox/ironlib/tree/main/examples
I've left a few change suggestions.
ErrCreateVirtualDisk = errors.New("failed to create virtual disk") | ||
) | ||
|
||
func CreateVirtualDiskError(createStdout []byte) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: implement the error interface and expose a single error type that wraps the others. If this seems to increase the number of lines of code instead of reducing it, feel free to ignore the suggestion.
This this can be done as such,
type StorageControllerError{
stdout string
}
// implements the Error interface
func (s *StorageController) Error() string {
return s.stdout
}
// constructor
func newStorageControllerError(stdout string) *StorageControllerError {
return &StorageControllerError{stdout: stdout}
}
It can then be invoked as
if _, ok := validRaidModes[raidMode]; !ok {
errRaidMode := newStorageControllerError(
fmt.Sprintf("InvalidRaidMode %w : %v", ErrInvalidRaidMode, raidMode)
)
return nil, errors.Wrap(errRaidMode, ErrInvalidRaidMode.Error())
}
For end users, it may be easier to deal with one error type that wraps all of the other errors declared above,
// its easier to test for one type of error instead of the various ones above
if errors.Is(err, ErrStorageController) {
}
293fb14
to
ba4f5db
Compare
* fixtures/utils/mvcli: Add fixture data for mvcli * utils/mvcli.go: stringToInt(string, bitSize)
* actions/inventory.go: When a Marvell StorageController is found, call mvcli to augment lshw data * actions/inventory.go: Add mvcli as an additional Drive collector to populate controller attached physical disk data * model/interface.go: Add VirtualDiskCreator, VirtualDiskDestroyer and RaidController interfaces * Update all GetInventory() calls to pass the dynamic bool * actions/dynamic.go,actions/inventory.go: Use dynamic ByVendor() functions to find additional Collector(s)
* utils/lshw.go: Force all regexp to compile * utils/lshw.go: Ensure pciID regex returns a match with len == 2 * fixtures/*: Update fixtures to include PCI Vendor and Product IDs where applicable
* Functions were replaced by slices.Contains()
…r Create/Destroy actions * actions/interface.go: Add VirtualDiskManager interface * actions/interface.go & actions/storage_controller.go: Add VirtualDiskManager VD listing
* go.mod,go.sum: Switch to go 1.18 and include the experimental mod * go.mod,go.sum: upgraded github.com/bmc-toolbox/common v0.0.0-20221018142844-ecac9b89512c
0c35049
to
153c49a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks again for all the work here and squashing the commits!
What does this PR do
Fleshes out RAID controller support, specifically for Marvell RAID controllers.
The HW vendor this change applies to (if applicable)
Marvell
The HW model number, product name this change applies to (if applicable)
Marvell RAID controllers, generally. Specifically the: 88SE9230 PCIe 2.0 x2 4-port SATA 6 Gb/s RAID Controller
The BMC firmware and/or BIOS versions that this change applies to (if applicable)
N/A
What version of tooling - vendor specific or opensource does this change depend on (if applicable)
mvcli (mvcli-4.1.13.31_A01 was used during development testing)
How can this change be tested by a PR reviewer?
Description for changelog/release notes