Skip to content

Commit 14b3feb

Browse files
robinschneiderDuciwuci
authored andcommitted
add missing context, fix volume
1 parent fc357a9 commit 14b3feb

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

pkg/csi/cinder/controllerserver.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
121121
return nil, status.Error(codes.AlreadyExists, "Volume Already exists with same name and different capacity")
122122
}
123123

124-
if volumes[0].Status != openstack.VolumeAvailableStatus {
125-
return nil, status.Error(codes.Internal, fmt.Sprintf("Volume %s is not in available state", volumes[0].ID))
124+
if vols[0].Status != openstack.VolumeAvailableStatus {
125+
return nil, status.Error(codes.Internal, fmt.Sprintf("Volume %s is not in available state", vols[0].ID))
126126
}
127127
klog.V(4).Infof("Volume %s already exists in Availability Zone: %s of size %d GiB", vols[0].ID, vols[0].AvailabilityZone, vols[0].Size)
128128
return getCreateVolumeResponse(&vols[0], nil, ignoreVolumeAZ, req.GetAccessibilityRequirements()), nil
@@ -253,7 +253,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
253253
}
254254

255255
targetStatus := []string{openstack.VolumeAvailableStatus}
256-
err = cloud.WaitVolumeTargetStatusWithCustomBackoff(vol.ID, targetStatus,
256+
err = cloud.WaitVolumeTargetStatusWithCustomBackoff(ctx, vol.ID, targetStatus,
257257
&wait.Backoff{
258258
Duration: 20 * time.Second,
259259
Steps: 5,

pkg/csi/cinder/openstack/openstack.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ type IOpenStack interface {
5555
DetachVolume(ctx context.Context, instanceID, volumeID string) error
5656
WaitDiskDetached(ctx context.Context, instanceID string, volumeID string) error
5757
WaitVolumeTargetStatus(ctx context.Context, volumeID string, tStatus []string) error
58-
WaitVolumeTargetStatusWithCustomBackoff(volumeID string, tStatus []string, backoff *wait.Backoff) error
58+
WaitVolumeTargetStatusWithCustomBackoff(ctx context.Context, volumeID string, tStatus []string, backoff *wait.Backoff) error
5959
GetAttachmentDiskPath(ctx context.Context, instanceID, volumeID string) (string, error)
6060
GetVolume(ctx context.Context, volumeID string) (*volumes.Volume, error)
6161
GetVolumesByName(ctx context.Context, name string) ([]volumes.Volume, error)

pkg/csi/cinder/openstack/openstack_mock.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func (_m *OpenStackMock) WaitVolumeTargetStatus(ctx context.Context, volumeID st
202202
}
203203

204204
// WaitVolumeTargetStatusWithCustomBackoff provides a mock function with given fields: volumeID, tStatus, backoff
205-
func (_m *OpenStackMock) WaitVolumeTargetStatusWithCustomBackoff(volumeID string, tStatus []string, backoff *wait.Backoff) error {
205+
func (_m *OpenStackMock) WaitVolumeTargetStatusWithCustomBackoff(ctx context.Context, volumeID string, tStatus []string, backoff *wait.Backoff) error {
206206
ret := _m.Called(volumeID, tStatus, backoff)
207207

208208
var r0 error

0 commit comments

Comments
 (0)