[Fai-commit] r6309 - branches/experimental/patches
Michael Tautschnig
mt at alioth.debian.org
Thu Mar 10 17:49:04 UTC 2011
Author: mt
Date: 2011-03-10 17:49:00 +0000 (Thu, 10 Mar 2011)
New Revision: 6309
Added:
branches/experimental/patches/setup-storage_no-extra-number
Modified:
branches/experimental/patches/series
branches/experimental/patches/setup-storage_gpt-bios-fix
branches/experimental/patches/setup-storage_hardcode-63-sectors
branches/experimental/patches/setup-storage_preserve-format-all
branches/experimental/patches/setup-storage_user-100-percent
Log:
- internal cleanup of redundant "number" config field
- make preserve:all accept partitions in any order
Modified: branches/experimental/patches/series
===================================================================
--- branches/experimental/patches/series 2011-03-10 16:48:33 UTC (rev 6308)
+++ branches/experimental/patches/series 2011-03-10 17:49:00 UTC (rev 6309)
@@ -25,3 +25,4 @@
setup-storage_better-error-msg
setup-storage_lvm-raid-preserve
setup-storage_deterministic-lv-ordering
+setup-storage_no-extra-number
Modified: branches/experimental/patches/setup-storage_gpt-bios-fix
===================================================================
--- branches/experimental/patches/setup-storage_gpt-bios-fix 2011-03-10 16:48:33 UTC (rev 6308)
+++ branches/experimental/patches/setup-storage_gpt-bios-fix 2011-03-10 17:49:00 UTC (rev 6309)
@@ -6,7 +6,7 @@
===================================================================
--- trunk.orig/lib/setup-storage/Sizes.pm
+++ trunk/lib/setup-storage/Sizes.pm
-@@ -684,13 +684,20 @@
+@@ -685,13 +685,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
@@ -29,7 +29,7 @@
# set proper defaults
$FAI::partition_pointer->{encrypt} = 0;
$FAI::partition_pointer->{filesystem} = "-";
-@@ -740,6 +747,11 @@
+@@ -741,6 +748,11 @@
# partition done
shift @worklist;
Modified: branches/experimental/patches/setup-storage_hardcode-63-sectors
===================================================================
--- branches/experimental/patches/setup-storage_hardcode-63-sectors 2011-03-10 16:48:33 UTC (rev 6308)
+++ branches/experimental/patches/setup-storage_hardcode-63-sectors 2011-03-10 17:49:00 UTC (rev 6309)
@@ -7,7 +7,7 @@
===================================================================
--- trunk.orig/lib/setup-storage/Sizes.pm
+++ trunk/lib/setup-storage/Sizes.pm
-@@ -650,15 +650,11 @@
+@@ -651,15 +651,11 @@
my $next_start = 0;
if ($FAI::configs{$config}{disklabel} eq "msdos") {
Added: branches/experimental/patches/setup-storage_no-extra-number
===================================================================
--- branches/experimental/patches/setup-storage_no-extra-number (rev 0)
+++ branches/experimental/patches/setup-storage_no-extra-number 2011-03-10 17:49:00 UTC (rev 6309)
@@ -0,0 +1,87 @@
+2011-03-10 Michael Tautschnig <mt at debian.org>
+
+ * setup-storage/{Parser,Sizes,Fstab,Volumes}.pm: Don't keep redundant number
+ field in config data structure.
+Index: trunk/lib/setup-storage/Fstab.pm
+===================================================================
+--- trunk.orig/lib/setup-storage/Fstab.pm
++++ trunk/lib/setup-storage/Fstab.pm
+@@ -224,8 +224,8 @@
+ # skip extended partitions and entries without a mountpoint
+ next if ($p_ref->{size}->{extended} || $p_ref->{mountpoint} eq "-");
+
+- my $device_name = 0 == $p_ref->{number} ? $device :
+- &FAI::make_device_name($device, $p_ref->{number});
++ my $device_name = 0 == $p ? $device :
++ &FAI::make_device_name($device, $p);
+
+ # if the mount point the /boot mount point, variables must be set
+ if ($p_ref->{mountpoint} eq $boot_mnt_point) {
+Index: trunk/lib/setup-storage/Parser.pm
+===================================================================
+--- trunk.orig/lib/setup-storage/Parser.pm
++++ trunk/lib/setup-storage/Parser.pm
+@@ -275,10 +275,6 @@
+ size => {}
+ };
+
+- # as we can't compute the index from the reference, we need to store the
+- # $part_number explicitly
+- (\%FAI::configs)->{$FAI::device}->{partitions}->{$extended}->{number} = $extended;
+-
+ my $part_size =
+ (\%FAI::configs)->{$FAI::device}->{partitions}->{$extended}->{size};
+
+@@ -314,10 +310,6 @@
+ (\%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
+- $FAI::partition_pointer->{number} = $part_number;
+-
+ # the partition is not an extended one
+ $FAI::partition_pointer->{size}->{extended} = 0;
+
+@@ -1131,10 +1123,6 @@
+ if ($config =~ /^PHY_(.+)$/) {
+ (scalar(keys %{ $FAI::configs{$config}{partitions} }) > 0) or
+ die "Empty disk_config stanza for device $1\n";
+- foreach my $part_id (keys %{ $FAI::configs{$config}{partitions} }) {
+- ($FAI::configs{$config}{partitions}{$part_id}{number} == $part_id) or
+- &FAI::internal_error("Partition numbers are inconsistent");
+- }
+ } elsif ($config =~ /^VG_(.+)$/) {
+ next if ($1 eq "--ANY--");
+ (scalar(keys %{ $FAI::configs{$config}{volumes} }) ==
+Index: trunk/lib/setup-storage/Sizes.pm
+===================================================================
+--- trunk.orig/lib/setup-storage/Sizes.pm
++++ trunk/lib/setup-storage/Sizes.pm
+@@ -687,7 +687,8 @@
+ # partitions
+ $FAI::device = $config;
+ &FAI::init_part_config("primary");
+- $FAI::configs{$config}{gpt_bios_part} = $FAI::partition_pointer->{number};
++ $FAI::configs{$config}{gpt_bios_part} =
++ (&FAI::phys_dev($FAI::partition_pointer_dev_name))[2];
+ 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";
+Index: trunk/lib/setup-storage/Volumes.pm
+===================================================================
+--- trunk.orig/lib/setup-storage/Volumes.pm
++++ trunk/lib/setup-storage/Volumes.pm
+@@ -574,10 +574,10 @@
+ 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})
++ "Can't preserve ". &FAI::make_device_name($1, $part_id)
+ . " because it does not exist\n";
+ defined ($part->{size}->{range}) or die
+- "Can't preserve ". &FAI::make_device_name($1, $part->{number})
++ "Can't preserve ". &FAI::make_device_name($1, $part_id)
+ . " because it is not defined in the current config\n";
+ }
+ }
Modified: branches/experimental/patches/setup-storage_preserve-format-all
===================================================================
--- branches/experimental/patches/setup-storage_preserve-format-all 2011-03-10 16:48:33 UTC (rev 6308)
+++ branches/experimental/patches/setup-storage_preserve-format-all 2011-03-10 17:49:00 UTC (rev 6309)
@@ -1,11 +1,14 @@
-2010-09-17 Michael Tautschnig <mt at debian.org>
+2011-03-10 Michael Tautschnig <mt at debian.org>
- * setup-storage/Parser.pm: Added "all" as valid value for preserve_always,
- preserve_reinstall, resize, always_format with the same semantics as
- specifying each device index separately; in addition, preserve_always:all
- makes sure no parted operations on that disk happen at all (suggested by
- Toomas Tamm).
+ * setup-storage/{Commands,Parser}.pm: Added "all" as valid value for
+ preserve_always, preserve_reinstall, resize, always_format with the same
+ semantics as specifying each device index separately; in addition,
+ preserve_always:all makes sure no parted operations on that disk happen at
+ all (suggested by Toomas Tamm).
* setup-storage.8: Document this extension.
+ * setup-storage/Sizes.pm: Ignore seemingly overflowing partitions if all
+ partitions are to be preserved; thereby we can properly deal with oddly
+ numbered partition tables.
Index: trunk/lib/setup-storage/Parser.pm
===================================================================
--- trunk.orig/lib/setup-storage/Parser.pm
@@ -464,3 +467,17 @@
} else {
# create partitions on non-virtual configs
&FAI::setup_partitions($config);
+Index: trunk/lib/setup-storage/Sizes.pm
+===================================================================
+--- trunk.orig/lib/setup-storage/Sizes.pm
++++ trunk/lib/setup-storage/Sizes.pm
+@@ -318,7 +318,8 @@
+ my $curr_part = $current_disk->{partitions}->{$part_id};
+
+ ($next_start > $curr_part->{begin_byte})
+- and die "Previous partitions overflow begin of preserved partition $part_dev_name\n";
++ and die "Previous partitions overflow begin of preserved partition $part_dev_name\n"
++ unless (defined($FAI::configs{$config}{opts_all}{preserve}));
+
+ # get what the user desired
+ my ($start, $end) = &FAI::make_range($part->{size}->{range},
Modified: branches/experimental/patches/setup-storage_user-100-percent
===================================================================
--- branches/experimental/patches/setup-storage_user-100-percent 2011-03-10 16:48:33 UTC (rev 6308)
+++ branches/experimental/patches/setup-storage_user-100-percent 2011-03-10 17:49:00 UTC (rev 6309)
@@ -23,8 +23,8 @@
# reference to the current disk config
my $current_disk = $FAI::current_config{$disk};
-@@ -321,8 +322,7 @@
- and die "Previous partitions overflow begin of preserved partition $part_dev_name\n";
+@@ -322,8 +323,7 @@
+ unless (defined($FAI::configs{$config}{opts_all}{preserve}));
# get what the user desired
- my ($start, $end) = &FAI::make_range($part->{size}->{range},
@@ -33,7 +33,7 @@
($start > $curr_part->{count_byte} || $end < $curr_part->{count_byte})
and warn "Preserved partition $part_dev_name retains size " .
$curr_part->{count_byte} . "B\n";
-@@ -434,6 +434,7 @@
+@@ -435,6 +435,7 @@
# @param $next_start Start of the next partition
# @param $block_size Requested alignment
# @param $min_req_total_space Minimum space required on disk
@@ -41,7 +41,7 @@
# @param $worklist Reference to the remaining partitions
#
# @return Updated values of ($next_start, $min_req_total_space)
-@@ -441,15 +442,15 @@
+@@ -442,15 +443,15 @@
################################################################################
sub do_partition_real {
@@ -60,7 +60,7 @@
# check, whether the size is fixed
if ($end != $start) {
-@@ -488,8 +489,7 @@
+@@ -489,8 +490,7 @@
next;
} else {
my ($min_size, $max_size) = &FAI::make_range(
@@ -70,7 +70,7 @@
# logical partitions require the space for the EPBR to be left
# out
-@@ -653,6 +653,7 @@
+@@ -654,6 +654,7 @@
# on msdos disk labels, the first partitions starts at head #1
$next_start = $current_disk->{bios_sectors_per_track} *
$current_disk->{sector_size};
@@ -78,7 +78,7 @@
# the MBR requires space, too
$min_req_total_space += $current_disk->{bios_sectors_per_track} *
-@@ -704,6 +705,11 @@
+@@ -705,6 +706,11 @@
$FAI::partition_pointer->{mountpoint} = "-";
}
@@ -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} }));
-@@ -755,13 +761,14 @@
+@@ -756,13 +762,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