Skip to content

Commit a010950

Browse files
authored
[cinder-csi-plugin] Fix ControllerGetVolume multi-cloud iteration bug (#3121)
In ControllerGetVolume, when multiple clouds are configured, the loop iterates over all clouds without breaking on success. If the volume is found in an earlier cloud but a subsequent cloud returns NotFound, the err variable is overwritten and the function erroneously returns NotFound despite having already located the volume. Add a break statement after a successful GetVolume call to stop iterating once the volume is found. Signed-off-by: Walter Boring <waboring@hemna.com>
1 parent 46c2161 commit a010950

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

pkg/csi/cinder/controllerserver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,7 @@ func (cs *controllerServer) ControllerGetVolume(ctx context.Context, req *csi.Co
952952
}
953953
return nil, status.Errorf(codes.Internal, "ControllerGetVolume failed with error %v", err)
954954
}
955+
break
955956
}
956957
if err != nil {
957958
return nil, status.Errorf(codes.NotFound, "Volume %s not found", volumeID)

0 commit comments

Comments
 (0)