[Fai-commit] r4841 - people/michael/features/setup_harddisks_2/implementation/lib
mt at alioth.debian.org
mt at alioth.debian.org
Sat Jan 26 09:45:49 UTC 2008
Author: mt
Date: 2008-01-26 09:45:49 +0000 (Sat, 26 Jan 2008)
New Revision: 4841
Modified:
people/michael/features/setup_harddisks_2/implementation/lib/sizes.pm
Log:
made make_range accept floating point values as well, call make_range always
with proper units (otherwise MB would be assumed instead of B)
Modified: people/michael/features/setup_harddisks_2/implementation/lib/sizes.pm
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/lib/sizes.pm 2008-01-25 19:15:23 UTC (rev 4840)
+++ people/michael/features/setup_harddisks_2/implementation/lib/sizes.pm 2008-01-26 09:45:49 UTC (rev 4841)
@@ -53,10 +53,10 @@
# convert size to Bytes
my $size_b = &FAI::convert_unit($size) * 1024.0 * 1024.0;
# check the format of the string
- ($rstr =~ /^(\d+%?)-(\d+%?)$/) or &FAI::internal_error("Invalid range");
- my ($start, $end) = ($1, $2);
+ ($rstr =~ /^(\d+(\.\d+)?%?)-(\d+(\.\d+)?%?)$/) or &FAI::internal_error("Invalid range");
+ my ($start, $end) = ($1, $3);
# start may be given in percents of the size
- if ($start =~ /^(\d+)%$/) {
+ if ($start =~ /^(\d+(\.\d+)?)%$/) {
# rewrite it to bytes
$start = POSIX::floor($size_b * $1 / 100);
} else {
@@ -65,7 +65,7 @@
}
# end may be given in percents of the size
- if ( $end =~ /^(\d+)%$/ ) {
+ if ( $end =~ /^(\d+(\.\d+)?)%$/ ) {
# rewrite it to bytes
$end = POSIX::ceil($size_b * $1 / 100);
} else {
@@ -407,7 +407,8 @@
# reference to the current partition
my $part = (\%FAI::configs)->{$config}->{partitions}->{$part_id};
- my ($start, $end) = &FAI::make_range($part->{size}->{range}, $current_disk->{size});
+ my ($start, $end) = &FAI::make_range($part->{size}->{range},
+ $current_disk->{size} . "B");
# check, whether the size is fixed
if ($end != $start) {
@@ -444,7 +445,8 @@
next;
} else {
my ($min_size, $max_size) = &FAI::make_range(
- $FAI::configs{$config}{partitions}{$p}{size}{range}, $current_disk->{size});
+ $FAI::configs{$config}{partitions}{$p}{size}{range},
+ $current_disk->{size} . "B");
# logical partitions require the space for the EPBR to be left
# out
More information about the Fai-commit
mailing list