[Fai-commit] r5735 - in trunk: bin debian lib/setup-storage man
Michael Tautschnig
mt at alioth.debian.org
Tue Mar 16 21:05:38 UTC 2010
Author: mt
Date: 2010-03-16 21:05:36 +0000 (Tue, 16 Mar 2010)
New Revision: 5735
Modified:
trunk/bin/setup-storage
trunk/debian/changelog
trunk/lib/setup-storage/Commands.pm
trunk/lib/setup-storage/Fstab.pm
trunk/lib/setup-storage/Parser.pm
trunk/lib/setup-storage/Sizes.pm
trunk/lib/setup-storage/Volumes.pm
trunk/man/setup-storage.8
Log:
merged patches from experimental:
setup-storage_GIB-support
setup-storage_mdadm-output
setup-storage_swap-fstab-bugfix
setup-storage_ext4-support
and bumped setup-storage version to 1.2.1
Modified: trunk/bin/setup-storage
===================================================================
--- trunk/bin/setup-storage 2010-03-16 20:41:30 UTC (rev 5734)
+++ trunk/bin/setup-storage 2010-03-16 21:05:36 UTC (rev 5735)
@@ -52,7 +52,7 @@
package FAI;
-my $version = "1.2";
+my $version = "1.2.1";
# command line parameter handling
use Getopt::Std;
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2010-03-16 20:41:30 UTC (rev 5734)
+++ trunk/debian/changelog 2010-03-16 21:05:36 UTC (rev 5735)
@@ -7,6 +7,19 @@
* list_disks removed
* disk-info: do not return size of disks, return only device names,
* subroutines: adjust set_disk_info to new behaviour of disk-info
+
+ [ Michael Tautschnig ]
+ * setup-storage: Bumped version number to 1.2.1
+ * setup-storage/Parser.pm: Ignore 'i' in GiB, MiB, etc. and treat those
+ units like GB, MB, etc.
+ * setup-storage/Sizes.pm: Use MiB instead of MB internally.
+ * setup-storage.8: Update syntax.
+ * setup-storage/Volumes.pm: Handle new mdadm output format (thanks Brian
+ Kroth for the patch) (closes: #568794)
+ * setup-storage/Fstab.pm: fsck priority of swap should be 0 instead of 2
+ (closes: #568800)
+ * setup-storage/Commands.pm: Work around missing ext4 support in parted
+ (thanks Stefan Goetz for the patch) (closes: #572120)
-- Thomas Lange <lange at debian.org> Mon, 15 Mar 2010 15:47:01 +0100
Modified: trunk/lib/setup-storage/Commands.pm
===================================================================
--- trunk/lib/setup-storage/Commands.pm 2010-03-16 20:41:30 UTC (rev 5734)
+++ trunk/lib/setup-storage/Commands.pm 2010-03-16 21:05:36 UTC (rev 5735)
@@ -890,6 +890,7 @@
$fs = "linux-swap" if ($fs eq "swap");
$fs = "fat32" if ($fs eq "vfat");
$fs = "fat16" if ($fs eq "msdos");
+ $fs = "ext3" if ($fs eq "ext4");
$fs = $FAI::current_config{$disk}{partitions}{$mapped_id}{filesystem}
if ($part->{size}->{preserve} || $part->{size}->{resize});
$fs = "" if ($fs eq "-");
Modified: trunk/lib/setup-storage/Fstab.pm
===================================================================
--- trunk/lib/setup-storage/Fstab.pm 2010-03-16 20:41:30 UTC (rev 5734)
+++ trunk/lib/setup-storage/Fstab.pm 2010-03-16 21:05:36 UTC (rev 5735)
@@ -60,7 +60,7 @@
# order of filesystem checks: the root filesystem gets a 1, the others
# get 2, swap gets 0
$fstab_line[-1] = 1 if ($d_ref->{mountpoint} eq "/");
- $fstab_line[-1] = 0 if ($d_ref->{mountpoint} eq "swap");
+ $fstab_line[-1] = 0 if ($d_ref->{filesystem} eq "swap");
# set the ROOT_PARTITION variable, if this is the mountpoint for /
$FAI::disk_var{ROOT_PARTITION} = $name
Modified: trunk/lib/setup-storage/Parser.pm
===================================================================
--- trunk/lib/setup-storage/Parser.pm 2010-03-16 20:41:30 UTC (rev 5734)
+++ trunk/lib/setup-storage/Parser.pm 2010-03-16 21:05:36 UTC (rev 5735)
@@ -290,7 +290,7 @@
################################################################################
#
-# @brief This function converts different sizes to Mbyte
+# @brief This function converts different sizes to MiB
#
# @param $val is the number with its unit
#
@@ -298,15 +298,22 @@
sub convert_unit
{
my ($val) = @_;
- ($val =~ /^(\d+(\.\d+)?)([kMGTP%]?)(B)?\s*$/) or
- &FAI::internal_error("convert_unit $val");
- $val = $1 * (1 / 1024) * (1 / 1024) if ($3 eq "" && defined ($4) && $4 eq "B");
- $val = $1 * (1 / 1024) if ($3 eq "k");
- $val = $1 if ($3 eq "M");
- $val = $1 * 1024 if ($3 eq "G");
- $val = $1 * (1024 * 1024) if ($3 eq "T");
- $val = $1 * (1024 * 1024 * 1024) if ($3 eq "P");
+
+ ## don't warn for now, G/GiB/GB are all treated the same way
+ ## ($val =~ /([kKMGTP])\s*$/) and
+ ## warn "Using $1 as size modifier is deprecated, please use $1iB or $1B
+ ## instead; in future releases these will be treated as different modifiers\n";
+
# % is returned as is
+ if ($val =~ /^(\d+(\.\d+)?)%\s*$/) { 1; }
+ elsif ($val =~ /^(\d+(\.\d+)?)B\s*$/) { $val = $1 * (1 / 1024) * (1 / 1024); }
+ elsif ($val =~ /^(\d+(\.\d+)?)[kK](i)?(B)?\s*$/) { $val = $1 * (1 / 1024); }
+ elsif ($val =~ /^(\d+(\.\d+)?)M(i)?(B)?\s*$/) { $val = $1; }
+ elsif ($val =~ /^(\d+(\.\d+)?)G(i)?(B)?\s*$/) { $val = $1 * 1024; }
+ elsif ($val =~ /^(\d+(\.\d+)?)T(i)?(B)?\s*$/) { $val = $1 * (1024 * 1024); }
+ elsif ($val =~ /^(\d+(\.\d+)?)P(i)?(B)?\s*$/) { $val = $1 * (1024 * 1024 * 1024); }
+ else { &FAI::internal_error("convert_unit $val"); }
+
return $val;
}
@@ -623,7 +630,7 @@
1;
}
- size: /^(\d+[kMGTP%]?(-(\d+[kMGTP%]?)?)?)(:resize)?\s+/
+ size: /^(\d+[kMGTP%iB]*(-(\d+[kMGTP%iB]*)?)?)(:resize)?\s+/
{
# complete the size specification to be a range in all cases
my $range = $1;
@@ -641,7 +648,9 @@
# convert the units, if necessary
my ($min, $max) = split (/-/, $range);
+ $min .= "MiB" if ($min =~ /\d\s*$/);
$min = &FAI::convert_unit($min);
+ $max .= "MiB" if ($max =~ /\d\s*$/);
$max = &FAI::convert_unit($max);
$range = "$min-$max";
# enter the range into the hash
@@ -652,13 +661,15 @@
$FAI::configs{$FAI::device}{preserveparts} = 1;
}
}
- | /^(-\d+[kMGTP%]?)(:resize)?\s+/
+ | /^(-\d+[kMGTP%iB]*)(:resize)?\s+/
{
# complete the range by assuming 0 as the lower limit
my $range = "0$1";
# convert the units, if necessary
my ($min, $max) = split (/-/, $range);
+ $min .= "MiB" if ($min =~ /\d\s*$/);
$min = &FAI::convert_unit($min);
+ $max .= "MiB" if ($max =~ /\d\s*$/);
$max = &FAI::convert_unit($max);
$range = "$min-$max";
# enter the range into the hash
Modified: trunk/lib/setup-storage/Sizes.pm
===================================================================
--- trunk/lib/setup-storage/Sizes.pm 2010-03-16 20:41:30 UTC (rev 5734)
+++ trunk/lib/setup-storage/Sizes.pm 2010-03-16 21:05:36 UTC (rev 5735)
@@ -236,7 +236,7 @@
# reference to the size of the current logical volume
my $lv_size = (\%FAI::configs)->{$config}->{volumes}->{$lv}->{size};
# get the effective sizes (in Bytes) from the range
- my ($start, $end) = &FAI::make_range($lv_size->{range}, "${vg_size}MB");
+ my ($start, $end) = &FAI::make_range($lv_size->{range}, "${vg_size}MiB");
# make them MB
$start /= 1024.0 * 1024.0;
$end /= 1024.0 * 1024.0;
@@ -274,7 +274,7 @@
# get the range again
my ($start, $end) =
- &FAI::make_range($FAI::configs{$config}{volumes}{$lv}{size}{range}, "${vg_size}MB");
+ &FAI::make_range($FAI::configs{$config}{volumes}{$lv}{size}{range}, "${vg_size}MiB");
# make them MB
$start /= 1024.0 * 1024.0;
$end /= 1024.0 * 1024.0;
@@ -685,7 +685,7 @@
$FAI::device = $config;
&FAI::init_part_config("primary");
$FAI::configs{$config}{gpt_bios_part} = $FAI::partition_pointer->{number};
- my $s = &FAI::convert_unit("120k");
+ my $s = &FAI::convert_unit("120KiB");
# enter the range into the hash
$FAI::partition_pointer->{size}->{range} = "$s-$s";
# set proper defaults
@@ -740,9 +740,9 @@
($next_start, $min_req_total_space) = &FAI::do_partition_real($part_id,
$config, $disk, $next_start, $min_req_total_space, \@worklist);
- # msdos does not support partitions larger than 2TB
- ($part->{size}->{eff_size} > (&FAI::convert_unit("2TB") * 1024.0 *
- 1024.0)) and die "msdos disklabel does not support partitions > 2TB, please use disklabel:gpt or gpt-bios\n"
+ # msdos does not support partitions larger than 2TiB
+ ($part->{size}->{eff_size} > (&FAI::convert_unit("2TiB") * 1024.0 *
+ 1024.0)) and die "msdos disklabel does not support partitions > 2TiB, please use disklabel:gpt or gpt-bios\n"
if ($FAI::configs{$config}{disklabel} eq "msdos");
# partition done
shift @worklist;
Modified: trunk/lib/setup-storage/Volumes.pm
===================================================================
--- trunk/lib/setup-storage/Volumes.pm 2010-03-16 20:41:30 UTC (rev 5734)
+++ trunk/lib/setup-storage/Volumes.pm 2010-03-16 21:05:36 UTC (rev 5735)
@@ -372,7 +372,7 @@
# parse the output line by line
foreach my $line (@mdadm_print) {
- if ($line =~ /^ARRAY \/dev\/md(\d+) level=(\S+) num-devices=\d+(\s+|$)/) {
+ if ($line =~ /^ARRAY \/dev\/md[\/]?(\d+) level=(\S+) num-devices=\d+(\s+|$)/) {
$id = $1;
$FAI::current_raid_config{$id}{mode} = $2;
&FAI::push_command( "true", "", "exist_/dev/md$id" );
Modified: trunk/man/setup-storage.8
===================================================================
--- trunk/man/setup-storage.8 2010-03-16 20:41:30 UTC (rev 5734)
+++ trunk/man/setup-storage.8 2010-03-16 21:05:36 UTC (rev 5735)
@@ -318,16 +318,20 @@
.br
-size ::= [[:digit:]]+[kMGTP%]?(-([[:digit:]]+[kMGTP%]?)?)?(:resize)?
+size ::= [[:digit:]]+[kKMGTP%iB]*(-([[:digit:]]+[kKMGTP%iB]*)?)?(:resize)?
.br
- /* size in kilo, mega (default), giga, tera or petabytes or %,
+ /* size in kilo (KiB), mega (default, MiB), giga (GiB), tera (TiB) or
.br
- * possibly given as a range; physical
+ * petabytes (PiB) or %, possibly given as a range; physical
.br
- * partitions or lvm logical volumes only; */
+ * partitions or lvm logical volumes only; in future releases KB, MB,
.br
- | -[[:digit:]]+[kMGTP%]?(:resize)?
+ * GB, ... will be treated as 1000 instead of 1024 (KiB, MiB, GiB, ...)
.br
+ * multipliers */
+.br
+ | -[[:digit:]]+[kKMGTP%iB]*(:resize)?
+.br
/* size in kilo, mega (default), giga, tera or petabytes or %,
.br
* given as upper limit; physical partitions
@@ -405,10 +409,10 @@
Preserve the 6th and the 7th partition. The disklabel is msdos which is the default
for x86. Furthermore the 3rd partition is made bootable.
.IP \(bu
-Create a primary partition /dev/hda1 with a size between 20 and 100 MB and mount it
+Create a primary partition /dev/hda1 with a size between 20 and 100 MiB and mount it
read-write as /boot; it is formatted using ext3 filesystem.
.IP \(bu
-/dev/hda2 will be a swap space of 1000 MB
+/dev/hda2 will be a swap space of 1000 MiB
.IP \(bu
/dev/hda3 should be formatted using ext3 filesystem; when calling mkfs.ext3
the option "\-b 2048" is appended.
More information about the Fai-commit
mailing list