From cb3351f8a32510caaf8eb1b52386c650f3fad748 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 10 Apr 2020 14:09:07 +0200 Subject: [PATCH] [smartstatus] Added support for nvme SSDs --- bumblebee/modules/smartstatus.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bumblebee/modules/smartstatus.py b/bumblebee/modules/smartstatus.py index f5ded96..0ee167b 100644 --- a/bumblebee/modules/smartstatus.py +++ b/bumblebee/modules/smartstatus.py @@ -84,13 +84,15 @@ class Module(bumblebee.engine.Module): for (root, folders, files) in os.walk('/dev'): if root == '/dev': devices = {"".join(filter(lambda i: i.isdigit() == False, file)) for file in files if 'sd' in file} + nvme = {file for file in files if('nvme0n' in file and 'p' not in file)} + devices.update(nvme) return devices def smart(self, disk_name): SMARTCTL_PATH = which('smartctl') assessment = None cmd = Popen( - ['sudo', SMARTCTL_PATH, '--health', os.path.join('/dev/', disk_name.replace('nvd','nvme'))], + ['sudo', SMARTCTL_PATH, '--health', os.path.join('/dev/', disk_name)], stdout=PIPE, stderr=PIPE, ) @@ -105,7 +107,7 @@ class Module(bumblebee.engine.Module): if assessment == 'OK': cmd = Popen( - ['sudo', SMARTCTL_PATH, '-A', os.path.join('/dev/', disk_name.replace('nvd','nvme'))], + ['sudo', SMARTCTL_PATH, '-A', os.path.join('/dev/', disk_name)], stdout=PIPE, stderr=PIPE, )