[Fai-commit] r5422 - people/michael/experimental/patches

Michael Tautschnig mt at alioth.debian.org
Thu Jun 25 20:39:01 UTC 2009


Author: mt
Date: 2009-06-25 20:39:00 +0000 (Thu, 25 Jun 2009)
New Revision: 5422

Added:
   people/michael/experimental/patches/setup-storage_mdadm-parser-bugfix
Modified:
   people/michael/experimental/patches/bugfix-532321
   people/michael/experimental/patches/series
   people/michael/experimental/patches/setup-storage_better-error-msgs
Log:
- added bugfix for new mdadm output
- proper handling of vol_id -l exit code 3 (to be ignored)
- fixed patch for #532321 as suggested by Cajus


Modified: people/michael/experimental/patches/bugfix-532321
===================================================================
--- people/michael/experimental/patches/bugfix-532321	2009-06-13 20:32:51 UTC (rev 5421)
+++ people/michael/experimental/patches/bugfix-532321	2009-06-25 20:39:00 UTC (rev 5422)
@@ -1,13 +1,13 @@
-2009-06-13  Michael Tautschnig  <mt at debian.org>
+2009-06-25  Michael Tautschnig  <mt at debian.org>
 
 	* setup-storage/Volumes.pm: Fixed perl syntax error, properly handle existing
