From 98fe14560b3781f21e3708c76c051e452600d4ff Mon Sep 17 00:00:00 2001 From: Tom Mortensen Date: Sat, 28 Oct 2023 09:18:18 -0700 Subject: [PATCH 01/42] remove pool name suffix from subpool names displayed on Main --- emhttp/plugins/dynamix/nchan/device_list | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emhttp/plugins/dynamix/nchan/device_list b/emhttp/plugins/dynamix/nchan/device_list index 4caafc8cc..f95232ceb 100755 --- a/emhttp/plugins/dynamix/nchan/device_list +++ b/emhttp/plugins/dynamix/nchan/device_list @@ -53,7 +53,8 @@ function device_info(&$disk,$online) { $view = ""; } $name = _var($disk,'name'); - $fancyname = compress(_(my_disk($name),3),16,5); + $namex = (strpos($name, '~') !== false) ? substr($name, strpos($name, '~')) : $name; + $fancyname = compress(_(my_disk($namex,true),3),16,5); $type = _var($disk,'type')=='Flash' ? $disk['type'] : 'Device'; $action = strpos(_var($disk,'color'),'blink')===false ? 'down' : 'up'; switch (_var($disk,'color')) { From b10bceac79cd3babc38f6d11b020e6b502ee5282 Mon Sep 17 00:00:00 2001 From: SimonFair <39065407+SimonFair@users.noreply.github.com> Date: Sun, 29 Oct 2023 17:29:32 +0000 Subject: [PATCH 02/42] Additional multifunction changes Slot has to be > 1 for pc and 0 for q35 --- .../dynamix.vm.manager/include/libvirt.php | 9 ++++++--- .../include/libvirt_helpers.php | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php index 702c29264..dfe4b6780 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php @@ -843,7 +843,8 @@ if ($gpu['multi'] == "on"){ $newgpu_bus = dechex(hexdec($gpu_bus) + 0x20) ; - $strSpecialAddress = "
" ; + if ($machine_type == "pc") $newgpu_slot = "0x01" ; else $newgpu_slot = "0x00" ; + $strSpecialAddress = "
" ; $multidevices[$gpu_bus] = "0x$gpu_bus" ; } @@ -874,7 +875,8 @@ if ($audio_function != 0) { if (isset($multidevices[$audio_bus])) { $newaudio_bus = dechex(hexdec($audio_bus) + 0x20) ; - $strSpecialAddressAudio = "
" ; + if ($machine_type == "pc") $newaudio_slot = "0x01" ; else $newaudio_slot = "0x00" ; + $strSpecialAddressAudio = "
" ; } } @@ -904,7 +906,8 @@ if ($pci_function != 0) { if (isset($multidevices[$pci_bus])) { $newpci_bus = dechex(hexdec($pci_bus) + 0x20) ; - $strSpecialAddressOther = "
" ; + if ($machine_type == "pc") $newpci_slot = "0x01" ; else $newpci_slot = "0x00" ; + $strSpecialAddressOther = "
" ; } } diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php index fce31ea18..7cf94223d 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php @@ -1448,6 +1448,23 @@ private static $encoding = 'UTF-8'; return json_encode($memorybacking); ; } + function getClocks($xml) { + $clocks = new SimpleXMLElement($xml); + $clocks = $clocks->clock ; + return json_encode($clocks); ; + } + + function getQEMUCmdLine($xml) { + $x = strpos($xml,"", 0) ; + $y = strpos($xml,"", 0) ; + $z=$y ; + while ($y!=false) { + $y = strpos($xml,"", $z +19) ; + if ($y != false) $z =$y ; + } + return substr($xml,$x, ($z + 19) -$x) ; + } + function getchannels($res) { global $lv ; $xml = $lv->domain_get_xml($res) ; From 87e4de608470cf9914fb1d8fd874c278f74951b6 Mon Sep 17 00:00:00 2001 From: Christoph Hummer Date: Tue, 31 Oct 2023 10:36:45 +0100 Subject: [PATCH 03/42] Custom rsyslog config files This allows to create custom config files for rsyslog in `/boot/config/rsyslog.d/` and link them on boot in the directory `/etc/rsyslog.d/` --- etc/rc.d/rc.M | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/etc/rc.d/rc.M b/etc/rc.d/rc.M index 0026b0ded..2ae1f5dc8 100755 --- a/etc/rc.d/rc.M +++ b/etc/rc.d/rc.M @@ -52,6 +52,12 @@ dmesg -s 65536 > /var/log/dmesg if [[ -x /etc/rc.d/rc.rsyslogd ]]; then [[ -f /boot/logs/syslog-previous ]] && rm /boot/logs/syslog-previous [[ -f /boot/logs/syslog ]] && mv /boot/logs/syslog /boot/logs/syslog-previous + # Check for additional rsyslog config files and link them if found + if [[ ! -z "$(ls -1 /boot/config/rsyslog.d/ 2>/dev/null)" ]]; then + for file in $(ls -1 /boot/config/rsyslog.d/); do + ln -s "/boot/config/rsyslog.d/$file" "/etc/rsyslog.d/$file" + done + fi /etc/rc.d/rc.rsyslogd start fi From f03d8a00901c9b3eff5db959e379c83dcbae81be Mon Sep 17 00:00:00 2001 From: bergware Date: Wed, 1 Nov 2023 18:18:22 +0100 Subject: [PATCH 04/42] Fixes for ZFS subpools ZFS subpools have a tilde in their name, which is an illegal character in PHP keys and HTML ids. A tilde is automatically replaced to avoid conflicts. The MAIN page shows the total of a ZFS pool at end, also when subpools are part of it. --- emhttp/plugins/dynamix/CacheDevices.page | 4 +- emhttp/plugins/dynamix/include/Helpers.php | 3 + emhttp/plugins/dynamix/nchan/device_list | 40 ++++++------- emhttp/plugins/dynamix/nchan/update_2 | 5 +- emhttp/plugins/dynamix/scripts/monitor | 60 ++++++++++--------- .../plugins/dynamix/styles/default-azure.css | 3 + .../plugins/dynamix/styles/default-black.css | 3 + .../plugins/dynamix/styles/default-gray.css | 3 + .../plugins/dynamix/styles/default-white.css | 3 + 9 files changed, 71 insertions(+), 53 deletions(-) diff --git a/emhttp/plugins/dynamix/CacheDevices.page b/emhttp/plugins/dynamix/CacheDevices.page index dfbb439ae..e9c316d6a 100644 --- a/emhttp/plugins/dynamix/CacheDevices.page +++ b/emhttp/plugins/dynamix/CacheDevices.page @@ -141,9 +141,7 @@ $('#tab2').bind({click:function() {$('i.toggle').show('slow');}}); - - - + diff --git a/emhttp/plugins/dynamix/include/Helpers.php b/emhttp/plugins/dynamix/include/Helpers.php index 0d0e97ab6..a4b27fc3a 100644 --- a/emhttp/plugins/dynamix/include/Helpers.php +++ b/emhttp/plugins/dynamix/include/Helpers.php @@ -63,6 +63,9 @@ function my_disks($disk) { function my_hyperlink($text, $link) { return str_replace(['[',']'],["",""],$text); } +function no_tilde($name) { + return str_replace('~','_-_',$name); +} function prefix($key) { return preg_replace('/\d+$/','',$key); } diff --git a/emhttp/plugins/dynamix/nchan/device_list b/emhttp/plugins/dynamix/nchan/device_list index 4caafc8cc..2715cfe0a 100755 --- a/emhttp/plugins/dynamix/nchan/device_list +++ b/emhttp/plugins/dynamix/nchan/device_list @@ -53,7 +53,7 @@ function device_info(&$disk,$online) { $view = ""; } $name = _var($disk,'name'); - $fancyname = compress(_(my_disk($name),3),16,5); + $fancyname = compress(_(my_disk(my_explode('~',$name)[1]?:$name,true),3),16,5); $type = _var($disk,'type')=='Flash' ? $disk['type'] : 'Device'; $action = strpos(_var($disk,'color'),'blink')===false ? 'down' : 'up'; switch (_var($disk,'color')) { @@ -445,45 +445,45 @@ while (true) { $echo[1] .= ""; $sum = initSum(); - $cache = cache_filter($disks); $n = 2; + $cache = cache_filter($disks); $n = 2; + foreach ($cache as $disk) $crypto |= _var($disk,'luksState',0)!=0 || vfs_luks(_var($disk,'fsType')); foreach ($pools as $pool) { $echo[$n] = "pool_device".($n-2)."\n"; - foreach ($cache as $disk) if (prefix(_var($disk,'name'))==$pool) $crypto |= _var($disk,'luksState',0)!=0 || vfs_luks(_var($disk,'fsType')); + $root = explode('~',$pool)[0]; + $print = end(array_filter(array_column($cache,'name'),function($name) use ($pools,$root) {return in_array($name,$pools) && strncmp($root,$name,strlen($root))==0;})); if (_var($var,'fsState')=='Stopped') { $log = @parse_ini_file($pool_log) ?: []; $off = false; foreach ($cache as $disk) if (prefix(_var($disk,'name'))==$pool) { $echo[$n] .= array_offline($disk,$pool); + $name = _var($disk,'name'); // tilde is not allowed in array key - replace it - $diskname = str_replace('~','_-_',_var($disk,'name')); - if (isset($log[$diskname])) $off |= ($log[$diskname] != _var($disk,'id')); elseif ($diskname) $log[$diskname] = _var($disk,'id'); + $named = no_tilde($name); + if (isset($log[$named])) $off |= ($log[$named] != _var($disk,'id')); elseif ($named) $log[$named] = _var($disk,'id'); } $data = []; foreach ($log as $key => $value) $data[] = "$key=\"$value\""; file_put_contents($pool_log,implode("\n",$data)); - $echo[$n] .= ""; + $echo[$n] .= ""; + $current_subpools = array_filter($pools, function($element) use ($pool) {return strpos($element, "$pool~")!==false;}); + $current_subpools_list = str_replace("$pool~","", implode(',', $current_subpools)); + $echo[$n] .= ""; } + $echo[$n] .= ""; } else { foreach ($cache as $disk) if (prefix($disk['name'])==$pool) { if (isset($disk['fsType'])) $fstype = vfs_type($disk['fsType']); if (substr(_var($cache[$pool],'fsStatus'),0,11)=='Unmountable' && empty($disk['fsStatus'])) $disk['fsStatus'] = _var($cache[$pool],'fsStatus'); $echo[$n] .= array_online($disk,$fstype); } - delete_file($pool_log); - if (_var($display,'total') && _var($cache[$pool],'devices',0)>1) $echo[$n] .= show_totals(sprintf(_('Pool of %s devices'),my_word($cache[$pool]['devices'])),false,"$pool*"); - $sum = initSum(); - } + if (strcmp($root,$pool)!=0) $cache[$root]['devices'] += $cache[$pool]['devices']; + if (strcmp($pool,$print)==0) { + delete_file($pool_log); + if (_var($display,'total') && _var($cache[$root],'devices',0)>1) $echo[$n] .= show_totals(sprintf(_('Pool of %s devices'),my_word($cache[$root]['devices'])),strpos($pool,'~')!==false,"$pool*"); + $sum = initSum(); + } + } $n++; } diff --git a/emhttp/plugins/dynamix/nchan/update_2 b/emhttp/plugins/dynamix/nchan/update_2 index 579331d10..6d7b29d66 100755 --- a/emhttp/plugins/dynamix/nchan/update_2 +++ b/emhttp/plugins/dynamix/nchan/update_2 @@ -175,6 +175,7 @@ function device_smart(&$disk, &$fail, &$smart) { if (!_var($disk,'device') || strpos(_var($disk,'color'),'blink')!==false) return "-"; $failed = ['FAILED','NOK']; $name = _var($disk,'name'); + $named = no_tilde($name); $select = get_value($name,'smSelect',0); $level = get_value($name,'smLevel',1); $events = explode('|',get_value($disk,'smEvents',$numbers)); @@ -186,7 +187,7 @@ function device_smart(&$disk, &$fail, &$smart) { if (file_exists("$file") && exec("grep -Pom1 '^SMART.*: \K[A-Z]+' ".escapeshellarg($file)." |tr -d '\n' 2>/dev/null", $ssa) && in_array("$ssa",$failed)) { $title = _('SMART health-check failed')."\n"; $thumb = 'thumbs-o-down'; $color = 'red'; $text = 'fail'; $fail++; } else { - if (empty($saved["smart"]["$name.ack"])) { + if (empty($saved["smart"]["$named.ack"])) { exec("awk 'NR>7{print $1,$2,$4,$6,$9,$10}' ".escapeshellarg($file)." 2>/dev/null", $codes); foreach ($codes as $code) { if (!$code || !is_numeric($code[0])) continue; @@ -199,7 +200,7 @@ function device_smart(&$disk, &$fail, &$smart) { } } $title .= _('Click for context menu'); - return "$text"; + return "$text"; } function device_usage(&$disk, &$full, &$high) { global $display; diff --git a/emhttp/plugins/dynamix/scripts/monitor b/emhttp/plugins/dynamix/scripts/monitor index 834596abd..098a4d503 100755 --- a/emhttp/plugins/dynamix/scripts/monitor +++ b/emhttp/plugins/dynamix/scripts/monitor @@ -44,28 +44,30 @@ $top = 120; function check_temp(&$disk,$text,$info) { global $notify,$saved,$server,$display,$top; - $name = _var($disk,'name'); - $temp = _var($disk,'temp','*'); - $max = _var($disk,'maxTemp')>=0 ? $disk['maxTemp'] : (_var($display,'max')>=0 ? $display['max'] : 0); - $hot = _var($disk,'hotTemp')>=0 ? $disk['hotTemp'] : (_var($display,'hot')>=0 ? $display['hot'] : 0); - $warn = exceed($temp,$max,$top) ? 'alert' : (exceed($temp,$hot,$top) ? 'warning' : false); - $item = 'temp'; - $last = $saved[$item][$name] ?? 0; + $name = _var($disk,'name'); + $named = no_tilde($name); + $temp = _var($disk,'temp','*'); + $max = _var($disk,'maxTemp')>=0 ? $disk['maxTemp'] : (_var($display,'max')>=0 ? $display['max'] : 0); + $hot = _var($disk,'hotTemp')>=0 ? $disk['hotTemp'] : (_var($display,'hot')>=0 ? $display['hot'] : 0); + $warn = exceed($temp,$max,$top) ? 'alert' : (exceed($temp,$hot,$top) ? 'warning' : false); + $item = 'temp'; + $last = $saved[$item][$named] ?? 0; if ($warn) { if ($temp>$last) { exec("$notify -l '/Main' -e ".escapeshellarg("Unraid $text temperature")." -s ".escapeshellarg(ucfirst($warn)." [$server] - $text ".($warn=='alert'?'overheated (':'is hot (').my_temp($temp).")")." -d ".escapeshellarg("$info")." -i \"$warn\" 2>/dev/null"); - $saved[$item][$name] = max($max,$temp); + $saved[$item][$named] = max($max,$temp); } } else { if ($last && $temp<=$top) { exec("$notify -l '/Main' -e ".escapeshellarg("Unraid $text message")." -s ".escapeshellarg("Notice [$server] - $text returned to normal temperature")." -d ".escapeshellarg("$info")." 2>/dev/null"); - unset($saved[$item][$name]); + unset($saved[$item][$named]); } } } function check_smart(&$disk,$port,$text,$info) { global $notify,$saved,$server,$numbers; $name = _var($disk,'name'); + $named = no_tilde($name); $select = get_value($disk,'smSelect',0); $level = get_value($disk,'smLevel',1); $events = explode('|',get_value($disk,'smEvents',$numbers)); @@ -80,10 +82,10 @@ function check_smart(&$disk,$port,$text,$info) { $fail = strpos($when,'FAILING_NOW')!==false; if (!$fail && !in_array($id,$events)) continue; $word = str_replace(['_',' (-)'],[' ',''],strtolower("$class ($when)")); - $ack = "$name.ack"; + $ack = "$named.ack"; switch ($select) { case 0: - $attr = "$name.$id"; + $attr = "$named.$id"; $last = ($saved[$item][$attr] ?? 0)*$level; if ($raw>0 || $fail) { if ($raw>$last) { @@ -100,7 +102,7 @@ function check_smart(&$disk,$port,$text,$info) { } break; case 1: - $attr = "$name.{$id}n"; + $attr = "$named.{$id}n"; $last = $saved[$item][$attr] ?? 255; if (($thres>0 && $value<=$thres*$level) || $fail) { if ($value*($value>$thres?$level:1)<$last) { @@ -122,32 +124,34 @@ function check_smart(&$disk,$port,$text,$info) { function check_usage(&$disk,$used,$text,$info) { global $notify,$saved,$server,$display; if ($used == -1) return; - $name = _var($disk,'name'); + $name = _var($disk,'name'); + $named = no_tilde($name); $critical = _var($disk,'critical')>=0 ? $disk['critical'] : (_var($display,'critical')>=0 ? $display['critical'] : 0); - $warning = _var($disk,'warning')>=0 ? $disk['warning'] : (_var($display,'warning')>=0 ? $display['warning'] : 0); - $warn = exceed($used,$critical) ? 'alert' : (exceed($used,$warning) ? 'warning' : false); - $item = 'used'; - $last = $saved[$item][$name] ?? 0; + $warning = _var($disk,'warning')>=0 ? $disk['warning'] : (_var($display,'warning')>=0 ? $display['warning'] : 0); + $warn = exceed($used,$critical) ? 'alert' : (exceed($used,$warning) ? 'warning' : false); + $item = 'used'; + $last = $saved[$item][$named] ?? 0; if ($warn) { if ($used>$last) { exec("$notify -l '/Main' -e ".escapeshellarg("Unraid $text disk utilization")." -s ".escapeshellarg(ucfirst($warn)." [$server] - $text is ".($warn=='alert'?'low on space':'high on usage')." ({$used}%)")." -d ".escapeshellarg("$info")." -i \"$warn\" 2>/dev/null"); - $saved[$item][$name] = max($critical,$used); + $saved[$item][$named] = max($critical,$used); } } else { if ($last && $used<=100) { exec("$notify -l '/Main' -e ".escapeshellarg("Unraid $text message")." -s ".escapeshellarg("Notice [$server] - $text returned to normal utilization level")." -d ".escapeshellarg("$info")." 2>/dev/null"); - unset($saved[$item][$name]); + unset($saved[$item][$named]); } } } // check array devices foreach ($disks as $disk) { - $name = _var($disk,'name'); + $name = _var($disk,'name'); if ($name=='flash' || substr(_var($disk,'status'),-3)=='_NP') continue; - $text = my_disk($name).(in_array($name,$pools)||$name=='parity'?' disk':''); + $named = no_tilde($name); + $text = my_disk($name).(in_array($name,$pools)||$name=='parity'?' disk':''); $device = _var($disk,'device'); - $info = !empty($disk['id']) ? "{$disk['id']} ($device)" : "No device identification ($device)"; + $info = !empty($disk['id']) ? "{$disk['id']} ($device)" : "No device identification ($device)"; // process disk temperature notifications check_temp($disk,$text,$info); // process disk SMART notifications @@ -157,7 +161,7 @@ foreach ($disks as $disk) { // process disk operation notifications $warn = strtok(_var($disk,'color'),'-'); $item = 'disk'; - $last = $saved[$item][$name] ?? ''; + $last = $saved[$item][$named] ?? ''; switch ($warn) { case 'red': if ($warn!=$last) { @@ -165,7 +169,7 @@ foreach ($disks as $disk) { $status = strtolower(str_replace(['NP_','_'],['',' '],_var($disk,'status'))); exec("$notify -l '/Main' -e ".escapeshellarg("Unraid $text error")." -s ".escapeshellarg("Alert [$server] - $text in error state ($status)")." -d ".escapeshellarg("$info")." -i \"alert\" 2>/dev/null"); } - $saved[$item][$name] = $warn; + $saved[$item][$named] = $warn; } break; case 'yellow': @@ -174,7 +178,7 @@ foreach ($disks as $disk) { $status = $name=='parity' ? "parity-sync in progress" : " is being reconstructed and is available for normal operation"; exec("$notify -l '/Main' -e ".escapeshellarg("Unraid $text message")." -s ".escapeshellarg("Notice [$server] - $text, $status")." -d ".escapeshellarg("$info")." 2>/dev/null"); } - $saved[$item][$name] = $warn; + $saved[$item][$named] = $warn; } break; default: @@ -182,7 +186,7 @@ foreach ($disks as $disk) { if (_var($var,'fsState')!='Stopped') { exec("$notify -l '/Main' -e ".escapeshellarg("Unraid $text message")." -s ".escapeshellarg("Notice [$server] - $text returned to normal operation")." -d ".escapeshellarg("$info")." 2>/dev/null"); } - unset($saved[$item][$name]); + unset($saved[$item][$named]); } break;} // count disk errors @@ -197,7 +201,7 @@ foreach ($disks as $disk) { $saved[$item][$attr] = 1; } } elseif (isset($saved[$item][$attr])) unset($saved[$item][$attr]); - $attr = "profile-$name"; + $attr = "profile-$named"; if (exec("/sbin/btrfs filesystem df /mnt/$name 2>/dev/null|grep -c '^Data'")>1) { if (empty($saved[$item][$attr])) { exec("$notify -l '/Main' -e ".escapeshellarg("Unraid $text message")." -s ".escapeshellarg("Warning [$server] - $pool pool BTRFS too many profiles (You can ignore this warning when a pool balance operation is in progress)")." -d ".escapeshellarg("$info")." -i \"warning\" 2>/dev/null"); @@ -318,7 +322,7 @@ if ($saved) { $text = ''; foreach ($saved as $item => $block) { if ($block) $text .= "[$item]\n"; - foreach ($block as $key => $value) $text .= "$key=\"$value\"\n"; + foreach ($block as $key => $value) $text .= str_replace('~','_-_',$key)."=\"$value\"\n"; } if ($text) { if ($text != @file_get_contents($ram)) file_put_contents($ram, $text); diff --git a/emhttp/plugins/dynamix/styles/default-azure.css b/emhttp/plugins/dynamix/styles/default-azure.css index b79049e5f..eecff92b9 100644 --- a/emhttp/plugins/dynamix/styles/default-azure.css +++ b/emhttp/plugins/dynamix/styles/default-azure.css @@ -205,6 +205,9 @@ span.outer.stopped>img,span.outer.stopped>i.img{opacity:0.3} span.outer.paused>img,span.outer.paused>i.img{opacity:0.6} span.inner{display:inline-block;vertical-align:top} span.state{font-size:1.1rem;margin-left:7px} +span.slots{display:inline-block;width:44rem} +span.slots-left{float:left} +input.subpool{float:right;margin:0} i.padlock{margin-right:8px;cursor:default;vertical-align:middle} i.nolock{visibility:hidden;margin-right:8px;vertical-align:middle} i.lock{margin-left:8px;cursor:default;vertical-align:middle} diff --git a/emhttp/plugins/dynamix/styles/default-black.css b/emhttp/plugins/dynamix/styles/default-black.css index 7e2a1ebee..a4bfb2ace 100644 --- a/emhttp/plugins/dynamix/styles/default-black.css +++ b/emhttp/plugins/dynamix/styles/default-black.css @@ -199,6 +199,9 @@ span.outer.stopped>img,span.outer.stopped>i.img{opacity:0.3} span.outer.paused>img,span.outer.paused>i.img{opacity:0.6} span.inner{display:inline-block;vertical-align:top} span.state{font-size:1.1rem;margin-left:7px} +span.slots{display:inline-block;width:44rem} +span.slots-left{float:left} +input.subpool{float:right;margin:0} i.padlock{margin-right:8px;cursor:default;vertical-align:middle} i.nolock{visibility:hidden;margin-right:8px;vertical-align:middle} i.lock{margin-left:8px;cursor:default;vertical-align:middle} diff --git a/emhttp/plugins/dynamix/styles/default-gray.css b/emhttp/plugins/dynamix/styles/default-gray.css index 3c058ea18..cb0a8349f 100644 --- a/emhttp/plugins/dynamix/styles/default-gray.css +++ b/emhttp/plugins/dynamix/styles/default-gray.css @@ -205,6 +205,9 @@ span.outer.stopped>img,span.outer.stopped>i.img{opacity:0.3} span.outer.paused>img,span.outer.paused>i.img{opacity:0.6} span.inner{display:inline-block;vertical-align:top} span.state{font-size:1.1rem;margin-left:7px} +span.slots{display:inline-block;width:44rem} +span.slots-left{float:left} +input.subpool{float:right;margin:0} i.padlock{margin-right:8px;cursor:default;vertical-align:middle} i.nolock{visibility:hidden;margin-right:8px;vertical-align:middle} i.lock{margin-left:8px;cursor:default;vertical-align:middle} diff --git a/emhttp/plugins/dynamix/styles/default-white.css b/emhttp/plugins/dynamix/styles/default-white.css index 0f9dff443..f7f925af2 100644 --- a/emhttp/plugins/dynamix/styles/default-white.css +++ b/emhttp/plugins/dynamix/styles/default-white.css @@ -199,6 +199,9 @@ span.outer.stopped>img,span.outer.stopped>i.img{opacity:0.3} span.outer.paused>img,span.outer.paused>i.img{opacity:0.6} span.inner{display:inline-block;vertical-align:top} span.state{font-size:1.1rem;margin-left:7px} +span.slots{display:inline-block;width:44rem} +span.slots-left{float:left} +input.subpool{float:right;margin:0} i.padlock{margin-right:8px;cursor:default;vertical-align:middle} i.nolock{visibility:hidden;margin-right:8px;vertical-align:middle} i.lock{margin-left:8px;cursor:default;vertical-align:middle} From 491bc801814dc7797daa6328921d8966b8e2a01c Mon Sep 17 00:00:00 2001 From: bergware Date: Wed, 1 Nov 2023 18:39:24 +0100 Subject: [PATCH 05/42] Update device_list --- emhttp/plugins/dynamix/nchan/device_list | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emhttp/plugins/dynamix/nchan/device_list b/emhttp/plugins/dynamix/nchan/device_list index 2715cfe0a..73e27dff2 100755 --- a/emhttp/plugins/dynamix/nchan/device_list +++ b/emhttp/plugins/dynamix/nchan/device_list @@ -53,7 +53,8 @@ function device_info(&$disk,$online) { $view = ""; } $name = _var($disk,'name'); - $fancyname = compress(_(my_disk(my_explode('~',$name)[1]?:$name,true),3),16,5); + //$fancyname = compress(_(my_disk(my_explode('~',$name)[1]?:$name),3),16,5); + $fancyname = compress(_(my_disk(my_explode('~',$name)[1]?:$name),3),16,5); $type = _var($disk,'type')=='Flash' ? $disk['type'] : 'Device'; $action = strpos(_var($disk,'color'),'blink')===false ? 'down' : 'up'; switch (_var($disk,'color')) { From 839745a48f6c3f7280c3794d7292eb0c7daf9581 Mon Sep 17 00:00:00 2001 From: bergware Date: Wed, 1 Nov 2023 18:50:07 +0100 Subject: [PATCH 06/42] Update device_list --- emhttp/plugins/dynamix/nchan/device_list | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emhttp/plugins/dynamix/nchan/device_list b/emhttp/plugins/dynamix/nchan/device_list index 73e27dff2..cb172f19a 100755 --- a/emhttp/plugins/dynamix/nchan/device_list +++ b/emhttp/plugins/dynamix/nchan/device_list @@ -53,8 +53,8 @@ function device_info(&$disk,$online) { $view = ""; } $name = _var($disk,'name'); - //$fancyname = compress(_(my_disk(my_explode('~',$name)[1]?:$name),3),16,5); - $fancyname = compress(_(my_disk(my_explode('~',$name)[1]?:$name),3),16,5); + $extra = my_explode('~',$name)[1]; + $fancyname = compress($extra ? '~'.my_disk(_($extra,3)) : my_disk(_($name,3)),16,5); $type = _var($disk,'type')=='Flash' ? $disk['type'] : 'Device'; $action = strpos(_var($disk,'color'),'blink')===false ? 'down' : 'up'; switch (_var($disk,'color')) { From 304be089eeaa6beb0223571f74fc82d04a0b4d13 Mon Sep 17 00:00:00 2001 From: bergware Date: Wed, 1 Nov 2023 19:02:29 +0100 Subject: [PATCH 07/42] Fixes for ZFS subpools --- emhttp/plugins/dynamix/ArrayDevices.page | 2 +- emhttp/plugins/dynamix/nchan/device_list | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/emhttp/plugins/dynamix/ArrayDevices.page b/emhttp/plugins/dynamix/ArrayDevices.page index cb2586eb3..422226d50 100644 --- a/emhttp/plugins/dynamix/ArrayDevices.page +++ b/emhttp/plugins/dynamix/ArrayDevices.page @@ -20,7 +20,7 @@ function toggle_state(device,name,action) { if (name) { var group = name.replace(/(\d+|\*)$/,''); if (name.slice(-1)!='*') { - $('#dev-'+name).removeClass('fa-circle fa-square fa-warning fa-times').addClass('fa-refresh fa-spin'); + $('#dev-'+name.replace('~','_-_')).removeClass('fa-circle fa-square fa-warning fa-times').addClass('fa-refresh fa-spin'); } else { if (group=='array') { $('[id^="dev-parity"]').removeClass('fa-circle fa-square fa-warning fa-times').addClass('fa-refresh fa-spin'); diff --git a/emhttp/plugins/dynamix/nchan/device_list b/emhttp/plugins/dynamix/nchan/device_list index cb172f19a..7baaec4db 100755 --- a/emhttp/plugins/dynamix/nchan/device_list +++ b/emhttp/plugins/dynamix/nchan/device_list @@ -53,6 +53,7 @@ function device_info(&$disk,$online) { $view = ""; } $name = _var($disk,'name'); + $named = no_tilde($name); $extra = my_explode('~',$name)[1]; $fancyname = compress($extra ? '~'.my_disk(_($extra,3)) : my_disk(_($name,3)),16,5); $type = _var($disk,'type')=='Flash' ? $disk['type'] : 'Device'; @@ -75,7 +76,7 @@ function device_info(&$disk,$online) { $ctrl = " style='cursor:pointer' onclick=\"toggle_state('$type','$name','$action')\""; $help .= "
"._("Click to spin $action device"); } - $status = "$help"; + $status = "$help"; $link = (_var($disk,'type')=='Parity' && strpos($disk_status,'_NP')===false) || (_var($disk,'type')=='Data' && $disk_status!='DISK_NP') || (_var($disk,'type')=='Cache' && $disk_status!='DISK_NP') || From eef112fbd2d3d4b13e1d75b92a56200f7aa009a2 Mon Sep 17 00:00:00 2001 From: bergware Date: Wed, 1 Nov 2023 19:51:40 +0100 Subject: [PATCH 08/42] Fixes for ZFS subpools --- emhttp/plugins/dynamix/ArrayDevices.page | 4 +++- emhttp/plugins/dynamix/scripts/monitor | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/emhttp/plugins/dynamix/ArrayDevices.page b/emhttp/plugins/dynamix/ArrayDevices.page index 422226d50..5c465b1f9 100644 --- a/emhttp/plugins/dynamix/ArrayDevices.page +++ b/emhttp/plugins/dynamix/ArrayDevices.page @@ -15,12 +15,14 @@ Tag="database" */ ?>
_(Device)__(Identification)__(Temp)_._(Reads)__(Writes)__(Errors)__(FS)__(Size)__(Used)__(Free)_
"._('Slots')."".cache_slots($off,$pool,_var($cache[$pool],'devicesSb'),_var($cache[$pool],'slots',0))."
"._('Slots')."".cache_slots($off,$pool,_var($cache[$pool],'devicesSb'),_var($cache[$pool],'slots',0)).""; $zfsPool = strstr(_var($cache[$pool],'fsType'),'zfs') && !isSubpool($pool); if ($zfsPool) { - $current_subpools = array_filter($pools, function ($element) use ($pool) { - return strpos($element, "$pool~")!==false; - }); - if (count($current_subpools) < count($subpools)) { - $current_subpools_list = str_replace("$pool~","", implode(',', $current_subpools)); - $subPoolButton = ""; - } else { - $subPoolButton = ""; - } - $echo[$n] .= "
$subPoolButton