[Fai-commit] r6122 - branches/experimental/patches
Michael Tautschnig
mt at alioth.debian.org
Tue Oct 12 21:33:58 UTC 2010
Author: mt
Date: 2010-10-12 21:33:54 +0000 (Tue, 12 Oct 2010)
New Revision: 6122
Added:
branches/experimental/patches/setup-storage_entire-disk-in-volume
branches/experimental/patches/setup-storage_no-empty-config
Modified:
branches/experimental/patches/series
Log:
Trying to fix problems reported by Peter Kruse
Modified: branches/experimental/patches/series
===================================================================
--- branches/experimental/patches/series 2010-10-10 09:01:08 UTC (rev 6121)
+++ branches/experimental/patches/series 2010-10-12 21:33:54 UTC (rev 6122)
@@ -21,3 +21,5 @@
improved-doc-of-hooks
setup-storage_quote-preserved-type
install-packages_hold-bugfix
+setup-storage_no-empty-config
+setup-storage_entire-disk-in-volume
Added: branches/experimental/patches/setup-storage_entire-disk-in-volume
===================================================================
--- branches/experimental/patches/setup-storage_entire-disk-in-volume (rev 0)
+++ branches/experimental/patches/setup-storage_entire-disk-in-volume 2010-10-12 21:33:54 UTC (rev 6122)
@@ -0,0 +1,40 @@
+2010-10-12 Michael Tautschnig <mt at debian.org>
+
+ * setup-storage/Commands.pm: Use proper dependencies when entire disks are
+ used as part of a RAID or LVM volume (thanks Peter Kruse for reporting).
+Index: trunk/lib/setup-storage/Commands.pm
+===================================================================
+--- trunk.orig/lib/setup-storage/Commands.pm
++++ trunk/lib/setup-storage/Commands.pm
+@@ -183,7 +183,9 @@
+ # set the raid/lvm unless this is an entire disk flag
+ my $cmd = "parted -s $disk set $part_no $t on";
+ $cmd = "true" if ($part_no == -1);
+- &FAI::push_command( $cmd, "cleared2_$disk,exist_$d", "type_${t}_$d" );
++ my $pre = "exist_$d";
++ $pre .= ",cleared2_$disk" if (defined($FAI::configs{"PHY_$disk"}));
++ &FAI::push_command( $cmd, "$pre", "type_${t}_$d" );
+ if (defined($FAI::partition_table_deps{$disk})) {
+ $FAI::partition_table_deps{$disk} .= ",type_${t}_$d";
+ } else {
+@@ -324,12 +326,15 @@
+ }
+
+ $d = &FAI::enc_name($d);
+- if ($vol->{preserve}) {
+- $pre_req .= (&FAI::phys_dev($d))[0] ?
+- ",pt_complete_" . (&FAI::phys_dev($d))[1] :
+- ",exist_$d";
++ my ($i_p_d, $disk, $part_no) = &FAI::phys_dev($d);
++ if ($vol->{preserve}) {
++ $pre_req .= ($i_p_d && defined($FAI::configs{"PHY_$disk"})) ?
++ ",pt_complete_$disk" :
++ ",exist_$d";
+ } elsif (&FAI::set_partition_type_on_phys_dev($d, "raid")) {
+- $pre_req .= ",pt_complete_" . (&FAI::phys_dev($d))[1];
++ $pre_req .= defined($FAI::configs{"PHY_$disk"}) ?
++ ",pt_complete_$disk" :
++ ",exist_$d";
+ } else {
+ $pre_req .= ",exist_$d";
+ }
Added: branches/experimental/patches/setup-storage_no-empty-config
===================================================================
--- branches/experimental/patches/setup-storage_no-empty-config (rev 0)
+++ branches/experimental/patches/setup-storage_no-empty-config 2010-10-12 21:33:54 UTC (rev 6122)
@@ -0,0 +1,56 @@
+2010-10-11 Michael Tautschnig <mt at debian.org>
+
+ * setup-storage, setup-storage/Parser.pm: Perform additional check for invalid
+ configs (such as empty disk_config X stanzas).
+Index: trunk/bin/setup-storage
+===================================================================
+--- trunk.orig/bin/setup-storage
++++ trunk/bin/setup-storage
+@@ -127,6 +127,9 @@
+ print "Using config file: $opt_f\n";
+ &FAI::run_parser($config_file);
+
++# make sure there are no empty disk_config stanzas
++&FAI::check_config;
++
+ # read the sizes and partition tables of all disks listed in $FAI::disks
+ &FAI::get_current_disks;
+
+Index: trunk/lib/setup-storage/Parser.pm
+===================================================================
+--- trunk.orig/lib/setup-storage/Parser.pm
++++ trunk/lib/setup-storage/Parser.pm
+@@ -1076,5 +1076,33 @@
+ defined $FAI::Parser->file($input) or die "Syntax error\n";
+ }
+
++################################################################################
++#
++# @brief Check for invalid configs (despite correct syntax)
++#
++################################################################################
++sub check_config {
++
++ # 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";
++ } elsif ($config =~ /^VG_(.+)$/) {
++ next if ($1 eq "--ANY--");
++ next;
++ } elsif ($config eq "RAID") {
++ (scalar(keys %{ $FAI::configs{$config}{volumes} }) > 0) or
++ die "Empty RAID configuration\n";
++ } elsif ($config eq "CRYPT") {
++ next;
++ } elsif ($config eq "TMPFS") {
++ next;
++ } else {
++ &FAI::internal_error("Unexpected key $config");
++ }
++ }
++}
++
+ 1;
+
More information about the Fai-commit
mailing list