| 53 |
# convert size to Bytes |
# convert size to Bytes |
| 54 |
my $size_b = &FAI::convert_unit($size) * 1024.0 * 1024.0; |
my $size_b = &FAI::convert_unit($size) * 1024.0 * 1024.0; |
| 55 |
# check the format of the string |
# check the format of the string |
| 56 |
($rstr =~ /^(\d+%?)-(\d+%?)$/) or &FAI::internal_error("Invalid range"); |
($rstr =~ /^(\d+(\.\d+)?%?)-(\d+(\.\d+)?%?)$/) or &FAI::internal_error("Invalid range"); |
| 57 |
my ($start, $end) = ($1, $2); |
my ($start, $end) = ($1, $3); |
| 58 |
# start may be given in percents of the size |
# start may be given in percents of the size |
| 59 |
if ($start =~ /^(\d+)%$/) { |
if ($start =~ /^(\d+(\.\d+)?)%$/) { |
| 60 |
# rewrite it to bytes |
# rewrite it to bytes |
| 61 |
$start = POSIX::floor($size_b * $1 / 100); |
$start = POSIX::floor($size_b * $1 / 100); |
| 62 |
} else { |
} else { |
| 65 |
} |
} |
| 66 |
|
|
| 67 |
# end may be given in percents of the size |
# end may be given in percents of the size |
| 68 |
if ( $end =~ /^(\d+)%$/ ) { |
if ( $end =~ /^(\d+(\.\d+)?)%$/ ) { |
| 69 |
# rewrite it to bytes |
# rewrite it to bytes |
| 70 |
$end = POSIX::ceil($size_b * $1 / 100); |
$end = POSIX::ceil($size_b * $1 / 100); |
| 71 |
} else { |
} else { |
| 407 |
# reference to the current partition |
# reference to the current partition |
| 408 |
my $part = (\%FAI::configs)->{$config}->{partitions}->{$part_id}; |
my $part = (\%FAI::configs)->{$config}->{partitions}->{$part_id}; |
| 409 |
|
|
| 410 |
my ($start, $end) = &FAI::make_range($part->{size}->{range}, $current_disk->{size}); |
my ($start, $end) = &FAI::make_range($part->{size}->{range}, |
| 411 |
|
$current_disk->{size} . "B"); |
| 412 |
|
|
| 413 |
# check, whether the size is fixed |
# check, whether the size is fixed |
| 414 |
if ($end != $start) { |
if ($end != $start) { |
| 445 |
next; |
next; |
| 446 |
} else { |
} else { |
| 447 |
my ($min_size, $max_size) = &FAI::make_range( |
my ($min_size, $max_size) = &FAI::make_range( |
| 448 |
$FAI::configs{$config}{partitions}{$p}{size}{range}, $current_disk->{size}); |
$FAI::configs{$config}{partitions}{$p}{size}{range}, |
| 449 |
|
$current_disk->{size} . "B"); |
| 450 |
|
|
| 451 |
# logical partitions require the space for the EPBR to be left |
# logical partitions require the space for the EPBR to be left |
| 452 |
# out |
# out |