-		empty volume groups (thanks Brian Kroth for debugging this).
-		(closes: #532321)
+		empty volume groups (thanks Brian Kroth and Cajus Pollmeier for debugging
+		this).  (closes: #532321)
 Index: trunk/lib/setup-storage/Volumes.pm
 ===================================================================
 --- trunk.orig/lib/setup-storage/Volumes.pm
 +++ trunk/lib/setup-storage/Volumes.pm	
-@@ -305,23 +305,23 @@
+@@ -305,23 +305,26 @@
    foreach my $vg (get_volume_group_list()) {
      # initialise the hash entry
      $FAI::current_lvm_config{$vg}{physical_volumes} = ();
@@ -16,13 +16,18 @@
  
      # store the vg size in MB
      my %vg_info = get_volume_group_information($vg);
-     $FAI::current_lvm_config{$vg}{size} =
+-    $FAI::current_lvm_config{$vg}{size} =
 -      &FAI::convert_unit( $vg_info{alloc_pe_size} .
 -        $vg_info{alloc_pe_size_unit} );
-+      &FAI::convert_unit($vg_info{alloc_pe_size} ?
-+        ($vg_info{alloc_pe_size} . $vg_info{alloc_pe_size_unit}):"0M");
++    if (defined %vg_info) {
++      $FAI::current_lvm_config{$vg}{size} = $vg_info{alloc_pe_size} .
++        $vg_info{alloc_pe_size_unit};
++    } else {
++      $FAI::current_lvm_config{$vg}{size} = "0M";
++    }
  
-       # store the logical volumes and their sizes
+-      # store the logical volumes and their sizes
++    # store the logical volumes and their sizes
      my %lv_info = get_logical_volume_information($vg);
      foreach my $lv_name (sort keys %lv_info) {
        my $short_name = $lv_name;

Modified: people/michael/experimental/patches/series
===================================================================
--- people/michael/experimental/patches/series	2009-06-13 20:32:51 UTC (rev 5421)
+++ people/michael/experimental/patches/series	2009-06-25 20:39:00 UTC (rev 5422)
@@ -16,3 +16,4 @@
 bugfix-532321
 setup-storage_raid10
 setup-storage_better-error-msgs
+setup-storage_mdadm-parser-bugfix

Modified: people/michael/experimental/patches/setup-storage_better-error-msgs
===================================================================
--- people/michael/experimental/patches/setup-storage_better-error-msgs	2009-06-13 20:32:51 UTC (rev 5421)
+++ people/michael/experimental/patches/setup-storage_better-error-msgs	2009-06-25 20:39:00 UTC (rev 5422)
@@ -1,11 +1,11 @@
-2009-06-13  Michael Tautschnig  <mt at debian.org>
+2009-06-25  Michael Tautschnig  <mt at debian.org>
 
 	* setup-storage, setup-storage/Sizes.pm: Properly handle -h, early check for
 		unset (but necessary) environment variables, print full device names in
 		several error/warning messages instead of the partition id only.
 	* setup-storage/Fstab.pm: Be more verbose if obtaining the UUID fails (may be
 		caused by earlier use in RAID array, tell the user how to solve the
-		problem).
+		problem). Ignore exit code 3 of vol_id -l.
 Index: trunk/bin/setup-storage
 ===================================================================
 --- trunk.orig/bin/setup-storage
@@ -192,7 +192,7 @@
 ===================================================================
 --- trunk.orig/lib/setup-storage/Fstab.pm
 +++ trunk/lib/setup-storage/Fstab.pm	
-@@ -99,7 +99,9 @@
+@@ -99,12 +99,16 @@
    # every device must have a uuid, otherwise this is an error (unless we
    # are testing only)
    ($FAI::no_dry_run == 0 || scalar (@uuid) == 1)
@@ -201,5 +201,14 @@
 +      This may happen if the device was part of a RAID array in the past;\n
 +      in this case run mdadm --zero-superblock $device_name and retry\n";
  
-   # get the label -- this is likely empty
+-  # get the label -- this is likely empty
++  # get the label -- this is likely empty; exit code 3 if no label, but that is
++  # ok here
    my @label = ();
+   &FAI::execute_ro_command(
+-    "/lib/udev/vol_id -l $device_name", \@label, 0);
++    "( /lib/udev/vol_id -l $device_name ; exc=\$? ; if [ \$exc -eq 3 ] ;" .
++    " then exit 0 ; else exit \$exc ; fi )", \@label, 0);
+ 
+   # using the fstabkey value the desired device entry is defined
+   if ($key_type eq "uuid") {

Added: people/michael/experimental/patches/setup-storage_mdadm-parser-bugfix
===================================================================
--- people/michael/experimental/patches/setup-storage_mdadm-parser-bugfix	                        (rev 0)
+++ people/michael/experimental/patches/setup-storage_mdadm-parser-bugfix	2009-06-25 20:39:00 UTC (rev 5422)
@@ -0,0 +1,37 @@
+2009-06-25  Michael Tautschnig  <mt at debian.org>
+
+	* setup-storage/Volumes.pm: Updated mdadm --scan output parser to work with
+		current mdadm versions.
+Index: trunk/lib/setup-storage/Volumes.pm
+===================================================================
+--- trunk.orig/lib/setup-storage/Volumes.pm
++++ trunk/lib/setup-storage/Volumes.pm	
+@@ -357,17 +357,27 @@
+ #    devices=/dev/hda1,/dev/hda2
+ # ARRAY /dev/md1 level=raid0 num-devices=2 UUID=50d7a6ec:4207f0db:b110d941:ce79a4f6
+ #    devices=/dev/md0,/dev/hda3
++# or (newer version of mdadm?)
++# kueppers[~]# mdadm --detail --scan --verbose -c partitions
++# ARRAY /dev/md0 level=raid0 num-devices=3 metadata=00.90
++# UUID=a4553444:0baf31ae:135399f0:a895f15f
++#    devices=/dev/sdf2,/dev/sdd2,/dev/sde2
++# ARRAY /dev/md1 level=raid0 num-devices=3 metadata=00.90
++# 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+ UUID=/) {
++    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" );
+     } elsif ($line =~ /^\s*devices=(\S+)$/) {
++      defined($id) or &FAI::internal_error("mdadm ARRAY line not yet seen");
+       @{ $FAI::current_raid_config{$id}{devices} } = split (",", $1);
+     }
+   }




More information about the Fai-commit mailing list