[Fai-commit] r5318 - in trunk: bin debian lib/setup-storage

Michael Tautschnig mt at alioth.debian.org
Thu Apr 9 17:59:22 UTC 2009


Author: mt
Date: 2009-04-09 17:59:22 +0000 (Thu, 09 Apr 2009)
New Revision: 5318

Modified:
   trunk/bin/setup-storage
   trunk/debian/changelog
   trunk/lib/setup-storage/Volumes.pm
Log:
applied bugfix for #521153 (fai-client: setup-storage prints perl warning
instead of clear message) in trunk


Modified: trunk/bin/setup-storage
===================================================================
--- trunk/bin/setup-storage	2009-04-09 17:22:31 UTC (rev 5317)
+++ trunk/bin/setup-storage	2009-04-09 17:59:22 UTC (rev 5318)
@@ -115,8 +115,9 @@
 print "Using config file: $opt_f\n";
 &FAI::run_parser($config_file);
 
-# mark devices as preserve, where not all already done so
-&FAI::propagate_preserve;
+# mark devices as preserve, where not all already done so and check that only
+# defined devices are marked preserve
+&FAI::propagate_and_check_preserve;
 
 # read the sizes and partition tables of all disks listed in $FAI::disks
 &FAI::get_current_disks;

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2009-04-09 17:22:31 UTC (rev 5317)
+++ trunk/debian/changelog	2009-04-09 17:59:22 UTC (rev 5318)
@@ -74,6 +74,9 @@
     must be read using $PIPESTATUS, not $? (closes: #444210)
   * bin/faimond: Try to load Proc::Daemon only in case -d is given; if it
     fails, print a helpful error message (closes: #513090)
+  * bin/setup-storage, setup-storage/Volumes.pm: When propagating preserve
+    markers also check whether the to-be-preserved volume is defined at all
+    (closes: #521153)
 
  -- Thomas Lange <lange at debian.org>  Thu, 09 Apr 2009 17:02:27 +0200
 

Modified: trunk/lib/setup-storage/Volumes.pm
===================================================================
--- trunk/lib/setup-storage/Volumes.pm	2009-04-09 17:22:31 UTC (rev 5317)
+++ trunk/lib/setup-storage/Volumes.pm	2009-04-09 17:59:22 UTC (rev 5318)
@@ -407,24 +407,31 @@
 ################################################################################
 #
 # @brief Mark devices as preserve, in case an LVM volume or RAID device shall be
-# preserved
+# preserved and check that only defined devices are marked preserve
 #
 ################################################################################
-sub propagate_preserve {
+sub propagate_and_check_preserve {
 
   # loop through all configs
   foreach my $config (keys %FAI::configs) {
 
-    # no physical devices here
-    next if ($config =~ /^PHY_./);
-
-    if ($config =~ /^VG_(.+)$/) {
+    if ($config =~ /^PHY_(.+)$/) {
+      foreach my $part_id (&numsort(keys %{ $FAI::configs{$config}{partitions} })) {
+        my $part = (\%FAI::configs)->{$config}->{partitions}->{$part_id};
+        next unless ($part->{size}->{preserve} || $part->{size}->{resize});
+        defined ($part->{size}->{range}) or die
+          "Can't preserve ". &FAI::make_device_name($1, $part->{number})
+            . " because it is not defined in the current config\n";
+      }
+    } elsif ($config =~ /^VG_(.+)$/) {
       next if ($1 eq "--ANY--");
       # check for logical volumes that need to be preserved and preserve the
       # underlying devices recursively
       foreach my $l (keys %{ $FAI::configs{$config}{volumes} }) {
         next unless ($FAI::configs{$config}{volumes}{$l}{size}{preserve} == 1 ||
           $FAI::configs{$config}{volumes}{$l}{size}{resize} == 1);
+        defined ($FAI::configs{$config}{volumes}{$l}{size}{range}) or die
+          "Can't preserve /dev/$1/$l because it is not defined in the current config\n";
         &FAI::mark_preserve($_) foreach (keys %{ $FAI::configs{$config}{devices} });
         last;
       }
@@ -433,6 +440,8 @@
       # devices recursively
       foreach my $r (keys %{ $FAI::configs{$config}{volumes} }) {
         next unless ($FAI::configs{$config}{volumes}{$r}{preserve} == 1);
+        defined ($FAI::configs{$config}{volumes}{$r}{devices}) or die
+          "Can't preserve /dev/md$r because it is not defined in the current config\n";
         &FAI::mark_preserve($_) foreach (keys %{ $FAI::configs{$config}{volumes}{$r}{devices} });
       }
     } else {




More information about the Fai-commit mailing list