disk monitor: check supported devices by vendor
This commit is contained in:
parent
f213faab8b
commit
dd9c768bb9
1 changed files with 13 additions and 5 deletions
|
|
@ -3,6 +3,9 @@ import tuned.monitors.interface
|
|||
import os
|
||||
|
||||
class DiskMonitor(tuned.monitors.interface.MonitorInterface):
|
||||
|
||||
_supported_vendors = ["ATA", "SCSI"]
|
||||
|
||||
@classmethod
|
||||
def _init_available_devices(cls):
|
||||
block_devices = os.listdir("/sys/block")
|
||||
|
|
@ -11,15 +14,20 @@ class DiskMonitor(tuned.monitors.interface.MonitorInterface):
|
|||
|
||||
@classmethod
|
||||
def _is_device_supported(cls, device):
|
||||
capability_name = "/sys/block/%s/capability" % device
|
||||
capability = (int) (open(capability_name).read())
|
||||
vendor_file = "/sys/block/%s/device/vendor" % device
|
||||
try:
|
||||
vendor = open(vendor_file).read().strip()
|
||||
except IOError:
|
||||
return False
|
||||
|
||||
# FIXME: not sure about this
|
||||
# !GENHD_FL_REMOVABLE && !GENHD_FL_CD
|
||||
return (capability & 9) == 0
|
||||
return vendor in cls._supported_vendors
|
||||
|
||||
@classmethod
|
||||
def update(cls):
|
||||
for device in cls._updating_devices:
|
||||
# TODO
|
||||
cls._load[device] = None
|
||||
|
||||
@classmethod
|
||||
def _update_disk(cls, name):
|
||||
pass
|
||||
|
|
|
|||
Loading…
Reference in a new issue