mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30: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
|
volumeStatus := map[EBSVolumeID]string{} // for better logging of volume status
|
||||||
for _, blockDevice := range info.BlockDeviceMappings {
|
for _, blockDevice := range info.BlockDeviceMappings {
|
||||||
name := aws.StringValue(blockDevice.DeviceName)
|
name := aws.StringValue(blockDevice.DeviceName)
|
||||||
if strings.HasPrefix(name, "/dev/sd") {
|
name = strings.TrimPrefix(name, "/dev/sd")
|
||||||
name = name[7:]
|
name = strings.TrimPrefix(name, "/dev/xvd")
|
||||||
}
|
|
||||||
if strings.HasPrefix(name, "/dev/xvd") {
|
|
||||||
name = name[8:]
|
|
||||||
}
|
|
||||||
if len(name) < 1 || len(name) > 2 {
|
if len(name) < 1 || len(name) > 2 {
|
||||||
klog.Warningf("Unexpected EBS DeviceName: %q", aws.StringValue(blockDevice.DeviceName))
|
klog.Warningf("Unexpected EBS DeviceName: %q", aws.StringValue(blockDevice.DeviceName))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user