[Fai-commit] r6335 - branches/experimental/patches

Michael Tautschnig mt at alioth.debian.org
Thu Apr 14 12:25:54 UTC 2011


Author: mt
Date: 2011-04-14 12:25:50 +0000 (Thu, 14 Apr 2011)
New Revision: 6335

Removed:
   branches/experimental/patches/setup-storage_better-error-msg
   branches/experimental/patches/setup-storage_extended-is-not-last
   branches/experimental/patches/setup-storage_gpt-bios-fix
   branches/experimental/patches/setup-storage_lvm-raid-preserve
   branches/experimental/patches/setup-storage_no-decimal
   branches/experimental/patches/setup-storage_no-empty-config
Modified:
   branches/experimental/patches/series
   branches/experimental/patches/setup-storage_cryptsetup-passphrase
   branches/experimental/patches/setup-storage_deterministic-lv-ordering
   branches/experimental/patches/setup-storage_devmapper
   branches/experimental/patches/setup-storage_disklist-LOGDIR-defaults
   branches/experimental/patches/setup-storage_internals-cleanup
   branches/experimental/patches/setup-storage_no-cylinder-boundaries
   branches/experimental/patches/setup-storage_preserve-format-all
Log:
Merged several patches into trunk


Modified: branches/experimental/patches/series
===================================================================
--- branches/experimental/patches/series	2011-04-14 11:31:40 UTC (rev 6334)
+++ branches/experimental/patches/series	2011-04-14 12:25:50 UTC (rev 6335)
@@ -7,23 +7,17 @@
 setup-storage_devmapper
 fix-eval_cmdline
 ainsl_man-page-return-codes
-setup-storage_extended-is-not-last
 setup-storage_preserve-format-all
-setup-storage_gpt-bios-fix
 setup-storage_user-100-percent
 bugfix-498412
 ftar_rm-fix
 fcopy_symlinks
 setup-storage_cryptsetup-passphrase
-setup-storage_no-empty-config
 setup-storage_disklist-LOGDIR-defaults
 grub-in-target
 setup-storage_hardcode-63-sectors
-setup-storage_no-decimal
 fcopy-unchanged-uid-gid
 setup-storage_man-page-fixes
-setup-storage_better-error-msg
-setup-storage_lvm-raid-preserve
 setup-storage_deterministic-lv-ordering
 setup-storage_internals-cleanup
 make-fai-nfsroot_add-keys

Deleted: branches/experimental/patches/setup-storage_better-error-msg
===================================================================
--- branches/experimental/patches/setup-storage_better-error-msg	2011-04-14 11:31:40 UTC (rev 6334)
+++ branches/experimental/patches/setup-storage_better-error-msg	2011-04-14 12:25:50 UTC (rev 6335)
@@ -1,133 +0,0 @@
-2010-12-16  Michael Tautschnig  <mt at debian.org>
-
-	* 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).
-	* setup-storage/Init.pm: Use Carp::confess to produce stack traces when
-		calling internal_error.
-Index: trunk/lib/setup-storage/Parser.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Parser.pm
-+++ trunk/lib/setup-storage/Parser.pm
-@@ -128,7 +128,7 @@
- 
-   # test, whether this is the first disk_config stanza to configure $disk
-   defined ($FAI::configs{$FAI::device})
--    and die "Duplicate configuration for disk $FAI::disks[ $1-1 ]\n";
-+    and die "Duplicate configuration for disk $disk\n";
- 
-   # Initialise the entry in $FAI::configs
-   $FAI::configs{$FAI::device} = {
-@@ -384,6 +384,7 @@
-     line: <skip: qr/[ \t]*/> "\\n"
-         | <skip: qr/[ \t]*/> comment "\\n"
-         | <skip: qr/[ \t]*/> config "\\n"
-+        | <error>
- 
-     comment: /^\s*#.*/
- 
-@@ -1068,20 +1069,60 @@
- ################################################################################
- 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} }) {
-+        next if (1 == $FAI::configs{$config}{partitions}{$p}{size}{extended});
-+        defined($FAI::configs{$config}{partitions}{$p}{mountpoint}) or
-+          &FAI::internal_error("Undefined mountpoint for non-extended partition");
-+        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
-+++ trunk/lib/setup-storage/Volumes.pm
-@@ -456,7 +456,9 @@
- 	  }
-       }
-     } elsif ($line =~ /^\s*devices=(\S+)$/) {
--      defined($id) or &FAI::internal_error("mdadm ARRAY line not yet seen");
-+      defined($id) or
-+        &FAI::internal_error("mdadm ARRAY line not yet seen -- unexpected mdadm output:\n"
-+          . join("", @mdadm_print));
-       push @{ $FAI::current_raid_config{$id}{devices} }, abs_path($_)
-         foreach (split (",", $1));
-  
-@@ -534,6 +536,8 @@
-           defined ($FAI::current_config{$1}) or die
-             "Can't preserve $1 because it does not exist\n";
-         } else {
-+          defined ($FAI::current_config{$1}) or die
-+            "Can't preserve partition on $1 because $1 does not exist\n";
-           defined ($FAI::current_config{$1}{partitions}{$part_id}) or die
-             "Can't preserve ". &FAI::make_device_name($1, $part->{number})
-               . " because it does not exist\n";
-Index: trunk/lib/setup-storage/Init.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Init.pm
-+++ trunk/lib/setup-storage/Init.pm
-@@ -302,7 +302,9 @@
- 
-   my ($error_msg) = @_;
- 
--  die <<EOF;
-+  use Carp;
-+  $Carp::CarpLevel = 1;
-+  confess <<EOF;
- INTERNAL ERROR in setup-storage:
- $error_msg
- Please report this error to the Debian Bug Tracking System.

Modified: branches/experimental/patches/setup-storage_cryptsetup-passphrase
===================================================================
--- branches/experimental/patches/setup-storage_cryptsetup-passphrase	2011-04-14 11:31:40 UTC (rev 6334)
+++ branches/experimental/patches/setup-storage_cryptsetup-passphrase	2011-04-14 12:25:50 UTC (rev 6335)
@@ -47,8 +47,8 @@
 ===================================================================
 --- trunk.orig/lib/setup-storage/Parser.pm
 +++ trunk/lib/setup-storage/Parser.pm
-@@ -695,7 +695,7 @@
-           $FAI::partition_pointer = (\%FAI::configs)->{RAID}->{volumes}->{$vol_id};
+@@ -735,7 +735,7 @@
+           $FAI::partition_pointer_dev_name = "/dev/md$vol_id";
          }
          mountpoint devices filesystem mount_options mdcreateopts
 -        | /^(luks|tmp|swap)\s+/
@@ -73,7 +73,7 @@
  .br
           | tmp
  .br
-@@ -602,9 +606,11 @@
+@@ -604,9 +608,11 @@
  reasons why a system may fail to boot.
  .IP \(bu
  Crypto support requires some site-specific changes: If you use cryptsetup

Modified: branches/experimental/patches/setup-storage_deterministic-lv-ordering
===================================================================
--- branches/experimental/patches/setup-storage_deterministic-lv-ordering	2011-04-14 11:31:40 UTC (rev 6334)
+++ branches/experimental/patches/setup-storage_deterministic-lv-ordering	2011-04-14 12:25:50 UTC (rev 6335)
@@ -7,7 +7,7 @@
 ===================================================================
 --- trunk.orig/lib/setup-storage/Parser.pm
 +++ trunk/lib/setup-storage/Parser.pm
-@@ -807,6 +807,8 @@
+@@ -806,6 +806,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";
@@ -16,7 +16,7 @@
            # initialise the new hash
            defined($FAI::configs{$FAI::device}{volumes}{$2}) or
              $FAI::configs{$FAI::device}{volumes}{$2} = {};
-@@ -860,6 +862,8 @@
+@@ -859,6 +861,8 @@
              $FAI::configs{$FAI::device}{volumes} = {};
            # initialise the list of physical devices
            $FAI::configs{$FAI::device}{devices} = ();
@@ -25,7 +25,7 @@
            # init device tree
            $FAI::dev_children{$FAI::device} = ();
            # the rule must not return undef
-@@ -1143,6 +1147,12 @@
+@@ -1142,6 +1146,12 @@
        }
      } elsif ($config =~ /^VG_(.+)$/) {
        next if ($1 eq "--ANY--");

Modified: branches/experimental/patches/setup-storage_devmapper
===================================================================
--- branches/experimental/patches/setup-storage_devmapper	2011-04-14 11:31:40 UTC (rev 6334)
+++ branches/experimental/patches/setup-storage_devmapper	2011-04-14 12:25:50 UTC (rev 6335)
@@ -2,7 +2,7 @@
 ===================================================================
 --- trunk.orig/lib/setup-storage/Init.pm
 +++ trunk/lib/setup-storage/Init.pm
-@@ -195,6 +195,7 @@
+@@ -203,6 +203,7 @@
      defined($2) or return (1, "/dev/$1", -1);
      return (1, "/dev/$1", $3);
    }

