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

Michael Tautschnig mt at alioth.debian.org
Thu Mar 10 16:48:34 UTC 2011


Author: mt
Date: 2011-03-10 16:48:33 +0000 (Thu, 10 Mar 2011)
New Revision: 6308

Modified:
   branches/experimental/patches/setup-storage_cryptsetup-passphrase
   branches/experimental/patches/setup-storage_deterministic-lv-ordering
   branches/experimental/patches/setup-storage_gpt-bios-fix
   branches/experimental/patches/setup-storage_lvm-raid-preserve
   branches/experimental/patches/setup-storage_no-empty-config
   branches/experimental/patches/setup-storage_user-100-percent
Log:
- make gpt-bios partition the one with the highest index while still locating it
  at the beginning of the disk
- fixed bugs in lvm-raid-preserve


Modified: branches/experimental/patches/setup-storage_cryptsetup-passphrase
===================================================================
--- branches/experimental/patches/setup-storage_cryptsetup-passphrase	2011-03-10 16:38:11 UTC (rev 6307)
+++ branches/experimental/patches/setup-storage_cryptsetup-passphrase	2011-03-10 16:48:33 UTC (rev 6308)
@@ -47,7 +47,7 @@
 ===================================================================
 --- trunk.orig/lib/setup-storage/Parser.pm
 +++ trunk/lib/setup-storage/Parser.pm	
-@@ -709,7 +709,7 @@
+@@ -695,7 +695,7 @@
            $FAI::partition_pointer = (\%FAI::configs)->{RAID}->{volumes}->{$vol_id};
          }
          mountpoint devices filesystem mount_options mdcreateopts

Modified: branches/experimental/patches/setup-storage_deterministic-lv-ordering
===================================================================
--- branches/experimental/patches/setup-storage_deterministic-lv-ordering	2011-03-10 16:38:11 UTC (rev 6307)
+++ branches/experimental/patches/setup-storage_deterministic-lv-ordering	2011-03-10 16:48:33 UTC (rev 6308)
@@ -7,7 +7,7 @@
 ===================================================================
 --- trunk.orig/lib/setup-storage/Parser.pm
 +++ trunk/lib/setup-storage/Parser.pm	
-@@ -821,6 +821,8 @@
+@@ -807,6 +807,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} = {};
-@@ -874,6 +876,8 @@
+@@ -860,6 +862,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
-@@ -1141,8 +1145,18 @@
+@@ -1127,8 +1131,18 @@
      if ($config =~ /^PHY_(.+)$/) {
        (scalar(keys %{ $FAI::configs{$config}{partitions} }) > 0) or
          die "Empty disk_config stanza for device $1\n";

Modified: branches/experimental/patches/setup-storage_gpt-bios-fix
===================================================================
--- branches/experimental/patches/setup-storage_gpt-bios-fix	2011-03-10 16:38:11 UTC (rev 6307)
+++ branches/experimental/patches/setup-storage_gpt-bios-fix	2011-03-10 16:48:33 UTC (rev 6308)
@@ -1,53 +1,43 @@
-2010-09-17  Michael Tautschnig  <mt at debian.org>
+2011-03-10  Michael Tautschnig  <mt at debian.org>
 
-	* setup-storage/{Parser.pm,Sizes.pm}: Make extra partition for gpt-bios the
-		first one.
-Index: trunk/lib/setup-storage/Parser.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Parser.pm
-+++ trunk/lib/setup-storage/Parser.pm	
-@@ -615,6 +615,20 @@
-           # supported by parted could be allowed, but others are not implemented
-           # yet
-           $FAI::configs{$FAI::device}{disklabel} = $1;
-+
-+          # on gpt-bios we'll need an partition at the very beginning to store what
-+          # doesn't fit in the MBR
-+          if ($1 eq "gpt-bios") {
-+            &FAI::init_part_config("primary");
-+            $FAI::configs{$FAI::device}{gpt_bios_part} = $FAI::partition_pointer->{number};
-+            my $s = &FAI::convert_unit("1MiB");
-+            # enter the range into the hash
-+            $FAI::partition_pointer->{size}->{range} = "$s-$s";
-+            # set proper defaults
-+            $FAI::partition_pointer->{encrypt} = 0;
-+            $FAI::partition_pointer->{filesystem} = "-";
-+            $FAI::partition_pointer->{mountpoint} = "-";
-+          }
-         }
-         | /^bootable:(\d+)/
-         {
+	* 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	
-@@ -682,19 +682,6 @@
- 
-       # the space required by the GPTs
+@@ -684,13 +684,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
+ 
+       # on gpt-bios we'll need an additional partition to store what doesn't fit
 -      # in the MBR
--      $FAI::device = $config;
--      &FAI::init_part_config("primary");
--      $FAI::configs{$config}{gpt_bios_part} = $FAI::partition_pointer->{number};
++      # 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");
--      # enter the range into the hash
--      $FAI::partition_pointer->{size}->{range} = "$s-$s";
--      # set proper defaults
--      $FAI::partition_pointer->{encrypt} = 0;
--      $FAI::partition_pointer->{filesystem} = "-";
--      $FAI::partition_pointer->{mountpoint} = "-";
-     }
++      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} = "-";
+@@ -740,6 +747,11 @@
  
-     # the list of partitions that we need to find start and end bytes for
+         # 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_lvm-raid-preserve
===================================================================
--- branches/experimental/patches/setup-storage_lvm-raid-preserve	2011-03-10 16:38:11 UTC (rev 6307)
+++ branches/experimental/patches/setup-storage_lvm-raid-preserve	2011-03-10 16:48:33 UTC (rev 6308)
@@ -238,13 +238,28 @@
    }
  
    # run vgreduce to get them removed
-@@ -623,26 +634,35 @@
+@@ -607,11 +618,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 +636,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"}{volumes})) {
++    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
@@ -273,12 +288,12 @@
        }
      } else {
 -      &FAI::push_command("true", "vgchange_a_n", "exist_/dev/$vg/$_") foreach
-+      &FAI::push_command("true", "vgchange_a_n",
++      &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 +670,16 @@
+@@ -650,9 +672,16 @@
      return 0;
    }
  
@@ -297,7 +312,7 @@
      $vg_destroy_pre .= ",lv_rm_$vg/$lv";
    }
    &FAI::push_command( "vgremove $vg", "$vg_destroy_pre", "vg_removed_$vg");
-@@ -662,7 +689,7 @@
+@@ -662,7 +691,7 @@
    $devices .= " " . &FAI::enc_name($_) foreach
      (@{ $FAI::current_lvm_config{$vg}{physical_volumes} });
    $FAI::debug and print "Erased devices:$devices\n";
@@ -306,7 +321,7 @@
    return 1;
  }
  
-@@ -676,14 +703,26 @@
+@@ -676,14 +705,26 @@
  sub build_lvm_commands {
  
    # disable volumes if there are pre-existing ones
@@ -340,7 +355,7 @@
  
    # loop through all configs
    foreach my $config (keys %FAI::configs) {
-@@ -913,8 +952,15 @@
+@@ -913,8 +954,15 @@
      or die "Can't change disklabel, partitions are to be preserved\n";
  
    # write the disklabel to drop the previous partition table
@@ -460,7 +475,7 @@
  }
  
  ################################################################################
-@@ -656,6 +671,18 @@
+@@ -642,6 +657,18 @@
  	  use Storable qw(dclone);
  
  	  $FAI::configs{$FAI::device} = dclone($FAI::configs{"PHY_" . $ref_dev});
@@ -479,7 +494,7 @@
  	}
  	| /^sameas:(\S+)/
  	{
-@@ -665,6 +692,18 @@
+@@ -651,6 +678,18 @@
  	  use Storable qw(dclone);
  
  	  $FAI::configs{$FAI::device} = dclone($FAI::configs{"PHY_" . $ref_dev});
@@ -498,7 +513,7 @@
  	}
          | /^always_format:((\d+(,\d+)*)|all)/
          {
-@@ -708,6 +747,7 @@
+@@ -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};
@@ -506,7 +521,7 @@
          }
          mountpoint devices filesystem mount_options mdcreateopts
          | /^(luks|luks:"[^"]+"|tmp|swap)\s+/
-@@ -728,6 +768,7 @@
+@@ -714,6 +754,7 @@
            $FAI::configs{CRYPT}{volumes}{$vol_id}{preserve} = 0;
  
            $FAI::partition_pointer = (\%FAI::configs)->{CRYPT}->{volumes}->{$vol_id};
@@ -514,7 +529,7 @@
          }
          mountpoint devices filesystem mount_options lv_or_fsopts
          | /^tmpfs\s+/
-@@ -748,6 +789,7 @@
+@@ -734,6 +775,7 @@
            $FAI::configs{TMPFS}{volumes}{$vol_id}{preserve} = 0;
  
            $FAI::partition_pointer = (\%FAI::configs)->{TMPFS}->{volumes}->{$vol_id};
@@ -522,7 +537,7 @@
          }
          mountpoint tmpfs_size mount_options
          | type mountpoint size filesystem mount_options lv_or_fsopts
-@@ -796,6 +838,9 @@
+@@ -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};
@@ -532,7 +547,7 @@
          }
  
      mountpoint: m{^(-|swap|/[^\s\:]*)(:encrypt(:randinit)?)?}
-@@ -829,6 +874,8 @@
+@@ -815,6 +860,8 @@
              $FAI::configs{$FAI::device}{volumes} = {};
            # initialise the list of physical devices
            $FAI::configs{$FAI::device}{devices} = ();
@@ -541,7 +556,7 @@
            # the rule must not return undef
            1;
          }
-@@ -958,15 +1005,21 @@
+@@ -944,15 +991,21 @@
                  "spare" => $spare,
                  "missing" => $missing
                };

Modified: branches/experimental/patches/setup-storage_no-empty-config
===================================================================
--- branches/experimental/patches/setup-storage_no-empty-config	2011-03-10 16:38:11 UTC (rev 6307)
+++ branches/experimental/patches/setup-storage_no-empty-config	2011-03-10 16:48:33 UTC (rev 6308)
@@ -20,7 +20,7 @@
 ===================================================================
 --- trunk.orig/lib/setup-storage/Parser.pm
 +++ trunk/lib/setup-storage/Parser.pm	
-@@ -1075,5 +1075,33 @@
+@@ -1061,5 +1061,33 @@
    defined $FAI::Parser->file($input) or die "Syntax error\n";
  }
  

Modified: branches/experimental/patches/setup-storage_user-100-percent
===================================================================
--- branches/experimental/patches/setup-storage_user-100-percent	2011-03-10 16:38:11 UTC (rev 6307)
+++ branches/experimental/patches/setup-storage_user-100-percent	2011-03-10 16:48:33 UTC (rev 6308)
@@ -78,8 +78,8 @@
  
        # the MBR requires space, too
        $min_req_total_space += $current_disk->{bios_sectors_per_track} *
-@@ -684,6 +685,11 @@
-       $min_req_total_space += 33 * $current_disk->{sector_size};
+@@ -704,6 +705,11 @@
+       $FAI::partition_pointer->{mountpoint} = "-";
      }
  
 +    # the size of a 100% partition (the 100% available to the user)
@@ -90,7 +90,7 @@
      # the list of partitions that we need to find start and end bytes for
      my @worklist = (&numsort(keys %{ $FAI::configs{$config}{partitions} }));
  
-@@ -730,13 +736,14 @@
+@@ -755,13 +761,14 @@
        # the partition $part_id must be preserved
        } elsif ($part->{size}->{preserve}) {
          ($next_start, $min_req_total_space) = &FAI::do_partition_preserve($part_id,




More information about the Fai-commit mailing list