Skip to content

Commit

Permalink
Merge pull request #1546 from ConnorJC3/snow-mount
Browse files Browse the repository at this point in the history
Grab snow device path via last character rather than trimming
  • Loading branch information
k8s-ci-robot authored Mar 29, 2023
2 parents 67c0374 + 6f93a56 commit ed42e16
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pkg/driver/node_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ func (d *nodeService) findDevicePath(devicePath, volumeID, partition string) (st

if util.IsSBE(d.metadata.GetRegion()) {
klog.V(5).InfoS("[Debug] Falling back to snow volume lookup", "devicePath", devicePath)
canonicalDevicePath = "/dev/vd" + strings.TrimPrefix(devicePath, "/dev/xvdb")
// Snow completely ignores the requested device path and mounts volumes starting at /dev/vda .. /dev/vdb .. etc
// Morph the device path to the snow form by chopping off the last letter and prefixing with /dev/vd
// VMs on snow devices are currently limited to 10 block devices each - if that ever exceeds 26 this will need
// to be adapted
canonicalDevicePath = "/dev/vd" + devicePath[len(devicePath)-1:]
}

if canonicalDevicePath == "" {
Expand Down
16 changes: 15 additions & 1 deletion pkg/driver/node_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
)

func TestFindDevicePath(t *testing.T) {
devicePath := "/dev/xvdba"
devicePath := "/dev/xvdaa"
nvmeDevicePath := "/dev/nvme1n1"
snowDevicePath := "/dev/vda"
volumeID := "vol-test"
Expand Down Expand Up @@ -120,6 +120,20 @@ func TestFindDevicePath(t *testing.T) {
},
expectDevicePath: snowDevicePath,
},
{
name: "success: non-standard snow device path",
devicePath: "/dev/sda",
volumeID: volumeID,
partition: "",
expectMock: func(mockMounter MockMounter, mockDeviceIdentifier MockDeviceIdentifier) {
gomock.InOrder(
mockMounter.EXPECT().PathExists(gomock.Eq("/dev/sda")).Return(false, nil),

mockDeviceIdentifier.EXPECT().Lstat(gomock.Eq(nvmeName)).Return(nil, os.ErrNotExist),
)
},
expectDevicePath: snowDevicePath,
},
}
// The partition variant of each case should be the same except the partition
// is expected to be appended to devicePath
Expand Down

0 comments on commit ed42e16

Please sign in to comment.