Modified: branches/experimental/patches/setup-storage_disklist-LOGDIR-defaults
===================================================================
--- branches/experimental/patches/setup-storage_disklist-LOGDIR-defaults	2011-04-14 11:31:40 UTC (rev 6334)
+++ branches/experimental/patches/setup-storage_disklist-LOGDIR-defaults	2011-04-14 12:25:50 UTC (rev 6335)
@@ -65,7 +65,7 @@
  
  # the config source file
  my $config_file = undef;
-@@ -211,23 +218,23 @@
+@@ -223,23 +230,23 @@
  # print fstab
  $FAI::debug and print "$_\n" foreach (@fstab);
  
@@ -95,7 +95,7 @@
    print DISK_VAR "$_=\${$_:-$FAI::disk_var{$_}}\n" foreach (keys %FAI::disk_var);
    close DISK_VAR;
  }
-@@ -235,10 +242,10 @@
+@@ -247,10 +254,10 @@
  # print crypttab
  $FAI::debug and print "$_\n" foreach (@FAI::crypttab);
  

Deleted: branches/experimental/patches/setup-storage_extended-is-not-last
===================================================================
--- branches/experimental/patches/setup-storage_extended-is-not-last	2011-04-14 11:31:40 UTC (rev 6334)
+++ branches/experimental/patches/setup-storage_extended-is-not-last	2011-04-14 12:25:50 UTC (rev 6335)
@@ -1,93 +0,0 @@
-2010-06-19  Michael Tautschnig  <mt at debian.org>
-
-	* setup-storage/Sizes.pm: Properly handle extended partitions that aren't the
-		last primary partition.
-Index: trunk/lib/setup-storage/Sizes.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Sizes.pm
-+++ trunk/lib/setup-storage/Sizes.pm
-@@ -361,15 +361,9 @@
-     ($part->{size}->{extended} == $curr_part->{is_extended})
-       or die "Preserved partition $part_dev_name can't change extended/normal setting\n";
- 
--    # extended partitions consume no space
--    if ($part->{size}->{extended}) {
--
--      # revert the addition of the size
--      $min_req_total_space -= $part->{size}->{eff_size};
--
--      # set the next start to the start of the extended partition
--      $next_start = $part->{start_byte};
--    }
-+    # extended partitions are not handled in here (anymore)
-+    ($part->{size}->{extended})
-+      and die &FAI::internal_error("Preserve must not handle extended partitions\n");
-   }
- 
-   # on gpt, ensure that the partition ends at a sector boundary
-@@ -704,37 +698,45 @@
-       # reference to the current partition
-       my $part = (\%FAI::configs)->{$config}->{partitions}->{$part_id};
- 
--      # the partition $part_id must be preserved
--      if ($part->{size}->{preserve}) {
--        ($next_start, $min_req_total_space) = &FAI::do_partition_preserve($part_id, 
--          $config, $disk, $next_start, $min_req_total_space);
--
--        # partition done
--        shift @worklist;
--      }
--
-       # msdos specific: deal with extended partitions
--      elsif ($part->{size}->{extended}) {
-+      if ($part->{size}->{extended}) {
-+        # handle logical partitions first
-+        if (scalar (@worklist) > 1) {
-+          my @old_worklist = @worklist;
-+          @worklist = ();
-+          my @primaries = ();
-+          foreach my $p (@old_worklist) {
-+            if ($p > 4) {
-+              push @worklist, $p;
-+            } else {
-+              push @primaries, $p;
-+            }
-+          }
-+          if (scalar (@worklist)) {
-+            push @worklist, @primaries;
-+            next;
-+          }
-+          @worklist = @primaries;
-+        }
-+
-         # make sure that there is only one extended partition
--        ($extended == -1 || 1 == scalar (@worklist))
--          or &FAI::internal_error("More than 1 extended partition");
-+        ($extended == -1) or &FAI::internal_error("More than 1 extended partition");
- 
-         # set the local variable to this id
-         $extended = $part_id;
- 
--        # the size cannot be determined now, push it to the end of the
--        # worklist; the check against $extended being == -1 ensures that
--        # there is no indefinite loop
--        if (scalar (@worklist) > 1) {
--          push @worklist, shift @worklist;
--          next;
--        }
--
-         # determine the size of the extended partition
-         &FAI::do_partition_extended($part_id, $config, $current_disk);
- 
-         # partition done
-         shift @worklist;
-+      # the partition $part_id must be preserved
-+      } elsif ($part->{size}->{preserve}) {
-+        ($next_start, $min_req_total_space) = &FAI::do_partition_preserve($part_id,
-+          $config, $disk, $next_start, $min_req_total_space);
-+
-+        # partition done
-+        shift @worklist;
-       } else {
-         ($next_start, $min_req_total_space) = &FAI::do_partition_real($part_id, 
-           $config, $disk, $next_start, $block_size, $min_req_total_space, \@worklist);

Deleted: branches/experimental/patches/setup-storage_gpt-bios-fix
===================================================================
--- branches/experimental/patches/setup-storage_gpt-bios-fix	2011-04-14 11:31:40 UTC (rev 6334)
+++ branches/experimental/patches/setup-storage_gpt-bios-fix	2011-04-14 12:25:50 UTC (rev 6335)
@@ -1,43 +0,0 @@
-2011-03-10  Michael Tautschnig  <mt at debian.org>
-
-	* setup-storage/Sizes.pm: Make extra partition for gpt-bios the
-		first one location-wise but still give it the last id.
-Index: trunk/lib/setup-storage/Sizes.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Sizes.pm
-+++ trunk/lib/setup-storage/Sizes.pm
-@@ -675,13 +675,20 @@
-       $min_req_total_space += 33 * $current_disk->{sector_size};
- 
-       # on gpt-bios we'll need an additional partition to store what doesn't fit
--      # in the MBR
-+      # in the MBR; this partition must be at the beginning, but it should be
-+      # created at the very end such as not to invalidate indices of other
-+      # partitions
-       $FAI::device = $config;
-       &FAI::init_part_config("primary");
-       $FAI::configs{$config}{gpt_bios_part} = $FAI::partition_pointer->{number};
--      my $s = &FAI::convert_unit("120KiB");
-+      my ($s, $e) = &FAI::make_range("1-1", $current_disk->{size} . "B");
-       # enter the range into the hash
-       $FAI::partition_pointer->{size}->{range} = "$s-$s";
-+      # retain the free space at the beginning and fix the position
-+      $FAI::partition_pointer->{start_byte} = $next_start;
-+      $FAI::partition_pointer->{end_byte} = $next_start + $s - 1;
-+      $next_start += $s;
-+      $min_req_total_space += $s;
-       # set proper defaults
-       $FAI::partition_pointer->{encrypt} = 0;
-       $FAI::partition_pointer->{filesystem} = "-";
-@@ -731,6 +738,11 @@
- 
-         # partition done
-         shift @worklist;
-+      # the gpt-bios special partition is set up already
-+      } elsif (defined($FAI::configs{$config}{gpt_bios_part}) &&
-+        $FAI::configs{$config}{gpt_bios_part} == $part_id) {
-+        # partition done
-+        shift @worklist;
-       # the partition $part_id must be preserved
-       } elsif ($part->{size}->{preserve}) {
-         ($next_start, $min_req_total_space) = &FAI::do_partition_preserve($part_id,

Modified: branches/experimental/patches/setup-storage_internals-cleanup
===================================================================
--- branches/experimental/patches/setup-storage_internals-cleanup	2011-04-14 11:31:40 UTC (rev 6334)
+++ branches/experimental/patches/setup-storage_internals-cleanup	2011-04-14 12:25:50 UTC (rev 6335)
@@ -34,7 +34,7 @@
        my $part_size =
          (\%FAI::configs)->{$FAI::device}->{partitions}->{$extended}->{size};
  
-@@ -314,10 +310,6 @@
+@@ -313,10 +309,6 @@
      (\%FAI::configs)->{$FAI::device}->{partitions}->{$part_number};
    $FAI::partition_pointer_dev_name = &FAI::make_device_name($disk, $part_number);
  

Deleted: branches/experimental/patches/setup-storage_lvm-raid-preserve
===================================================================
--- branches/experimental/patches/setup-storage_lvm-raid-preserve	2011-04-14 11:31:40 UTC (rev 6334)
+++ branches/experimental/patches/setup-storage_lvm-raid-preserve	2011-04-14 12:25:50 UTC (rev 6335)
@@ -1,693 +0,0 @@
-2011-03-10  Michael Tautschnig  <mt at debian.org>
-
-	* setup-storage/Volumes.pm: Properly handle preserved partitions when marked
-		missing in RAID volume.
-	* setup-storage/Commands.pm: Don't add "missing" when doing mdadm --assemble.
-	* setup-storage/{Init,Parser,Volumes}.pm: Build device nesting tree.
-	* setup-storage/Commands.pm: Honor dependencies and nesting of LVM/RAID
-		devices when stopping and removing volumes and partitions.
-	* setup-storage/Commands.pm: Add mdadm --assemble call if arrays were detected
-		by mdadm --examine (these might exist but haven't necessarily been started).
-	* setup-storage/Exec.pm: Ignore error exit code 2 in this mdadm --assemble
-		call.
-	* setup-storage: Force start of arrays using mdadm-startall. Added debug
-		output of device nesting tree.
-
-Index: trunk/lib/setup-storage/Volumes.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Volumes.pm
-+++ trunk/lib/setup-storage/Volumes.pm
-@@ -98,6 +98,9 @@
-     # make sure, $disk is a proper block device
-     (-b $disk) or die "$disk is not a block special device!\n";
- 
-+    # init device tree
-+    $FAI::current_dev_children{$disk} = ();
-+
-     # the list to hold the output of parted commands as parsed below
-     my @parted_print = ();
- 
-@@ -326,6 +329,9 @@
-       ( ( $FAI::current_config{$disk}{disklabel} eq "msdos" )
-           && ( $6 eq "extended" ) )
-         and $FAI::current_config{$disk}{partitions}{$1}{is_extended} = 1;
-+
-+      # add entry in device tree
-+      push @{ $FAI::current_dev_children{$disk} }, &FAI::make_device_name($disk, $1);
-     }
- 
-     # reset the output list
-@@ -378,6 +384,9 @@
-     # initialise the hash entry
-     $FAI::current_lvm_config{$vg}{physical_volumes} = ();
- 
-+    # init device tree
-+    $FAI::current_dev_children{"VG_$vg"} = ();
-+
-     # store the vg size in MB
-     my %vg_info = get_volume_group_information($vg);
-     if (%vg_info) {
-@@ -395,12 +404,19 @@
-       $FAI::current_lvm_config{$vg}{volumes}{$short_name}{size} =
-         &FAI::convert_unit($lv_info{$lv_name}->{lv_size} .
-           $lv_info{$lv_name}->{lv_size_unit});
-+      # add entry in device tree
-+      push @{ $FAI::current_dev_children{"VG_$vg"} }, $lv_name;
-     }
- 
-     # store the physical volumes
-     my %pv_info = get_physical_volume_information($vg);
--    push @{ $FAI::current_lvm_config{$vg}{physical_volumes} },
--      abs_path($_) foreach (sort keys %pv_info);
-+    foreach my $pv_name (sort keys %pv_info) {
-+      push @{ $FAI::current_lvm_config{$vg}{physical_volumes} },
-+        abs_path($pv_name);
-+
-+      # add entry in device tree
-+      push @{ $FAI::current_dev_children{abs_path($pv_name)} }, "VG_$vg";
-+    }
-   }
- 
- }
-@@ -442,29 +458,37 @@
- # UUID=77a22e9f:83fd1276:135399f0:a895f15f
- #    devices=/dev/sde3,/dev/sdf3,/dev/sdd3
- 
-+  # create a temporary mdadm-from-examine.conf
-+  open(MDADM_EX, ">$FAI::DATADIR/mdadm-from-examine.conf");
-+
-   # the id of the RAID
-   my $id;
- 
-   # parse the output line by line
-   foreach my $line (@mdadm_print) {
-+    print MDADM_EX "$line";
-     if ($line =~ /^ARRAY \/dev\/md[\/]?(\d+)\s+/) {
-       $id = $1;
- 
-       foreach (split (" ", $line)) {
--	  if ($_ =~ /^level=(\S+)/) {
--	      $FAI::current_raid_config{$id}{mode} = $1;
--	  }
-+        $FAI::current_raid_config{$id}{mode} = $1 if ($_ =~ /^level=(\S+)/);
-       }
-     } elsif ($line =~ /^\s*devices=(\S+)$/) {
-       defined($id) or
-         &FAI::internal_error("mdadm ARRAY line not yet seen -- unexpected mdadm output:\n"
--          . join("", @mdadm_print));
--      push @{ $FAI::current_raid_config{$id}{devices} }, abs_path($_)
--        foreach (split (",", $1));
-- 
-+        . join("", @mdadm_print));
-+      foreach my $d (split (",", $1)) {
-+        push @{ $FAI::current_raid_config{$id}{devices} }, abs_path($d);
-+
-+        # add entry in device tree
-+        push @{ $FAI::current_dev_children{abs_path($d)} }, "/dev/md$id";
-+      }
-+
-       undef($id);
-     }
-   }
-+
-+  close(MDADM_EX);
- }
- 
- 
-@@ -476,34 +500,49 @@
- #
- ################################################################################
- sub mark_preserve {
--  my ($device_name) = @_;
-+  my ($device_name, $missing) = @_;
-   my ($i_p_d, $disk, $part_no) = &FAI::phys_dev($device_name);
- 
-   if (1 == $i_p_d) {
--    defined ($FAI::current_config{$disk}{partitions}{$part_no}) or die
--      "Can't preserve $device_name because it does not exist\n";
--    if (defined($FAI::configs{"PHY_$disk"}{partitions}{$part_no})) {
-+    if (defined($FAI::configs{"PHY_$disk"}) &&
-+        defined($FAI::configs{"PHY_$disk"}{partitions}{$part_no})) {
-+      defined ($FAI::current_config{$disk}{partitions}{$part_no}) or die
-+        "Can't preserve $device_name because it does not exist\n";
-       $FAI::configs{"PHY_$disk"}{partitions}{$part_no}{size}{preserve} = 1;
-       $FAI::configs{"PHY_$disk"}{preserveparts} = 1;
-+    } elsif (0 == $missing) {
-+      defined ($FAI::current_config{$disk}{partitions}{$part_no}) or die
-+        "Can't preserve $device_name because it does not exist\n";
-     }
-   } elsif ($device_name =~ m{^/dev/md[\/]?(\d+)$}) {
-     my $vol = $1;
--    defined ($FAI::current_raid_config{$vol}) or die
--      "Can't preserve $device_name because it does not exist\n";
--    if (defined($FAI::configs{RAID}{volumes}{$vol}) && 
--        $FAI::configs{RAID}{volumes}{$vol}{preserve} != 1) {
--      $FAI::configs{RAID}{volumes}{$vol}{preserve} = 1;
--      &FAI::mark_preserve($_) foreach (keys %{ $FAI::configs{RAID}{volumes}{$vol}{devices} });
-+    if (defined($FAI::configs{RAID}) &&
-+        defined($FAI::configs{RAID}{volumes}{$vol})) {
-+      defined ($FAI::current_raid_config{$vol}) or die
-+        "Can't preserve $device_name because it does not exist\n";
-+      if ($FAI::configs{RAID}{volumes}{$vol}{preserve} != 1) {
-+        $FAI::configs{RAID}{volumes}{$vol}{preserve} = 1;
-+        &FAI::mark_preserve($_, $FAI::configs{RAID}{volumes}{$vol}{devices}{$_}{missing})
-+          foreach (keys %{ $FAI::configs{RAID}{volumes}{$vol}{devices} });
-+      }
-+    } elsif (0 == $missing) {
-+      defined ($FAI::current_raid_config{$vol}) or die
-+        "Can't preserve $device_name because it does not exist\n";
-     }
-   } elsif ($device_name =~ m{^/dev/([^/\s]+)/([^/\s]+)$}) {
-     my $vg = $1;
-     my $lv = $2;
--    defined ($FAI::current_lvm_config{$vg}{volumes}{$lv}) or die
--      "Can't preserve $device_name because it does not exist\n";
--    if (defined($FAI::configs{"VG_$vg"}{volumes}{$lv}) &&
--        $FAI::configs{"VG_$vg"}{volumes}{$lv}{size}{preserve} != 1) {
--      $FAI::configs{"VG_$vg"}{volumes}{$lv}{size}{preserve} = 1;
--      &FAI::mark_preserve($_) foreach (keys %{ $FAI::configs{"VG_$vg"}{devices} });
-+    if (defined($FAI::configs{"VG_$vg"}) &&
-+        defined($FAI::configs{"VG_$vg"}{volumes}{$lv})) {
-+      defined ($FAI::current_lvm_config{$vg}{volumes}{$lv}) or die
-+        "Can't preserve $device_name because it does not exist\n";
-+      if ($FAI::configs{"VG_$vg"}{volumes}{$lv}{size}{preserve} != 1) {
-+        $FAI::configs{"VG_$vg"}{volumes}{$lv}{size}{preserve} = 1;
-+        &FAI::mark_preserve($_, $missing) foreach (keys %{ $FAI::configs{"VG_$vg"}{devices} });
-+      }
-+    } elsif (0 == $missing) {
-+      defined ($FAI::current_lvm_config{$vg}{volumes}{$lv}) or die
-+        "Can't preserve $device_name because it does not exist\n";
-     }
-   } else {
-     warn "Don't know how to mark $device_name for preserve\n";
-@@ -561,7 +600,7 @@
-           "Can't preserve /dev/$1/$l because it does not exist\n";
-         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} });
-+        &FAI::mark_preserve($_, 0) foreach (keys %{ $FAI::configs{$config}{devices} });
-       }
-     } elsif ($config eq "RAID") {
-       # check for volumes that need to be preserved and preserve the underlying
-@@ -575,7 +614,8 @@
-           "Can't preserve /dev/md$r because it does not exist\n";
-         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} });
-+        &FAI::mark_preserve($_, $FAI::configs{$config}{volumes}{$r}{devices}{$_}{missing})
-+          foreach (keys %{ $FAI::configs{$config}{volumes}{$r}{devices} });
-       }
-     } elsif ($config eq "CRYPT") {
-       # We don't do preserve for encrypted partitions
-Index: trunk/lib/setup-storage/Commands.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Commands.pm
-+++ trunk/lib/setup-storage/Commands.pm
-@@ -290,6 +290,19 @@
- ################################################################################
- sub build_raid_commands {
- 
-+  # check RAID arrays if there are pre-existing ones
-+  &FAI::push_command("mdadm --assemble --scan --config=$FAI::DATADIR/mdadm-from-examine.conf",
-+    "", "mdadm_startall_examined") if (scalar(keys %FAI::current_raid_config));
-+  foreach my $id (keys %FAI::current_raid_config) {
-+    my $md = "/dev/md$id";
-+    my $pre_deps_cl = "mdadm_startall_examined";
-+    $pre_deps_cl .= ",self_cleared_" .
-+      join(",self_cleared_", @{ $FAI::current_dev_children{$md} })
-+      if (defined($FAI::current_dev_children{$md}) &&
-+        scalar(@{ $FAI::current_dev_children{$md} }));
-+    &FAI::push_command( "mdadm -W --stop $md", "$pre_deps_cl", "self_cleared_$md");
-+  }
-+
-   foreach my $config (keys %FAI::configs) { # loop through all configs
-     # no encrypted, tmpfs, LVM or physical devices here
-     next if ($config eq "CRYPT" || $config eq "TMPFS" || $config =~ /^VG_./ || $config =~ /^PHY_./);
-@@ -346,7 +359,7 @@
- 	$pre_req =~ s/^,//;
-         # Assemble the array
-         &FAI::push_command(
--	    "mdadm --assemble /dev/md$id " . join(" ", @eff_devs),
-+	    "mdadm --assemble /dev/md$id " . join(" ", grep(!/^missing$/, @eff_devs)),
- 	    "$pre_req", "exist_/dev/md$id");
- 
-         # create the filesystem on the volume, if requested
-@@ -411,14 +424,14 @@
-     # create all the devices
-     foreach my $d (keys %{ $FAI::configs{$config}{devices} }) {
-       $d = &FAI::enc_name($d);
--      my $pre = ",exist_$d";
-+      my $pre = "exist_$d";
-       my ($i_p_d, $disk, $part_no) = &FAI::phys_dev($d);
--      $pre = ",pt_complete_$disk"
-+      $pre .= ",pt_complete_$disk"
-         if (&FAI::set_partition_type_on_phys_dev($d, "lvm") &&
-           defined($FAI::configs{"PHY_$disk"}));
- 
-       &FAI::push_command( "pvcreate -ff -y $pv_create_options $d",
--        "all_pv_sigs_removed$pre", "pv_done_$d");
-+        "$pre", "pv_done_$d");
-       $devs .= " $d";
-       $pre_dev .= ",pv_done_$d";
-     }
-@@ -463,14 +476,14 @@
- 
-   # create all the devices
-   foreach my $dev (@new_devices) {
--    my $pre = ",exist_$dev";
-+    my $pre = "exist_$dev";
-     my ($i_p_d, $disk, $part_no) = &FAI::phys_dev($dev);
--    $pre = ",pt_complete_$disk"
-+    $pre .= ",pt_complete_$disk"
-       if (&FAI::set_partition_type_on_phys_dev($dev, "lvm") &&
-         defined($FAI::configs{"PHY_$disk"}));
- 
-     &FAI::push_command( "pvcreate -ff -y $pv_create_options $dev",
--      "all_pv_sigs_removed$pre", "pv_done_$dev");
-+      "$pre", "pv_done_$dev");
-     $pre_dev .= ",pv_done_$dev";
-   }
-   $pre_dev =~ s/^,//;
-@@ -481,7 +494,7 @@
-     &FAI::push_command( "vgextend $vg " . join (" ", @new_devices), "$pre_dev",
-       "vg_extended_$vg" );
-   } else {
--    &FAI::push_command( "true", "all_pv_sigs_removed,$pre_dev", "vg_extended_$vg" );
-+    &FAI::push_command( "true", "self_cleared_VG_$vg,$pre_dev", "vg_extended_$vg" );
-   }
- 
-   # run vgreduce to get them removed
-@@ -607,11 +620,13 @@
-         next;
-     } elsif ($dev =~ m{^/dev/md[\/]?(\d+)$}) {
-       my $vol = $1;
-+      defined ($FAI::configs{RAID}) or next;
-       defined ($FAI::configs{RAID}{volumes}{$vol}) or next;
-       next if (1 == $FAI::configs{RAID}{volumes}{$vol}{preserve});
-     } elsif ($dev =~ m{^/dev/([^/\s]+)/([^/\s]+)$}) {
-       my $ivg = $1;
-       my $lv = $2;
-+      defined($FAI::configs{"VG_$ivg"}) or next;
-       defined($FAI::configs{"VG_$ivg"}{volumes}{$lv}) or next;
-       next if (1 == $FAI::configs{"VG_$ivg"}{volumes}{$lv}{size}{preserve});
-     } else {
-@@ -623,26 +638,35 @@
-   }
- 
-   if (0 == $clear_vg) {
--    my $vg_setup_pre = "vgchange_a_n";
--    if (defined($FAI::configs{"VG_$vg"}{volumes})) {
-+    my $vg_setup_pre = "vgchange_a_n_VG_$vg";
-+    if (defined($FAI::configs{"VG_$vg"})) {
-       $FAI::configs{"VG_$vg"}{exists} = 1;
- 
-       # remove all volumes that do not exist anymore or need not be preserved
-       foreach my $lv (keys %{ $FAI::current_lvm_config{$vg}{volumes} }) {
-+        my $pre_deps_cl = "";
-+        $pre_deps_cl = ",self_cleared_" .
-+          join(",self_cleared_", @{ $FAI::current_dev_children{"/dev/$vg/$lv"} })
-+            if (defined($FAI::current_dev_children{"/dev/$vg/$lv"}) &&
-+              scalar(@{ $FAI::current_dev_children{"/dev/$vg/$lv"} }));
-         # skip preserved/resized volumes
-         if (defined ( $FAI::configs{"VG_$vg"}{volumes}{$lv})) {
-           if ($FAI::configs{"VG_$vg"}{volumes}{$lv}{size}{preserve} == 1 ||
-             $FAI::configs{"VG_$vg"}{volumes}{$lv}{size}{resize} == 1) {
--            &FAI::push_command("true", "vgchange_a_n", "exist_/dev/$vg/$lv");
-+            &FAI::push_command("true", "vgchange_a_n_VG_$vg$pre_deps_cl",
-+              "exist_/dev/$vg/$lv,self_cleared_/dev/$vg/$lv");
-             next;
-           }
-         }
- 
--        &FAI::push_command( "lvremove -f $vg/$lv", "vgchange_a_n", "lv_rm_$vg/$lv");
-+        &FAI::push_command( "lvremove -f $vg/$lv",
-+          "vgchange_a_n_VG_$vg$pre_deps_cl",
-+          "lv_rm_$vg/$lv,self_cleared_/dev/$vg/$lv");
-         $vg_setup_pre .= ",lv_rm_$vg/$lv";
-       }
-     } else {
--      &FAI::push_command("true", "vgchange_a_n", "exist_/dev/$vg/$_") foreach
-+      &FAI::push_command("true", "vgchange_a_n_VG_$vg",
-+        "exist_/dev/$vg/$_,self_cleared_/dev/$vg/$_") foreach
-         (keys %{ $FAI::current_lvm_config{$vg}{volumes} });
-     }
-     &FAI::push_command("true", $vg_setup_pre, "vg_exists_$vg");
-@@ -650,9 +674,16 @@
-     return 0;
-   }
- 
--  my $vg_destroy_pre = "vgchange_a_n";
-+  my $vg_destroy_pre = "vgchange_a_n_VG_$vg";
-   foreach my $lv (keys %{ $FAI::current_lvm_config{$vg}{volumes} }) {
--    &FAI::push_command( "lvremove -f $vg/$lv", "vgchange_a_n", "lv_rm_$vg/$lv");
-+    my $pre_deps_cl = "";
-+    $pre_deps_cl = ",self_cleared_" .
-+      join(",self_cleared_", @{ $FAI::current_dev_children{"/dev/$vg/$lv"} })
-+        if (defined($FAI::current_dev_children{"/dev/$vg/$lv"}) &&
-+          scalar(@{ $FAI::current_dev_children{"/dev/$vg/$lv"} }));
-+    &FAI::push_command( "lvremove -f $vg/$lv",
-+      "vgchange_a_n_VG_$vg$pre_deps_cl",
-+      "lv_rm_$vg/$lv,self_cleared_/dev/$vg/$lv");
-     $vg_destroy_pre .= ",lv_rm_$vg/$lv";
-   }
-   &FAI::push_command( "vgremove $vg", "$vg_destroy_pre", "vg_removed_$vg");
-@@ -662,7 +693,7 @@
-   $devices .= " " . &FAI::enc_name($_) foreach
-     (@{ $FAI::current_lvm_config{$vg}{physical_volumes} });
-   $FAI::debug and print "Erased devices:$devices\n";
--  &FAI::push_command( "pvremove $devices", "", "pv_sigs_removed_$vg" );
-+  &FAI::push_command( "pvremove $devices", "vg_removed_$vg", "pv_sigs_removed_$vg" );
-   return 1;
- }
- 
-@@ -676,14 +707,26 @@
- sub build_lvm_commands {
- 
-   # disable volumes if there are pre-existing ones
--  &FAI::push_command("vgchange -a n", "", "vgchange_a_n");
--  my $all_vg_pre = "vgchange_a_n";
--  if (scalar(keys %FAI::current_lvm_config)) {
--    foreach my $vg (keys %FAI::current_lvm_config) {
--      $all_vg_pre .= ",pv_sigs_removed_$vg" if (&FAI::cleanup_vg($vg));
--    }
-+  foreach my $d (keys %FAI::current_dev_children) {
-+    next unless ($d =~ /^VG_(.+)$/);
-+    my $vg = $1;
-+    my $vg_pre = "vgchange_a_n_VG_$vg";
-+    my $pre_deps_vgc = "";
-+    foreach my $c (@{ $FAI::current_dev_children{$d} }) {
-+      $pre_deps_vgc = ",self_cleared_" .
-+        join(",self_cleared_", @{ $FAI::current_dev_children{$c} })
-+        if (defined($FAI::current_dev_children{$c}) &&
-+          scalar(@{ $FAI::current_dev_children{$c} }));
-+    }
-+    $pre_deps_vgc =~ s/^,//;
-+    &FAI::push_command("vgchange -a n $1", "$pre_deps_vgc", $vg_pre);
-+    $vg_pre .= ",pv_sigs_removed_$vg" if (&FAI::cleanup_vg($vg));
-+    my $pre_deps_cl = "";
-+    $pre_deps_cl = ",self_cleared_" .
-+      join(",self_cleared_", @{ $FAI::current_dev_children{$d} })
-+      if (scalar(@{ $FAI::current_dev_children{$d} }));
-+    &FAI::push_command("true", "$vg_pre$pre_deps_cl", "self_cleared_VG_$vg");
-   }
--  &FAI::push_command("true", "$all_vg_pre", "all_pv_sigs_removed");
- 
-   # loop through all configs
-   foreach my $config (keys %FAI::configs) {
-@@ -913,8 +956,15 @@
-     or die "Can't change disklabel, partitions are to be preserved\n";
- 
-   # write the disklabel to drop the previous partition table
-+  my $pre_deps = "";
-+  foreach my $c (@{ $FAI::current_dev_children{$disk} }) {
-+    $pre_deps .= ",self_cleared_" .
-+    join(",self_cleared_", @{ $FAI::current_dev_children{$c} })
-+    if (defined($FAI::current_dev_children{$c}) &&
-+      scalar(@{ $FAI::current_dev_children{$c} }));
-+  }
-   &FAI::push_command( ($needs_resize ? "parted -s $disk mklabel $label" : "true"),
--    "exist_$disk,all_pv_sigs_removed", "cleared1_$disk" );
-+    "exist_$disk$pre_deps", "cleared1_$disk" );
- 
-   &FAI::rebuild_preserved_partitions($config, \@to_preserve) if ($needs_resize);
- 
-Index: trunk/bin/setup-storage
-===================================================================
---- trunk.orig/bin/setup-storage
-+++ trunk/bin/setup-storage
-@@ -137,6 +137,15 @@
- # make sure there are no empty disk_config stanzas
- &FAI::check_config;
- 
-+# first find the proper way to tell udev to settle
-+$FAI::udev_settle = "udevadm settle --timeout=10" if (&FAI::in_path("udevadm"));
-+$FAI::udev_settle = "udevsettle --timeout=10" if (&FAI::in_path("udevsettle"));
-+defined($FAI::udev_settle) or die "Failed to find determine a proper way to tell udev to settle; is udev installed?";
-+
-+# start all RAID arrays in case some of the aren't running yet
-+`mdadm-startall`;
-+`$FAI::udev_settle`;
-+
- # read the sizes and partition tables of all disks listed in $FAI::disks
- &FAI::get_current_disks;
- 
-@@ -170,6 +179,11 @@
- 
-   our %current_raid_config;
-   print Dumper \%current_raid_config;
-+
-+  print "Current device tree\n";
-+
-+  our %current_dev_children;
-+  print Dumper \%current_dev_children;
- }
- 
- # compute the new LVM and partition sizes; do the partition sizes first to have
-@@ -180,6 +194,8 @@
- # print the current contents of $FAI::configs
- $FAI::debug and print "Desired disk layout\n";
- $FAI::debug and print Dumper \%FAI::configs;
-+$FAI::debug and print "Desired device tree\n";
-+$FAI::debug and print Dumper \%FAI::dev_children;
- 
- # generate the command script
- &FAI::build_disk_commands;
-@@ -200,10 +216,6 @@
- }
- 
- # run the commands (if $FAI::no_dry_run is set)
--# first find the proper way to tell udev to settle
--$FAI::udev_settle = "udevadm settle --timeout=10" if (&FAI::in_path("udevadm"));
--$FAI::udev_settle = "udevsettle --timeout=10" if (&FAI::in_path("udevsettle"));
--defined($FAI::udev_settle) or die "Failed to find determine a proper way to tell udev to settle; is udev installed?";
- foreach (&numsort(keys %FAI::commands)) {
-   `$FAI::udev_settle`;
-   next if ($FAI::commands{$_}{cmd} eq "true");
-Index: trunk/lib/setup-storage/Init.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Init.pm
-+++ trunk/lib/setup-storage/Init.pm
-@@ -160,6 +160,14 @@
- 
- ################################################################################
- #
-+# @brief Map from devices to volumes stacked on top of them
-+#
-+################################################################################
-+%FAI::dev_children = ();
-+%FAI::current_dev_children = ();
-+
-+################################################################################
-+#
- # @brief Add command to hash
- #
- # @param cmd Command
-Index: trunk/lib/setup-storage/Parser.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Parser.pm
-+++ trunk/lib/setup-storage/Parser.pm
-@@ -140,6 +140,11 @@
-     partitions => {},
-     opts_all   => {}
-   };
-+
-+  # Init device tree object
-+  $FAI::dev_children{$disk} = ();
-+
-+  return 1;
- }
- 
- ################################################################################
-@@ -162,10 +167,13 @@
- 
-   # check that a physical device is being configured; logical partitions are
-   # only supported on msdos disk labels.
--  ($FAI::device =~ /^PHY_/ && ($type ne "logical"
-+  ($FAI::device =~ /^PHY_(.+)$/ && ($type ne "logical"
-       || $FAI::configs{$FAI::device}{disklabel} eq "msdos")) or 
-     die "Syntax error: invalid partition type";
- 
-+  # the disk
-+  my $disk = $1;
-+
-   # the index of the new partition
-   my $part_number = 0;
- 
-@@ -288,6 +296,9 @@
-       # add the resize = default flag, if it doesn't exist already
-       defined ($part_size->{resize})
-         or $part_size->{resize} = $resize_default;
-+
-+      # add entry to device tree
-+      push @{ $FAI::dev_children{$disk} }, &FAI::make_device_name($disk, $extended);
-     }
-   }
- 
-@@ -301,6 +312,7 @@
-   # the reference is used by all further processing of this config line
-   $FAI::partition_pointer =
-     (\%FAI::configs)->{$FAI::device}->{partitions}->{$part_number};
-+  $FAI::partition_pointer_dev_name = &FAI::make_device_name($disk, $part_number);
- 
-   # as we can't compute the index from the reference, we need to store the
-   # $part_number explicitly
-@@ -320,6 +332,9 @@
-   # add the resize = 0 flag, if it doesn't exist already
-   defined ($FAI::partition_pointer->{size}->{resize})
-     or $FAI::partition_pointer->{size}->{resize} = $resize_default;
-+
-+  # add entry to device tree
-+  push @{ $FAI::dev_children{$disk} }, $FAI::partition_pointer_dev_name;
- }
- 
- ################################################################################
-@@ -642,6 +657,18 @@
- 	  use Storable qw(dclone);
- 
- 	  $FAI::configs{$FAI::device} = dclone($FAI::configs{"PHY_" . $ref_dev});
-+    # add entries to device tree
-+    defined($FAI::dev_children{$ref_dev}) or
-+      &FAI::internal_error("dev_children missing reference entry");
-+    ($FAI::device =~ /^PHY_(.+)$/) or
-+      &FAI::internal_error("unexpected device name");
-+    my $disk = $1;
-+    foreach my $p (@{ $FAI::dev_children{$ref_dev} }) {
-+      my ($i_p_d, $rd, $pd) = &FAI::phys_dev($p);
-+      (1 == $i_p_d) or next;
-+      ($rd eq $ref_dev) or &FAI::internal_error("dev_children is inconsistent");
-+      push @{ $FAI::dev_children{$disk} }, &FAI::make_device_name($disk, $pd);
-+    }
- 	}
- 	| /^sameas:(\S+)/
- 	{
-@@ -651,6 +678,18 @@
- 	  use Storable qw(dclone);
- 
- 	  $FAI::configs{$FAI::device} = dclone($FAI::configs{"PHY_" . $ref_dev});
-+    # add entries to device tree
-+    defined($FAI::dev_children{$ref_dev}) or
-+      &FAI::internal_error("dev_children missing reference entry");
-+    ($FAI::device =~ /^PHY_(.+)$/) or
-+      &FAI::internal_error("unexpected device name");
-+    my $disk = $1;
-+    foreach my $p (@{ $FAI::dev_children{$ref_dev} }) {
-+      my ($i_p_d, $rd, $pd) = &FAI::phys_dev($p);
-+      (1 == $i_p_d) or next;
-+      ($rd eq $ref_dev) or &FAI::internal_error("dev_children is inconsistent");
-+      push @{ $FAI::dev_children{$disk} }, &FAI::make_device_name($disk, $pd);
-+    }
- 	}
-         | /^always_format:((\d+(,\d+)*)|all)/
-         {
-@@ -694,6 +733,7 @@
-           # set the reference to the current volume
-           # the reference is used by all further processing of this config line
-           $FAI::partition_pointer = (\%FAI::configs)->{RAID}->{volumes}->{$vol_id};
-+          $FAI::partition_pointer_dev_name = "/dev/md$vol_id";
-         }
-         mountpoint devices filesystem mount_options mdcreateopts
-         | /^(luks|luks:"[^"]+"|tmp|swap)\s+/
-@@ -714,6 +754,7 @@
-           $FAI::configs{CRYPT}{volumes}{$vol_id}{preserve} = 0;
- 
-           $FAI::partition_pointer = (\%FAI::configs)->{CRYPT}->{volumes}->{$vol_id};
-+          $FAI::partition_pointer_dev_name = "CRYPT$vol_id";
-         }
-         mountpoint devices filesystem mount_options lv_or_fsopts
-         | /^tmpfs\s+/
-@@ -734,6 +775,7 @@
-           $FAI::configs{TMPFS}{volumes}{$vol_id}{preserve} = 0;
- 
-           $FAI::partition_pointer = (\%FAI::configs)->{TMPFS}->{volumes}->{$vol_id};
-+          $FAI::partition_pointer_dev_name = "TMPFS$vol_id";
-         }
-         mountpoint tmpfs_size mount_options
-         | type mountpoint size filesystem mount_options lv_or_fsopts
-@@ -782,6 +824,9 @@
-           # set the reference to the current volume
-           # the reference is used by all further processing of this config line
-           $FAI::partition_pointer = (\%FAI::configs)->{$FAI::device}->{volumes}->{$2};
-+          $FAI::partition_pointer_dev_name = "/dev/$1/$2";
-+          # add entry to device tree
-+          push @{ $FAI::dev_children{$FAI::device} }, $FAI::partition_pointer_dev_name;
-         }
- 
-     mountpoint: m{^(-|swap|/[^\s\:]*)(:encrypt(:randinit)?)?}
-@@ -815,6 +860,8 @@
-             $FAI::configs{$FAI::device}{volumes} = {};
-           # initialise the list of physical devices
-           $FAI::configs{$FAI::device}{devices} = ();
-+          # init device tree
-+          $FAI::dev_children{$FAI::device} = ();
-           # the rule must not return undef
-           1;
-         }
-@@ -944,15 +991,21 @@
-                 "spare" => $spare,
-                 "missing" => $missing
-               };
-+              # add entry to device tree
-+              push @{ $FAI::dev_children{$dev} }, $FAI::partition_pointer_dev_name;
-             } elsif ($FAI::device eq "CRYPT") {
-               die "Failed to resolve $dev to a unique device name\n" if (scalar(@candidates) != 1);
-               $FAI::partition_pointer->{device} = $candidates[0];
-               &FAI::mark_encrypted($candidates[0]);
-+              # add entry to device tree
-+              push @{ $FAI::dev_children{$candidates[0]} }, $FAI::partition_pointer_dev_name;
-             } else {
-               die "Failed to resolve $dev to a unique device name\n" if (scalar(@candidates) != 1);
-               $dev = $candidates[0];
-               # create an empty hash for each device
-               $FAI::configs{$FAI::device}{devices}{$dev} = {};
-+              # add entry to device tree
-+              push @{ $FAI::dev_children{$dev} }, $FAI::device;
-             }
-           }
-           1;
-@@ -1084,6 +1137,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_(.+)$/) {
-@@ -1093,6 +1148,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;
-@@ -1104,6 +1161,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") {
-Index: trunk/lib/setup-storage/Exec.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Exec.pm
-+++ trunk/lib/setup-storage/Exec.pm
-@@ -178,6 +178,15 @@
-     exit_codes   => [0..255],
-   },
-   {
-+    error        => "mdadm_assemble",
-+    message      => "mdadm tried to assemble arrays but failed, ignoring as arrays might be running already\n",
-+    stderr_regex => '^$',
-+    stdout_regex => '^$',
-+    program      => "mdadm --assemble --scan --config=$FAI::DATADIR/mdadm-from-examine.conf",
-+    response     => "warn",
-+    exit_codes   => [2],
-+  },
-+  {
-     error        => "catch_all_nonzero_exit_code",
-     message      => "Command had non-zero exit code\n",
-     stderr_regex => "",

Modified: branches/experimental/patches/setup-storage_no-cylinder-boundaries
===================================================================
--- branches/experimental/patches/setup-storage_no-cylinder-boundaries	2011-04-14 11:31:40 UTC (rev 6334)
+++ branches/experimental/patches/setup-storage_no-cylinder-boundaries	2011-04-14 12:25:50 UTC (rev 6335)
@@ -32,7 +32,7 @@
  
      # make sure we don't change extended partitions to ordinary ones and
      # vice-versa
-@@ -407,9 +406,6 @@
+@@ -401,9 +400,6 @@
    ($part_id <= 4) or
      &FAI::internal_error("Extended partition wouldn't be a primary one");
  
@@ -42,7 +42,7 @@
    # initialise the size and the start byte
    $part->{size}->{eff_size} = 0;
    $part->{start_byte} = -1;
-@@ -418,10 +414,11 @@
+@@ -412,10 +408,11 @@
      next if ($p < 5);
  
      $part->{start_byte} = $FAI::configs{$config}{partitions}{$p}{start_byte} -
@@ -57,7 +57,7 @@
  
      $part->{end_byte} = $FAI::configs{$config}{partitions}{$p}{end_byte};
    }
