Skip to content
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

Merged
merged 8 commits into from
Oct 20, 2022

Conversation

splaspood
Copy link
Contributor

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

  • StorageController extended to support RAID controller specific bits
  • actions.CreateVirtualDisk and actions.DestroyVirtualDisk interfaces

utils/mvcli.go Fixed Show fixed Hide fixed
utils/mvcli.go Fixed Show fixed Hide fixed
utils/mvcli.go Fixed Show fixed Hide fixed
@joelrebel
Copy link
Member

@splaspood if you rebase this branch on main, the linting should go through.

Copy link
Member

@joelrebel joelrebel left a 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 {
Copy link
Member

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) {

}

utils/mvcli.go Show resolved Hide resolved
actions/inventory.go Outdated Show resolved Hide resolved
actions/inventory.go Outdated Show resolved Hide resolved
actions/inventory.go Outdated Show resolved Hide resolved
utils/lshw.go Outdated Show resolved Hide resolved
utils/mvcli.go Outdated Show resolved Hide resolved
utils/misc.go Outdated Show resolved Hide resolved
utils/misc.go Outdated Show resolved Hide resolved
utils/mvcli.go Outdated Show resolved Hide resolved
* 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
Copy link
Member

@joelrebel joelrebel left a 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!

@splaspood splaspood merged commit eea2867 into main Oct 20, 2022
@splaspood splaspood deleted the raid-controller-0 branch October 20, 2022 12:28
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