[Fai-commit] r6255 - trunk/lib/setup-storage

Michael Tautschnig mt at alioth.debian.org
Thu Dec 23 22:16:45 UTC 2010


Author: mt
Date: 2010-12-23 22:16:44 +0000 (Thu, 23 Dec 2010)
New Revision: 6255

Modified:
   trunk/lib/setup-storage/Commands.pm
Log:
setup-storage/Commands.pm: Rebuild partition table only once, unless necessary
for resizing; also fixes perl compilation error.
    
Closes: #607901
Thanks: Toomas Tamm <tt-fai at kky.ttu.ee>


Modified: trunk/lib/setup-storage/Commands.pm
===================================================================
--- trunk/lib/setup-storage/Commands.pm	2010-12-23 12:48:03 UTC (rev 6254)
+++ trunk/lib/setup-storage/Commands.pm	2010-12-23 22:16:44 UTC (rev 6255)
@@ -883,6 +883,12 @@
 
   # the list of partitions that must be preserved
   my @to_preserve = &FAI::get_preserved_partitions($config);
+  # resize needed?
+  my $needs_resize = 0;
+  foreach my $part_id (@to_preserve) {
+    $needs_resize = 1 if ($FAI::configs{$config}{partitions}{$part_id}{size}{resize});
+    last if ($needs_resize);
+  }
 
   my $label = $FAI::configs{$config}{disklabel};
   $label = "gpt" if ($label eq "gpt-bios");
@@ -893,10 +899,10 @@
     or die "Can't change disklabel, partitions are to be preserved\n";
 
   # write the disklabel to drop the previous partition table
-  &FAI::push_command( "parted -s $disk mklabel $label",
+  &FAI::push_command( ($needs_resize ? "parted -s $disk mklabel $label" : "true"),
     "exist_$disk,all_pv_sigs_removed", "cleared1_$disk" );
 
-  &FAI::rebuild_preserved_partitions($config, \@to_preserve);
+  &FAI::rebuild_preserved_partitions($config, \@to_preserve) if ($needs_resize);
 
   my $pre_all_resize = "";
 




More information about the Fai-commit mailing list