[Fai-commit] r5188 - in trunk: debian lib/setup-storage

lange at alioth.debian.org lange at alioth.debian.org
Tue Oct 14 13:29:57 UTC 2008


Author: lange
Date: 2008-10-14 13:29:57 +0000 (Tue, 14 Oct 2008)
New Revision: 5188

Modified:
   trunk/debian/changelog
   trunk/lib/setup-storage/Parser.pm
   trunk/lib/setup-storage/Sizes.pm
Log:
Warn, if a preserved partition does not match the size specified in the
disk_config; fail, if an extended partition is to be created in place
of a to-be-preserved partition (closes: #501772)

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2008-10-14 13:11:02 UTC (rev 5187)
+++ trunk/debian/changelog	2008-10-14 13:29:57 UTC (rev 5188)
@@ -1,8 +1,12 @@
 fai (3.2.12) unstable; urgency=low
 
+  * lib/setup-storage/Parser.pm, lib/setup-storage/Sizes.pm: Warn, if a
+    preserved partition does not match the size specified in the
+    disk_config; fail, if an extended partition is to be created in place
+    of a to-be-preserved partition (closes: #501772)
   * make-fai-nfsroot: print version of debootstrap (closes: #500046)
 
- -- Thomas Lange <lange at debian.org>  Tue, 14 Oct 2008 15:04:22 +0200
+ -- Thomas Lange <lange at debian.org>  Tue, 14 Oct 2008 15:29:21 +0200
 
 fai (3.2.11) unstable; urgency=low
 

Modified: trunk/lib/setup-storage/Parser.pm
===================================================================
--- trunk/lib/setup-storage/Parser.pm	2008-10-14 13:11:02 UTC (rev 5187)
+++ trunk/lib/setup-storage/Parser.pm	2008-10-14 13:29:57 UTC (rev 5188)
@@ -217,10 +217,11 @@
       ($extended < 5)
         or die "Too many primary partitions while creating extended\n";
 
-      # initialize the entry
-      (\%FAI::configs)->{$FAI::device}->{partitions}->{$extended} = {
-        size => {}
-      };
+      # initialize the entry, unless it already exists
+      defined ($FAI::configs{$FAI::device}{partitions}{$extended})
+        or (\%FAI::configs)->{$FAI::device}->{partitions}->{$extended} = {
+          size => {}
+        };
 
       my $part_size =
         (\%FAI::configs)->{$FAI::device}->{partitions}->{$extended}->{size};

Modified: trunk/lib/setup-storage/Sizes.pm
===================================================================
--- trunk/lib/setup-storage/Sizes.pm	2008-10-14 13:11:02 UTC (rev 5187)
+++ trunk/lib/setup-storage/Sizes.pm	2008-10-14 13:29:57 UTC (rev 5188)
@@ -294,6 +294,13 @@
   ($next_start > $curr_part->{begin_byte})
     and die "Previous partitions overflow begin of preserved partition $part_id\n";
 
+  # get what the user desired
+  my ($start, $end) = &FAI::make_range($part->{size}->{range},
+    $current_disk->{size} . "B");
+  ($start > $curr_part->{count_byte} || $end < $curr_part->{count_byte})
+    and warn "Preserved partition $part_id retains size " .
+      $curr_part->{count_byte} . "\n";
+
   # set the effective size to the value known already
   $part->{size}->{eff_size} = $curr_part->{count_byte};
 
@@ -321,6 +328,11 @@
     $min_req_total_space += $current_disk->{bios_sectors_per_track} *
       $current_disk->{sector_size} if ($part_id > 4);
 
+    # make sure we don't change extended partitions to ordinary ones and
+    # vice-versa
+    ($part->{size}->{extended} == $curr_part->{is_extended})
+      or die "Preserved partition $part_id can't change extended/normal setting\n";
+
     # extended partitions consume no space
     if ($part->{size}->{extended}) {
 




More information about the Fai-commit mailing list