mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
[Provider/aws] use strings.TrimPrefix()
This commit is contained in:
parent
d6f44b0ea9
commit
033f94e58a
@ -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))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user