Skip to content

Commit

Permalink
remove iopspergb mandatory constraint on io1 volume
Browse files Browse the repository at this point in the history
  • Loading branch information
surian committed May 4, 2023
1 parent b57d85d commit b3f6c6c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 45 deletions.
6 changes: 0 additions & 6 deletions pkg/driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,6 @@ func (d *controllerService) CreateVolume(ctx context.Context, req *csi.CreateVol
}
}

if volumeType == cloud.VolumeTypeIO1 {
if iopsPerGB == 0 {
return nil, status.Errorf(codes.InvalidArgument, "The parameter IOPSPerGB must be specified for io1 volumes")
}
}

if blockExpress && volumeType != cloud.VolumeTypeIO2 {
return nil, status.Errorf(codes.InvalidArgument, "Block Express is only supported on io2 volumes")
}
Expand Down
39 changes: 0 additions & 39 deletions pkg/driver/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1521,45 +1521,6 @@ func TestCreateVolume(t *testing.T) {
checkExpectedErrorCode(t, err, codes.Aborted)
},
},
{
name: "fail with missing iopsPerGB parameter",
testFunc: func(t *testing.T) {
req := &csi.CreateVolumeRequest{
Name: "vol-test",
CapacityRange: stdCapRange,
VolumeCapabilities: stdVolCap,
Parameters: map[string]string{
VolumeTypeKey: cloud.VolumeTypeIO1,
},
}

ctx := context.Background()

mockCtl := gomock.NewController(t)
defer mockCtl.Finish()

mockCloud := cloud.NewMockCloud(mockCtl)

awsDriver := controllerService{
cloud: mockCloud,
inFlight: internal.NewInFlight(),
driverOptions: &DriverOptions{},
}

_, err := awsDriver.CreateVolume(ctx, req)
if err == nil {
t.Fatalf("Expected CreateVolume to fail but got no error")
}

srvErr, ok := status.FromError(err)
if !ok {
t.Fatalf("Could not get error status code from error: %v", srvErr)
}
if srvErr.Code() != codes.InvalidArgument {
t.Fatalf("Expect InvalidArgument but got: %s", srvErr.Code())
}
},
},
{
name: "Fail with IdempotentParameterMismatch error",
testFunc: func(t *testing.T) {
Expand Down

0 comments on commit b3f6c6c

Please sign in to comment.