Skip to content

Commit ee486ef

Browse files
fmoehleraramprice
authored andcommitted
Revert "Noble VMs on AWS don't have /dev/sdX devices for some reason."
This reverts commit 6dd55d5.
1 parent b508298 commit ee486ef

File tree

2 files changed

+8
-24
lines changed

2 files changed

+8
-24
lines changed

infrastructure/devicepathresolver/mapped_device_path_resolver.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package devicepathresolver
22

33
import (
4-
"fmt"
54
"os"
65
"path/filepath"
76
"strings"
@@ -58,17 +57,16 @@ func (dpr mappedDevicePathResolver) findPossibleDevice(devicePath string) (strin
5857
needsMapping := strings.HasPrefix(devicePath, "/dev/sd")
5958

6059
if needsMapping { //nolint:nestif
61-
pathLetterSuffix := strings.Split(devicePath, "/dev/sd")[1]
62-
pathNumberSuffix := fmt.Sprintf("%d", pathLetterSuffix[0]-97) // a=0, b=1
63-
64-
possiblePaths := []string{
65-
"/dev/xvd" + pathLetterSuffix, // Xen
66-
"/dev/vd" + pathLetterSuffix, // KVM
67-
"/dev/sd" + pathLetterSuffix,
68-
"/dev/nvme" + pathNumberSuffix + "n1", // Nitro instances with Noble
60+
pathSuffix := strings.Split(devicePath, "/dev/sd")[1]
61+
62+
possiblePrefixes := []string{
63+
"/dev/xvd", // Xen
64+
"/dev/vd", // KVM
65+
"/dev/sd",
6966
}
7067

71-
for _, path := range possiblePaths {
68+
for _, prefix := range possiblePrefixes {
69+
path := prefix + pathSuffix
7270
if dpr.fs.FileExists(path) {
7371
return path, true, nil
7472
}

infrastructure/devicepathresolver/mapped_device_path_resolver_test.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,6 @@ var _ = Describe("mappedDevicePathResolver", func() {
9090
})
9191
})
9292

93-
Context("when a matching /dev/nvmeXn1 device is found", func() {
94-
BeforeEach(func() {
95-
err := fs.WriteFile("/dev/nvme0n1", []byte{})
96-
Expect(err).NotTo(HaveOccurred())
97-
})
98-
99-
It("returns the match", func() {
100-
realPath, timedOut, err := resolver.GetRealDevicePath(diskSettings)
101-
Expect(err).NotTo(HaveOccurred())
102-
Expect(timedOut).To(BeFalse())
103-
Expect(realPath).To(Equal("/dev/nvme0n1"))
104-
})
105-
})
106-
10793
Context("when no matching device is found the first time", func() {
10894
Context("when the timeout has not expired", func() {
10995
BeforeEach(func() {

0 commit comments

Comments
 (0)