-@@ -436,8 +433,9 @@
+@@ -430,8 +427,9 @@
  #
  # @param $part_id Partition id within $config
  # @param $config Disk config
@@ -68,7 +68,7 @@
  # @param $min_req_total_space Minimum space required on disk
  # @param $worklist Reference to the remaining partitions
  #
-@@ -446,7 +444,7 @@
+@@ -440,7 +438,7 @@
  ################################################################################
  sub do_partition_real {
  
@@ -77,7 +77,7 @@
    # reference to the current disk config
    my $current_disk = $FAI::current_config{$disk};
  
-@@ -456,6 +454,34 @@
+@@ -450,6 +448,34 @@
    my ($start, $end) = &FAI::make_range($part->{size}->{range},
      $current_disk->{size} . "B");
  
@@ -112,7 +112,7 @@
    # check, whether the size is fixed
    if ($end != $start) {
  
-@@ -483,11 +509,8 @@
+@@ -477,11 +503,8 @@
  
          # logical partitions require the space for the EPBR to be left
          # out
@@ -126,7 +126,7 @@
          last;
        } elsif ($FAI::configs{$config}{partitions}{$p}{size}{extended}) {
          next;
-@@ -497,13 +520,11 @@
+@@ -491,13 +514,11 @@
            $current_disk->{size} . "B");
  
          # logical partitions require the space for the EPBR to be left
@@ -144,7 +144,7 @@
          }
  
          $min_req_space += $min_size;
-@@ -535,48 +556,9 @@
+@@ -529,48 +550,9 @@
      $end   = $start;
    }
  
@@ -195,7 +195,7 @@
  
    # set $start and $end to the effective values
    $start = $end_byte - $next_start + 1;
-@@ -625,6 +607,21 @@
+@@ -619,6 +601,21 @@
      # reference to the current disk config
      my $current_disk = $FAI::current_config{$disk};
  
@@ -217,7 +217,7 @@
      # at various points the following code highly depends on the desired disk label!
      # initialise variables
      # the id of the extended partition to be created, if required
-@@ -668,13 +665,12 @@
+@@ -662,13 +659,12 @@
        $min_req_total_space += (34 + 33) * $current_disk->{sector_size};
  
      } elsif ($FAI::configs{$config}{disklabel} eq "gpt-bios") {
@@ -236,7 +236,7 @@
  
        # apparently parted insists in having some space left at the end too
        # modify the disk to claim the space for the second partition table
-@@ -741,7 +737,7 @@
+@@ -755,7 +751,7 @@
          shift @worklist;
        } else {
          ($next_start, $min_req_total_space) = &FAI::do_partition_real($part_id, 
@@ -249,7 +249,7 @@
 ===================================================================
 --- trunk.orig/lib/setup-storage/Parser.pm
 +++ trunk/lib/setup-storage/Parser.pm
-@@ -590,6 +590,10 @@
+@@ -630,6 +630,10 @@
          {
            $FAI::configs{$FAI::device}{partitions}{$_}{size}{always_format} = 1 foreach (split(",", $1));
          }
@@ -260,7 +260,7 @@
  
      volume: /^vg\s+/ name devices vgcreateopt(s?)
          | /^raid([0156]|10)\s+/
-@@ -739,7 +743,7 @@
+@@ -787,7 +791,7 @@
            1;
          }
  
@@ -269,7 +269,7 @@
          {
            # complete the size specification to be a range in all cases
            my $range = $1;
-@@ -770,7 +774,7 @@
+@@ -818,7 +822,7 @@
              $FAI::configs{$FAI::device}{preserveparts} = 1;
            }
          }
@@ -278,7 +278,7 @@
          {
            # complete the range by assuming 0 as the lower limit 
            my $range = "0$1";
-@@ -791,7 +795,7 @@
+@@ -839,7 +843,7 @@
          }
          | <error: invalid partition size near "$text">
  

Deleted: branches/experimental/patches/setup-storage_no-decimal
===================================================================
--- branches/experimental/patches/setup-storage_no-decimal	2011-04-14 11:31:40 UTC (rev 6334)
+++ branches/experimental/patches/setup-storage_no-decimal	2011-04-14 12:25:50 UTC (rev 6335)
@@ -1,22 +0,0 @@
-2010-12-03  Michael Tautschnig  <mt at debian.org>
-
-	* setup-storage.8: Clarify that partition/volume sizes are integers, not
-		decimal numbers.
-Index: trunk/man/setup-storage.8
-===================================================================
---- trunk.orig/man/setup-storage.8
-+++ trunk/man/setup-storage.8
-@@ -378,9 +378,11 @@
- .br
-          /* size in kilo (KiB), mega (default, MiB), giga (GiB), tera (TiB),
- .br
--          * petabytes (PiB) or percentage of disk size or RAM size;
-+          * petabytes (PiB) or percentage of disk size or RAM size; integers
-+.br
-+          * only, no decimal numbers.
- .br          
--          * in future releases KB, MB, GB, ... will be treated as 1000 instead
-+          * In future releases KB, MB, GB, ... will be treated as 1000 instead
- .br
-           * of 1024 (KiB, MiB, GiB, ...) multipliers */
- 

Deleted: branches/experimental/patches/setup-storage_no-empty-config
===================================================================
--- branches/experimental/patches/setup-storage_no-empty-config	2011-04-14 11:31:40 UTC (rev 6334)
+++ branches/experimental/patches/setup-storage_no-empty-config	2011-04-14 12:25:50 UTC (rev 6335)
@@ -1,56 +0,0 @@
-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
-@@ -1061,5 +1061,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;
- 

Modified: branches/experimental/patches/setup-storage_preserve-format-all
===================================================================
--- branches/experimental/patches/setup-storage_preserve-format-all	2011-04-14 11:31:40 UTC (rev 6334)
+++ branches/experimental/patches/setup-storage_preserve-format-all	2011-04-14 12:25:50 UTC (rev 6335)
@@ -21,9 +21,9 @@
 +    partitions => {},
 +    opts_all   => {}
    };
- }
  
-@@ -168,6 +169,15 @@
+   # Init device tree object
+@@ -176,6 +177,15 @@
    # the index of the new partition
    my $part_number = 0;
  
@@ -39,19 +39,18 @@
    # create a primary partition
    if ($type eq "primary") {
      (defined($FAI::configs{$FAI::device}{partitions}{0})) and
-@@ -275,8 +285,9 @@
+@@ -283,8 +293,8 @@
        defined ($part_size->{always_format})
          or $part_size->{always_format} = 0;
  
 -      # add the resize = 0 flag, if it doesn't exist already
 -      defined ($part_size->{resize}) or $part_size->{resize} = 0;
 +      # add the resize = default flag, if it doesn't exist already
-+      defined ($part_size->{resize})
-+        or $part_size->{resize} = $resize_default;
-     }
-   }
++      defined ($part_size->{resize}) or $part_size->{resize} = $resize_default;
  
-@@ -300,15 +311,15 @@
+       # add entry to device tree
+       push @{ $FAI::dev_children{$disk} }, &FAI::make_device_name($disk, $extended);
+@@ -312,15 +322,15 @@
  
    # add the preserve = 0 flag, if it doesn't exist already
    defined ($FAI::partition_pointer->{size}->{preserve})
@@ -67,10 +66,10 @@
    defined ($FAI::partition_pointer->{size}->{resize})
 -    or $FAI::partition_pointer->{size}->{resize} = 0;
 +    or $FAI::partition_pointer->{size}->{resize} = $resize_default;
- }
  
- ################################################################################
-@@ -385,6 +396,7 @@
+   # add entry to device tree
+   push @{ $FAI::dev_children{$disk} }, $FAI::partition_pointer_dev_name;
+@@ -401,6 +411,7 @@
            &FAI::in_path("mdadm") or die "mdadm not found in PATH\n";
            $FAI::device = "RAID";
            $FAI::configs{$FAI::device}{fstabkey} = "device";
@@ -78,7 +77,7 @@
          }
          raid_option(s?)
          | 'cryptsetup'
-@@ -405,6 +417,7 @@
+@@ -421,6 +432,7 @@
            # being configured
            $FAI::device = "VG_";
            $FAI::configs{"VG_--ANY--"}{fstabkey} = "device";
