Skip to content

Commit ae27218

Browse files
robinschneiderDuciwuci
authored andcommitted
add missing context, fix volume
1 parent d693759 commit ae27218

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
@@ -120,8 +120,8 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
120120
return nil, status.Error(codes.AlreadyExists, "Volume Already exists with same name and different capacity")
121121
}
122122

123-
if volumes[0].Status != openstack.VolumeAvailableStatus {
124-
return nil, status.Error(codes.Internal, fmt.Sprintf("Volume %s is not in available state", volumes[0].ID))
123+
if vols[0].Status != openstack.VolumeAvailableStatus {
124+
return nil, status.Error(codes.Internal, fmt.Sprintf("Volume %s is not in available state", vols[0].ID))
125125
}
126126
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)
127127
accessibleTopology := getTopology(&vols[0], accessibleTopologyReq, cs.Driver.withTopology, ignoreVolumeAZ)
@@ -259,7 +259,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
259259
}
260260

261261
targetStatus := []string{openstack.VolumeAvailableStatus}
262-
err = cloud.WaitVolumeTargetStatusWithCustomBackoff(vol.ID, targetStatus,
262+
err = cloud.WaitVolumeTargetStatusWithCustomBackoff(ctx, vol.ID, targetStatus,
263263
&wait.Backoff{
264264
Duration: 20 * time.Second,
265265
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)