Skip to content

Commit

Permalink
Merge pull request #98 from N3WWN/almalinux
Browse files Browse the repository at this point in the history
Update actor.py to support NVMe device enumeration
  • Loading branch information
andrewlukoshko authored Apr 23, 2024
2 parents 07a9a8a + 9cc2b7f commit fd92fe5
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,24 @@ def process(self):
}

def devparts(dev):
part = next(re.finditer(r'\d+$', dev)).group(0)
dev = dev[:-len(part)]
"""
NVMe block devices aren't named like SCSI/ATA/etc block devices and must be parsed differently.
SCSI/ATA/etc devices have a syntax resembling /dev/sdb4 for the 4th partition on the 2nd disk.
NVMe devices have a syntax resembling /dev/nvme0n2p4 for the 4th partition on the 2nd disk.
"""
if '/dev/nvme' in dev:
"""
NVMe
"""
part = next(re.finditer(r'p\d+$', dev)).group(0)
dev = dev[:-len(part)]
part = part[1:]
else:
"""
Non-NVMe (SCSI, ATA, etc)
"""
part = next(re.finditer(r'\d+$', dev)).group(0)
dev = dev[:-len(part)]
return [dev, part];

with open('/etc/system-release', 'r') as sr:
Expand Down

0 comments on commit fd92fe5

Please sign in to comment.