Skip to content

Commit

Permalink
fix: properly detect nvme and sd card disk types
Browse files Browse the repository at this point in the history
The order was incorrect so it was never reaching the last two cases.

Signed-off-by: Artem Chernyshev <[email protected]>
  • Loading branch information
Unix4ever authored and talos-bot committed May 6, 2021
1 parent 1d830a2 commit b77400e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions blockdevice/util/disk/disks.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,14 @@ func Get(dev string) *Disk {
rotational := readFile(sysblock, dev, "queue/rotational")

switch {
case rotational == "1":
diskType = TypeHDD
case rotational == "0":
diskType = TypeSSD
case strings.Contains(dev, "nvme"):
diskType = TypeNVMe
case strings.Contains(dev, "mmc"):
diskType = TypeSD
case rotational == "1":
diskType = TypeHDD
case rotational == "0":
diskType = TypeSSD
}

uuid := readFile(sysblock, dev, "uuid")
Expand Down

0 comments on commit b77400e

Please sign in to comment.