Skip to content

Commit

Permalink
Don't trim device prefix for existing volumes in DeviceManager
Browse files Browse the repository at this point in the history
If a volume is (already) mounted at /dev/sdX, DM will trim the prefix
and claim the volume should be mounted at /dev/xvdX - this causes the
driver to get stuck in an infinite loop waiting for the volume to be
attached to the wrong location. This bug commonly is triggered by
manually mounting a volume using the AWS console, because it uses the
prefix /dev/sdX by default.

Signed-off-by: Connor Catlett <[email protected]>
  • Loading branch information
ConnorJC3 committed Feb 13, 2023
1 parent c4baaa7 commit cc7e528
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions pkg/cloud/devicemanager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,6 @@ func (d *deviceManager) getDeviceNamesInUse(instance *ec2.Instance) map[string]s
inUse := map[string]string{}
for _, blockDevice := range instance.BlockDeviceMappings {
name := aws.StringValue(blockDevice.DeviceName)
// trims /dev/sd or /dev/xvd from device name
name = strings.TrimPrefix(name, "/dev/sd")
name = strings.TrimPrefix(name, "/dev/xvd")

if len(name) < 1 || len(name) > 2 {
klog.InfoS("Unexpected EBS DeviceName", "DeviceName", aws.StringValue(blockDevice.DeviceName))
Expand All @@ -227,7 +224,7 @@ func (d *deviceManager) getDeviceNamesInUse(instance *ec2.Instance) map[string]s
func (d *deviceManager) getPath(inUse map[string]string, volumeID string) string {
for name, volID := range inUse {
if volumeID == volID {
return devPreffix + name
return name
}
}
return ""
Expand Down

0 comments on commit cc7e528

Please sign in to comment.