From 76d03b65faecad3c6a1f132edfd57e0296a5d580 Mon Sep 17 00:00:00 2001 From: thomas Date: Thu, 16 Feb 2023 11:25:14 +0100 Subject: [PATCH 1/3] mxraid/mxraid_assemble: Add a comment for disk key regex --- mxraid/mxraid_assemble | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mxraid/mxraid_assemble b/mxraid/mxraid_assemble index be43a8a..5256d2e 100755 --- a/mxraid/mxraid_assemble +++ b/mxraid/mxraid_assemble @@ -712,7 +712,7 @@ exit; my @ret; my $num = scalar @$dev_list; for (my $i=0; $i<$num; $i++) { - my ($dk) = $dev_list->[$i] =~ m|([^/]+)$|; + my ($dk) = $dev_list->[$i] =~ m|([^/]+)$|; # '/sys/block/sda' -> 'sda' my $model = sys_fs_get_prop('/sys/block/'.$dk.'/device/model'); my $sizeb = sys_fs_get_prop('/sys/block/'.$dk.'/size') * 512; From 00cfc1fb3f121fe8ce237f936004b673fb1eac34 Mon Sep 17 00:00:00 2001 From: thomas Date: Thu, 16 Feb 2023 11:38:41 +0100 Subject: [PATCH 2/3] mxraid/mxraid_assemble: Fix smartctl callup Possible cause for the bug: smartctl_info was only tested when starting the code, later on the the switch from a simple device key to dev_list was forgotten in this function. --- mxraid/mxraid_assemble | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mxraid/mxraid_assemble b/mxraid/mxraid_assemble index 5256d2e..1ac07d0 100755 --- a/mxraid/mxraid_assemble +++ b/mxraid/mxraid_assemble @@ -735,7 +735,7 @@ exit; $serial_number =~ s/^\s+//; } else { if ($self->{root_priv}) { - $serial_number = smartctl_info($dev_list->[$i], 'Serial_Number'); + $serial_number = smartctl_info('/dev/'.$dk, 'Serial_Number'); } else { warn "# You must be root to query '$dk'.\n" if $self->{verbose} >= 1; } @@ -801,6 +801,7 @@ exit; if ($parse) { my ($key, $val) = $_ =~ m/^([^:]+):\s*(.+)$/; next unless defined $key and defined $val; + $key =~ s/\s+/_/g; $smart_data{$key} = $val; } } From 9cb66bbcb14cb8b002b45cccabb22e2fac0cd01d Mon Sep 17 00:00:00 2001 From: thomas Date: Thu, 16 Feb 2023 15:33:08 +0100 Subject: [PATCH 3/3] mxraid/mxraid_assemble: Raise version to 1.2 --- mxraid/mxraid_assemble | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mxraid/mxraid_assemble b/mxraid/mxraid_assemble index 1ac07d0..3d5bc18 100755 --- a/mxraid/mxraid_assemble +++ b/mxraid/mxraid_assemble @@ -14,7 +14,7 @@ import MxRaid::HostData; import MxRaid::Utils; import MxRaid::Color; -my $VERSION = '1.1'; +my $VERSION = '1.2'; sub exec_usage {