Skip to content

Commit

Permalink
feat(middleend): adjust to annotations
Browse files Browse the repository at this point in the history
Signed-off-by: Artsiom Koltun <[email protected]>
  • Loading branch information
artek-koltun committed Aug 30, 2023
1 parent b7e582b commit 5b8621e
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions pkg/middleend/qos.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (s *Server) CreateQosVolume(_ context.Context, in *pb.CreateQosVolumeReques
return volume, nil
}

if err := s.setMaxLimit(in.QosVolume.VolumeNameRef, in.QosVolume.MaxLimit); err != nil {
if err := s.setMaxLimit(in.QosVolume.VolumeNameRef, in.QosVolume.Limits.Max); err != nil {
return nil, err
}

Expand Down Expand Up @@ -129,7 +129,7 @@ func (s *Server) UpdateQosVolume(_ context.Context, in *pb.UpdateQosVolumeReques
return nil, status.Errorf(codes.InvalidArgument, msg)
}
log.Println("Set new max limit values")
if err := s.setMaxLimit(in.QosVolume.VolumeNameRef, in.QosVolume.MaxLimit); err != nil {
if err := s.setMaxLimit(in.QosVolume.VolumeNameRef, in.QosVolume.Limits.Max); err != nil {
return nil, err
}

Expand Down Expand Up @@ -250,35 +250,35 @@ func (s *Server) verifyQosVolume(volume *pb.QosVolume) error {
return err
}

if volume.MinLimit != nil {
if volume.Limits.Min != nil {
return fmt.Errorf("QoS volume min_limit is not supported")
}
if volume.MaxLimit.RdIopsKiops != 0 {
if volume.Limits.Max.RdIopsKiops != 0 {
return fmt.Errorf("QoS volume max_limit rd_iops_kiops is not supported")
}
if volume.MaxLimit.WrIopsKiops != 0 {
if volume.Limits.Max.WrIopsKiops != 0 {
return fmt.Errorf("QoS volume max_limit wr_iops_kiops is not supported")
}

if volume.MaxLimit.RdBandwidthMbs == 0 &&
volume.MaxLimit.WrBandwidthMbs == 0 &&
volume.MaxLimit.RwBandwidthMbs == 0 &&
volume.MaxLimit.RdIopsKiops == 0 &&
volume.MaxLimit.WrIopsKiops == 0 &&
volume.MaxLimit.RwIopsKiops == 0 {
if volume.Limits.Max.RdBandwidthMbs == 0 &&
volume.Limits.Max.WrBandwidthMbs == 0 &&
volume.Limits.Max.RwBandwidthMbs == 0 &&
volume.Limits.Max.RdIopsKiops == 0 &&
volume.Limits.Max.WrIopsKiops == 0 &&
volume.Limits.Max.RwIopsKiops == 0 {
return fmt.Errorf("QoS volume max_limit should set limit")
}

if volume.MaxLimit.RwIopsKiops < 0 {
if volume.Limits.Max.RwIopsKiops < 0 {
return fmt.Errorf("QoS volume max_limit rw_iops_kiops cannot be negative")
}
if volume.MaxLimit.RdBandwidthMbs < 0 {
if volume.Limits.Max.RdBandwidthMbs < 0 {
return fmt.Errorf("QoS volume max_limit rd_bandwidth_mbs cannot be negative")
}
if volume.MaxLimit.WrBandwidthMbs < 0 {
if volume.Limits.Max.WrBandwidthMbs < 0 {
return fmt.Errorf("QoS volume max_limit wr_bandwidth_mbs cannot be negative")
}
if volume.MaxLimit.RwBandwidthMbs < 0 {
if volume.Limits.Max.RwBandwidthMbs < 0 {
return fmt.Errorf("QoS volume max_limit rw_bandwidth_mbs cannot be negative")
}

Expand Down

0 comments on commit 5b8621e

Please sign in to comment.