Merge pull request #596 from martindoublem/smartstatus
[smartstatus] Added support for nvme SSDs
This commit is contained in:
commit
3a376a4ad2
1 changed files with 4 additions and 2 deletions
|
@ -84,13 +84,15 @@ class Module(bumblebee.engine.Module):
|
||||||
for (root, folders, files) in os.walk('/dev'):
|
for (root, folders, files) in os.walk('/dev'):
|
||||||
if root == '/dev':
|
if root == '/dev':
|
||||||
devices = {"".join(filter(lambda i: i.isdigit() == False, file)) for file in files if 'sd' in file}
|
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
|
return devices
|
||||||
|
|
||||||
def smart(self, disk_name):
|
def smart(self, disk_name):
|
||||||
SMARTCTL_PATH = which('smartctl')
|
SMARTCTL_PATH = which('smartctl')
|
||||||
assessment = None
|
assessment = None
|
||||||
cmd = Popen(
|
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,
|
stdout=PIPE,
|
||||||
stderr=PIPE,
|
stderr=PIPE,
|
||||||
)
|
)
|
||||||
|
@ -105,7 +107,7 @@ class Module(bumblebee.engine.Module):
|
||||||
|
|
||||||
if assessment == 'OK':
|
if assessment == 'OK':
|
||||||
cmd = Popen(
|
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,
|
stdout=PIPE,
|
||||||
stderr=PIPE,
|
stderr=PIPE,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue