summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-06-21 07:42:35 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-06-21 07:42:35 +0000
commit5fd094c7e819f3cdd30ab87a5c44455e97b48346 (patch)
tree476c3df776e8ba9e945e0ae56cc84b93ade33909
parent23dcaf106a64bae2b9c5760b95d3548c5da7c315 (diff)
downloaddrakx-5fd094c7e819f3cdd30ab87a5c44455e97b48346.tar
drakx-5fd094c7e819f3cdd30ab87a5c44455e97b48346.tar.gz
drakx-5fd094c7e819f3cdd30ab87a5c44455e97b48346.tar.bz2
drakx-5fd094c7e819f3cdd30ab87a5c44455e97b48346.tar.xz
drakx-5fd094c7e819f3cdd30ab87a5c44455e97b48346.zip
- compute free_space per hd if needed (useful when auto-allocating on vgs with still free space on hd)
- fix verifying enough space for next allocate
-rw-r--r--perl-install/fsedit.pm16
1 files changed, 11 insertions, 5 deletions
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index e2000b2b1..ae403b9d7 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -295,13 +295,19 @@ sub computeSize {
my $max = $part->{maxsize} || $part->{size};
return min($max, $best->{size}) unless $best->{ratio};
- my $free_space = fs::get::free_space($all_hds);
- my @l = my @L = grep {
- if ($free_space >= $_->{size}) {
- $free_space -= $_->{size};
+ my %free_space;
+ $free_space{$_->{rootDevice}} += $_->{size} foreach fs::get::holes($all_hds);
+
+ my @l = my @L = grep {
+ my @possible = $_->{hd} ? $_->{hd} : keys %free_space;
+ my $size = $_->{size};
+ if (my $dev = find { $free_space{$_} >= $size } @possible) {
+ $free_space{$dev} -= $size;
1;
} else { 0 } } @$suggestions;
+ my $free_space = $best->{hd} && $free_space{$best->{hd}} || sum(values %free_space);
+
my $cylinder_size_maxsize_adjusted;
my $tot_ratios = 0;
while (1) {
@@ -327,7 +333,7 @@ sub computeSize {
}
my $size = int min($max, $best->{size} + $free_space * ($tot_ratios && $best->{ratio} / $tot_ratios));
#- verify other entry can fill the hole
- (any { $_->{size} < $max - $size } @L) ? $size : $max;
+ (any { $_->{size} <= $max - $size } @L) ? $size : $max;
}
sub suggest_part {