From cc97a8100221f8cd5f1859a5e88866f0c5be7502 Mon Sep 17 00:00:00 2001 From: bergware Date: Sat, 3 Sep 2016 14:35:14 +0200 Subject: [PATCH] Add configurable display of WWN in device ID --- plugins/dynamix/ArrayOperation.page | 10 +++++----- plugins/dynamix/DisplaySettings.page | 12 ++++++++++++ plugins/dynamix/default.cfg | 1 + plugins/dynamix/include/DeviceList.php | 11 +++-------- plugins/dynamix/include/Helpers.php | 6 ++++++ 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/plugins/dynamix/ArrayOperation.page b/plugins/dynamix/ArrayOperation.page index f1dc0d23c..fd6b2cb50 100644 --- a/plugins/dynamix/ArrayOperation.page +++ b/plugins/dynamix/ArrayOperation.page @@ -118,7 +118,7 @@ $('.tabs').append("0):?> Unmountable disk present:
-".my_disk($disk['name'])." • {$disk['id']} ({$disk['device']})";?> +".my_disk($disk['name'])." • ".my_id($disk['id'])." (".$disk['device'].")";?> Format will create a file system in all Unmountable disks, discarding all data currently on those disks.
Yes I want to do this @@ -364,7 +364,7 @@ $('.tabs').append(" new disk.
-".my_disk($disk['name'])." • {$disk['id']} ({$disk['device']})";?> +".my_disk($disk['name'])." • ".my_id($disk['id'])." (".$disk['device'].")";?> Start will record the new disk information and bring the expanded array on-line. @@ -374,7 +374,7 @@ $('.tabs').append(" Stopped. Found new erased disk.
-".my_disk($disk['name'])." • {$disk['id']} ({$disk['device']})";?> +".my_disk($disk['name'])." • ".my_id($disk['id'])." (".$disk['device'].")";?> Start will record the new disk information and bring the expanded array on-line.
Yes I want to do this @@ -383,7 +383,7 @@ $('.tabs').append(" new disk.
-".my_disk($disk['name'])." • {$disk['id']} ({$disk['device']})";?> +".my_disk($disk['name'])." • ".my_id($disk['id'])." (".$disk['device'].")";?> Clear will completely clear (set to zero) the new disk.
Once clear completes, the array may be Started, expanding the array to include the new disk. @@ -434,7 +434,7 @@ $('.tabs').append("".my_disk($disk['name'])." • {$disk['id']} ({$disk['device']})";?> +".my_disk($disk['name'])." • ".my_id($disk['id'])." (".$disk['device'].")";?> Start will just record the new disk positions and bring the array on-line.
We recommend you start a Parity-Check afterwards just to be safe. diff --git a/plugins/dynamix/DisplaySettings.page b/plugins/dynamix/DisplaySettings.page index 9b130f223..0edd5bc77 100644 --- a/plugins/dynamix/DisplaySettings.page +++ b/plugins/dynamix/DisplaySettings.page @@ -190,6 +190,18 @@ Table view spacing: +Display world-wide-name in device ID: +: + +> World Wide Name (WWN) is a unique identifier used for SAS attached devices. +> +> Select *Disabled* to suppress the appending of WWN to the device identification +> +> Select "Automatic" to append WWN to the device identification in case of SAS devices + Display array totals: : "; $empty = ($disk['idSb']!='' ? 'no device' : 'unassigned'); if ($disk['id']!='') { - $out .= ""; + $out .= ""; $out .= ""; } else $out .= ""; - foreach ($devs as $dev) {$out .= "";} + foreach ($devs as $dev) {$out .= "";} return "$out"; } function fs_info(&$disk) { diff --git a/plugins/dynamix/include/Helpers.php b/plugins/dynamix/include/Helpers.php index 5fb0c5e3a..38b3e33dc 100644 --- a/plugins/dynamix/include/Helpers.php +++ b/plugins/dynamix/include/Helpers.php @@ -54,6 +54,12 @@ function my_disk($name) { function my_disks($disk) { return strpos($disk['status'],'_NP')===false; } +function my_id($id) { + global $display; + $len = strlen($id); + $wwn = substr($id,-18); + return ($display['wwn'] || substr($wwn,0,2)!='_3' || preg_match('/.[_-]/',$wwn)) ? $id : substr($id,0,$len-18); +} function my_word($num) { $words = array('zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'); return $num