Skip to content

Commit

Permalink
Merge pull request #53 from e0ne/fw-m-update
Browse files Browse the repository at this point in the history
fix: Fix FirmwareConfigMatchCondition condition update
  • Loading branch information
e0ne authored Nov 19, 2024
2 parents b676b51 + c70ba71 commit cd96e21
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 18 deletions.
2 changes: 1 addition & 1 deletion config/configmap/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ data:
Nvidia_mlx5_MT42822_BlueField-2_integrated_ConnectX-6_Dx-24.07: "a2d6 24.07-0.6.1 24.42.1000"
Nvidia_mlx5_ConnectX-4-24.10: "1013 24.10-0.7.0 12.28.2006"
Nvidia_mlx5_ConnectX-4_Lx-24.10: "1013 24.10-0.7.0 14.32.1010"
Nvidia_mlx5_ConnectX-5-24.10: "1017 24.10-0.7.0.35.4030"
Nvidia_mlx5_ConnectX-5-24.10: "1017 24.10-0.7.0 16.35.4030"
Nvidia_mlx5_ConnectX-5_Ex-24.10: "1019 24.10-0.7.0 16.35.4030"
Nvidia_mlx5_ConnectX-6-24.10: "101b 24.10-0.7.0 20.43.1014"
Nvidia_mlx5_ConnectX-6_Dx-24.10: "101d 24.10-0.7.0 22.43.1014"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@ kind: ConfigMap
metadata:
name: supported-nic-firmware
data:
Nvidia_mlx5_ConnectX-4: "1013 24.07-0.6.1 12.28.2006"
Nvidia_mlx5_ConnectX-5: "1017 24.07-0.6.1 16.35.4030"
Nvidia_mlx5_ConnectX-5_Ex: "1019 24.07-0.6.1 16.35.4030"
Nvidia_mlx5_ConnectX-6: "101b 24.07-0.6.1 20.42.1000"
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"
Nvidia_mlx5_ConnectX-4-24.07: "1013 24.07-0.6.1 12.28.2006"
Nvidia_mlx5_ConnectX-5-24.07: "1017 24.07-0.6.1 16.35.4030"
Nvidia_mlx5_ConnectX-5_Ex-24.07: "1019 24.07-0.6.1 16.35.4030"
Nvidia_mlx5_ConnectX-6-24.07: "101b 24.07-0.6.1 20.42.1000"
Nvidia_mlx5_ConnectX-6_Dx-24.07: "101d 24.07-0.6.1 22.42.1000"
Nvidia_mlx5_ConnectX-6_Lx-24.07: "101f 24.07-0.6.1 26.42.1000"
Nvidia_mlx5_ConnectX-7-24.07: "1021 24.07-0.6.1 28.42.1000"
Nvidia_mlx5_MT42822_BlueField-2_integrated_ConnectX-6_Dx-24.07: "a2d6 24.07-0.6.1 24.42.1000"
Nvidia_mlx5_ConnectX-4-24.10: "1013 24.10-0.7.0 12.28.2006"
Nvidia_mlx5_ConnectX-4_Lx-24.10: "1013 24.10-0.7.0 14.32.1010"
Nvidia_mlx5_ConnectX-5-24.10: "1017 24.10-0.7.0 16.35.4030"
Nvidia_mlx5_ConnectX-5_Ex-24.10: "1019 24.10-0.7.0 16.35.4030"
Nvidia_mlx5_ConnectX-6-24.10: "101b 24.10-0.7.0 20.43.1014"
Nvidia_mlx5_ConnectX-6_Dx-24.10: "101d 24.10-0.7.0 22.43.1014"
Nvidia_mlx5_ConnectX-6_Lx-24.10: "101f 24.10-0.7.0 26.43.1014"
Nvidia_mlx5_ConnectX-7-24.10: "1021 24.10-0.7.0 28.43.1014"
Nvidia_mlx5_MT42822_BlueField-2_integrated_ConnectX-6_Dx-24.10: "a2d6 24.10-0.7.0 22.43.1014"
23 changes: 15 additions & 8 deletions internal/controller/devicediscovery_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,21 @@ func setFwConfigConditionsForDevice(device *v1alpha1.NicDevice, recommendedFirmw
switch recommendedFirmware {
case currentFirmware:
condition = metav1.Condition{
Type: consts.FimwareConfigMatchCondition,
Type: consts.FirmwareConfigMatchCondition,
Status: metav1.ConditionTrue,
Reason: consts.DeviceFwMatchReason,
Message: fmt.Sprintf("Device firmware '%s' matches to recommended version '%s'", currentFirmware, recommendedFirmware),
}
case "":
condition = metav1.Condition{
Type: consts.FimwareConfigMatchCondition,
Type: consts.FirmwareConfigMatchCondition,
Status: metav1.ConditionUnknown,
Reason: consts.DeviceFwMatchReason,
Message: "Can't get OFED version to check recommended firmware version",
}
default:
condition = metav1.Condition{
Type: consts.FimwareConfigMatchCondition,
Type: consts.FirmwareConfigMatchCondition,
Status: metav1.ConditionFalse,
Reason: consts.DeviceFwMismatchReason,
Message: fmt.Sprintf("Device firmware '%s' doesn't match to recommended version '%s'", currentFirmware, recommendedFirmware),
Expand Down Expand Up @@ -137,7 +137,13 @@ func (d *DeviceDiscovery) reconcile(ctx context.Context) error {
continue
}

d.updateFwCondition(nicDeviceCR)
d.updateFwCondition(&nicDeviceCR)
log.Log.V(2).Info("updated device", "nicDeviceCR", nicDeviceCR)
err = d.Client.Status().Update(ctx, &nicDeviceCR)
if err != nil {
log.Log.Error(err, "failed to update FirmwareConfigMatchCondition", "device", nicDeviceCR.Name)
continue
}

// Need to nullify conditions for deep equal
observedDeviceStatus.Conditions = nicDeviceCR.Status.Conditions
Expand Down Expand Up @@ -194,20 +200,21 @@ func (d *DeviceDiscovery) reconcile(ctx context.Context) error {
device.Status.Node = d.nodeName
setInitialsConditionsForDevice(device)

d.updateFwCondition(*device)
d.updateFwCondition(device)
log.Log.V(2).Info("updated device", "device", device)
err = d.Client.Status().Update(ctx, device)
if err != nil {
log.Log.Error(err, "failed to update FimwareConfigMatchCondition", "device", device.Name)
log.Log.Error(err, "failed to update FirmwareConfigMatchCondition", "device", device.Name)
continue
}
}
return nil
}

func (d *DeviceDiscovery) updateFwCondition(nicDeviceCR v1alpha1.NicDevice) {
func (d *DeviceDiscovery) updateFwCondition(nicDeviceCR *v1alpha1.NicDevice) {
ofedVersion := d.hostManager.DiscoverOfedVersion()
recommendedFirmware := helper.GetRecommendedFwVersion(nicDeviceCR.Status.Type, ofedVersion)
setFwConfigConditionsForDevice(&nicDeviceCR, recommendedFirmware)
setFwConfigConditionsForDevice(nicDeviceCR, recommendedFirmware)
}

// Start starts the device discovery process by reconciling devices on the host.
Expand Down
2 changes: 1 addition & 1 deletion pkg/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const (
Infiniband = "Infiniband"

ConfigUpdateInProgressCondition = "ConfigUpdateInProgress"
FimwareConfigMatchCondition = "FirmwareConfigMatch"
FirmwareConfigMatchCondition = "FirmwareConfigMatch"
IncorrectSpecReason = "IncorrectSpec"
UpdateStartedReason = "UpdateStarted"
PendingRebootReason = "PendingReboot"
Expand Down

0 comments on commit cd96e21

Please sign in to comment.