Unverified Commit a0acd865 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #58431 from mlmhl/aws_volume_attacher

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. remove duplicated check of device path in aws attacher **What this PR does / why we need it**: The `devicePath` parameter is already validated in this [code](https://github.com/kubernetes/kubernetes/blob/b7100f1ee7231617891a100dd34b3490a1f578e4/pkg/volume/aws_ebs/attacher.go#L158), so no need to check it again in the `for loop` as it won't be modified. This can make the code clearer. **Release note**: ```release-note NONE ``` /sig storage /kind cleanup
parents 3d36e249 edd66c9b
...@@ -168,19 +168,15 @@ func (attacher *awsElasticBlockStoreAttacher) WaitForAttach(spec *volume.Spec, d ...@@ -168,19 +168,15 @@ func (attacher *awsElasticBlockStoreAttacher) WaitForAttach(spec *volume.Spec, d
select { select {
case <-ticker.C: case <-ticker.C:
glog.V(5).Infof("Checking AWS Volume %q is attached.", volumeID) glog.V(5).Infof("Checking AWS Volume %q is attached.", volumeID)
if devicePath != "" { devicePaths := getDiskByIdPaths(aws.KubernetesVolumeID(volumeSource.VolumeID), partition, devicePath)
devicePaths := getDiskByIdPaths(aws.KubernetesVolumeID(volumeSource.VolumeID), partition, devicePath) path, err := verifyDevicePath(devicePaths)
path, err := verifyDevicePath(devicePaths) if err != nil {
if err != nil { // Log error, if any, and continue checking periodically. See issue #11321
// Log error, if any, and continue checking periodically. See issue #11321 glog.Errorf("Error verifying AWS Volume (%q) is attached: %v", volumeID, err)
glog.Errorf("Error verifying AWS Volume (%q) is attached: %v", volumeID, err) } else if path != "" {
} else if path != "" { // A device path has successfully been created for the PD
// A device path has successfully been created for the PD glog.Infof("Successfully found attached AWS Volume %q.", volumeID)
glog.Infof("Successfully found attached AWS Volume %q.", volumeID) return path, nil
return path, nil
}
} else {
glog.V(5).Infof("AWS Volume (%q) is not attached yet", volumeID)
} }
case <-timer.C: case <-timer.C:
return "", fmt.Errorf("Could not find attached AWS Volume %q. Timeout waiting for mount paths to be created.", volumeID) return "", fmt.Errorf("Could not find attached AWS Volume %q. Timeout waiting for mount paths to be created.", volumeID)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment