[Fai-commit] r6112 - branches/stable/3.4/lib/setup-storage
Michael Prokop
mika at alioth.debian.org
Tue Oct 5 15:17:11 UTC 2010
Author: mika
Date: 2010-10-05 15:16:57 +0000 (Tue, 05 Oct 2010)
New Revision: 6112
Modified:
branches/stable/3.4/lib/setup-storage/Volumes.pm
Log:
Rework mdadm output parsing code to make it more tolerant to changes in the output format
Modified: branches/stable/3.4/lib/setup-storage/Volumes.pm
===================================================================
--- branches/stable/3.4/lib/setup-storage/Volumes.pm 2010-10-05 15:16:47 UTC (rev 6111)
+++ branches/stable/3.4/lib/setup-storage/Volumes.pm 2010-10-05 15:16:57 UTC (rev 6112)
@@ -436,20 +436,30 @@
# ARRAY /dev/md1 level=raid0 num-devices=3 metadata=00.90
# UUID=77a22e9f:83fd1276:135399f0:a895f15f
# devices=/dev/sde3,/dev/sdf3,/dev/sdd3
+# and another variant
+# ARRAY /dev/md1 level=raid0 metadata=1.2 num-devices=3
+# UUID=77a22e9f:83fd1276:135399f0:a895f15f
+# devices=/dev/sde3,/dev/sdf3,/dev/sdd3
-
# the id of the RAID
my $id;
# parse the output line by line
foreach my $line (@mdadm_print) {
- if ($line =~ /^ARRAY \/dev\/md[\/]?(\d+) level=(\S+) num-devices=\d+(\s+|$)/) {
+ if ($line =~ /^ARRAY \/dev\/md[\/]?(\d+)\s+/) {
$id = $1;
- $FAI::current_raid_config{$id}{mode} = $2;
+
+ foreach (split (" ", $line)) {
+ if ($_ =~ /^level=(\S+)/) {
+ $FAI::current_raid_config{$id}{mode} = $1;
+ }
+ }
} elsif ($line =~ /^\s*devices=(\S+)$/) {
defined($id) or &FAI::internal_error("mdadm ARRAY line not yet seen");
push @{ $FAI::current_raid_config{$id}{devices} }, abs_path($_)
foreach (split (",", $1));
+
+ undef($id);
}
}
}
More information about the Fai-commit
mailing list