[Fai-commit] r5909 - branches/experimental/patches
Michael Tautschnig
mt at alioth.debian.org
Thu Jul 29 16:32:50 UTC 2010
Author: mt
Date: 2010-07-29 16:32:48 +0000 (Thu, 29 Jul 2010)
New Revision: 5909
Removed:
branches/experimental/patches/device2grub_stable_names
branches/experimental/patches/setup-storage_abs-path
branches/experimental/patches/setup-storage_always-format
branches/experimental/patches/setup-storage_better-parser-errors
branches/experimental/patches/setup-storage_cciss-bugfix
branches/experimental/patches/setup-storage_empty-vg
branches/experimental/patches/setup-storage_exit-codes
branches/experimental/patches/setup-storage_external-journal
branches/experimental/patches/setup-storage_lvm-preserve2
branches/experimental/patches/setup-storage_parted2.2
branches/experimental/patches/setup-storage_preserve-lazy
branches/experimental/patches/setup-storage_ramsize
branches/experimental/patches/setup-storage_resize2fs
branches/experimental/patches/setup-storage_tmpfs
branches/experimental/patches/setup-storage_used-devs-only
Modified:
branches/experimental/patches/grub-pc
branches/experimental/patches/series
branches/experimental/patches/setup-storage_devmapper
branches/experimental/patches/setup-storage_exp-version
Log:
Merged most of the setup-storage related patches (+device2grub_stable_names)
into trunk, updated further patches to match current trunk
Deleted: branches/experimental/patches/device2grub_stable_names
===================================================================
--- branches/experimental/patches/device2grub_stable_names 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/device2grub_stable_names 2010-07-29 16:32:48 UTC (rev 5909)
@@ -1,48 +0,0 @@
-2010-07-07 Julien BLACHE <jblache at debian.org>
- * bin/device2grub: try to find and use a stable name (by-id) for the
- device if the shortname has no match in device.map. Needed now that
- grub2 in unstable has switched to using stable names in device.map.
-Index: trunk/bin/device2grub
-===================================================================
---- trunk.orig/bin/device2grub
-+++ trunk/bin/device2grub
-@@ -5,11 +5,15 @@
- # TODO: read from stdin if no parameter given
-
- use strict;
-+
-+use Cwd 'abs_path';
-+
- my $grubdevice;
- my %map;
-
- my $device=shift;
- my $devicemap="$ENV{target}/boot/grub/device.map";
-+my $devbyid = "/dev/disk/by-id";
-
- open (DEVICEMAP,"<$devicemap") || die "Can't open $devicemap\n";
- while (<DEVICEMAP>) {
-@@ -23,7 +27,22 @@
- if ($map{$disk}) {
- $grubdevice=$map{$disk};
- } else {
-- die "No match in $devicemap for $disk\n";
-+ opendir (my $dh, $devbyid) || die "Can't open /dev/disk/by-id\n";
-+ while (my $diskid = readdir $dh) {
-+ next if ($diskid =~ /[.].*/);
-+
-+ $diskid = $devbyid . "/" . $diskid;
-+
-+ my $shortdev = abs_path($diskid);
-+
-+ if (($shortdev eq $disk) && $map{$diskid}) {
-+ $grubdevice = $map{$diskid};
-+ last;
-+ }
-+ }
-+ closedir $dh;
-+
-+ die "No match in $devicemap for $disk\n" unless $grubdevice;
- }
-
- if ($partition) {
Modified: branches/experimental/patches/grub-pc
===================================================================
--- branches/experimental/patches/grub-pc 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/grub-pc 2010-07-29 16:32:48 UTC (rev 5909)
@@ -93,7 +93,7 @@
===================================================================
--- trunk.orig/lib/setup-storage/Fstab.pm
+++ trunk/lib/setup-storage/Fstab.pm
-@@ -128,6 +128,54 @@
+@@ -129,6 +129,54 @@
}
}
@@ -148,7 +148,7 @@
################################################################################
#
-@@ -148,6 +196,9 @@
+@@ -149,6 +197,9 @@
# the file to be returned, a list of lines
my @fstab = ();
@@ -158,7 +158,7 @@
# walk through all configured parts
# the order of entries is most likely wrong, it is fixed at the end
foreach my $c (keys %$config) {
-@@ -171,15 +222,11 @@
+@@ -172,15 +223,11 @@
my $device_name = &FAI::make_device_name($device, $p_ref->{number});
@@ -178,7 +178,7 @@
}
push @fstab, &FAI::create_fstab_line($p_ref,
-@@ -216,15 +263,13 @@
+@@ -217,15 +264,13 @@
my $device_name = $fstab_key[0];
@@ -201,7 +201,7 @@
}
push @fstab, &FAI::create_fstab_line($l_ref,
-@@ -243,15 +288,13 @@
+@@ -244,15 +289,13 @@
my $device_name = "/dev/md$r";
@@ -224,7 +224,7 @@
}
push @fstab, &FAI::create_fstab_line($r_ref,
-@@ -265,8 +308,7 @@
+@@ -266,8 +309,7 @@
my $device_name = &FAI::enc_name($c_ref->{device});
@@ -234,7 +234,7 @@
die "Boot partition cannot be encrypted\n";
push @fstab, &FAI::create_fstab_line($c_ref, $device_name, $device_name);
-@@ -281,7 +323,10 @@
+@@ -305,7 +347,10 @@
$FAI::disk_var{SWAPLIST} =~ s/\s*$/"/;
# cleanup the list of boot devices (remove leading space and add quotes)
Modified: branches/experimental/patches/series
===================================================================
--- branches/experimental/patches/series 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/series 2010-07-29 16:32:48 UTC (rev 5909)
@@ -5,24 +5,9 @@
bugfix-313397
bugfix-479537
setup-storage_no-cylinder-boundaries
-setup-storage_used-devs-only
-setup-storage_preserve-lazy
-setup-storage_lvm-preserve2
-setup-storage_resize2fs
-setup-storage_always-format
-setup-storage_parted2.2
-setup-storage_empty-vg
-setup-storage_abs-path
setup-storage_devmapper
fix-eval_cmdline
-setup-storage_ramsize
-setup-storage_tmpfs
-setup-storage_external-journal
-setup-storage_cciss-bugfix
ainsl_man-page-return-codes
-setup-storage_better-parser-errors
setup-storage_extended-is-not-last
-setup-storage_exit-codes
setup-storage_no-useless-rebuild
-device2grub_stable_names
dhcp-transition
Deleted: branches/experimental/patches/setup-storage_abs-path
===================================================================
--- branches/experimental/patches/setup-storage_abs-path 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/setup-storage_abs-path 2010-07-29 16:32:48 UTC (rev 5909)
@@ -1,46 +0,0 @@
-2010-04-20 Michael Tautschnig <mt at debian.org>
-
- * setup-storage/Volumes.pm: Use absolute path names for devices in volume
- groups, RAID volumes.
-Index: trunk/lib/setup-storage/Volumes.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Volumes.pm
-+++ trunk/lib/setup-storage/Volumes.pm
-@@ -368,6 +368,7 @@
- sub get_current_lvm {
-
- use Linux::LVM;
-+ use Cwd qw(abs_path);
-
- # get the existing volume groups
- foreach my $vg (get_volume_group_list()) {
-@@ -395,8 +396,8 @@
-
- # store the physical volumes
- my %pv_info = get_physical_volume_information($vg);
-- @{ $FAI::current_lvm_config{$vg}{physical_volumes} } =
-- sort keys %pv_info;
-+ push @{ $FAI::current_lvm_config{$vg}{physical_volumes} },
-+ abs_path($_) foreach (sort keys %pv_info);
- }
-
- }
-@@ -409,6 +410,8 @@
- ################################################################################
- sub get_current_raid {
-
-+ use Cwd qw(abs_path);
-+
- # the list to hold the output of mdadm commands as parsed below
- my @mdadm_print = ();
-
-@@ -443,7 +446,8 @@
- $FAI::current_raid_config{$id}{mode} = $2;
- } elsif ($line =~ /^\s*devices=(\S+)$/) {
- defined($id) or &FAI::internal_error("mdadm ARRAY line not yet seen");
-- @{ $FAI::current_raid_config{$id}{devices} } = split (",", $1);
-+ push @{ $FAI::current_raid_config{$id}{devices} }, abs_path($_)
-+ foreach (split (",", $1));
- }
- }
- }
Deleted: branches/experimental/patches/setup-storage_always-format
===================================================================
--- branches/experimental/patches/setup-storage_always-format 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/setup-storage_always-format 2010-07-29 16:32:48 UTC (rev 5909)
@@ -1,173 +0,0 @@
-2010-04-06 Michael Tautschnig <mt at debian.org>
-
- * setup-storage/{Parser.pm,Commands.pm}: Added support for new always_format
- option.
- * setup-storage.8: Documented new always_format option.
-Index: trunk/lib/setup-storage/Commands.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Commands.pm
-+++ trunk/lib/setup-storage/Commands.pm
-@@ -251,6 +251,10 @@
- # done; its existance has been checked in propagate_and_check_preserve
- if ($vol->{preserve}) {
- &FAI::push_command("true", "", "exist_/dev/md$id");
-+ # create the filesystem on the volume, if requested
-+ &FAI::build_mkfs_commands("/dev/md$id",
-+ \%{ $FAI::configs{$config}{volumes}{$id} })
-+ if (1 == $vol->{always_format});
- next;
- }
-
-@@ -439,6 +443,10 @@
- defined ($FAI::current_lvm_config{$vg}{volumes}{$lv})
- or die "Preserved volume $vg/$lv does not exist\n";
- warn "$vg/$lv will be preserved\n";
-+ # create the filesystem on the volume, if requested
-+ &FAI::build_mkfs_commands("/dev/$vg/$lv",
-+ \%{ $FAI::configs{$config}{volumes}{$lv} })
-+ if (1 == $lv_size->{always_format});
- next;
- }
-
-@@ -482,6 +490,10 @@
- }
- }
-
-+ # create the filesystem on the volume, if requested
-+ &FAI::build_mkfs_commands("/dev/$vg/$lv",
-+ \%{ $FAI::configs{$config}{volumes}{$lv} })
-+ if (1 == $lv_size->{always_format});
- next;
- }
-
-@@ -1039,8 +1051,9 @@
- my $part = (\%FAI::configs)->{$config}->{partitions}->{$part_id};
-
- # skip preserved/resized/extended partitions
-- next if ($part->{size}->{preserve} == 1
-- || $part->{size}->{resize} == 1 || $part->{size}->{extended} == 1);
-+ next if (($part->{size}->{always_format} == 0 &&
-+ ($part->{size}->{preserve} == 1 || $part->{size}->{resize} == 1))
-+ || $part->{size}->{extended} == 1);
-
- # create the filesystem on the device
- &FAI::build_mkfs_commands( &FAI::make_device_name($disk, $part_id), $part );
-Index: trunk/lib/setup-storage/Parser.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Parser.pm
-+++ trunk/lib/setup-storage/Parser.pm
-@@ -257,6 +257,10 @@
- defined ($part_size->{preserve})
- or $part_size->{preserve} = 0;
-
-+ # add the always_format = 0 flag, if it doesn't exist already
-+ defined ($part_size->{always_format})
-+ or $part_size->{always_format} = 0;
-+
- # add the resize = 0 flag, if it doesn't exist already
- defined ($part_size->{resize}) or $part_size->{resize} = 0;
- }
-@@ -284,6 +288,10 @@
- defined ($FAI::partition_pointer->{size}->{preserve})
- or $FAI::partition_pointer->{size}->{preserve} = 0;
-
-+ # add the always_format = 0 flag, if it doesn't exist already
-+ defined ($FAI::partition_pointer->{size}->{always_format})
-+ or $FAI::partition_pointer->{size}->{always_format} = 0;
-+
- # add the resize = 0 flag, if it doesn't exist already
- defined ($FAI::partition_pointer->{size}->{resize})
- or $FAI::partition_pointer->{size}->{resize} = 0;
-@@ -414,6 +422,10 @@
- # the information preferred for fstab device identifieres
- $FAI::configs{$FAI::device}{fstabkey} = $1;
- }
-+ | /^always_format:(\d+(,\d+)*)/
-+ {
-+ $FAI::configs{RAID}{volumes}{$_}{always_format} = 1 foreach (split (",", $1));
-+ }
-
- cryptsetup_option: /^randinit/
- {
-@@ -462,6 +474,14 @@
- # the information preferred for fstab device identifieres
- $FAI::configs{"VG_--ANY--"}{fstabkey} = $1;
- }
-+ | m{^always_format:([^/,\s\-]+-[^/,\s\-]+(,[^/,\s\-]+-[^/,\s\-]+)*)}
-+ {
-+ foreach (split (",", $1)) {
-+ (m{^([^/,\s\-]+)-([^/,\s\-]+)}) or
-+ die &FAI::internal_error("VG re-parse failed");
-+ $FAI::configs{"VG_$1"}{volumes}{$2}{size}{always_format} = 1;
-+ }
-+ }
-
-
- option: /^preserve_always:(\d+(,\d+)*)/
-@@ -532,6 +552,10 @@
-
- $FAI::configs{$FAI::device} = dclone($FAI::configs{"PHY_" . $ref_dev});
- }
-+ | /^always_format:(\d+(,\d+)*)/
-+ {
-+ $FAI::configs{$FAI::device}{partitions}{$_}{size}{always_format} = 1 foreach (split(",", $1));
-+ }
-
- volume: /^vg\s+/ name devices vgcreateopt(s?)
- | /^raid([0156]|10)\s+/
-@@ -606,6 +630,8 @@
- # initialise the preserve and resize flags
- defined($FAI::configs{$FAI::device}{volumes}{$2}{size}{preserve}) or
- $FAI::configs{$FAI::device}{volumes}{$2}{size}{preserve} = 0;
-+ defined($FAI::configs{$FAI::device}{volumes}{$2}{size}{always_format}) or
-+ $FAI::configs{$FAI::device}{volumes}{$2}{size}{always_format} = 0;
- defined($FAI::configs{$FAI::device}{volumes}{$2}{size}{resize}) or
- $FAI::configs{$FAI::device}{volumes}{$2}{size}{resize} = 0;
- # set the reference to the current volume
-Index: trunk/man/setup-storage.8
-===================================================================
---- trunk.orig/man/setup-storage.8
-+++ trunk/man/setup-storage.8
-@@ -168,6 +168,10 @@
- .br
- /* preserve volumes -- unless these don't exist yet */
- .br
-+ | always_format:[^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*
-+.br
-+ /* run mkfs on the volumes, even if marked as preserve */
-+.br
- | resize:[^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*
- .br
- /* attempt to resize partitions */
-@@ -198,6 +202,10 @@
- .br
- /* preserve volumes -- unless these don't exist yet */
- .br
-+ | always_format:[[:digit:]]+(,[[:digit:]]+)*
-+.br
-+ /* run mkfs on the volumes, even if marked as preserve */
-+.br
- | fstabkey:(device|label|uuid)
- .br
- /* when creating the fstab the key used for defining the device
-@@ -232,6 +240,10 @@
- .br
- /* preserve partitions -- unless these don't exist yet */
- .br
-+ | always_format:[[:digit:]]+(,[[:digit:]]+)*
-+.br
-+ /* run mkfs on the partitions, even if marked as preserve */
-+.br
- | resize:[[:digit:]]+(,[[:digit:]]+)*
- .br
- /* attempt to resize partitions */
-@@ -396,6 +408,9 @@
- one of the FAI_FLAGS. preserve_lazy allows to preserve partitions only if these
- exist already. Otherwise they are created.
- .IP \(bu
-+The "always_format" option overrides preserving filesystems (via one of the
-+"preserveX" options), like the "format" option in setup_harddisks.
-+.IP \(bu
- Support for LVM and RAID is completely new
- .IP \(bu
- Resizing partitions and filesystems is supported
Deleted: branches/experimental/patches/setup-storage_better-parser-errors
===================================================================
--- branches/experimental/patches/setup-storage_better-parser-errors 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/setup-storage_better-parser-errors 2010-07-29 16:32:48 UTC (rev 5909)
@@ -1,76 +0,0 @@
-2010-06-18 Michael Tautschnig <mt at debian.org>
-
- * setup-storage/Parser.pm: Handle parse errors earlier for more informative
- error messages.
- * setup-storage/Volumes.pm: Proper error message in case an extended partition
- is marked as preserve
-Index: trunk/lib/setup-storage/Parser.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Parser.pm
-+++ trunk/lib/setup-storage/Parser.pm
-@@ -239,7 +239,7 @@
-
- # msdos disk labels don't allow for more than 4 primary partitions
- ($extended < 5)
-- or die "Too many primary partitions while creating extended\n";
-+ or die "Too many primary partitions; cannot add extended partition\n";
-
- # initialize the entry, unless it already exists
- defined ($FAI::configs{$FAI::device}{partitions}{$extended})
-@@ -247,6 +247,10 @@
- size => {}
- };
-
-+ # as we can't compute the index from the reference, we need to store the
-+ # $part_number explicitly
-+ (\%FAI::configs)->{$FAI::device}->{partitions}->{$extended}->{number} = $extended;
-+
- my $part_size =
- (\%FAI::configs)->{$FAI::device}->{partitions}->{$extended}->{size};
-
-@@ -355,7 +359,6 @@
- {
- $return = 1;
- }
-- | <error>
-
- line: <skip: qr/[ \t]*/> "\\n"
- | <skip: qr/[ \t]*/> comment "\\n"
-@@ -421,6 +424,7 @@
- &FAI::init_disk_config($item[ 1 ]);
- }
- option(s?)
-+ | <error>
-
- raid_option: /^preserve_always:(\d+(,\d+)*)/
- {
-@@ -644,6 +648,7 @@
- }
- mountpoint tmpfs_size mount_options
- | type mountpoint size filesystem mount_options lv_or_fsopts
-+ | <error>
-
- type: 'primary'
- {
-@@ -715,7 +720,7 @@
- 1;
- }
-
-- size: /^((RAM:\d+%|\d+[kMGTP%iB]*)(-(RAM:\d+%|\d+[kMGTP%iB]*)?)?)(:resize)?\s+/
-+ size: /^((RAM:\d+%|\d+[kMGTP%iB]*)(-(RAM:\d+%|\d+[kMGTP%iB]*)?)?)(:resize)?/
- {
- # complete the size specification to be a range in all cases
- my $range = $1;
-Index: trunk/lib/setup-storage/Volumes.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Volumes.pm
-+++ trunk/lib/setup-storage/Volumes.pm
-@@ -518,6 +518,8 @@
- defined($FAI::current_config{$1}{partitions}{$part_id})) ? 1 : 0)
- if (2 == $part->{size}->{preserve});
- next unless ($part->{size}->{preserve} || $part->{size}->{resize});
-+ ($part->{size}->{extended}) and die
-+ "Preserving extended partitions is not supported; mark all logical partitions instead\n";
- defined ($FAI::current_config{$1}{partitions}{$part_id}) or die
- "Can't preserve ". &FAI::make_device_name($1, $part->{number})
- . " because it does not exist\n";
Deleted: branches/experimental/patches/setup-storage_cciss-bugfix
===================================================================
--- branches/experimental/patches/setup-storage_cciss-bugfix 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/setup-storage_cciss-bugfix 2010-07-29 16:32:48 UTC (rev 5909)
@@ -1,22 +0,0 @@
-2010-05-29 Michael Tautschnig <mt at debian.org>
-
- * setup-storage/Init.pm: Properly handle /dev/cciss disk devices, even without
- partitions (thanks Steffen Grunewald <steffen.grunewald at aei.mpg.de> and
- Mathieu Alorent <malorent at echo.fr>).
-Index: trunk/lib/setup-storage/Init.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Init.pm
-+++ trunk/lib/setup-storage/Init.pm
-@@ -183,10 +183,10 @@
- return (1, "/dev/$1", $2);
- }
- elsif ($dev =~
-- m{^/dev/(cciss/c\dd\d|ida/c\dd\d|rd/c\dd\d|ataraid/d\d|etherd/e\d+\.\d+)p(\d+)?$})
-+ m{^/dev/(cciss/c\dd\d|ida/c\dd\d|rd/c\dd\d|ataraid/d\d|etherd/e\d+\.\d+)(p(\d+))?$})
- {
- defined($2) or return (1, "/dev/$1", -1);
-- return (1, "/dev/$1", $2);
-+ return (1, "/dev/$1", $3);
- }
- # TODO: handle /dev/mapper devices
- return (0, "", -2);
Modified: branches/experimental/patches/setup-storage_devmapper
===================================================================
--- branches/experimental/patches/setup-storage_devmapper 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/setup-storage_devmapper 2010-07-29 16:32:48 UTC (rev 5909)
@@ -4,7 +4,7 @@
+++ trunk/lib/setup-storage/Init.pm
@@ -188,6 +188,7 @@
defined($2) or return (1, "/dev/$1", -1);
- return (1, "/dev/$1", $2);
+ return (1, "/dev/$1", $3);
}
+ # TODO: handle /dev/mapper devices
return (0, "", -2);
Deleted: branches/experimental/patches/setup-storage_empty-vg
===================================================================
--- branches/experimental/patches/setup-storage_empty-vg 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/setup-storage_empty-vg 2010-07-29 16:32:48 UTC (rev 5909)
@@ -1,17 +0,0 @@
-2010-04-20 Michael Tautschnig <mt at debian.org>
-
- * setup-storage/Volumes.pm: Use VG size for volume group size, not space in
- use. Thanks Mathieu Alorent for reporting this.
-Index: trunk/lib/setup-storage/Volumes.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Volumes.pm
-+++ trunk/lib/setup-storage/Volumes.pm
-@@ -378,7 +378,7 @@
- my %vg_info = get_volume_group_information($vg);
- if (%vg_info) {
- $FAI::current_lvm_config{$vg}{size} = &FAI::convert_unit(
-- $vg_info{alloc_pe_size} . $vg_info{alloc_pe_size_unit});
-+ $vg_info{vg_size} . $vg_info{vg_size_unit});
- } else {
- $FAI::current_lvm_config{$vg}{size} = "0";
- }
Deleted: branches/experimental/patches/setup-storage_exit-codes
===================================================================
--- branches/experimental/patches/setup-storage_exit-codes 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/setup-storage_exit-codes 2010-07-29 16:32:48 UTC (rev 5909)
@@ -1,175 +0,0 @@
-2010-06-28 Michael Tautschnig <mt at debian.org>
-
- * setup-storage/Exec.pm: All unexpected non-zero exit codes of subcommands
- lead to immediate failure of setup-storage.
-Index: trunk/lib/setup-storage/Exec.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Exec.pm
-+++ trunk/lib/setup-storage/Exec.pm
-@@ -58,6 +58,7 @@
- stdout_regex => "",
- program => "parted",
- response => "die",
-+ exit_codes => [0..255],
- },
- {
- error => "parted_1_new",
-@@ -66,22 +67,25 @@
- stdout_regex => "Error: Could not stat device .* - No such file or directory",
- program => "parted",
- response => "die",
-+ exit_codes => [0..255],
- },
- {
- error => "parted_2",
-- message => "Parted could not read a disk label\n",
-+ message => "Parted could not read a disk label (new disk?)\n",
- stderr_regex => "Error: Unable to open .* - unrecognised disk label",
- stdout_regex => "",
-- program => "parted",
-+ program => "parted -s \\S+ unit TiB print",
- response => "warn",
-+ exit_codes => [1],
- },
- {
- error => "parted_2_new",
-- message => "Parted could not read a disk label\n",
-+ message => "Parted could not read a disk label (new disk?)\n",
- stderr_regex => "",
- stdout_regex => "Error: .* unrecognised disk label",
-- program => "parted",
-+ program => "parted -s \\S+ unit TiB print",
- response => "warn",
-+ exit_codes => [1],
- },
- ## {
- ## error => "parted_3",
-@@ -90,6 +94,7 @@
- ## stdout_regex => "",
- ## program => "parted",
- ## response => \&FAI::restore_partition_table,
-+ ## exit_codes => [0..255],
- ## },
- {
- error => "parted_4",
-@@ -98,6 +103,7 @@
- stdout_regex => "",
- program => "parted",
- response => "die",
-+ exit_codes => [0..255],
- },
- {
- error => "parted_4_new",
-@@ -106,6 +112,7 @@
- stdout_regex => "No Implementation: Partition \\d+ isn't aligned to cylinder boundaries",
- program => "parted",
- response => "die",
-+ exit_codes => [0..255],
- },
- {
- error => "parted_5",
-@@ -114,6 +121,7 @@
- stdout_regex => "",
- program => "parted",
- response => "die",
-+ exit_codes => [0..255],
- },
- {
- error => "parted_5_new",
-@@ -122,6 +130,7 @@
- stdout_regex => "Error: Can't have overlapping partitions",
- program => "parted",
- response => "die",
-+ exit_codes => [0..255],
- },
- {
- error => "parted_6",
-@@ -130,6 +139,7 @@
- stdout_regex => "",
- program => "parted",
- response => "die",
-+ exit_codes => [0..255],
- },
- {
- error => "parted_6_new",
-@@ -138,6 +148,7 @@
- stdout_regex => "Error: Unable to satisfy all constraints on the partition",
- program => "parted",
- response => "die",
-+ exit_codes => [0..255],
- },
- {
- error => "cmd_parted_1",
-@@ -145,7 +156,8 @@
- stderr_regex => "(parted: command not found|/sbin/parted: No such file or directory)",
- stdout_regex => "",
- program => "parted",
-- response => "die"
-+ response => "die",
-+ exit_codes => [0..255],
- },
- {
- error => "mkfs.xfs_1",
-@@ -154,6 +166,7 @@
- stdout_regex => "",
- program => "mkfs.xfs",
- response => "die",
-+ exit_codes => [0..255],
- },
- {
- error => "ntfsresize_1",
-@@ -162,6 +175,16 @@
- stdout_regex => "",
- program => "ntfsresize",
- response => "die",
-+ exit_codes => [0..255],
-+ },
-+ {
-+ error => "catch_all_nonzero_exit_code",
-+ message => "Command had non-zero exit code\n",
-+ stderr_regex => "",
-+ stdout_regex => "",
-+ program => ".*",
-+ response => "die",
-+ exit_codes => [1..255],
- },
- ];
-
-@@ -301,6 +324,7 @@
- my @stdout = ();
- my $stderr_line = "";
- my $stdout_line = "";
-+ my $exit_code = 0;
-
- #make tempfile, get perl filehandle and filename of the file
- my ($stderr_fh, $stderr_filename) = File::Temp::tempfile(UNLINK => 1);
-@@ -315,9 +339,10 @@
- # execute the bash command, write stderr and stdout into the testfiles
- print "Executing: $command\n";
- `$command 1> $stdout_filename 2> $stderr_filename`;
-- ( ($?>>8) ne 0 ) and warn "Command $command had exit code " . ($?>>8) . "\n";
-+ $exit_code = ($?>>8);
- } else {
-- print "would run command $command; to have them executed, use -X \n";
-+ print "would run command $command; to have it executed, use -X \n";
-+ return "";
- }
-
- # read the tempfile into lists, each element of the list one line
-@@ -345,11 +370,11 @@
-
- #get the error, if there was any
- foreach my $err (@$FAI::error_codes) {
-- if (($err->{stdout_regex} eq "" || $stdout_line =~ /$err->{stdout_regex}/)
-- && ($err->{stderr_regex} eq "" || $stderr_line =~ /$err->{stderr_regex}/)
-- && ($err->{program} eq "" || $command =~ /$err->{program}/)) {
-- return $err->{error};
-- }
-+ return $err->{error} if
-+ (($err->{stdout_regex} eq "" || $stdout_line =~ /$err->{stdout_regex}/)
-+ && ($err->{stderr_regex} eq "" || $stderr_line =~ /$err->{stderr_regex}/)
-+ && ($err->{program} eq "" || $command =~ /$err->{program}/)
-+ && (grep {$_ == $exit_code} @{ $err->{exit_codes} }));
- }
-
- }
Modified: branches/experimental/patches/setup-storage_exp-version
===================================================================
--- branches/experimental/patches/setup-storage_exp-version 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/setup-storage_exp-version 2010-07-29 16:32:48 UTC (rev 5909)
@@ -9,8 +9,8 @@
package FAI;
--my $version = "1.2.1";
-+my $version = "1.2.1+exp";
+-my $version = "1.3";
++my $version = "1.3+exp";
# command line parameter handling
use Getopt::Std;
Deleted: branches/experimental/patches/setup-storage_external-journal
===================================================================
--- branches/experimental/patches/setup-storage_external-journal 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/setup-storage_external-journal 2010-07-29 16:32:48 UTC (rev 5909)
@@ -1,159 +0,0 @@
-2010-05-27 Julien BLACHE <jblache at debian.org>
- * lib/setup-storage/Commands.pm: support the creation of journal
- devices (ext3/4) and filesystems with external journal (ext3/4, xfs).
- * lib/setup-storage/Parser.pm: add support for FS_journal and
- FS:journal=.
- * man/setup-storage.8: document external journal support.
-
-Index: trunk/lib/setup-storage/Commands.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Commands.pm
-+++ trunk/lib/setup-storage/Commands.pm
-@@ -55,6 +55,7 @@
- defined ($partition->{filesystem})
- or &FAI::internal_error("filesystem is undefined");
- my $fs = $partition->{filesystem};
-+ my $journal = $partition->{journal_dev};
-
- return if ($fs eq "-");
-
-@@ -67,13 +68,45 @@
- print "$partition->{mountpoint} FS create_options: $create_options\n" if ($FAI::debug && $create_options);
- print "$partition->{mountpoint} FS tune_options: $tune_options\n" if ($FAI::debug && $tune_options);
-
-- # create the file system with options
-- my $create_tool = "mkfs.$fs";
-- ($fs eq "swap") and $create_tool = "mkswap";
-- ($fs eq "xfs") and $create_options = "$create_options -f" unless ($create_options =~ m/-f/);
-- ($fs eq "reiserfs") and $create_options = "$create_options -q" unless ($create_options =~ m/-(f|q|y)/);
-- &FAI::push_command( "$create_tool $create_options $device", "exist_$device",
-- "has_fs_$device" );
-+ my $prereqs = "exist_$device";
-+ my $provides;
-+ my $create_tool;
-+
-+ # create filesystem journal
-+ if ($fs =~ m/.*_journal$/) {
-+ $provides = "journal_preped_$device";
-+ undef($tune_options);
-+
-+ if ($fs =~ /ext[34]_journal/) {
-+ $create_tool = "mke2fs";
-+ $create_options = "-O journal_dev";
-+ } elsif ($fs eq "xfs_journal") {
-+ $create_tool = "/bin/true";
-+ $create_options = "";
-+ } else {
-+ &FAI::internal_error("unsupported journal type $fs");
-+ }
-+ } else {
-+ # create regular filesystem
-+ $provides = "has_fs_$device";
-+ $create_tool = "mkfs.$fs";
-+
-+ ($fs eq "swap") and $create_tool = "mkswap";
-+ ($fs eq "xfs") and $create_options = "$create_options -f" unless ($create_options =~ m/-f/);
-+ ($fs eq "reiserfs") and $create_options = "$create_options -q" unless ($create_options =~ m/-(f|q|y)/);
-+
-+ # adjust options for filesystem with external journal
-+ if (defined($journal)) {
-+ $journal =~ s/^journal=//;
-+ $prereqs = "$prereqs,journal_preped_$journal";
-+
-+ ($fs eq "xfs") and $create_options = "$create_options -l logdev=$journal";
-+ ($fs eq "ext3") and $create_options = "$create_options -J device=$journal";
-+ ($fs eq "ext4") and $create_options = "$create_options -J device=$journal";
-+ }
-+ }
-+
-+ &FAI::push_command( "$create_tool $create_options $device", $prereqs, $provides);
-
- # possibly tune the file system - this depends on whether the file system
- # supports tuning at all
-@@ -981,12 +1014,14 @@
- }
- }
-
-- my $fs = $part->{filesystem};
-- $fs = "" unless defined($fs);
-+ my $fs = (defined($part->{filesystem}) && $part->{filesystem} =~ /\S+/) ?
-+ $part->{filesystem} : "-";
-+ ($fs) = split(/:/, $fs);
- $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 = "" if ($fs =~ m/.*_journal$/);
- $fs = $FAI::current_config{$disk}{partitions}{$mapped_id}{filesystem}
- if ($part->{size}->{preserve} || $part->{size}->{resize});
- $fs = "" if ($fs eq "-");
-Index: trunk/lib/setup-storage/Parser.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Parser.pm
-+++ trunk/lib/setup-storage/Parser.pm
-@@ -870,16 +870,24 @@
- }
- | /^\S+/
- {
-- $FAI::partition_pointer->{filesystem} = $item[ 1 ];
-+ my ($fs, $journal) = split(/:/, $item[1]);
- my $to_be_preserved = 0;
-+
-+ $FAI::partition_pointer->{filesystem} = $fs;
-+
-+ defined($journal) and $journal =~ s/journal=//;
-+ $FAI::partition_pointer->{journal_dev} = $journal;
-+
- if ($FAI::device eq "RAID" or $FAI::device eq "CRYPT") {
- $to_be_preserved = $FAI::partition_pointer->{preserve};
- } else {
- $to_be_preserved = $FAI::partition_pointer->{size}->{preserve};
- }
- if (0 == $to_be_preserved) {
-- &FAI::in_path("mkfs.$item[1]") or
-- die "unknown/invalid filesystem type $item[1] (mkfs.$item[1] not found in PATH)\n";
-+ $fs =~ s/_journal$//;
-+
-+ &FAI::in_path("mkfs.$fs") or
-+ die "unknown/invalid filesystem type $fs (mkfs.$fs not found in PATH)\n";
- }
- }
-
-Index: trunk/man/setup-storage.8
-===================================================================
---- trunk.orig/man/setup-storage.8
-+++ trunk/man/setup-storage.8
-@@ -536,6 +536,33 @@
- .IP \(bu
- Mount a tmpfs on /scratch with a maximum size of 3 GiB.
-
-+.TP
-+External log device example
-+.sp
-+.nf
-+.ta 10n 20n 30n 40n 60n
-+disk_config /dev/sda fstabkey:uuid bootable:2
-+primary / 20GiB ext3 defaults
-+primary /boot 250 ext2 defaults
-+primary swap 4GiB swap defaults
-+logical - 256 ext3_journal -
-+logical - 256 ext4_journal -
-+logical - 256 xfs_journal -
-+
-+disk_config /dev/sdb fstabkey:uuid
-+primary /mnt/ext3 33% ext3:journal=/dev/sda5 defaults
-+primary /mnt/ext4 33% ext4:journal=/dev/sda6 defaults
-+primary /mnt/xfs 33% xfs:journal=/dev/sda7 defaults
-+.sp
-+.fi
-+.PP
-+.IP \(bu
-+Mount an ext3 filesystem on /dev/sdb1 with an external journal on /dev/sda5
-+.IP \(bu
-+Mount an ext4 filesystem on /dev/sdb2 with an external journal on /dev/sda6
-+.IP \(bu
-+Mount an XFS filesystem on /dev/sdb3 using /dev/sda7 as the log device
-+
- .SH CAVEATS
- .IP \(bu
- Partition UUID cannot be obtained: In case a partition was previously used as
Deleted: branches/experimental/patches/setup-storage_lvm-preserve2
===================================================================
--- branches/experimental/patches/setup-storage_lvm-preserve2 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/setup-storage_lvm-preserve2 2010-07-29 16:32:48 UTC (rev 5909)
@@ -1,508 +0,0 @@
-2010-06-28 Michael Tautschnig <mt at debian.org>
-
- * setup-storage/{Commands.pm,Volumes.pm}: Completed support for preserve in
- LVM/RAID contexts; extended checking for volume groups that remain alive,
- fixed bug in LV resize code, disable existing volume groups, remove
- non-preserved volume groups (thanks Mathieu Alorent <malorent at echo.fr> for
- extensive testing).
-Index: trunk/lib/setup-storage/Commands.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Commands.pm
-+++ trunk/lib/setup-storage/Commands.pm
-@@ -143,14 +143,15 @@
-
- my ($d, $t) = @_;
- my ($i_p_d, $disk, $part_no) = &FAI::phys_dev($d);
-- return unless $i_p_d;
-+ return 0 unless $i_p_d;
- # make sure this device really exists (we can't check for the partition
- # as that may be created later on
- (-b $disk) or die "Specified disk $disk does not exist in this system!\n";
- # set the raid/lvm unless this is an entire disk flag
- my $cmd = "parted -s $disk set $part_no $t on";
- $cmd = "true" if ($part_no == -1);
-- &FAI::push_command( $cmd, "exist_$d", "type_${t}_$d" );
-+ &FAI::push_command( $cmd, "cleared2_$disk,exist_$d", "type_${t}_$d" );
-+ return 1;
- }
-
- ################################################################################
-@@ -245,12 +246,17 @@
-
- # keep a reference to the current volume
- my $vol = (\%FAI::configs)->{$config}->{volumes}->{$id};
-+
-+ # if it is a volume that has to be preserved, there is not much to be
-+ # done; its existance has been checked in propagate_and_check_preserve
-+ if ($vol->{preserve}) {
-+ &FAI::push_command("true", "", "exist_/dev/md$id");
-+ next;
-+ }
-+
- # the desired RAID level
- my $level = $vol->{mode};
-
-- warn "RAID implementation is incomplete - preserve is not supported\n" if
-- ($vol->{preserve});
--
- # prepend "raid", if the mode is numeric-only
- $level = "raid$level" if ($level =~ /^\d+$/);
-
-@@ -308,29 +314,6 @@
-
- ################################################################################
- #
--# @brief Erase the LVM signature from a list of devices that should be prestine
--# in order to avoid confusion of the lvm tools
--#
--################################################################################
--sub erase_lvm_signature {
--
-- my ($devices_aref) = @_;
-- # first remove the dm_mod module to prevent ghost lvm volumes
-- # from existing
-- # push @FAI::commands, "modprobe -r dm_mod";
-- # zero out (broken?) lvm signatures
-- # push @FAI::commands, "dd if=/dev/zero of=$_ bs=1 count=1"
-- # foreach ( @{$devices_aref} );
-- my $device_list = join (" ", @{$devices_aref});
-- $FAI::debug and print "Erased devices: $device_list\n";
-- &FAI::push_command( "pvremove -ff -y $device_list", "", "pv_sigs_removed" );
--
-- # reload module
-- # push @FAI::commands, "modprobe dm_mod";
--}
--
--################################################################################
--#
- # @brief Create the volume group $config, unless it exists already; if the
- # latter is the case, only add/remove the physical devices
- #
-@@ -343,24 +326,6 @@
- ($config =~ /^VG_(.+)$/) and ($1 ne "--ANY--") or &FAI::internal_error("Invalid config $config");
- my $vg = $1; # the actual volume group
-
-- my $vg_exists = 0;
-- if (defined ($FAI::current_lvm_config{$vg})) {
-- $vg_exists = 1;
-- foreach my $dev (@{ $FAI::current_lvm_config{$vg}{"physical_volumes"} }) {
-- my ($i_p_d, $disk, $part_no) = &FAI::phys_dev($dev);
-- # if this is not a physical disk, just assume that the volume group will
-- # not exist anymore
-- if ($i_p_d) {
-- defined ($FAI::configs{"PHY_$disk"}) or next;
-- defined ($FAI::configs{"PHY_$disk"}{partitions}{$part_no}) and
-- ($FAI::configs{"PHY_$disk"}{partitions}{$part_no}{size}{preserve}) and
-- next;
-- }
-- $vg_exists = 0;
-- last;
-- }
-- }
--
- my ($pv_create_options) = $FAI::configs{$config}{pvcreateopts};
- my ($vg_create_options) = $FAI::configs{$config}{vgcreateopts};
- # prevent warnings of uninitialized variables
-@@ -368,59 +333,82 @@
- $vg_create_options = '' unless $vg_create_options;
- print "/dev/$vg PV create_options: $pv_create_options\n" if ($FAI::debug && $pv_create_options);
- print "/dev/$vg VG create_options: $vg_create_options\n" if ($FAI::debug && $vg_create_options);
-+
- # create the volume group, if it doesn't exist already
-- if (!$vg_exists) {
-- # create all the devices
-- my @devices = ();
-- push @devices, &FAI::enc_name($_) foreach (keys %{ $FAI::configs{$config}{devices} });
-- &FAI::erase_lvm_signature(\@devices);
-- &FAI::push_command( "pvcreate $pv_create_options $_",
-- "pv_sigs_removed,exist_$_", "pv_done_$_") foreach (@devices);
-- # create the volume group
-+ if (!defined($FAI::configs{"VG_$vg"}{exists})) {
- my $pre_dev = "";
-- $pre_dev .= ",exist_$_,pv_done_$_" foreach (@devices);
-+ my $devs = "";
-+ # create all the devices
-+ foreach my $d (keys %{ $FAI::configs{$config}{devices} }) {
-+ my $dev = &FAI::enc_name($d);
-+
-+ # set proper partition types for LVM
-+ my $type_pre = "";
-+ $type_pre .= ",type_lvm_$dev" if (&FAI::set_partition_type_on_phys_dev($dev, "lvm"));
-+
-+ &FAI::push_command( "pvcreate $pv_create_options $dev",
-+ "all_pv_sigs_removed,exist_$dev$type_pre", "pv_done_$dev");
-+ $devs .= " $dev";
-+ $pre_dev .= ",pv_done_$dev";
-+ }
- $pre_dev =~ s/^,//;
-- &FAI::push_command( "vgcreate $vg_create_options $vg " . join (" ",
-- @devices), "$pre_dev", "vg_created_$vg" );
-+
-+ # create the volume group
-+ &FAI::push_command( "vgcreate $vg_create_options $vg $devs",
-+ "$pre_dev", "vg_created_$vg" );
-+
- # we are done
- return;
- }
-
- # otherwise add or remove the devices for the volume group, run pvcreate
- # where needed
-- # the list of devices to be created
-- my %new_devs = ();
-+ # the devices to be removed later on
-+ my %rm_devs = ();
-+ @rm_devs{ @{ $FAI::current_lvm_config{$vg}{"physical_volumes"} } } = ();
-
-- # create an undefined entry for each new device
-- @new_devs{ keys %{ $FAI::configs{$config}{devices} } } = ();
-+ # all devices of this VG
-+ my @all_devices = ();
-
-+ # the list of devices to be created
- my @new_devices = ();
-- push @new_devices, &FAI::enc_name($_) foreach (keys %new_devs);
-
-- # &FAI::erase_lvm_signature( \@new_devices );
-+ # create an undefined entry for each device
-+ foreach my $d (keys %{ $FAI::configs{$config}{devices} }) {
-+ my $denc = &FAI::enc_name($d);
-+ push @all_devices, $denc;
-+ push @new_devices, $denc unless (exists($rm_devs{$denc}));
-+ }
-+
-+ # remove remaining devices from the list
-+ delete $rm_devs{$_} foreach (@all_devices);
-
- # create all the devices
-- &FAI::push_command( "pvcreate $pv_create_options $_", "exist_$_", "pv_done_$_"
-- ) foreach (@new_devices);
-+ my $pre_dev = "vg_exists_$vg";
-+ foreach my $dev (@new_devices) {
-+ # set proper partition types for LVM
-+ my $type_pre = "";
-+ $type_pre .= ",type_lvm_$dev" if (&FAI::set_partition_type_on_phys_dev($dev, "lvm"));
-
-- # extend the volume group by the new devices (includes the current ones)
-- my $pre_dev = "";
-- $pre_dev .= ",pv_done_$_" foreach (@new_devices);
-+ &FAI::push_command( "pvcreate $pv_create_options $dev",
-+ "all_pv_sigs_removed,exist_$dev$type_pre", "pv_done_$dev");
-+ $pre_dev .= ",pv_done_$dev";
-+ }
- $pre_dev =~ s/^,//;
-- &FAI::push_command( "vgextend $vg " . join (" ", @new_devices), "$pre_dev",
-- "vg_extended_$vg" );
-
-- # the devices to be removed
-- my %rm_devs = ();
-- @rm_devs{ @{ $FAI::current_lvm_config{$vg}{"physical_volumes"} } } = ();
-
-- # remove remaining devices from the list
-- delete $rm_devs{$_} foreach (@new_devices);
-+ # extend the volume group by the new devices
-+ if (scalar (@new_devices)) {
-+ &FAI::push_command( "vgextend $vg " . join (" ", @new_devices), "$pre_dev",
-+ "vg_extended_$vg" );
-+ } else {
-+ &FAI::push_command( "true", "all_pv_sigs_removed,$pre_dev", "vg_extended_$vg" );
-+ }
-
- # run vgreduce to get them removed
- if (scalar (keys %rm_devs)) {
- $pre_dev = "";
-- $pre_dev .= ",pv_done_$_" foreach (keys %rm_devs);
-+ $pre_dev .= ",exist_$_" foreach (keys %rm_devs);
- &FAI::push_command( "vgreduce $vg " . join (" ", keys %rm_devs),
- "vg_extended_$vg$pre_dev", "vg_created_$vg" );
- } else {
-@@ -442,25 +430,6 @@
- ($config =~ /^VG_(.+)$/) and ($1 ne "--ANY--") or &FAI::internal_error("Invalid config $config");
- my $vg = $1; # the actual volume group
-
-- my $lv_rm_pre = "";
-- my $lv_resize_pre = "";
-- # remove, resize, create the logical volumes
-- # remove all volumes that do not exist anymore or need not be preserved
-- foreach my $lv (keys %{ $FAI::current_lvm_config{$vg}{volumes} }) {
-- # skip preserved/resized volumes
-- if (defined ( $FAI::configs{$config}{volumes}{$lv})
-- && ($FAI::configs{$config}{volumes}{$lv}{size}{preserve} == 1)) {
-- $lv_resize_pre .= ",lv_resize_$vg/$lv" if
-- $FAI::configs{$config}{volumes}{$lv}{size}{resize};
-- next;
-- }
--
-- &FAI::push_command( "lvremove -f $vg/$lv", "vg_enabled_$vg", "lv_rm_$vg/$lv");
-- $lv_rm_pre .= ",lv_rm_$vg/$lv";
-- }
-- $lv_rm_pre =~ s/^,//;
-- $lv_resize_pre =~ s/^,//;
--
- # now create or resize the configured logical volumes
- foreach my $lv (keys %{ $FAI::configs{$config}{volumes} }) {
- # reference to the size of the current logical volume
-@@ -483,14 +452,14 @@
- $FAI::current_lvm_config{$vg}{volumes}{$lv}{size})
- {
- &FAI::push_command( "parted -s /dev/$vg/$lv resize 1 0 " . $lv_size->{eff_size} . "B",
-- "vg_enabled_$vg,$lv_rm_pre", "lv_shrink_$vg/$lv" );
-+ "vg_enabled_$vg,exist_/dev/$vg/$lv", "lv_shrink_$vg/$lv" );
- &FAI::push_command( "lvresize -L " . $lv_size->{eff_size} . " $vg/$lv",
-- "vg_enabled_$vg,$lv_rm_pre,lv_shrink_$vg/$lv", "lv_created_$vg/$lv" );
-+ "vg_enabled_$vg,lv_shrink_$vg/$lv", "lv_created_$vg/$lv" );
- } else {
- &FAI::push_command( "lvresize -L " . $lv_size->{eff_size} . " $vg/$lv",
-- "vg_enabled_$vg,$lv_rm_pre", "lv_grow_$vg/$lv" );
-+ "vg_enabled_$vg,exist_/dev/$vg/$lv", "lv_grow_$vg/$lv" );
- &FAI::push_command( "parted -s /dev/$vg/$lv resize 1 0 " . $lv_size->{eff_size} . "B",
-- "vg_enabled_$vg,$lv_rm_pre,lv_grow_$vg/$lv", "exist_/dev/$vg/$lv" );
-+ "vg_enabled_$vg,lv_grow_$vg/$lv", "exist_/dev/$vg/$lv" );
- }
-
- next;
-@@ -499,10 +468,10 @@
- my ($create_options) = $FAI::configs{$config}{volumes}{$lv}{lvcreateopts};
- # prevent warnings of uninitialized variables
- $create_options = '' unless $create_options;
-- print "/dev/$vg/$lv LV create_options: $create_options\n" if ($FAI::debug && $create_options);
-+ print "/dev/$vg/$lv LV create_options: $create_options\n" if ($FAI::debug && $create_options);
- # create a new volume
- &FAI::push_command( "lvcreate $create_options -n $lv -L " .
-- $lv_size->{eff_size} . " $vg", "vg_enabled_$vg,$lv_rm_pre",
-+ $lv_size->{eff_size} . " $vg", "vg_enabled_$vg",
- "exist_/dev/$vg/$lv" );
-
- # create the filesystem on the volume
-@@ -513,6 +482,85 @@
-
- ################################################################################
- #
-+# @brief Remove existing volume group if underlying devices will be modified,
-+# otherwise add proper exist_ preconditions
-+#
-+################################################################################
-+sub cleanup_vg {
-+
-+ my ($vg) = @_;
-+ my $clear_vg = 0;
-+
-+ foreach my $dev (@{ $FAI::current_lvm_config{$vg}{"physical_volumes"} }) {
-+ my ($i_p_d, $disk, $part_no) = &FAI::phys_dev($dev);
-+ if ($i_p_d) {
-+ defined ($FAI::configs{"PHY_$disk"}) or next;
-+ defined ($FAI::configs{"PHY_$disk"}{partitions}{$part_no}) and
-+ ($FAI::configs{"PHY_$disk"}{partitions}{$part_no}{size}{preserve}) and
-+ next;
-+ } elsif ($dev =~ m{^/dev/md[\/]?(\d+)$}) {
-+ my $vol = $1;
-+ defined ($FAI::configs{RAID}{volumes}{$vol}) or next;
-+ next if (1 == $FAI::configs{RAID}{volumes}{$vol}{preserve});
-+ } elsif ($dev =~ m{^/dev/([^/\s]+)/([^/\s]+)$}) {
-+ my $ivg = $1;
-+ my $lv = $2;
-+ defined($FAI::configs{"VG_$ivg"}{volumes}{$lv}) or next;
-+ next if (1 == $FAI::configs{"VG_$ivg"}{volumes}{$lv}{size}{preserve});
-+ } else {
-+ warn "Don't know how to check preservation of $dev\n";
-+ next;
-+ }
-+ $clear_vg = 1;
-+ last;
-+ }
-+
-+ if (0 == $clear_vg) {
-+ my $vg_setup_pre = "vgchange_a_n";
-+ if (defined($FAI::configs{"VG_$vg"}{volumes})) {
-+ $FAI::configs{"VG_$vg"}{exists} = 1;
-+
-+ # remove all volumes that do not exist anymore or need not be preserved
-+ foreach my $lv (keys %{ $FAI::current_lvm_config{$vg}{volumes} }) {
-+ # skip preserved/resized volumes
-+ if (defined ( $FAI::configs{"VG_$vg"}{volumes}{$lv})) {
-+ if ($FAI::configs{"VG_$vg"}{volumes}{$lv}{size}{preserve} == 1 ||
-+ $FAI::configs{"VG_$vg"}{volumes}{$lv}{size}{resize} == 1) {
-+ &FAI::push_command("true", "vgchange_a_n", "exist_/dev/$vg/$lv");
-+ next;
-+ }
-+ }
-+
-+ &FAI::push_command( "lvremove -f $vg/$lv", "vgchange_a_n", "lv_rm_$vg/$lv");
-+ $vg_setup_pre .= ",lv_rm_$vg/$lv";
-+ }
-+ } else {
-+ &FAI::push_command("true", "vgchange_a_n", "exist_/dev/$vg/$_") foreach
-+ (keys %{ $FAI::current_lvm_config{$vg}{volumes} });
-+ }
-+ &FAI::push_command("true", $vg_setup_pre, "vg_exists_$vg");
-+
-+ return 0;
-+ }
-+
-+ my $vg_destroy_pre = "vgchange_a_n";
-+ foreach my $lv (keys %{ $FAI::current_lvm_config{$vg}{volumes} }) {
-+ &FAI::push_command( "lvremove -f $vg/$lv", "vgchange_a_n", "lv_rm_$vg/$lv");
-+ $vg_destroy_pre .= ",lv_rm_$vg/$lv";
-+ }
-+ &FAI::push_command( "vgremove $vg", "$vg_destroy_pre", "vg_removed_$vg");
-+
-+ # clear all the devices
-+ my $devices = "";
-+ $devices .= " " . &FAI::enc_name($_) foreach
-+ (@{ $FAI::current_lvm_config{$vg}{physical_volumes} });
-+ $FAI::debug and print "Erased devices:$devices\n";
-+ &FAI::push_command( "pvremove $devices", "", "pv_sigs_removed_$vg" );
-+ return 1;
-+}
-+
-+################################################################################
-+#
- # @brief Using the configurations from %FAI::configs, a list of commands is
- # built to setup the LVM
- # creates the volume groups, the logical volumes and the filesystems
-@@ -520,6 +568,17 @@
- ################################################################################
- sub build_lvm_commands {
-
-+ # disable volumes if there are pre-existing ones
-+ my $all_vg_pre = "";
-+ if (scalar(keys %FAI::current_lvm_config)) {
-+ &FAI::push_command("vgchange -a n", "", "vgchange_a_n");
-+ foreach my $vg (keys %FAI::current_lvm_config) {
-+ $all_vg_pre .= ",pv_sigs_removed_$vg" if (&FAI::cleanup_vg($vg));
-+ }
-+ $all_vg_pre =~ s/^,//;
-+ }
-+ &FAI::push_command("true", "$all_vg_pre", "all_pv_sigs_removed");
-+
- # loop through all configs
- foreach my $config (keys %FAI::configs) {
-
-@@ -529,24 +588,11 @@
- next if ($1 eq "--ANY--");
- my $vg = $1; # the volume group
-
-- # set proper partition types for LVM
-- &FAI::set_partition_type_on_phys_dev($_, "lvm")
-- foreach (keys %{ $FAI::configs{$config}{devices} });
-- my $type_pre = "";
-- foreach my $d (keys %{ $FAI::configs{$config}{devices} }) {
-- $d = &FAI::enc_name($d);
-- if ((&FAI::phys_dev($d))[0]) {
-- $type_pre .= ",type_lvm_$d"
-- } else {
-- $type_pre .= ",exist_$d"
-- }
-- }
--
- # create the volume group or add/remove devices
- &FAI::create_volume_group($config);
- # enable the volume group
- &FAI::push_command( "vgchange -a y $vg",
-- "vg_created_$vg$type_pre", "vg_enabled_$vg" );
-+ "vg_created_$vg", "vg_enabled_$vg" );
-
- # perform all necessary operations on the underlying logical volumes
- &FAI::setup_logical_volumes($config);
-@@ -755,8 +801,8 @@
- or die "Can't change disklabel, partitions are to be preserved\n";
-
- # write the disklabel to drop the previous partition table
-- &FAI::push_command( "parted -s $disk mklabel $label", "exist_$disk",
-- "cleared1_$disk" );
-+ &FAI::push_command( "parted -s $disk mklabel $label",
-+ "exist_$disk,all_pv_sigs_removed", "cleared1_$disk" );
-
- &FAI::rebuild_preserved_partitions($config, \@to_preserve);
-
-Index: trunk/lib/setup-storage/Volumes.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Volumes.pm
-+++ trunk/lib/setup-storage/Volumes.pm
-@@ -348,7 +348,6 @@
- foreach my $vg (get_volume_group_list()) {
- # initialise the hash entry
- $FAI::current_lvm_config{$vg}{physical_volumes} = ();
-- &FAI::push_command("true", "", "vg_created_$vg");
-
- # store the vg size in MB
- my %vg_info = get_volume_group_information($vg);
-@@ -367,7 +366,6 @@
- $FAI::current_lvm_config{$vg}{volumes}{$short_name}{size} =
- &FAI::convert_unit($lv_info{$lv_name}->{lv_size} .
- $lv_info{$lv_name}->{lv_size_unit});
-- &FAI::push_command("true", "", "exist_/dev/$vg/$short_name");
- }
-
- # store the physical volumes
-@@ -418,7 +416,6 @@
- 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" );
- } elsif ($line =~ /^\s*devices=(\S+)$/) {
- defined($id) or &FAI::internal_error("mdadm ARRAY line not yet seen");
- @{ $FAI::current_raid_config{$id}{devices} } = split (",", $1);
-@@ -438,11 +435,17 @@
- my ($device_name) = @_;
- my ($i_p_d, $disk, $part_no) = &FAI::phys_dev($device_name);
-
-- if (1 == $i_p_d && defined($FAI::configs{"PHY_$disk"}{partitions}{$part_no})) {
-- $FAI::configs{"PHY_$disk"}{partitions}{$part_no}{size}{preserve} = 1;
-- $FAI::configs{"PHY_$disk"}{preserveparts} = 1;
-- } elsif ($device_name =~ m{^/dev/md(\d+)$}) {
-+ if (1 == $i_p_d) {
-+ defined ($FAI::current_config{$disk}{partitions}{$part_no}) or die
-+ "Can't preserve $device_name because it does not exist\n";
-+ if (defined($FAI::configs{"PHY_$disk"}{partitions}{$part_no})) {
-+ $FAI::configs{"PHY_$disk"}{partitions}{$part_no}{size}{preserve} = 1;
-+ $FAI::configs{"PHY_$disk"}{preserveparts} = 1;
-+ }
-+ } elsif ($device_name =~ m{^/dev/md[\/]?(\d+)$}) {
- my $vol = $1;
-+ defined ($FAI::current_raid_config{$vol}) or die
-+ "Can't preserve $device_name because it does not exist\n";
- if (defined($FAI::configs{RAID}{volumes}{$vol}) &&
- $FAI::configs{RAID}{volumes}{$vol}{preserve} != 1) {
- $FAI::configs{RAID}{volumes}{$vol}{preserve} = 1;
-@@ -451,6 +454,8 @@
- } elsif ($device_name =~ m{^/dev/([^/\s]+)/([^/\s]+)$}) {
- my $vg = $1;
- my $lv = $2;
-+ defined ($FAI::current_lvm_config{$vg}{volumes}{$lv}) or die
-+ "Can't preserve $device_name because it does not exist\n";
- if (defined($FAI::configs{"VG_$vg"}{volumes}{$lv}) &&
- $FAI::configs{"VG_$vg"}{volumes}{$lv}{size}{preserve} != 1) {
- $FAI::configs{"VG_$vg"}{volumes}{$lv}{size}{preserve} = 1;
-@@ -481,6 +486,9 @@
- defined($FAI::current_config{$1}{partitions}{$part_id})) ? 1 : 0)
- if (2 == $part->{size}->{preserve});
- next unless ($part->{size}->{preserve} || $part->{size}->{resize});
-+ defined ($FAI::current_config{$1}{partitions}{$part_id}) or die
-+ "Can't preserve ". &FAI::make_device_name($1, $part->{number})
-+ . " because it does not exist\n";
- defined ($part->{size}->{range}) or die
- "Can't preserve ". &FAI::make_device_name($1, $part->{number})
- . " because it is not defined in the current config\n";
-@@ -496,10 +504,11 @@
- if (2 == $FAI::configs{$config}{volumes}{$l}{size}{preserve});
- next unless ($FAI::configs{$config}{volumes}{$l}{size}{preserve} == 1 ||
- $FAI::configs{$config}{volumes}{$l}{size}{resize} == 1);
-+ defined ($FAI::current_lvm_config{$1}{volumes}{$l}) or die
-+ "Can't preserve /dev/$1/$l because it does not exist\n";
- defined ($FAI::configs{$config}{volumes}{$l}{size}{range}) or die
- "Can't preserve /dev/$1/$l because it is not defined in the current config\n";
- &FAI::mark_preserve($_) foreach (keys %{ $FAI::configs{$config}{devices} });
-- last;
- }
- } elsif ($config eq "RAID") {
- # check for volumes that need to be preserved and preserve the underlying
-@@ -509,6 +518,8 @@
- (defined($FAI::current_raid_config{$r}) ? 1 : 0)
- if (2 == $FAI::configs{$config}{volumes}{$r}{preserve});
- next unless ($FAI::configs{$config}{volumes}{$r}{preserve} == 1);
-+ defined ($FAI::current_raid_config{$r}) or die
-+ "Can't preserve /dev/md$r because it does not exist\n";
- defined ($FAI::configs{$config}{volumes}{$r}{devices}) or die
- "Can't preserve /dev/md$r because it is not defined in the current config\n";
- &FAI::mark_preserve($_) foreach (keys %{ $FAI::configs{$config}{volumes}{$r}{devices} });
Deleted: branches/experimental/patches/setup-storage_parted2.2
===================================================================
--- branches/experimental/patches/setup-storage_parted2.2 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/setup-storage_parted2.2 2010-07-29 16:32:48 UTC (rev 5909)
@@ -1,53 +0,0 @@
-2010-04-15 Michael Tautschnig <mt at debian.org>
-
- * setup-storage/Volumes.pm: Fixed uninitialized variable warnings in parsing
- output of parted 2.2.
-Index: trunk/lib/setup-storage/Volumes.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Volumes.pm
-+++ trunk/lib/setup-storage/Volumes.pm
-@@ -178,6 +178,23 @@
- # 7 30450018816B 32547432959B 2097414144B logical ext3
- # 8 32547465216B 82343278079B 49795812864B logical ext3
- #
-+# parted 2.2:
-+# $ parted -s /dev/sda unit TiB print
-+# Model: ATA VBOX HARDDISK (scsi)
-+# Disk /dev/sda: 0.06TiB
-+# Sector size (logical/physical): 512B/512B
-+# Partition Table: msdos
-+#
-+# Number Start End Size Type File system Flags
-+# 1 0.00TiB 0.00TiB 0.00TiB primary ext3 boot
-+# 2 0.00TiB 0.00TiB 0.00TiB primary linux-swap(v1)
-+# 3 0.00TiB 0.00TiB 0.00TiB primary ext3
-+# 4 0.00TiB 0.06TiB 0.06TiB extended lba
-+# 5 0.00TiB 0.00TiB 0.00TiB logical ext3
-+# 6 0.00TiB 0.00TiB 0.00TiB logical ext3
-+# 7 0.00TiB 0.00TiB 0.00TiB logical ext3
-+# 8 0.00TiB 0.01TiB 0.00TiB logical ext3
-+# 9 0.01TiB 0.06TiB 0.05TiB logical lvm
-
- # As shown above, some entries may be blank. Thus the exact column starts
- # and lengths must be parsed from the header line. This is stored in the
-@@ -250,9 +267,17 @@
- # file system either
- next if ($id eq "");
-
-- # extract the set of characters
-- $line =~ /^.{$fs_cols_before}(.{$fs_col_width})/;
-- my $fs = $1;
-+ # extract the file system information
-+ my $fs = "";
-+ if (length ($line) > $fs_cols_before) {
-+ if (length ($line) >= ($fs_cols_before + $fs_col_width)) {
-+ $line =~ /^.{$fs_cols_before}(.{$fs_col_width})/;
-+ $fs = $1;
-+ } else {
-+ $line =~ /^.{$fs_cols_before}(.+)$/;
-+ $fs = $1;
-+ }
-+ }
-
- # remove any trailing space
- $fs =~ s/\s*$//g;
Deleted: branches/experimental/patches/setup-storage_preserve-lazy
===================================================================
--- branches/experimental/patches/setup-storage_preserve-lazy 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/setup-storage_preserve-lazy 2010-07-29 16:32:48 UTC (rev 5909)
@@ -1,205 +0,0 @@
-2010-03-12 Michael Tautschnig <mt at debian.org>
-
- * setup-storage, setup-storage/{Parser.pm,Volumes.pm}: Added support for new
- preserve_lazy option that will preserve volumes that exist, but newly create
- them if not found.
- * setup-storage.8: Document new preserve_lazy option.
-Index: trunk/bin/setup-storage
-===================================================================
---- trunk.orig/bin/setup-storage
-+++ trunk/bin/setup-storage
-@@ -127,10 +127,6 @@
- print "Using config file: $opt_f\n";
- &FAI::run_parser($config_file);
-
--# mark devices as preserve, where not all already done so and check that only
--# defined devices are marked preserve
--&FAI::propagate_and_check_preserve;
--
- # read the sizes and partition tables of all disks listed in $FAI::disks
- &FAI::get_current_disks;
-
-@@ -140,6 +136,10 @@
- # see whether there are any existing RAID devices
- &FAI::get_current_raid;
-
-+# mark devices as preserve, where not all already done so and check that only
-+# defined devices are marked preserve
-+&FAI::propagate_and_check_preserve;
-+
- # debugging only: print the current configuration
- if ($FAI::debug) {
- # for debugging purposes to print the hash structures
-Index: trunk/lib/setup-storage/Parser.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Parser.pm
-+++ trunk/lib/setup-storage/Parser.pm
-@@ -405,6 +405,10 @@
- $FAI::configs{RAID}{volumes}{$_}{preserve} = 1 foreach (split(",", $1));
- }
- }
-+ | /^preserve_lazy:(\d+(,\d+)*)/
-+ {
-+ $FAI::configs{RAID}{volumes}{$_}{preserve} = 2 foreach (split(",", $1));
-+ }
- | /^fstabkey:(device|label|uuid)/
- {
- # the information preferred for fstab device identifieres
-@@ -422,7 +426,7 @@
- foreach (split (",", $1)) {
- (m{^([^/,\s\-]+)-([^/,\s\-]+)}) or
- die &FAI::internal_error("VG re-parse failed");
-- $FAI::configs{"VG_$1"}{volumes}{$2}{size}{preserve} = 1
-+ $FAI::configs{"VG_$1"}{volumes}{$2}{size}{preserve} = 1;
- }
- }
- | m{^preserve_reinstall:([^/,\s\-]+-[^/,\s\-]+(,[^/,\s\-]+-[^/,\s\-]+)*)}
-@@ -432,17 +436,25 @@
- foreach (split (",", $1)) {
- (m{^([^/,\s\-]+)-([^/,\s\-]+)}) or
- die &FAI::internal_error("VG re-parse failed");
-- $FAI::configs{"VG_$1"}{volumes}{$2}{size}{preserve} = 1
-+ $FAI::configs{"VG_$1"}{volumes}{$2}{size}{preserve} = 1;
- }
- }
- }
-+ | m{^preserve_lazy:([^/,\s\-]+-[^/,\s\-]+(,[^/,\s\-]+-[^/,\s\-]+)*)}
-+ {
-+ foreach (split (",", $1)) {
-+ (m{^([^/,\s\-]+)-([^/,\s\-]+)}) or
-+ die &FAI::internal_error("VG re-parse failed");
-+ $FAI::configs{"VG_$1"}{volumes}{$2}{size}{preserve} = 2;
-+ }
-+ }
- | m{^resize:([^/,\s\-]+-[^/,\s\-]+(,[^/,\s\-]+-[^/,\s\-]+)*)}
- {
- # set the resize flag for all ids
- foreach (split (",", $1)) {
- (m{^([^/,\s\-]+)-([^/,\s\-]+)}) or
- die &FAI::internal_error("VG re-parse failed");
-- $FAI::configs{"VG_$1"}{volumes}{$2}{size}{resize} = 1
-+ $FAI::configs{"VG_$1"}{volumes}{$2}{size}{resize} = 1;
- }
- }
- | /^fstabkey:(device|label|uuid)/
-@@ -466,6 +478,11 @@
- $FAI::configs{$FAI::device}{preserveparts} = 1;
- }
- }
-+ | /^preserve_lazy:(\d+(,\d+)*)/
-+ {
-+ $FAI::configs{$FAI::device}{partitions}{$_}{size}{preserve} = 2 foreach (split(",", $1));
-+ $FAI::configs{$FAI::device}{preserveparts} = 2;
-+ }
- | /^resize:(\d+(,\d+)*)/
- {
- # set the resize flag for all ids
-Index: trunk/lib/setup-storage/Volumes.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Volumes.pm
-+++ trunk/lib/setup-storage/Volumes.pm
-@@ -476,6 +476,10 @@
- if ($config =~ /^PHY_(.+)$/) {
- foreach my $part_id (&numsort(keys %{ $FAI::configs{$config}{partitions} })) {
- my $part = (\%FAI::configs)->{$config}->{partitions}->{$part_id};
-+ $part->{size}->{preserve} =
-+ ((defined($FAI::current_config{$1}) &&
-+ defined($FAI::current_config{$1}{partitions}{$part_id})) ? 1 : 0)
-+ if (2 == $part->{size}->{preserve});
- next unless ($part->{size}->{preserve} || $part->{size}->{resize});
- defined ($part->{size}->{range}) or die
- "Can't preserve ". &FAI::make_device_name($1, $part->{number})
-@@ -486,6 +490,10 @@
- # check for logical volumes that need to be preserved and preserve the
- # underlying devices recursively
- foreach my $l (keys %{ $FAI::configs{$config}{volumes} }) {
-+ $FAI::configs{$config}{volumes}{$l}{size}{preserve} =
-+ ((defined($FAI::current_lvm_config{$1}) &&
-+ defined($FAI::current_lvm_config{$1}{volumes}{$l})) ? 1 : 0)
-+ if (2 == $FAI::configs{$config}{volumes}{$l}{size}{preserve});
- next unless ($FAI::configs{$config}{volumes}{$l}{size}{preserve} == 1 ||
- $FAI::configs{$config}{volumes}{$l}{size}{resize} == 1);
- defined ($FAI::configs{$config}{volumes}{$l}{size}{range}) or die
-@@ -497,6 +505,9 @@
- # check for volumes that need to be preserved and preserve the underlying
- # devices recursively
- foreach my $r (keys %{ $FAI::configs{$config}{volumes} }) {
-+ $FAI::configs{$config}{volumes}{$r}{preserve} =
-+ (defined($FAI::current_raid_config{$r}) ? 1 : 0)
-+ if (2 == $FAI::configs{$config}{volumes}{$r}{preserve});
- next unless ($FAI::configs{$config}{volumes}{$r}{preserve} == 1);
- defined ($FAI::configs{$config}{volumes}{$r}{devices}) or die
- "Can't preserve /dev/md$r because it is not defined in the current config\n";
-Index: trunk/man/setup-storage.8
-===================================================================
---- trunk.orig/man/setup-storage.8
-+++ trunk/man/setup-storage.8
-@@ -156,14 +156,18 @@
- .br
- | preserve_always:[^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*
- .br
-- /* preserve partitions -- always */
-+ /* preserve volumes -- always */
- .br
- | preserve_reinstall:[^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*
- .br
-- /* preserve partitions -- unless the system is installed for the
-+ /* preserve volumes -- unless the system is installed for the
- .br
- first time */
- .br
-+ | preserve_lazy:[^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*
-+.br
-+ /* preserve volumes -- unless these don't exist yet */
-+.br
- | resize:[^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*
- .br
- /* attempt to resize partitions */
-@@ -182,14 +186,18 @@
- .br
- | preserve_always:[[:digit:]]+(,[[:digit:]]+)*
- .br
-- /* preserve partitions -- always */
-+ /* preserve volumes -- always */
- .br
- | preserve_reinstall:[[:digit:]]+(,[[:digit:]]+)*
- .br
-- /* preserve partitions -- unless the system is installed for the
-+ /* preserve volumes -- unless the system is installed for the
- .br
- first time */
- .br
-+ | preserve_lazy:[[:digit:]]+(,[[:digit:]]+)*
-+.br
-+ /* preserve volumes -- unless these don't exist yet */
-+.br
- | fstabkey:(device|label|uuid)
- .br
- /* when creating the fstab the key used for defining the device
-@@ -220,6 +228,10 @@
- .br
- first time */
- .br
-+ | preserve_lazy:[[:digit:]]+(,[[:digit:]]+)*
-+.br
-+ /* preserve partitions -- unless these don't exist yet */
-+.br
- | resize:[[:digit:]]+(,[[:digit:]]+)*
- .br
- /* attempt to resize partitions */
-@@ -378,10 +390,11 @@
- Any options to mkfs.xxx may be given using createopts="".
- .IP \(bu
- The "preserveX" and "boot" options are one of the options now given on the
--disk_config line, using preserve_reinstall or preserve_always and bootable.
--preserve_always is equivalent to the previous preserveX option, whereas
--preserve_reinstall preserves the partition unless "initial" is given as one of
--the FAI_FLAGS.
-+disk_config line, using preserve_reinstall, preserve_always, or preserve_lazy,
-+and bootable. preserve_always is equivalent to the previous preserveX option,
-+whereas preserve_reinstall preserves the partition unless "initial" is given as
-+one of the FAI_FLAGS. preserve_lazy allows to preserve partitions only if these
-+exist already. Otherwise they are created.
- .IP \(bu
- Support for LVM and RAID is completely new
- .IP \(bu
Deleted: branches/experimental/patches/setup-storage_ramsize
===================================================================
--- branches/experimental/patches/setup-storage_ramsize 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/setup-storage_ramsize 2010-07-29 16:32:48 UTC (rev 5909)
@@ -1,108 +0,0 @@
-2010-05-27 Julien BLACHE <jblache at debian.org>
- * lib/setup-storage/Parser.pm: add support for RAM:XX% in the parser and
- convert_units().
- * man/setup-storage.8: document RAM:XX%.
-
-Index: trunk/lib/setup-storage/Parser.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Parser.pm
-+++ trunk/lib/setup-storage/Parser.pm
-@@ -308,6 +308,21 @@
- {
- my ($val) = @_;
-
-+ if ($val =~ /^RAM:(\d+)%/) {
-+ $val = $1 / 100.0;
-+
-+ ## get total RAM
-+ open(F, "/proc/meminfo");
-+ my @meminfo = <F>;
-+ close F;
-+
-+ my ($totalmem) = grep /^MemTotal:/, @meminfo;
-+ $totalmem =~ s/[^0-9]//g;
-+ $totalmem = $totalmem / 1024.0;
-+
-+ return $val * $totalmem;
-+ }
-+
- ## 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
-@@ -674,17 +689,17 @@
- 1;
- }
-
-- size: /^(\d+[kMGTP%iB]*(-(\d+[kMGTP%iB]*)?)?)(:resize)?\s+/
-+ size: /^((RAM:\d+%|\d+[kMGTP%iB]*)(-(RAM:\d+%|\d+[kMGTP%iB]*)?)?)(:resize)?\s+/
- {
- # complete the size specification to be a range in all cases
- my $range = $1;
- # the size is fixed
-- if (!defined ($2))
-+ if (!defined ($3))
- {
- # make it a range of the form x-x
-- $range = "$range-$1";
-+ $range = "$range-$2";
- }
-- elsif (!defined ($3))
-+ elsif (!defined ($4))
- {
- # range has no upper limit, assume the whole disk
- $range = "${range}100%";
-@@ -700,12 +715,12 @@
- # enter the range into the hash
- $FAI::partition_pointer->{size}->{range} = $range;
- # set the resize flag, if required
-- if (defined ($4)) {
-+ if (defined ($5)) {
- $FAI::partition_pointer->{size}->{resize} = 1;
- $FAI::configs{$FAI::device}{preserveparts} = 1;
- }
- }
-- | /^(-\d+[kMGTP%iB]*)(:resize)?\s+/
-+ | /^(-(RAM:\d+%|\d+[kMGTP%iB]*))(:resize)?\s+/
- {
- # complete the range by assuming 0 as the lower limit
- my $range = "0$1";
-@@ -719,7 +734,7 @@
- # enter the range into the hash
- $FAI::partition_pointer->{size}->{range} = $range;
- # set the resize flag, if required
-- if (defined ($2)) {
-+ if (defined ($3)) {
- $FAI::partition_pointer->{size}->{resize} = 1;
- $FAI::configs{$FAI::device}{preserveparts} = 1;
- }
-Index: trunk/man/setup-storage.8
-===================================================================
---- trunk.orig/man/setup-storage.8
-+++ trunk/man/setup-storage.8
-@@ -340,19 +340,19 @@
- .br
-
-
--size ::= [[:digit:]]+[kKMGTP%iB]*(-([[:digit:]]+[kKMGTP%iB]*)?)?(:resize)?
-+size ::= (RAM:[[:digit:]]+%|[[:digit:]]+[kKMGTP%iB]*)(-(RAM:[[:digit:]]+%|[[:digit:]]+[kKMGTP%iB]*)?)?(:resize)?
- .br
-- /* size in kilo (KiB), mega (default, MiB), giga (GiB), tera (TiB) or
-+ /* size in kilo (KiB), mega (default, MiB), giga (GiB), tera (TiB),
- .br
-- * petabytes (PiB) or %, possibly given as a range; physical
-+ * petabytes (PiB) or percentage of disk size or RAM size, possibly
- .br
-- * partitions or lvm logical volumes only; in future releases KB, MB,
-+ * given as a range; physical partitions or lvm logical volumes only;
- .br
-- * GB, ... will be treated as 1000 instead of 1024 (KiB, MiB, GiB, ...)
-+ * in future releases KB, MB, GB, ... will be treated as 1000 instead
- .br
-- * multipliers */
-+ * of 1024 (KiB, MiB, GiB, ...) multipliers */
- .br
-- | -[[:digit:]]+[kKMGTP%iB]*(:resize)?
-+ | -(RAM:[[:digit:]]+%|[[:digit:]]+[kKMGTP%iB]*)(:resize)?
- .br
- /* size in kilo, mega (default), giga, tera or petabytes or %,
- .br
Deleted: branches/experimental/patches/setup-storage_resize2fs
===================================================================
--- branches/experimental/patches/setup-storage_resize2fs 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/setup-storage_resize2fs 2010-07-29 16:32:48 UTC (rev 5909)
@@ -1,155 +0,0 @@
-2010-04-06 Michael Tautschnig <mt at debian.org>
-
- * setup-storage/{Volumes.pm,Sizes.pm}: eff_size is bytes. Always.
- * setup-storage/Commands.pm: Prefer resize2fs over parted to resize logical
- volumes. Future versions of parted will allow even more use of resize2fs.
- Fix use of eff_size as bytes.
-Index: trunk/lib/setup-storage/Commands.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Commands.pm
-+++ trunk/lib/setup-storage/Commands.pm
-@@ -448,18 +448,38 @@
- or die "Resized volume $vg/$lv does not exist\n";
- warn "$vg/$lv will be resized\n";
-
-- if ($lv_size->{eff_size} <
-- $FAI::current_lvm_config{$vg}{volumes}{$lv}{size})
-+ use POSIX qw(floor);
-+
-+ my $lvsize_mib = &FAI::convert_unit($lv_size->{eff_size} . "B");
-+ if ($lvsize_mib < $FAI::current_lvm_config{$vg}{volumes}{$lv}{size})
- {
-- &FAI::push_command( "parted -s /dev/$vg/$lv resize 1 0 " . $lv_size->{eff_size} . "B",
-- "vg_enabled_$vg,exist_/dev/$vg/$lv", "lv_shrink_$vg/$lv" );
-- &FAI::push_command( "lvresize -L " . $lv_size->{eff_size} . " $vg/$lv",
-+ if (($FAI::configs{$config}{volumes}{$lv}{filesystem} =~
-+ /^ext[23]$/) && &FAI::in_path("resize2fs")) {
-+ my $block_count = POSIX::floor($lv_size->{eff_size} / 512);
-+ &FAI::push_command( "e2fsck -p -f /dev/$vg/$lv",
-+ "vg_enabled_$vg,exist_/dev/$vg/$lv", "e2fsck_f_resize_$vg/$lv" );
-+ &FAI::push_command( "resize2fs /dev/$vg/$lv ${block_count}s",
-+ "e2fsck_f_resize_$vg/$lv", "lv_shrink_$vg/$lv" );
-+ } else {
-+ &FAI::push_command( "parted -s /dev/$vg/$lv resize 1 0 " . $lv_size->{eff_size} . "B",
-+ "vg_enabled_$vg", "lv_shrink_$vg/$lv" );
-+ }
-+ &FAI::push_command( "lvresize -L $lvsize_mib $vg/$lv",
- "vg_enabled_$vg,lv_shrink_$vg/$lv", "lv_created_$vg/$lv" );
- } else {
-- &FAI::push_command( "lvresize -L " . $lv_size->{eff_size} . " $vg/$lv",
-+ &FAI::push_command( "lvresize -L $lvsize_mib $vg/$lv",
- "vg_enabled_$vg,exist_/dev/$vg/$lv", "lv_grow_$vg/$lv" );
-- &FAI::push_command( "parted -s /dev/$vg/$lv resize 1 0 " . $lv_size->{eff_size} . "B",
-- "vg_enabled_$vg,lv_grow_$vg/$lv", "exist_/dev/$vg/$lv" );
-+ if (($FAI::configs{$config}{volumes}{$lv}{filesystem} =~
-+ /^ext[23]$/) && &FAI::in_path("resize2fs")) {
-+ my $block_count = POSIX::floor($lv_size->{eff_size} / 512);
-+ &FAI::push_command( "e2fsck -p -f /dev/$vg/$lv",
-+ "vg_enabled_$vg,lv_grow_$vg/$lv", "e2fsck_f_resize_$vg/$lv" );
-+ &FAI::push_command( "resize2fs /dev/$vg/$lv ${block_count}s",
-+ "e2fsck_f_resize_$vg/$lv", "exist_/dev/$vg/$lv" );
-+ } else {
-+ &FAI::push_command( "parted -s /dev/$vg/$lv resize 1 0 " . $lv_size->{eff_size} . "B",
-+ "vg_enabled_$vg,lv_grow_$vg/$lv", "exist_/dev/$vg/$lv" );
-+ }
- }
-
- next;
-@@ -471,7 +491,7 @@
- print "/dev/$vg/$lv LV create_options: $create_options\n" if ($FAI::debug && $create_options);
- # create a new volume
- &FAI::push_command( "lvcreate $create_options -n $lv -L " .
-- $lv_size->{eff_size} . " $vg", "vg_enabled_$vg",
-+ &FAI::convert_unit($lv_size->{eff_size} . "B") . " $vg", "vg_enabled_$vg",
- "exist_/dev/$vg/$lv" );
-
- # create the filesystem on the volume
-@@ -876,25 +896,42 @@
- my $start = $part->{start_byte};
- my $end = $part->{end_byte};
-
-+ # ntfs/ext2,3 partition can't be moved
-+ ($start == $FAI::current_config{$disk}{partitions}{$mapped_id}{begin_byte})
-+ or &FAI::internal_error(
-+ $FAI::current_config{$disk}{partitions}{$mapped_id}{filesystem}
-+ . " partition start supposed to move, which is not allowed") if
-+ ($FAI::current_config{$disk}{partitions}{$mapped_id}{filesystem} =~
-+ /^(ntfs|ext[23])$/);
-+
- # build an appropriate command
- # ntfs requires specific care
- if ($FAI::current_config{$disk}{partitions}{$mapped_id}{filesystem} eq
- "ntfs") {
- # check, whether ntfsresize is available
- &FAI::in_path("ntfsresize") or die "ntfsresize not found in PATH\n";
-- # ntfs partition can't be moved
-- ($start == $FAI::current_config{$disk}{partitions}{$mapped_id}{begin_byte})
-- or &FAI::internal_error("ntfs partition supposed to move");
-- # ntfsresize requires device names
-- my $eff_size = $part->{size}->{eff_size};
-
-- &FAI::push_command( "yes | ntfsresize -s $eff_size " .
-+ &FAI::push_command( "yes | ntfsresize -s " . $part->{size}->{eff_size} .
- &FAI::make_device_name($disk, $p), "rebuilt_" .
- &FAI::make_device_name($disk, $p) . $deps, "ntfs_ready_for_rm_" .
- &FAI::make_device_name($disk, $p) );
-+ # TODO this is just a hack, we would really need support for resize
-+ # without data resize in parted, which will be added in some parted
-+ # version > 2.1
- &FAI::push_command( "parted -s $disk rm $p", "ntfs_ready_for_rm_" .
- &FAI::make_device_name($disk, $p), "resized_" .
- &FAI::make_device_name($disk, $p) );
-+ ## } elsif (($FAI::current_config{$disk}{partitions}{$mapped_id}{filesystem} =~
-+ ## /^ext[23]$/) && &FAI::in_path("resize2fs")) {
-+ ## TODO: BROKEN needs more checks, enlarge partition table before resize, just as
-+ ## NTFS case
-+ ## my $block_count = $part->{size}->{eff_size} / 512;
-+ ## &FAI::push_command( "e2fsck -p -f " . &FAI::make_device_name($disk, $p),
-+ ## "rebuilt_" . &FAI::make_device_name($disk, $p) . $deps,
-+ ## "e2fsck_f_resize_" . &FAI::make_device_name($disk, $p) );
-+ ## &FAI::push_command( "resize2fs " . &FAI::make_device_name($disk, $p) .
-+ ## " ${block_count}s", "e2fsck_f_resize_" . &FAI::make_device_name($disk, $p),
-+ ## "resized_" . &FAI::make_device_name($disk, $p) );
- } else {
- &FAI::push_command( "parted -s $disk resize $p ${start}B ${end}B",
- "rebuilt_" . &FAI::make_device_name($disk, $p) . $deps, "resized_" .
-Index: trunk/lib/setup-storage/Sizes.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Sizes.pm
-+++ trunk/lib/setup-storage/Sizes.pm
-@@ -252,7 +252,7 @@
- # the size is fixed
- if ($start == $end) {
- # write the size back to the configuration
-- $lv_size->{eff_size} = $start;
-+ $lv_size->{eff_size} = $start * 1024.0 * 1024.0;
- } else {
-
- # add this volume to the redistribution list
-@@ -282,7 +282,7 @@
-
- # write the final size
- $FAI::configs{$config}{volumes}{$lv}{size}{eff_size} =
-- $start + (($end - $start) * $redist_factor);
-+ ($start + (($end - $start) * $redist_factor)) * 1024.0 * 1024.0;
- }
- }
- }
-Index: trunk/lib/setup-storage/Volumes.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Volumes.pm
-+++ trunk/lib/setup-storage/Volumes.pm
-@@ -352,10 +352,10 @@
- # store the vg size in MB
- my %vg_info = get_volume_group_information($vg);
- if (%vg_info) {
-- $FAI::current_lvm_config{$vg}{size} = $vg_info{alloc_pe_size} .
-- $vg_info{alloc_pe_size_unit};
-+ $FAI::current_lvm_config{$vg}{size} = &FAI::convert_unit(
-+ $vg_info{alloc_pe_size} . $vg_info{alloc_pe_size_unit});
- } else {
-- $FAI::current_lvm_config{$vg}{size} = "0M";
-+ $FAI::current_lvm_config{$vg}{size} = "0";
- }
-
- # store the logical volumes and their sizes
Deleted: branches/experimental/patches/setup-storage_tmpfs
===================================================================
--- branches/experimental/patches/setup-storage_tmpfs 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/setup-storage_tmpfs 2010-07-29 16:32:48 UTC (rev 5909)
@@ -1,285 +0,0 @@
-2010-05-27 Julien BLACHE <jblache at debian.org>
- * lib/setup-storage/Commands.pm: support the TMPFS key where necessary.
- * lib/setup-storage/Fstab.pm: add support for tmpfs mounts.
- * lib/setup-storage/Parser.pm: add a new tmpfs stanza, a new tmpfs volume
- type and tmpfs_size (slightly differing from the regular size, no range
- support).
- * man/setup-storage.8: document the tmpfs stanza.
-
-Index: trunk/lib/setup-storage/Commands.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Commands.pm
-+++ trunk/lib/setup-storage/Commands.pm
-@@ -237,8 +237,8 @@
- sub build_raid_commands {
-
- foreach my $config (keys %FAI::configs) { # loop through all configs
-- # no LVM or physical devices here
-- next if ($config eq "CRYPT" || $config =~ /^VG_./ || $config =~ /^PHY_./);
-+ # no encrypted, tmpfs, LVM or physical devices here
-+ next if ($config eq "CRYPT" || $config eq "TMPFS" || $config =~ /^VG_./ || $config =~ /^PHY_./);
- ($config eq "RAID") or &FAI::internal_error("Invalid config $config");
-
- # create all raid devices
-@@ -614,8 +614,8 @@
- # loop through all configs
- foreach my $config (keys %FAI::configs) {
-
-- # no physical devices, RAID or encrypted here
-- next if ($config =~ /^PHY_./ || $config eq "RAID" || $config eq "CRYPT");
-+ # no physical devices, RAID, encrypted or tmpfs here
-+ next if ($config =~ /^PHY_./ || $config eq "RAID" || $config eq "CRYPT" || $config eq "TMPFS");
- ($config =~ /^VG_(.+)$/) or &FAI::internal_error("Invalid config $config");
- next if ($1 eq "--ANY--");
- my $vg = $1; # the volume group
-@@ -1027,8 +1027,8 @@
-
- # loop through all configs
- foreach my $config ( keys %FAI::configs ) {
-- # no RAID, encrypted or LVM devices here
-- next if ($config eq "RAID" || $config eq "CRYPT" || $config =~ /^VG_./);
-+ # no RAID, encrypted, tmpfs or LVM devices here
-+ next if ($config eq "RAID" || $config eq "CRYPT" || $config eq "TMPFS" || $config =~ /^VG_./);
- ($config =~ /^PHY_(.+)$/) or &FAI::internal_error("Invalid config $config");
- my $disk = $1; # the device to be configured
-
-Index: trunk/lib/setup-storage/Fstab.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Fstab.pm
-+++ trunk/lib/setup-storage/Fstab.pm
-@@ -59,9 +59,10 @@
- push @fstab_line, ($d_ref->{mountpoint}, $d_ref->{filesystem},
- $d_ref->{mount_options}, 0, 2);
- # order of filesystem checks: the root filesystem gets a 1, the others
-- # get 2, swap gets 0
-+ # get 2, swap and tmpfs get 0
- $fstab_line[-1] = 1 if ($d_ref->{mountpoint} eq "/");
- $fstab_line[-1] = 0 if ($d_ref->{filesystem} eq "swap");
-+ $fstab_line[-1] = 0 if ($d_ref->{filesystem} eq "tmpfs");
-
- # set the ROOT_PARTITION variable, if this is the mountpoint for /
- $FAI::disk_var{ROOT_PARTITION} = $name
-@@ -169,6 +170,9 @@
- return $this_mp if ($this_mp eq "/boot");
- $mnt_point = $this_mp if ($this_mp eq "/");
- }
-+ } elsif ($c eq "TMPFS") {
-+ # not usable for /boot
-+ next;
- } else {
- &FAI::internal_error("Unexpected key $c");
- }
-@@ -313,6 +317,26 @@
-
- push @fstab, &FAI::create_fstab_line($c_ref, $device_name, $device_name);
- }
-+ } elsif ($c eq "TMPFS") {
-+ foreach my $v (keys %{ $config->{$c}->{volumes} }) {
-+ my $c_ref = $config->{$c}->{volumes}->{$v};
-+
-+ next if ($c_ref->{mountpoint} eq "-");
-+
-+ ($c_ref->{mountpoint} eq "/boot" || ($c_ref->{mountpoint} eq "/" &&
-+ !defined ($FAI::disk_var{BOOT_PARTITION}))) and
-+ die "Boot partition cannot be a tmpfs\n";
-+
-+ if (($c_ref->{mount_options} =~ m/size=/) || ($c_ref->{mount_options} =~ m/nr_blocks=/)) {
-+ warn "Specified tmpfs size for $c_ref->{mountpoint} ignored as mount options contain size= or nr_blocks=\n";
-+ } else {
-+ $c_ref->{mount_options} .= "," if ($c_ref->{mount_options} ne "");
-+ # Size will be in % or MiB
-+ $c_ref->{mount_options} .= "size=" . $c_ref->{size};
-+ }
-+
-+ push @fstab, &FAI::create_fstab_line($c_ref, "tmpfs", "tmpfs");
-+ }
- } else {
- &FAI::internal_error("Unexpected key $c");
- }
-Index: trunk/lib/setup-storage/Parser.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Parser.pm
-+++ trunk/lib/setup-storage/Parser.pm
-@@ -399,6 +399,12 @@
- # exit config mode
- $FAI::device = "";
- }
-+ | /^tmpfs/
-+ {
-+ $FAI::device = "TMPFS";
-+ $FAI::configs{$FAI::device}{fstabkey} = "device";
-+ $FAI::configs{$FAI::device}{volumes} = {};
-+ }
- | /^disk(\d+)/
- {
- # check, whether parted is available
-@@ -617,6 +623,26 @@
- $FAI::partition_pointer = (\%FAI::configs)->{CRYPT}->{volumes}->{$vol_id};
- }
- mountpoint devices filesystem mount_options lv_or_fsopts
-+ | /^tmpfs\s+/
-+ {
-+ ($FAI::device eq "TMPFS") or die "tmpfs entry invalid in this context\n";
-+ defined ($FAI::configs{TMPFS}) or &FAI::internal_error("TMPFS entry missing");
-+
-+ my $vol_id = 0;
-+ foreach my $ex_vol_id (&FAI::numsort(keys %{ $FAI::configs{TMPFS}{volumes} })) {
-+ defined ($FAI::configs{TMPFS}{volumes}{$ex_vol_id}{device}) or last;
-+ $vol_id++;
-+ }
-+
-+ $FAI::configs{TMPFS}{volumes}{$vol_id}{device} = "tmpfs";
-+ $FAI::configs{TMPFS}{volumes}{$vol_id}{filesystem} = "tmpfs";
-+
-+ # We don't do preserve for tmpfs
-+ $FAI::configs{TMPFS}{volumes}{$vol_id}{preserve} = 0;
-+
-+ $FAI::partition_pointer = (\%FAI::configs)->{TMPFS}->{volumes}->{$vol_id};
-+ }
-+ mountpoint tmpfs_size mount_options
- | type mountpoint size filesystem mount_options lv_or_fsopts
-
- type: 'primary'
-@@ -741,6 +767,27 @@
- }
- | <error: invalid partition size near "$text">
-
-+ tmpfs_size: /^(RAM:(\d+%)|\d+[kMGTPiB]*)\s+/
-+ {
-+ my $size;
-+
-+ # convert the units, if necessary
-+ # A percentage is kept as is as tmpfs handles it
-+ if (defined($2)) {
-+ $size = $2;
-+ } else {
-+ $size = $1;
-+ $size .= "MiB" if ($size =~ /\d\s*$/);
-+ $size = &FAI::convert_unit($size);
-+ # Size in MiB for tmpfs
-+ $size .= "m";
-+ }
-+
-+ # enter the size into the hash
-+ $FAI::partition_pointer->{size} = $size;
-+ }
-+ | <error: invalid tmpfs size near "$text">
-+
- devices: /^([^\d,:\s\-][^,:\s]*(:(spare|missing))*(,[^,:\s]+(:(spare|missing))*)*)/
- {
- # split the device list by ,
-Index: trunk/lib/setup-storage/Sizes.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Sizes.pm
-+++ trunk/lib/setup-storage/Sizes.pm
-@@ -202,8 +202,8 @@
- # loop through all device configurations
- foreach my $config (keys %FAI::configs) {
-
-- # for RAID, encrypted or physical disks there is nothing to be done here
-- next if ($config eq "RAID" || $config eq "CRYPT" || $config =~ /^PHY_./);
-+ # for RAID, encrypted, tmpfs or physical disks there is nothing to be done here
-+ next if ($config eq "RAID" || $config eq "CRYPT" || $config eq "TMPFS" || $config =~ /^PHY_./);
- ($config =~ /^VG_(.+)$/) or &FAI::internal_error("invalid config entry $config");
- next if ($1 eq "--ANY--");
- my $vg = $1; # the volume group name
-@@ -598,8 +598,8 @@
- # loop through all device configurations
- foreach my $config (keys %FAI::configs) {
-
-- # for RAID, encrypted or LVM, there is nothing to be done here
-- next if ($config eq "RAID" || $config eq "CRYPT" || $config =~ /^VG_./);
-+ # for RAID, encrypted, tmpfs or LVM, there is nothing to be done here
-+ next if ($config eq "RAID" || $config eq "CRYPT" || $config eq "TMPFS" || $config =~ /^VG_./);
- ($config =~ /^PHY_(.+)$/) or &FAI::internal_error("invalid config entry $config");
- # nothing to be done, if this is a configuration for a virtual disk
- next if $FAI::configs{$config}{virtual};
-Index: trunk/lib/setup-storage/Volumes.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Volumes.pm
-+++ trunk/lib/setup-storage/Volumes.pm
-@@ -66,6 +66,9 @@
- } elsif ($config eq "CRYPT") {
- # devices must be one of the above already
- next;
-+ } elsif ($config eq "TMPFS") {
-+ # no devices
-+ next;
- } else {
- &FAI::internal_error("Unexpected key $config");
- }
-@@ -556,6 +559,9 @@
- } elsif ($config eq "CRYPT") {
- # We don't do preserve for encrypted partitions
- next;
-+ } elsif ($config eq "TMPFS") {
-+ # We don't do preserve for tmpfs
-+ next;
- } else {
- &FAI::internal_error("Unexpected key $config");
- }
-Index: trunk/man/setup-storage.8
-===================================================================
---- trunk.orig/man/setup-storage.8
-+++ trunk/man/setup-storage.8
-@@ -136,6 +136,8 @@
- .br
- | disk_config cryptsetup( <cryptsetupoption>)*
- .br
-+ | disk_config tmpfs
-+.br
- | disk_config end
- .br
- | disk_config disk[[:digit:]]+( <option>)*
-@@ -288,6 +290,10 @@
- .br
- /* lvm vg */
- .br
-+ | tmpfs <mountpoint> <tmpfs_size> <mount_options>
-+.br
-+ /* tmpfs volume */
-+.br
-
-
- type ::= primary
-@@ -366,6 +372,14 @@
- .br
-
-
-+tmpfs_size ::= (RAM:[[:digit:]]+%|[[:digit:]]+[kKMGTPiB]*)
-+.br
-+ /* tmpfs size in percentage of the total RAM or fixed size in
-+.br
-+ kilo (KiB), mega (default, MiB), giga (GiB), tera (TiB) or petabytes (PiB).
-+.br
-+
-+
- mount_options ::= [^[:space:]]+
- .br
-
-@@ -503,6 +517,25 @@
- .sp
- .fi
- .PP
-+
-+.TP
-+tmpfs example
-+.sp
-+.nf
-+.ta 10n 20n 30n 40n 50n
-+disk_config tmpfs
-+tmpfs /tmp RAM:20% defaults
-+tmpfs /scratch 3GiB defaults
-+.sp
-+.fi
-+.PP
-+.IP \(bu
-+Mount a tmpfs on /tmp with a maximum size equal to 20% of the total amount of
-+RAM in the machine. This is equivalent to using size=20% in the tmpfs mount
-+options.
-+.IP \(bu
-+Mount a tmpfs on /scratch with a maximum size of 3 GiB.
-+
- .SH CAVEATS
- .IP \(bu
- Partition UUID cannot be obtained: In case a partition was previously used as
Deleted: branches/experimental/patches/setup-storage_used-devs-only
===================================================================
--- branches/experimental/patches/setup-storage_used-devs-only 2010-07-29 16:30:51 UTC (rev 5908)
+++ branches/experimental/patches/setup-storage_used-devs-only 2010-07-29 16:32:48 UTC (rev 5909)
@@ -1,70 +0,0 @@
-2010-03-17 Michael Tautschnig <mt at debian.org>
-
- * setup-storage/Volumes.pm: Only read sizes and partitioning of disks
- referenced in the configuration (thanks Henning Sprang).
-Index: trunk/lib/setup-storage/Volumes.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Volumes.pm
-+++ trunk/lib/setup-storage/Volumes.pm
-@@ -38,18 +38,60 @@
-
- ################################################################################
- #
-+# @brief Collect all physical devices reference in the desired configuration
-+#
-+################################################################################
-+sub find_all_phys_devs {
-+
-+ my @phys_devs = ();
-+
-+ # loop through all configs
-+ foreach my $config (keys %FAI::configs) {
-+
-+ if ($config =~ /^PHY_(.+)$/) {
-+ push @phys_devs, $1;
-+ } elsif ($config =~ /^VG_(.+)$/) {
-+ next if ($1 eq "--ANY--");
-+ foreach my $d (keys %{ $FAI::configs{$config}{devices} }) {
-+ my ($i_p_d, $disk, $part_no) = &FAI::phys_dev($d);
-+ push @phys_devs, $disk if (1 == $i_p_d);
-+ }
-+ } elsif ($config eq "RAID") {
-+ foreach my $r (keys %{ $FAI::configs{$config}{volumes} }) {
-+ foreach my $d (keys %{ $FAI::configs{$config}{volumes}{$r}{devices} }) {
-+ my ($i_p_d, $disk, $part_no) = &FAI::phys_dev($d);
-+ push @phys_devs, $disk if (1 == $i_p_d);
-+ }
-+ }
-+ } elsif ($config eq "CRYPT") {
-+ # devices must be one of the above already
-+ next;
-+ } else {
-+ &FAI::internal_error("Unexpected key $config");
-+ }
-+ }
-+
-+ return \@phys_devs;
-+}
-+
-+################################################################################
-+#
- # @brief Collect the current partition information from all disks listed both
- # in $FAI::disks and $FAI::configs{PHY_<disk>}
- #
- ################################################################################
- sub get_current_disks {
-
-+ my %referenced_devs = ();
-+ @referenced_devs{ @{ &FAI::find_all_phys_devs() } } = ();
-+
- # obtain the current state of all disks
- foreach my $disk (@FAI::disks) {
--
- # create full paths
- ($disk =~ m{^/}) or $disk = "/dev/$disk";
-
-+ exists ($referenced_devs{$disk}) or next;
-+
- # make sure, $disk is a proper block device
- (-b $disk) or die "$disk is not a block special device!\n";
-
More information about the Fai-commit
mailing list