@@ -86,7 +85,7 @@
          }
          lvm_option(s?)
          | 'end'
-@@ -436,30 +449,46 @@
+@@ -452,30 +464,46 @@
          option(s?)
          | <error>
  
@@ -142,7 +141,7 @@
          }
  
      cryptsetup_option: /^randinit/
-@@ -467,41 +496,57 @@
+@@ -483,41 +511,57 @@
            $FAI::configs{$FAI::device}{randinit} = 1;
          }
  
@@ -222,7 +221,7 @@
            }
          }
          | /^fstabkey:(device|label|uuid)/
-@@ -509,39 +554,59 @@
+@@ -525,39 +569,59 @@
            # the information preferred for fstab device identifieres
            $FAI::configs{"VG_--ANY--"}{fstabkey} = $1;
          }
@@ -297,9 +296,9 @@
            $FAI::configs{$FAI::device}{preserveparts} = 1;
          }
          | /^disklabel:(msdos|gpt-bios|gpt)/
-@@ -586,9 +651,13 @@
- 
- 	  $FAI::configs{$FAI::device} = dclone($FAI::configs{"PHY_" . $ref_dev});
+@@ -626,9 +690,13 @@
+       push @{ $FAI::dev_children{$disk} }, &FAI::make_device_name($disk, $pd);
+     }
  	}
 -        | /^always_format:(\d+(,\d+)*)/
 +        | /^always_format:((\d+(,\d+)*)|all)/
@@ -313,7 +312,7 @@
          }
          | /^align-at:(\d+[kKMGTPiB]*)/
          {
-@@ -613,12 +682,14 @@
+@@ -653,12 +721,14 @@
            $FAI::configs{RAID}{volumes}{$vol_id}{mode} = $1;
            # initialise the hash of devices
            $FAI::configs{RAID}{volumes}{$vol_id}{devices} = {};
@@ -332,7 +331,7 @@
            # set the reference to the current volume
            # the reference is used by all further processing of this config line
            $FAI::partition_pointer = (\%FAI::configs)->{RAID}->{volumes}->{$vol_id};
-@@ -696,13 +767,17 @@
+@@ -739,13 +809,17 @@
            # initialise the new hash
            defined($FAI::configs{$FAI::device}{volumes}{$2}) or
              $FAI::configs{$FAI::device}{volumes}{$2} = {};
@@ -450,7 +449,7 @@
 ===================================================================
 --- trunk.orig/lib/setup-storage/Commands.pm
 +++ trunk/lib/setup-storage/Commands.pm
-@@ -1121,6 +1121,16 @@
+@@ -1171,6 +1171,16 @@
      } elsif (defined($FAI::configs{$config}{partitions}{0})) {
        # no partition table operations
        $FAI::partition_table_deps{$disk} = "";




More information about the Fai-commit mailing list