diff options
author | jim-p <jimp@netgate.com> | 2018-10-15 15:21:16 -0400 |
---|---|---|
committer | jim-p <jimp@netgate.com> | 2018-10-15 15:21:58 -0400 |
commit | 82c85c971f907b60c4f72c189137a8422378e136 (patch) | |
tree | 36a0da2d31824426e0b5c8c693e272dd9de72159 /src/etc | |
parent | 083e429167a5377ab7b089e741af3d2a295d57e4 (diff) | |
download | pfsense-82c85c971f907b60c4f72c189137a8422378e136.zip pfsense-82c85c971f907b60c4f72c189137a8422378e136.tar.gz |
Show nvme controllers in SMART list. Fixes #9042
(cherry picked from commit e738a4c9b2607ad3561a0fce89d903535ca71249)
Diffstat (limited to 'src/etc')
-rw-r--r-- | src/etc/inc/util.inc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index b717b3d..87c4722 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -2598,12 +2598,26 @@ function post_redirect($page, $params) { /* Locate disks that can be queried for S.M.A.R.T. data. */ function get_smart_drive_list() { + /* SMART supports some disks directly, and some controllers directly, + * See https://redmine.pfsense.org/issues/9042 */ + $supported_disk_types = array("ad", "da", "ada"); + $supported_controller_types = array("nvme"); $disk_list = explode(" ", get_single_sysctl("kern.disks")); foreach ($disk_list as $id => $disk) { // We only want certain kinds of disks for S.M.A.R.T. // 1 is a match, 0 is no match, False is any problem processing the regex - if (preg_match("/^(ad|da|ada).*[0-9]{1,2}$/", $disk) !== 1) { + if (preg_match("/^(" . implode("|", $supported_disk_types) . ").*[0-9]{1,2}$/", $disk) !== 1) { unset($disk_list[$id]); + continue; + } + } + foreach ($supported_controller_types as $controller) { + $devices = glob("/dev/{$controller}*"); + if (!is_array($devices)) { + continue; + } + foreach ($devices as $device) { + $disk_list[] = basename($device); } } sort($disk_list); |