Skip to content

Commit

Permalink
*: code format
Browse files Browse the repository at this point in the history
Signed-off-by: BornChanger <[email protected]>
  • Loading branch information
BornChanger committed Nov 15, 2023
1 parent 7244af5 commit b958787
Show file tree
Hide file tree
Showing 2 changed files with 272 additions and 4 deletions.
8 changes: 4 additions & 4 deletions br/pkg/aws/ebs.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ func (e *EC2Session) WaitVolumesCreated(volumeIDMap map[string]string, progress
return 0, errors.Trace(err)
}

err, createdVolumeSize, unfinishedVolumes := e.HandleDescribeVolumesResponse(resp, fsrEnabledRequired)
createdVolumeSize, unfinishedVolumes, err := e.HandleDescribeVolumesResponse(resp, fsrEnabledRequired)
if err != nil {
return 0, errors.Trace(err)
}
Expand Down Expand Up @@ -625,15 +625,15 @@ func ec2Tag(key, val string) *ec2.Tag {
return &ec2.Tag{Key: &key, Value: &val}
}

func (e *EC2Session) HandleDescribeVolumesResponse(resp *ec2.DescribeVolumesOutput, fsrEnabledRequired bool) (error, int64, []*string) {
func (e *EC2Session) HandleDescribeVolumesResponse(resp *ec2.DescribeVolumesOutput, fsrEnabledRequired bool) (int64, []*string, error) {
totalVolumeSize := int64(0)

var unfinishedVolumes []*string
for _, volume := range resp.Volumes {
if *volume.State == ec2.VolumeStateAvailable {
if fsrEnabledRequired && !*volume.FastRestored {
log.Error("snapshot fsr is not enabled for the volume", zap.String("volume", *volume.SnapshotId))
return errors.Errorf("Snapshot [%s] of volume [%s] is not fsr enabled", *volume.SnapshotId, *volume.VolumeId), 0, nil
return 0, nil, errors.Errorf("Snapshot [%s] of volume [%s] is not fsr enabled", *volume.SnapshotId, *volume.VolumeId)
}
log.Info("volume is available", zap.String("id", *volume.VolumeId))
totalVolumeSize += *volume.Size
Expand All @@ -643,5 +643,5 @@ func (e *EC2Session) HandleDescribeVolumesResponse(resp *ec2.DescribeVolumesOutp
}
}

return nil, totalVolumeSize, unfinishedVolumes
return totalVolumeSize, unfinishedVolumes, nil
}
Loading

0 comments on commit b958787

Please sign in to comment.