[Fai-commit] r5294 - people/michael/experimental/patches
mt at alioth.debian.org
mt at alioth.debian.org
Wed Mar 25 15:57:35 UTC 2009
Author: mt
Date: 2009-03-25 15:57:35 +0000 (Wed, 25 Mar 2009)
New Revision: 5294
Added:
people/michael/experimental/patches/bugfix-521153
Modified:
people/michael/experimental/patches/series
people/michael/experimental/patches/setup-storage_extended-opts
Log:
- Added patch to fix #521153
- #521172 has already been fixed by a previous patch (which was actually meant
to add additional features, but along the way it also fixes this issue)
Added: people/michael/experimental/patches/bugfix-521153
===================================================================
--- people/michael/experimental/patches/bugfix-521153 (rev 0)
+++ people/michael/experimental/patches/bugfix-521153 2009-03-25 15:57:35 UTC (rev 5294)
@@ -0,0 +1,72 @@
+2009-03-25 Michael Tautschnig <mt at debian.org>
+
+ * bin/setup-storage, setup-storage/Volumes.pm: When propagating preserve
+ markers also check to ensure that the to-be-preserved volume is defined at
+ all (closes: #521153)
+Index: trunk/bin/setup-storage
+===================================================================
+--- trunk.orig/bin/setup-storage
++++ trunk/bin/setup-storage
+@@ -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;
+Index: trunk/lib/setup-storage/Volumes.pm
+===================================================================
+--- trunk.orig/lib/setup-storage/Volumes.pm
++++ trunk/lib/setup-storage/Volumes.pm
+@@ -408,24 +408,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;
+ }
+@@ -434,6 +441,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 {
Modified: people/michael/experimental/patches/series
===================================================================
--- people/michael/experimental/patches/series 2009-03-21 19:20:07 UTC (rev 5293)
+++ people/michael/experimental/patches/series 2009-03-25 15:57:35 UTC (rev 5294)
@@ -19,3 +19,4 @@
setup-storage_full-crypto-support
bugfix-520554
ifconfig2ip
+bugfix-521153
Modified: people/michael/experimental/patches/setup-storage_extended-opts
===================================================================
--- people/michael/experimental/patches/setup-storage_extended-opts 2009-03-21 19:20:07 UTC (rev 5293)
+++ people/michael/experimental/patches/setup-storage_extended-opts 2009-03-25 15:57:35 UTC (rev 5294)
@@ -1,8 +1,9 @@
2009-03-20 Michael Tautschnig <mt at debian.org>
* setup-storage/Parser.pm, setup-storage/Commands.pm: Added support for
- optional (pv|vg|lv|md)createopts and moved parsing of createopts,tuneopts to
- Parser.pm
+ optional (pv|vg|lv|md)createopts
+ * Moved parsing of createopts,tuneopts to Parser.pm for simpler code and
+ better syntax checking (closes: #521172)
* man/setup-storage.8: Documented new options
Index: trunk/lib/setup-storage/Commands.pm
===================================================================
More information about the Fai-commit
mailing list