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

Michael Tautschnig mt at alioth.debian.org
Sat Jun 13 18:50:36 UTC 2009


Author: mt
Date: 2009-06-13 18:50:34 +0000 (Sat, 13 Jun 2009)
New Revision: 5418

Added:
   people/michael/experimental/patches/bugfix-532321
   people/michael/experimental/patches/setup-storage_raid10
Modified:
   people/michael/experimental/patches/series
Log:
added patches for setup-storage:
- bugfix of 532321
- added support for raid10


Added: people/michael/experimental/patches/bugfix-532321
===================================================================
--- people/michael/experimental/patches/bugfix-532321	                        (rev 0)
+++ people/michael/experimental/patches/bugfix-532321	2009-06-13 18:50:34 UTC (rev 5418)
@@ -0,0 +1,38 @@
+2009-06-13  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)
+Index: trunk/lib/setup-storage/Volumes.pm
+===================================================================
+--- trunk.orig/lib/setup-storage/Volumes.pm
++++ trunk/lib/setup-storage/Volumes.pm	
+@@ -305,23 +305,23 @@
+   foreach my $vg (get_volume_group_list()) {
+     # initialise the hash entry
+     $FAI::current_lvm_config{$vg}{physical_volumes} = ();
+-    &FAI::push_command( "true", "", "vg_created_$vg" );
++    &FAI::push_command("true", "", "vg_created_$vg");
+ 
+     # store the vg size in MB
+     my %vg_info = get_volume_group_information($vg);
+     $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");
+ 
+       # 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;
+-      $short_name =~ "s{/dev/\Q$vg\E/}{}";
++      $short_name =~ s{/dev/\Q$vg\E/}{};
+       $FAI::current_lvm_config{$vg}{volumes}{$short_name}{size} =
+         &FAI::convert_unit($lv_info{$lv_name}->{lv_size} .
+           $lv_info{$lv_name}->{lv_size_unit});
+-      &FAI::push_command( "true", "", "exist_/dev/$vg/$short_name" );
++      &FAI::push_command("true", "", "exist_/dev/$vg/$short_name");
+     }
+ 
+     # store the physical volumes

Modified: people/michael/experimental/patches/series
===================================================================
--- people/michael/experimental/patches/series	2009-06-13 14:42:00 UTC (rev 5417)
+++ people/michael/experimental/patches/series	2009-06-13 18:50:34 UTC (rev 5418)
@@ -13,3 +13,5 @@
 bugfix-515704
 setup-storage_raid-preserve-entry-missing
 setup-storage_udevsettle
+bugfix-532321
+setup-storage_raid10

Added: people/michael/experimental/patches/setup-storage_raid10
===================================================================
--- people/michael/experimental/patches/setup-storage_raid10	                        (rev 0)
+++ people/michael/experimental/patches/setup-storage_raid10	2009-06-13 18:50:34 UTC (rev 5418)
@@ -0,0 +1,47 @@
+2009-06-13  Michael Tautschnig  <mt at debian.org>
+
+	* setup-storage/Parser.pm, setup-storage/Sizes.pm: Added support for raid10
+		(thanks William Francis for suggesting this).
+Index: trunk/lib/setup-storage/Parser.pm
+===================================================================
+--- trunk.orig/lib/setup-storage/Parser.pm
++++ trunk/lib/setup-storage/Parser.pm	
+@@ -458,7 +458,7 @@
+         }
+ 
+     volume: /^vg\s+/ name devices vgcreateopt(s?)
+-        | /^raid([0156])\s+/
++        | /^raid([0156]|10)\s+/
+         {
+           # make sure that this is a RAID configuration
+           ($FAI::device eq "RAID") or die "RAID entry invalid in this context\n";
+Index: trunk/lib/setup-storage/Sizes.pm
+===================================================================
+--- trunk.orig/lib/setup-storage/Sizes.pm
++++ trunk/lib/setup-storage/Sizes.pm	
+@@ -146,6 +146,7 @@
+       # we can only estimate the sizes of existing volumes, assume the missing
+       # ones aren't smaller
+       foreach (@devcands) {
++        $dev_count-- if ($FAI::configs{RAID}{volumes}{$1}{devices}{$_}{spare});
+         next if ($FAI::configs{RAID}{volumes}{$1}{devices}{$_}{missing});
+         push @devs, $_;
+       }
+@@ -165,7 +166,7 @@
+     $level = "raid$level" if ($level =~ /^\d+$/);
+ 
+     # now do the mode-specific size estimations
+-    if ($level =~ /^raid[015]$/) {
++    if ($level =~ /^raid([0156]|10)$/) {
+       my $min_size = &estimate_size(shift @devs);
+       foreach (@devs) {
+         my $s = &FAI::estimate_size($_);
+@@ -175,6 +176,8 @@
+       return $min_size * $dev_count if ($level eq "raid0");
+       return $min_size if ($level eq "raid1");
+       return $min_size * ($dev_count - 1) if ($level eq "raid5");
++      return $min_size * ($dev_count - 2) if ($level eq "raid6");
++      return $min_size * ($dev_count/2) if ($level eq "raid10");
+     } else {
+ 
+       # probably some more should be implemented




More information about the Fai-commit mailing list