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

Capability collector #60

Merged
merged 20 commits into from
Nov 1, 2022
Merged

Capability collector #60

merged 20 commits into from
Nov 1, 2022

Conversation

joelrebel
Copy link
Member

What does this PR do

The actions.Collect inventory method now returns drive capabilities.

Based on @psteinbachs work to add hdparm, nvme drive feature collection,
this change set defines and implements the DriveCapabilities() interface.

  • The Device.Common struct was extended to include []*Capabilities that are then
    returned by the hdparm, nvme drive capability collectors.
  • Since Capabilities seemed a more apt name instead of Features the DriveCapability methods in the nvme, hparm were renamed and a []*common.Capability is returned.
  • Context propagation for nvme, hdparm command execution.
  • Lower case methods that are not exported.
  • Tests updated.

This change depends on bmc-toolbox/common#4

This interface defines methods to be implemented by utilities
to collect Drive capabilities.
- Capabilities seemed a more apt name for this and so the methods and
  the types were renamed, the shared Capability type is included in
  bmc-toolbox/common
- DriveFeatures renamed to DriveCapabilities
- The DriveCapabilities methods returns a []*common.Capabilities type
- Pass in context before command execution
- Lower case methods that are not exported
@joelrebel joelrebel added the wip label Oct 27, 2022
psteinbachs
psteinbachs previously approved these changes Oct 27, 2022
Copy link
Contributor

@psteinbachs psteinbachs left a comment

Choose a reason for hiding this comment

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

Looking good, and I agree that capabilities is more apt than features.

psteinbachs
psteinbachs previously approved these changes Oct 27, 2022
Copy link
Contributor

@psteinbachs psteinbachs left a comment

Choose a reason for hiding this comment

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

This also looks good, I had meant to include it.

This is required for the  the dell provider tests
and the actions tests to be able to run mock fake lsblk, nvme, hdparm executor,
we need to come up with a better way than specifying the relative path
to the fixture.
At the moment this code is limited to checking capabilities on SATA and NVME
drives.
This is done, since the lsblk fixture data in fixtures/utils/lsblk/json
corelates to the drives in the Dell fixture - the serial numbers match.

And since the lsblk fixture does not include drives that match
the SMC fixture serials, the capabilities data is removed from the SMC
fixture.
@joelrebel joelrebel force-pushed the capability-collector branch from d5d627d to a70a29a Compare October 28, 2022 13:29
@joelrebel
Copy link
Member Author

The final set of changes are -

  • Update test fixtures to include Protocol information based on lsblk.
  • Invoke DriveCapability collector based on drive Protocol - (sata/nvme).
  • Refactor the vetChanges() method which decides if the data from a newer collector should be merged.
  • Update tests to include drive capabilities data.

@psteinbachs psteinbachs self-requested a review October 28, 2022 13:43
Copy link
Contributor

@psteinbachs psteinbachs left a comment

Choose a reason for hiding this comment

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

The additional updates look solid to me, and vetUpdate() in particular is definitely easier to understand now. Thanks for all this work!

Copy link
Contributor

@splaspood splaspood left a comment

Choose a reason for hiding this comment

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

Nothing jumped out at me as being obviously wrong or bad form. I noticed us hard coding some specific capability names in utils/nvme.go and wonder if maybe that should be moved into something common, but I didn't feel it was something that would hold up approval.

actions/inventory.go Show resolved Hide resolved
@joelrebel joelrebel merged commit 33d9ca3 into main Nov 1, 2022
@joelrebel joelrebel deleted the capability-collector branch November 1, 2022 17:10
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.

3 participants