Package: fai-client
Version: 3.3.3

There are actually two problems in this bug report.  Both are
essentially problems with regex matching of program output that has
changed slightly with squeeze.  I have supplied a patch for both.

1) squeeze's mdadm reports arrays using the path /dev/md/0 instead of
/dev/md0 which results in the following error:
"mdadm ARRAY line not yet seen"

2) squeeze's parted reports sizes using GiB instead of GB which results
in the following error (for example):
convert_unit 3.75GiB

Attached is a very minor patch that should allow matching of updated
programs' outputs as well as remain backwards compatible with the old
style.

Thanks,
Brian
diff -Nur fai-client_3.3.3_all/usr/share/fai/setup-storage/Parser.pm 
fai-client_3.3.3_all.patched/usr/share/fai/setup-storage/Parser.pm
--- fai-client_3.3.3_all/usr/share/fai/setup-storage/Parser.pm  2010-02-03 
04:52:51.000000000 -0600
+++ fai-client_3.3.3_all.patched/usr/share/fai/setup-storage/Parser.pm  
2010-02-07 13:05:13.000000000 -0600
@@ -298,7 +298,12 @@
 sub convert_unit
 {
   my ($val) = @_;
-  ($val =~ /^(\d+(\.\d+)?)([kMGTP%]?)(B)?\s*$/) or
+  # Making the match work for squeeze machines too.
+  # The display units in terms of GiB, where the 'i' is new.
+  # 2010-02-07
+  # bpkroth
+  #($val =~ /^(\d+(\.\d+)?)([kMGTP%]?)(B)?\s*$/) or
+  ($val =~ /^(\d+(\.\d+)?)([kMGTP%]?)[i]?(B)?\s*$/) or
     &FAI::internal_error("convert_unit $val");
   $val = $1 * (1 / 1024) * (1 / 1024) if ($3 eq "" && defined ($4) && $4 eq 
"B");
   $val = $1 * (1 / 1024) if ($3 eq "k");
diff -Nur fai-client_3.3.3_all/usr/share/fai/setup-storage/Volumes.pm 
fai-client_3.3.3_all.patched/usr/share/fai/setup-storage/Volumes.pm
--- fai-client_3.3.3_all/usr/share/fai/setup-storage/Volumes.pm 2010-02-03 
04:52:51.000000000 -0600
+++ fai-client_3.3.3_all.patched/usr/share/fai/setup-storage/Volumes.pm 
2010-02-07 13:05:13.000000000 -0600
@@ -372,7 +372,12 @@
 
   # parse the output line by line
   foreach my $line (@mdadm_print) {
-    if ($line =~ /^ARRAY \/dev\/md(\d+) level=(\S+) num-devices=\d+(\s+|$)/) {
+    # Making the match work for squeeze machines as well.
+    # They display arrays in terms of /dev/md/0 where the '/' is new.
+    # 2010-02-07
+    # bpkroth
+    #if ($line =~ /^ARRAY \/dev\/md(\d+) level=(\S+) num-devices=\d+(\s+|$)/) {
+    if ($line =~ /^ARRAY \/dev\/md[\/]?(\d+) level=(\S+) 
num-devices=\d+(\s+|$)/) {
       $id = $1;
       $FAI::current_raid_config{$id}{mode} = $2;
       &FAI::push_command( "true", "", "exist_/dev/md$id" );

Attachment: pgpbmZg582caF.pgp
Description: PGP signature

Reply via email to