[Fai-commit] r5180 - people/michael/experimental/patches
mt at alioth.debian.org
mt at alioth.debian.org
Tue Sep 30 16:03:52 UTC 2008
Author: mt
Date: 2008-09-30 16:03:51 +0000 (Tue, 30 Sep 2008)
New Revision: 5180
Added:
people/michael/experimental/patches/setup-storage_command-dependencies
people/michael/experimental/patches/setup-storage_parted-error-msgs
Modified:
people/michael/experimental/patches/series
Log:
important bugfixes for setup-storage
- handle new error messages as used in parted
- fixed bugs in command sorting
Modified: people/michael/experimental/patches/series
===================================================================
--- people/michael/experimental/patches/series 2008-09-29 08:50:11 UTC (rev 5179)
+++ people/michael/experimental/patches/series 2008-09-30 16:03:51 UTC (rev 5180)
@@ -1,3 +1,5 @@
+setup-storage_parted-error-msgs
+setup-storage_command-dependencies
setup-storage_opt-d
setup-storage_crypto-bugfixes
setup-storage_initramfs-lvm-raid
Added: people/michael/experimental/patches/setup-storage_command-dependencies
===================================================================
--- people/michael/experimental/patches/setup-storage_command-dependencies (rev 0)
+++ people/michael/experimental/patches/setup-storage_command-dependencies 2008-09-30 16:03:51 UTC (rev 5180)
@@ -0,0 +1,134 @@
+2008-09-30 Michael Tautschnig <mt at debian.org>
+
+ * bin/setup-storage: extended debug output of sorted commands
+ * lib/setup-storage/Commands.pm: Properly sort commands, fixed dependency
+ errors, use start_byte for new config instead of begin_byte
+Index: trunk/bin/setup-storage
+===================================================================
+--- trunk.orig/bin/setup-storage
++++ trunk/bin/setup-storage
+@@ -163,7 +163,14 @@
+
+ # run all commands
+ # debugging only: print the command script
+-$FAI::debug and print "$_:" . $FAI::commands{$_}{cmd} . "\n" foreach (&numsort(keys %FAI::commands));
++if ($FAI::debug) {
++ foreach (&numsort(keys %FAI::commands)) {
++ defined($FAI::commands{$_}{cmd}) or &FAI::internal_error("Missing command entry for $_");
++ print "$_:" . $FAI::commands{$_}{cmd} . "\n";
++ defined($FAI::commands{$_}{pre}) and print "\tpre: " . $FAI::commands{$_}{pre} . "\n";
++ defined($FAI::commands{$_}{post}) and print "\tpost: " . $FAI::commands{$_}{post} . "\n";
++ }
++}
+
+ # run the commands (if $FAI::no_dry_run is set)
+ &FAI::execute_command($FAI::commands{$_}{cmd}) foreach (&numsort(keys %FAI::commands));
+Index: trunk/lib/setup-storage/Commands.pm
+===================================================================
+--- trunk.orig/lib/setup-storage/Commands.pm
++++ trunk/lib/setup-storage/Commands.pm
+@@ -293,7 +293,7 @@
+ # create the volume group
+ my $pre_dev = join(",pv_done_", @devices);
+ $pre_dev =~ s/^,//;
+- &FAI::push_command( "vgcreate $vg " . join (" ", @devices), "$pre_dev",
++ &FAI::push_command( "vgcreate $vg " . join (" ", @devices), "exist_$pre_dev",
+ "vg_created_$vg" );
+ # we are done
+ return;
+@@ -436,7 +436,14 @@
+ # set proper partition types for LVM
+ &FAI::set_partition_type_on_phys_dev($_, "lvm")
+ foreach (keys %{ $FAI::configs{$config}{devices} });
+- my $type_pre = join(",type_lvm_", keys %{ $FAI::configs{$config}{devices} });
++ my $type_pre = "";
++ foreach my $d (keys %{ $FAI::configs{$config}{devices} }) {
++ if ((&FAI::phys_dev($d))[0]) {
++ $type_pre .= ",type_lvm_$d"
++ } else {
++ $type_pre .= ",exist_$d"
++ }
++ }
+ $type_pre =~ s/^,//;
+ # wait for udev to set up all devices
+ &FAI::push_command( "udevsettle --timeout=10", "$type_pre",
+@@ -622,15 +629,14 @@
+ $FAI::current_config{$disk}{partitions}{$mapped_id}{new_id} = $part_nr;
+
+ my $post = "run_udev_" . &FAI::make_device_name($disk, $part_nr);
+- $post = "rebuilt_" . &FAI::make_device_name($disk, $part_nr) if
++ $post .= ",rebuilt_" . &FAI::make_device_name($disk, $part_nr) if
+ $FAI::configs{$config}{partitions}{$part_id}{size}{resize};
+ # build a parted command to create the partition
+ &FAI::push_command( "parted -s $disk mkpart $part_type $fs ${start}B ${end}B",
+ "cleared1_$disk", $post );
+ &FAI::push_command( "udevsettle --timeout=10", "run_udev_" .
+ &FAI::make_device_name($disk, $part_nr), "exist_" .
+- &FAI::make_device_name($disk, $part_nr) ) if
+- $FAI::configs{$config}{partitions}{$part_id}{size}{resize};
++ &FAI::make_device_name($disk, $part_nr) );
+ }
+ }
+
+@@ -693,7 +699,7 @@
+ # get the intermediate partition id
+ my $p_other = $FAI::current_config{$disk}{partitions}{$mapped_id_other}{new_id};
+ # check for overlap
+- next if($part->{begin_byte} >
++ next if($part->{start_byte} >
+ $FAI::current_config{$disk}{partitions}{$mapped_id_other}{end_byte});
+ next if($part->{end_byte} <
+ $FAI::current_config{$disk}{partitions}{$mapped_id_other}{begin_byte});
+@@ -701,7 +707,7 @@
+ # special care, even though this does not catch all cases (sometimes it
+ # will fail nevertheless
+ if ($part->{size}->{extended} && $part_other > 4) {
+- if($part->{begin_byte} >
++ if($part->{start_byte} >
+ $FAI::current_config{$disk}{partitions}{$mapped_id_other}{begin_byte}) {
+ $deps .= ",resized_" . &FAI::make_device_name($disk, $p_other);
+ }
+@@ -711,7 +717,7 @@
+ }
+ }
+ elsif ($part_id > 4 && $part_other_ref->{size}->{extended}) {
+- if($part->{begin_byte} <
++ if($part->{start_byte} <
+ $FAI::current_config{$disk}{partitions}{$mapped_id_other}{begin_byte}) {
+ $deps .= ",resized_" . &FAI::make_device_name($disk, $p_other);
+ }
+@@ -753,7 +759,7 @@
+ &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), "resized_" .
++ "rebuilt_" . &FAI::make_device_name($disk, $p) . $deps, "resized_" .
+ &FAI::make_device_name($disk, $p) );
+ }
+
+@@ -911,10 +917,13 @@
+
+ while ($i < $FAI::n_c_i) {
+ my $all_matched = 1;
+- foreach (split(/,/, $FAI::commands{$i}{pre})) {
+- next if scalar(grep(m{^$_$}, @pre_deps));
+- $all_matched = 0;
+- last;
++ if (defined($FAI::commands{$i}{pre})) {
++ foreach (split(/,/, $FAI::commands{$i}{pre})) {
++ my $cur = $_;
++ next if scalar(grep(m{^$cur$}, @pre_deps));
++ $all_matched = 0;
++ last;
++ }
+ }
+ if ($all_matched) {
+ defined($FAI::commands{$i}{post}) and push @pre_deps, split(/,/, $FAI::commands{$i}{post});
+@@ -932,6 +941,7 @@
+ &FAI::push_command( $FAI::commands{$i}{cmd}, $FAI::commands{$i}{pre},
+ $FAI::commands{$i}{post} );
+ delete $FAI::commands{$i};
++ $i++;
+ }
+ }
+
Added: people/michael/experimental/patches/setup-storage_parted-error-msgs
===================================================================
--- people/michael/experimental/patches/setup-storage_parted-error-msgs (rev 0)
+++ people/michael/experimental/patches/setup-storage_parted-error-msgs 2008-09-30 16:03:51 UTC (rev 5180)
@@ -0,0 +1,149 @@
+2008-09-30 Michael Tautschnig <mt at debian.org>
+
+ * lib/setup-storage/Exec.pm: recent versions of parted log errors to stdout
+ instead of stderr + adaption of error messages to current ones
+ * lib/setup-storage/Volumes.pm: Handle new error message in case of missing
+ disk label
+Index: trunk/lib/setup-storage/Exec.pm
+===================================================================
+--- trunk.orig/lib/setup-storage/Exec.pm
++++ trunk/lib/setup-storage/Exec.pm
+@@ -52,13 +52,21 @@
+ $FAI::error_codes = [
+ {
+ error => "parted_1",
+- message => "Parted failed to remove the partition\n",
+- stderr_regex => "Error: Could not stat device rm - No such file or directory",
++ message => "Parted failed to open the device\n",
++ stderr_regex => "Error: Could not stat device .* - No such file or directory",
+ stdout_regex => "",
+ program => "parted",
+ response => "die",
+ },
+ {
++ error => "parted_1_new",
++ message => "Parted failed to open the device\n",
++ stderr_regex => "",
++ stdout_regex => "Error: Could not stat device .* - No such file or directory",
++ program => "parted",
++ response => "die",
++ },
++ {
+ error => "parted_2",
+ message => "Parted could not read a disk label\n",
+ stderr_regex => "Error: Unable to open .* - unrecognised disk label",
+@@ -67,67 +75,83 @@
+ response => "warn",
+ },
+ {
+- error => "parted_3",
+- message => "Parted failed to open the device\n",
+- stderr_regex => "Error: Could not stat device .* - No such file or directory",
+- stdout_regex => "",
++ error => "parted_2_new",
++ message => "Parted could not read a disk label\n",
++ stderr_regex => "",
++ stdout_regex => "Error: .* unrecognised disk label",
+ program => "parted",
+- response => "die"
++ response => "warn",
+ },
++ ## {
++ ## error => "parted_3",
++ ## message => "Parted was unable to create the partition\n",
++ ## stderr_regex => "Warning: You requested a partition from .* to .*\\.\$",
++ ## stdout_regex => "",
++ ## program => "parted",
++ ## response => \&FAI::restore_partition_table,
++ ## },
+ {
+- error => "parted_4",
+- message => "parted not found\n",
+- stderr_regex => "(parted: command not found|/sbin/parted: No such file or directory)",
++ error => "parted_4",
++ message => "Parted was unable to read the partition table\n",
++ stderr_regex => "No Implementation: Partition \\d+ isn't aligned to cylinder boundaries",
+ stdout_regex => "",
+ program => "parted",
+- response => "die"
++ response => "die",
++ },
++ {
++ error => "parted_4_new",
++ message => "Parted was unable to read the partition table\n",
++ stderr_regex => "",
++ stdout_regex => "No Implementation: Partition \\d+ isn't aligned to cylinder boundaries",
++ program => "parted",
++ response => "die",
+ },
+ {
+ error => "parted_5",
+- message => "Parted was unable to create the partition\n",
+- stderr_regex => "Warning: You requested a partition from .* to .*\\.\$",
++ message => "Parted failed to resize due to a setup-storage internal error\n",
++ stderr_regex => "Error: Can't have overlapping partitions",
+ stdout_regex => "",
+ program => "parted",
+- response => \&FAI::restore_partition_table,
++ response => "die",
+ },
+ {
+- error => "mkfs.xfs_1",
+- message => "mkfs.xfs refused to create a filesystem. Probably you should add -f to the mkfs options in your disk_config file.\n",
+- stderr_regex => "mkfs.xfs: /dev/.* appears to contain an existing filesystem",
+- stdout_regex => "",
+- program => "mkfs.xfs",
++ error => "parted_5_new",
++ message => "Parted failed to resize due to a setup-storage internal error\n",
++ stderr_regex => "",
++ stdout_regex => "Error: Can't have overlapping partitions",
++ program => "parted",
+ response => "die",
+ },
+ {
+ error => "parted_6",
+- message => "Parted was unable to read the partition table\n",
+- stderr_regex => "No Implementation: Partition \\d+ isn't aligned to cylinder boundaries",
++ message => "Parted failed to resize the partition (is it too small?)\n",
++ stderr_regex => "Error: Unable to satisfy all constraints on the partition",
+ stdout_regex => "",
+ program => "parted",
+ response => "die",
+ },
+ {
+- error => "parted_7",
+- message => "Parted doesn't support ntfs resizing\n",
+- stderr_regex => "No Implementation: Support for opening ntfs file systems is not implemented yet",
+- stdout_regex => "",
++ error => "parted_6_new",
++ message => "Parted failed to resize the partition (is it too small?)\n",
++ stderr_regex => "",
++ stdout_regex => "Error: Unable to satisfy all constraints on the partition",
+ program => "parted",
+ response => "die",
+ },
+ {
+- error => "parted_8",
+- message => "Parted failed to resize due to a setup-storage internal error\n",
+- stderr_regex => "Error: Can't have overlapping partitions",
++ error => "cmd_parted_1",
++ message => "parted not found\n",
++ stderr_regex => "(parted: command not found|/sbin/parted: No such file or directory)",
+ stdout_regex => "",
+ program => "parted",
+- response => "die",
++ response => "die"
+ },
+ {
+- error => "parted_9",
+- message => "Parted failed to resize the partition (is it too small?)\n",
+- stderr_regex => "Error: Unable to satisfy all constraints on the partition",
++ error => "mkfs.xfs_1",
++ message => "mkfs.xfs refused to create a filesystem. Probably you should add -f to the mkfs options in your disk_config file.\n",
++ stderr_regex => "mkfs.xfs: /dev/.* appears to contain an existing filesystem",
+ stdout_regex => "",
+- program => "parted",
++ program => "mkfs.xfs",
+ response => "die",
+ },
+ {
More information about the Fai-commit
mailing list