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

feat: Implement firmware version check #16

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

e0ne
Copy link
Collaborator

@e0ne e0ne commented Sep 22, 2024

No description provided.

@coveralls
Copy link

coveralls commented Sep 22, 2024

Pull Request Test Coverage Report for Build 11104100618

Details

  • 36 of 112 (32.14%) changed or added relevant lines in 7 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.8%) to 59.195%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/host/host.go 0 3 0.0%
pkg/host/mocks/HostManager.go 16 21 76.19%
pkg/host/utils.go 0 7 0.0%
internal/controller/devicediscovery_controller.go 17 25 68.0%
cmd/nic-configuration-daemon/main.go 0 10 0.0%
pkg/host/mocks/HostUtils.go 0 21 0.0%
pkg/helper/helper.go 3 25 12.0%
Totals Coverage Status
Change from base Build 11008522688: -0.8%
Covered Lines: 1677
Relevant Lines: 2833

💛 - Coveralls

@e0ne e0ne force-pushed the fw-mismatch branch 3 times, most recently from e7ad82e to 5774509 Compare September 23, 2024 06:49
func setFwConfigConditionsForDevice(device *v1alpha1.NicDevice) {
currentFirmware := helper.NicFirmwareMap[device.Status.FirmwareVersion]
recommendedFirmware := helper.NicFirmwareMap[device.Status.Type]
if currentFirmware == recommendedFirmware {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@adrianchiris do we need to have '>=' here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @e0ne following our discussion,

we should try to get mofed version from the system then check against recommended firmware version for the specific mofed version.

how we get the set of firmware versions recommended for a mofed version should be queriable from mofed scripts or config map if we have no choice.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

until mofed scripts implement this feature, let's use configmap

@e0ne e0ne force-pushed the fw-mismatch branch 3 times, most recently from f1d6e06 to d8bd72d Compare September 24, 2024 10:20
return nil
}

func GetFwVersion(deviceId, ofed string) string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we want to add some sanity checks here? What will happen if the ConfigMap has invalid format?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

since configmap is deployed by the operator, it will be updated with a correct format during the next reconcile loop, so I don't think we need to handle a case when user updates it manually with an incorrect data

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree that we can ignore invalid updates from users, but should we panic in this case? I would prefer to log an error and return an empty string here. I think if len(fw) != 3 { return "" } will increase robustness of the code for free.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it makes sense, I'll update my pr

return nil
}

func GetFwVersion(deviceId, ofed string) string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's rename it to GetRecommendedFwVersion

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Nvidia_mlx5_ConnectX-6_Dx: "101d 24.07-0.6.1 22.42.1000"
Nvidia_mlx5_ConnectX-6_Lx: "101f 24.07-0.6.1 26.42.1000"
Nvidia_mlx5_ConnectX-7: "1021 24.07-0.6.1 28.42.1000"
Nvidia_mlx5_MT42822_BlueField-2_integrated_ConnectX-6_Dx: "a2d6 24.07-0.6.1 24.42.1000"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we also want to deploy this cfg map with make deploy?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we do:)

Copy link
Collaborator

@ykulazhenkov ykulazhenkov left a comment

Choose a reason for hiding this comment

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

LGTM

@almaslennikov almaslennikov merged commit 0463dbc into Mellanox:main Oct 1, 2024
8 checks passed
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.

5 participants