Merge pull request #90337 from gaurav1086/aws_use_TrimPrefix

[Provider/aws] use strings.TrimPrefix()
This commit is contained in:
Kubernetes Prow Robot
2020-04-27 02:51:29 -07:00
committed by GitHub

View File

@@ -1884,12 +1884,8 @@ func (c *Cloud) getMountDevice(
volumeStatus := map[EBSVolumeID]string{} // for better logging of volume status
for _, blockDevice := range info.BlockDeviceMappings {
name := aws.StringValue(blockDevice.DeviceName)
if strings.HasPrefix(name, "/dev/sd") {
name = name[7:]
}
if strings.HasPrefix(name, "/dev/xvd") {
name = name[8:]
}
name = strings.TrimPrefix(name, "/dev/sd")
name = strings.TrimPrefix(name, "/dev/xvd")
if len(name) < 1 || len(name) > 2 {
klog.Warningf("Unexpected EBS DeviceName: %q", aws.StringValue(blockDevice.DeviceName))
}