[Fai-commit] r6306 - branches/experimental/patches

Michael Tautschnig mt at alioth.debian.org
Thu Mar 10 15:33:19 UTC 2011


Author: mt
Date: 2011-03-10 15:33:11 +0000 (Thu, 10 Mar 2011)
New Revision: 6306

Added:
   branches/experimental/patches/setup-storage_deterministic-lv-ordering
Modified:
   branches/experimental/patches/series
Log:
Make on-disk order of logical volumes consistent with user-specified order
(otherwise breaks >2TB setups)


Modified: branches/experimental/patches/series
===================================================================
--- branches/experimental/patches/series	2011-03-10 15:02:38 UTC (rev 6305)
+++ branches/experimental/patches/series	2011-03-10 15:33:11 UTC (rev 6306)
@@ -24,3 +24,4 @@
 setup-storage_man-page-fixes
 setup-storage_better-error-msg
 setup-storage_lvm-raid-preserve
+setup-storage_deterministic-lv-ordering

Added: branches/experimental/patches/setup-storage_deterministic-lv-ordering
===================================================================
--- branches/experimental/patches/setup-storage_deterministic-lv-ordering	                        (rev 0)
+++ branches/experimental/patches/setup-storage_deterministic-lv-ordering	2011-03-10 15:33:11 UTC (rev 6306)
@@ -0,0 +1,59 @@
+2011-03-10  Michael Tautschnig  <mt at debian.org>
+
+	* setup-storage/Parser.pm: Build an additional list of logical volumes to make
+		on-disk order of logical volumes consistent with disk_config.
+	* setup-storage/Commands.pm: Implement this order.
+Index: trunk/lib/setup-storage/Parser.pm
+===================================================================
+--- trunk.orig/lib/setup-storage/Parser.pm
++++ trunk/lib/setup-storage/Parser.pm	
+@@ -821,6 +821,8 @@
+           # make sure, $2 has not been defined already
+           defined ($FAI::configs{$FAI::device}{volumes}{$2}{size}{range}) and 
+             die "Logical volume $2 has been defined already.\n";
++          # add to ordered list
++          push @{ $FAI::configs{$FAI::device}{ordered_lv_list} }, $2;
+           # initialise the new hash
+           defined($FAI::configs{$FAI::device}{volumes}{$2}) or
+             $FAI::configs{$FAI::device}{volumes}{$2} = {};
+@@ -874,6 +876,8 @@
+             $FAI::configs{$FAI::device}{volumes} = {};
+           # initialise the list of physical devices
+           $FAI::configs{$FAI::device}{devices} = ();
++          # initialise the ordered list of volumes
++          $FAI::configs{$FAI::device}{ordered_lv_list} = ();
+           # init device tree
+           $FAI::dev_children{$FAI::device} = ();
+           # the rule must not return undef
+@@ -1141,8 +1145,18 @@
+     if ($config =~ /^PHY_(.+)$/) {
+       (scalar(keys %{ $FAI::configs{$config}{partitions} }) > 0) or
+         die "Empty disk_config stanza for device $1\n";
++      foreach my $part_id (keys %{ $FAI::configs{$config}{partitions} }) {
++        ($FAI::configs{$config}{partitions}{$part_id}{number} == $part_id) or
++          &FAI::internal_error("Partition numbers are inconsistent");
++      }
+     } elsif ($config =~ /^VG_(.+)$/) {
+       next if ($1 eq "--ANY--");
++      (scalar(keys %{ $FAI::configs{$config}{volumes} }) ==
++        scalar(@{ $FAI::configs{$config}{ordered_lv_list} })) or
++        &FAI::internal_error("Inconsistent LV lists - missing entries");
++      defined($FAI::configs{$config}{volumes}{$_}) or
++        &FAI::internal_error("Inconsistent LV lists - missing entries")
++        foreach (@{ $FAI::configs{$config}{ordered_lv_list} });
+       next;
+     } elsif ($config eq "RAID") {
+       (scalar(keys %{ $FAI::configs{$config}{volumes} }) > 0) or
+Index: trunk/lib/setup-storage/Commands.pm
+===================================================================
+--- trunk.orig/lib/setup-storage/Commands.pm
++++ trunk/lib/setup-storage/Commands.pm	
+@@ -521,7 +521,7 @@
+   my $vg = $1; # the actual volume group
+ 
+   # now create or resize the configured logical volumes
+-  foreach my $lv (keys %{ $FAI::configs{$config}{volumes} }) {
++  foreach my $lv (@{ $FAI::configs{$config}{ordered_lv_list} }) {
+     # reference to the size of the current logical volume
+     my $lv_size = (\%FAI::configs)->{$config}->{volumes}->{$lv}->{size};
+     # skip preserved partitions, but ensure that they exist




More information about the Fai-commit mailing list