From 7b716c772ad21184279f8e5b9cde031a70343bf6 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Mon, 29 Apr 2013 12:48:07 +0200 Subject: [PATCH] fixed to honour the support of RAID controller parameters in the disk device names defined in the disk graph --- Changes | 2 ++ lib/disk.pm | 28 +++++++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Changes b/Changes index fbee87f..f442e52 100644 --- a/Changes +++ b/Changes @@ -19,6 +19,8 @@ - Fixed in 'port' graph to show the minimum number of graphs between the value of 'max' and the number of ports really defined. This fixes the error messages of uninitialized values in lines 410 and 411. +- Fixed to honour the support of RAID controller parameters in the disk device + names defined in the disk graph. 3.1.0 - 15-Mar-2013 diff --git a/lib/disk.pm b/lib/disk.pm index 00951ab..8296ba9 100644 --- a/lib/disk.pm +++ b/lib/disk.pm @@ -41,6 +41,7 @@ sub disk_init { my $d = trim($dsk[$n]); $d =~ s/^\"//; $d =~ s/\"$//; + $d =~ s/^(.+?) .*$/$1/; next if -e $d; logger("ERROR: $myself: invalid or inexistent device name '$d'."); return; @@ -360,7 +361,8 @@ sub disk_cgi { push(@tmp, "COMMENT: \\n"); for($n = 0; $n < 8; $n++) { if($d[$n]) { - my ($dstr) = (split /\s+/, trim($d[$n])); + my $dstr = trim($d[$n]); + $dstr =~ s/^(.+?) .*$/$1/; $str = sprintf("%-20s", $dstr); push(@tmp, "LINE2:temp_" . $n . $LC[$n] . ":$str"); push(@tmpz, "LINE2:temp_" . $n . $LC[$n] . ":$dstr"); @@ -476,14 +478,18 @@ sub disk_cgi { undef(@tmpz); for($n = 0; $n < 8; $n += 2) { if($d[$n]) { - $str = sprintf("%-17s", substr($d[$n], 0, 17)); + my $dstr = trim($d[$n]); + $dstr =~ s/^(.+?) .*$/$1/; + $str = sprintf("%-17s", substr($dstr, 0, 17)); push(@tmp, "LINE2:rsc" . $n . $LC[$n] . ":$str"); - push(@tmpz, "LINE2:rsc" . $n . $LC[$n] . ":$d[$n]\\g"); + push(@tmpz, "LINE2:rsc" . $n . $LC[$n] . ":$dstr\\g"); } if($d[$n + 1]) { - $str = sprintf("%-17s", substr($d[$n + 1], 0, 17)); + my $dstr = trim($d[$n + 1]); + $dstr =~ s/^(.+?) .*$/$1/; + $str = sprintf("%-17s", substr($dstr, 0, 17)); push(@tmp, "LINE2:rsc" . ($n + 1) . $LC[$n + 1] . ":$str\\n"); - push(@tmpz, "LINE2:rsc" . ($n + 1) . $LC[$n + 1] . ":$d[$n + 1]\\g"); + push(@tmpz, "LINE2:rsc" . ($n + 1) . $LC[$n + 1] . ":$dstr\\g"); } } ($width, $height) = split('x', $config->{graph_size}->{small}); @@ -560,14 +566,18 @@ sub disk_cgi { undef(@tmpz); for($n = 0; $n < 8; $n += 2) { if($d[$n]) { - $str = sprintf("%-17s", substr($d[$n], 0, 17)); + my $dstr = trim($d[$n]); + $dstr =~ s/^(.+?) .*$/$1/; + $str = sprintf("%-17s", substr($dstr, 0, 17)); push(@tmp, "LINE2:cps" . $n . $LC[$n] . ":$str"); - push(@tmpz, "LINE2:cps" . $n . $LC[$n] . ":$d[$n]\\g"); + push(@tmpz, "LINE2:cps" . $n . $LC[$n] . ":$dstr\\g"); } if($d[$n + 1]) { - $str = sprintf("%-17s", substr($d[$n + 1], 0, 17)); + my $dstr = trim($d[$n + 1]); + $dstr =~ s/^(.+?) .*$/$1/; + $str = sprintf("%-17s", substr($dstr, 0, 17)); push(@tmp, "LINE2:cps" . ($n + 1) . $LC[$n + 1] . ":$str\\n"); - push(@tmpz, "LINE2:cps" . ($n + 1) . $LC[$n + 1] . ":$d[$n + 1]\\g"); + push(@tmpz, "LINE2:cps" . ($n + 1) . $LC[$n + 1] . ":$dstr\\g"); } } ($width, $height) = split('x', $config->{graph_size}->{small});