[Fai-commit] r6310 - branches/experimental/patches
Michael Tautschnig
mt at alioth.debian.org
Thu Mar 10 22:28:01 UTC 2011
Author: mt
Date: 2011-03-10 22:27:58 +0000 (Thu, 10 Mar 2011)
New Revision: 6310
Modified:
branches/experimental/patches/setup-storage_better-error-msg
branches/experimental/patches/setup-storage_deterministic-lv-ordering
branches/experimental/patches/setup-storage_lvm-raid-preserve
branches/experimental/patches/setup-storage_no-extra-number
Log:
Additional checks as suggested in #617720
Modified: branches/experimental/patches/setup-storage_better-error-msg
===================================================================
--- branches/experimental/patches/setup-storage_better-error-msg 2011-03-10 17:49:00 UTC (rev 6309)
+++ branches/experimental/patches/setup-storage_better-error-msg 2011-03-10 22:27:58 UTC (rev 6310)
@@ -3,6 +3,8 @@
* setup-storage/Parser.pm: Fix error message in case of duplicate definitions
of a single disk. Sensible diagnostics instead of just printing "Syntax
error" for several syntax errors. Thanks Toomas Tamm for reporting this.
+ Perform more advanced consistency checking for duplicate mount points
+ (closes: #617720).
* setup-storage/Volumes.pm: Proper error reporting for wrong disk names (one
die was overridden by yet another die); more verbose output in case of
unexpected mdadm output (closes: #611728).
@@ -29,6 +31,64 @@
comment: /^\s*#.*/
+@@ -1068,20 +1069,57 @@
+ ################################################################################
+ sub check_config {
+
++ my %all_mount_pts = ();
++
+ # loop through all configs
+ foreach my $config (keys %FAI::configs) {
+ if ($config =~ /^PHY_(.+)$/) {
+ (scalar(keys %{ $FAI::configs{$config}{partitions} }) > 0) or
+ die "Empty disk_config stanza for device $1\n";
++ foreach my $p (keys %{ $FAI::configs{$config}{partitions} }) {
++ my $this_mp = $FAI::configs{$config}{partitions}{$p}{mountpoint};
++ next if ($this_mp eq "-");
++ defined($all_mount_pts{$this_mp}) and die
++ "Mount point $this_mp used twice\n";
++ ($this_mp eq "none") or $all_mount_pts{$this_mp} = 1;
++ }
+ } elsif ($config =~ /^VG_(.+)$/) {
+ next if ($1 eq "--ANY--");
++ foreach my $p (keys %{ $FAI::configs{$config}{volumes} }) {
++ my $this_mp = $FAI::configs{$config}{volumes}{$p}{mountpoint};
++ next if ($this_mp eq "-");
++ defined($all_mount_pts{$this_mp}) and die
++ "Mount point $this_mp used twice\n";
++ ($this_mp eq "none") or $all_mount_pts{$this_mp} = 1;
++ }
+ next;
+ } elsif ($config eq "RAID") {
+ (scalar(keys %{ $FAI::configs{$config}{volumes} }) > 0) or
+ die "Empty RAID configuration\n";
++ foreach my $p (keys %{ $FAI::configs{$config}{volumes} }) {
++ my $this_mp = $FAI::configs{$config}{volumes}{$p}{mountpoint};
++ next if ($this_mp eq "-");
++ defined($all_mount_pts{$this_mp}) and die
++ "Mount point $this_mp used twice\n";
++ ($this_mp eq "none") or $all_mount_pts{$this_mp} = 1;
++ }
+ } elsif ($config eq "CRYPT") {
++ foreach my $p (keys %{ $FAI::configs{$config}{volumes} }) {
++ my $this_mp = $FAI::configs{$config}{volumes}{$p}{mountpoint};
++ next if ($this_mp eq "-");
++ defined($all_mount_pts{$this_mp}) and die
++ "Mount point $this_mp used twice\n";
++ ($this_mp eq "none") or $all_mount_pts{$this_mp} = 1;
++ }
+ next;
+ } elsif ($config eq "TMPFS") {
++ foreach my $p (keys %{ $FAI::configs{$config}{volumes} }) {
++ my $this_mp = $FAI::configs{$config}{volumes}{$p}{mountpoint};
++ next if ($this_mp eq "-");
++ defined($all_mount_pts{$this_mp}) and die
++ "Mount point $this_mp used twice\n";
++ ($this_mp eq "none") or $all_mount_pts{$this_mp} = 1;
++ }
+ next;
+ } else {
+ &FAI::internal_error("Unexpected key $config");
Index: trunk/lib/setup-storage/Volumes.pm
===================================================================
--- trunk.orig/lib/setup-storage/Volumes.pm
Modified: branches/experimental/patches/setup-storage_deterministic-lv-ordering
===================================================================
--- branches/experimental/patches/setup-storage_deterministic-lv-ordering 2011-03-10 17:49:00 UTC (rev 6309)
+++ branches/experimental/patches/setup-storage_deterministic-lv-ordering 2011-03-10 22:27:58 UTC (rev 6310)
@@ -25,14 +25,8 @@
# init device tree
$FAI::dev_children{$FAI::device} = ();
# the rule must not return undef
-@@ -1127,8 +1131,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");
-+ }
+@@ -1140,6 +1144,12 @@
+ }
} elsif ($config =~ /^VG_(.+)$/) {
next if ($1 eq "--ANY--");
+ (scalar(keys %{ $FAI::configs{$config}{volumes} }) ==
@@ -41,9 +35,9 @@
+ 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
+ foreach my $p (keys %{ $FAI::configs{$config}{volumes} }) {
+ my $this_mp = $FAI::configs{$config}{volumes}{$p}{mountpoint};
+ next if ($this_mp eq "-");
Index: trunk/lib/setup-storage/Commands.pm
===================================================================
--- trunk.orig/lib/setup-storage/Commands.pm
Modified: branches/experimental/patches/setup-storage_lvm-raid-preserve
===================================================================
--- branches/experimental/patches/setup-storage_lvm-raid-preserve 2011-03-10 17:49:00 UTC (rev 6309)
+++ branches/experimental/patches/setup-storage_lvm-raid-preserve 2011-03-10 22:27:58 UTC (rev 6310)
@@ -578,3 +578,30 @@
}
}
1;
+@@ -1081,6 +1134,8 @@
+ next if ($this_mp eq "-");
+ defined($all_mount_pts{$this_mp}) and die
+ "Mount point $this_mp used twice\n";
++ defined($FAI::dev_children{&FAI::make_device_name($1, $p)}) and die
++ "Mount point $this_mp is shadowed by stacked devices\n";
+ ($this_mp eq "none") or $all_mount_pts{$this_mp} = 1;
+ }
+ } elsif ($config =~ /^VG_(.+)$/) {
+@@ -1090,6 +1145,8 @@
+ next if ($this_mp eq "-");
+ defined($all_mount_pts{$this_mp}) and die
+ "Mount point $this_mp used twice\n";
++ defined($FAI::dev_children{"/dev/$1/$p"}) and die
++ "Mount point $this_mp is shadowed by stacked devices\n";
+ ($this_mp eq "none") or $all_mount_pts{$this_mp} = 1;
+ }
+ next;
+@@ -1101,6 +1158,8 @@
+ next if ($this_mp eq "-");
+ defined($all_mount_pts{$this_mp}) and die
+ "Mount point $this_mp used twice\n";
++ defined($FAI::dev_children{"/dev/md$p"}) and die
++ "Mount point $this_mp is shadowed by stacked devices\n";
+ ($this_mp eq "none") or $all_mount_pts{$this_mp} = 1;
+ }
+ } elsif ($config eq "CRYPT") {
Modified: branches/experimental/patches/setup-storage_no-extra-number
===================================================================
--- branches/experimental/patches/setup-storage_no-extra-number 2011-03-10 17:49:00 UTC (rev 6309)
+++ branches/experimental/patches/setup-storage_no-extra-number 2011-03-10 22:27:58 UTC (rev 6310)
@@ -43,17 +43,6 @@
# the partition is not an extended one
$FAI::partition_pointer->{size}->{extended} = 0;
-@@ -1131,10 +1123,6 @@
- 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} }) ==
Index: trunk/lib/setup-storage/Sizes.pm
===================================================================
--- trunk.orig/lib/setup-storage/Sizes.pm
More information about the Fai-commit
mailing list