/[fai]/people/michael/features/setup_harddisks_2/implementation/lib/sizes.pm
ViewVC logotype

Diff of /people/michael/features/setup_harddisks_2/implementation/lib/sizes.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4840 by mt, Fri Jan 25 19:15:23 2008 UTC revision 4841 by mt, Sat Jan 26 09:45:49 2008 UTC
# Line 53  sub make_range { Line 53  sub make_range {
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 {
# Line 65  sub make_range { Line 65  sub make_range {
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 {
# Line 407  sub do_partition_real { Line 407  sub do_partition_real {
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) {
# Line 444  sub do_partition_real { Line 445  sub do_partition_real {
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

Legend:
Removed from v.4840  
changed lines
  Added in v.4841

  ViewVC Help
Powered by ViewVC 1.1.5