From f7b1790ec7cd12a8965b5e8fd5060e913db54edc Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Tue, 16 Jun 2020 16:42:54 +0100 Subject: Ignore free space on other devices when allocating partitions on single device. --- perl-install/fsedit.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'perl-install/fsedit.pm') diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index fc979ce87..e53648a37 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -346,7 +346,7 @@ sub is_one_big_fat_or_NT { sub computeSize { - my ($part, $best, $all_hds, $suggestions) = @_; + my ($part, $best, $all_hds, $suggestions, $o_target) = @_; my $max = $part->{maxsize} || $part->{size}; return min($max, $best->{size}) unless $best->{ratio}; @@ -361,7 +361,7 @@ sub computeSize { 1; } else { 0 } } @$suggestions; - my $free_space = $best->{hd} && $free_space{$best->{hd}} || sum(values %free_space); + my $free_space = $o_target && $free_space{$o_target->{device}} || $best->{hd} && $free_space{$best->{hd}} || sum(values %free_space); my $cylinder_size_maxsize_adjusted; my $tot_ratios = 0; @@ -392,7 +392,7 @@ sub computeSize { } sub suggest_part { - my ($part, $all_hds, $o_suggestions) = @_; + my ($part, $all_hds, $o_suggestions, $o_target) = @_; my $suggestions = $o_suggestions || $suggestions{server} || $suggestions{simple}; #- suggestions now use {fs_type}, but still keep compatibility @@ -430,7 +430,7 @@ sub suggest_part { $part->{mntpoint} = $best->{mntpoint}; fs::type::set_type_subpart($part, $best) if !isTrueFS($best) || !isTrueFS($part); - $part->{size} = computeSize($part, $best, $all_hds, \@local_suggestions); + $part->{size} = computeSize($part, $best, $all_hds, \@local_suggestions, $o_target); foreach ('options', 'lv_name', 'encrypt_key', 'primaryOrExtended', 'device_LABEL', 'prefer_device_LABEL', 'device_UUID', 'prefer_device_UUID', 'prefer_device') { $part->{$_} = $best->{$_} if $best->{$_}; @@ -506,7 +506,7 @@ sub allocatePartitions { next if $o_hd && (($o_hd->{device} || $o_hd->{VG_name}) ne $dev); my ($part, $suggested); while ($suggested = suggest_part($part = { start => $start, size => 0, maxsize => $size, rootDevice => $dev }, - $all_hds, \@to_add)) { + $all_hds, \@to_add, $o_hd)) { my $hd = fs::get::part2hd($part, $all_hds); add($hd, $part, $all_hds, { primaryOrExtended => $part->{primaryOrExtended} }); $size -= $part->{size} + $part->{start} - $start; -- cgit v1.2.1