Skip to content

Commit

Permalink
incorporating review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ushabelgur authored and Rohit-0505 committed Oct 3, 2024
1 parent 8fce8ad commit 75c0170
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions poollet/machinepoollet/controllers/machine_controller_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,18 +347,18 @@ func (r *MachineReconciler) getVolumeStatusesForMachine(
iriVolumeStatus, ok = iriVolumeStatusByName[machineVolume.Name]
volumeStatusValues computev1alpha1.VolumeStatus
)
volumeName := computev1alpha1.MachineVolumeName(machine.Name, machineVolume)
if ok {
var err error
volumeStatusValues, err = r.convertIRIVolumeStatus(iriVolumeStatus)
volumeStatusValues, err = r.convertIRIVolumeStatus(iriVolumeStatus, volumeName)
if err != nil {
return nil, fmt.Errorf("[volume %s] %w", machineVolume.Name, err)
}
volumeStatusValues.VolumeRef = corev1.LocalObjectReference{Name: computev1alpha1.MachineVolumeName(machine.Name, machineVolume)}
} else {
volumeStatusValues = computev1alpha1.VolumeStatus{
Name: machineVolume.Name,
State: computev1alpha1.VolumeStatePending,
VolumeRef: corev1.LocalObjectReference{Name: computev1alpha1.MachineVolumeName(machine.Name, machineVolume)},
VolumeRef: corev1.LocalObjectReference{Name: volumeName},
}
}

Expand All @@ -384,16 +384,17 @@ func (r *MachineReconciler) convertIRIVolumeState(iriState iri.VolumeState) (com
return "", fmt.Errorf("unknown iri volume state %v", iriState)
}

func (r *MachineReconciler) convertIRIVolumeStatus(iriVolumeStatus *iri.VolumeStatus) (computev1alpha1.VolumeStatus, error) {
func (r *MachineReconciler) convertIRIVolumeStatus(iriVolumeStatus *iri.VolumeStatus, volumeName string) (computev1alpha1.VolumeStatus, error) {
state, err := r.convertIRIVolumeState(iriVolumeStatus.State)
if err != nil {
return computev1alpha1.VolumeStatus{}, err
}

return computev1alpha1.VolumeStatus{
Name: iriVolumeStatus.Name,
Handle: iriVolumeStatus.Handle,
State: state,
Name: iriVolumeStatus.Name,
Handle: iriVolumeStatus.Handle,
State: state,
VolumeRef: corev1.LocalObjectReference{Name: volumeName},
}, nil
}

Expand Down

0 comments on commit 75c0170

Please sign in to comment.