[Fai-commit] r6442 - branches/stable/3.4/lib/setup-storage

Michael Prokop mika at alioth.debian.org
Fri Apr 15 18:14:12 UTC 2011


Author: mika
Date: 2011-04-15 18:14:04 +0000 (Fri, 15 Apr 2011)
New Revision: 6442

Modified:
   branches/stable/3.4/lib/setup-storage/Commands.pm
   branches/stable/3.4/lib/setup-storage/Parser.pm
Log:
setup-storage/{Parser,Commands}.pm: Make on-disk LV order consistent with disk_config

* 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.

(cherry picked from commit 13135c8b520f7c34a50af3f9dd2f9328ca2ca2b8)

Modified: branches/stable/3.4/lib/setup-storage/Commands.pm
===================================================================
--- branches/stable/3.4/lib/setup-storage/Commands.pm	2011-04-15 18:13:45 UTC (rev 6441)
+++ branches/stable/3.4/lib/setup-storage/Commands.pm	2011-04-15 18:14:04 UTC (rev 6442)
@@ -508,7 +508,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

Modified: branches/stable/3.4/lib/setup-storage/Parser.pm
===================================================================
--- branches/stable/3.4/lib/setup-storage/Parser.pm	2011-04-15 18:13:45 UTC (rev 6441)
+++ branches/stable/3.4/lib/setup-storage/Parser.pm	2011-04-15 18:14:04 UTC (rev 6442)
@@ -715,6 +715,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} = {};
@@ -764,6 +766,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
@@ -1047,6 +1051,12 @@
       }
     } 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} });
       foreach my $p (keys %{ $FAI::configs{$config}{volumes} }) {
         my $this_mp = $FAI::configs{$config}{volumes}{$p}{mountpoint};
         next if ($this_mp eq "-");




More information about the Fai-commit mailing list