[Fai-commit] r5680 - people/michael/experimental/patches
Michael Tautschnig
mt at alioth.debian.org
Sun Nov 22 20:16:06 UTC 2009
Author: mt
Date: 2009-11-22 20:16:06 +0000 (Sun, 22 Nov 2009)
New Revision: 5680
Added:
people/michael/experimental/patches/setup-storage_sameas-option
Modified:
people/michael/experimental/patches/series
Log:
Added Julien Blache's sameas option patch
Modified: people/michael/experimental/patches/series
===================================================================
--- people/michael/experimental/patches/series 2009-11-22 20:05:20 UTC (rev 5679)
+++ people/michael/experimental/patches/series 2009-11-22 20:16:06 UTC (rev 5680)
@@ -8,3 +8,4 @@
bugfix-514160
bugfix-556082
bugfix-556168
+setup-storage_sameas-option
Added: people/michael/experimental/patches/setup-storage_sameas-option
===================================================================
--- people/michael/experimental/patches/setup-storage_sameas-option (rev 0)
+++ people/michael/experimental/patches/setup-storage_sameas-option 2009-11-22 20:16:06 UTC (rev 5680)
@@ -0,0 +1,122 @@
+2009-11-22 Michael Tautschnig <mt at debian.org>
+
+ * setup-storage/Parser.pm, setup-storage.8: Added new sameas disk_config
+ option (thanks Julien BLACHE for the patch).
+Index: trunk/lib/setup-storage/Parser.pm
+===================================================================
+--- trunk.orig/lib/setup-storage/Parser.pm
++++ trunk/lib/setup-storage/Parser.pm
+@@ -68,21 +68,17 @@
+ }
+
+ ################################################################################
++# @brief Determines a device's full path from a short name or number
+ #
+-# @brief Initialise a new entry in @ref $FAI::configs for a physical disk.
+-#
+-# Besides creating the entry in the hash, the fully path of the device is
+-# computed (see @ref $disk) and it is tested, whether this is a block device.
+-# The device name is then used to define @ref $FAI::device.
++# Resolves the device name (/dev/sda), short name (sda) or device number (0) to
++# a full device name (/dev/sda) and tests whether the device is a valid block
++# device.
+ #
+ # @param $disk Either an integer, occurring in the context of, e.g., disk2, or
+ # a device name. The latter may be fully qualified, such as /dev/hda, or a short
+ # name, such as sdb, in which case /dev/ is prepended.
+-#
+ ################################################################################
+-sub init_disk_config {
+-
+- # Initialise $disk
++sub resolv_disk_shortname {
+ my ($disk) = @_;
+
+ # test $disk for being numeric
+@@ -104,6 +100,28 @@
+ $disk = $candidates[0] if (scalar(@candidates) == 1);
+ die "Device name $disk could not be substituted\n" if ($disk =~ m{[\*\?\[\{\~]});
+
++ return $disk;
++}
++
++################################################################################
++#
++# @brief Initialise a new entry in @ref $FAI::configs for a physical disk.
++#
++# Checks whether the specified device is valid, creates the entry in the hash
++# and sets @ref $FAI::device.
++#
++# @param $disk Either an integer, occurring in the context of, e.g., disk2, or
++# a device name. The latter may be fully qualified, such as /dev/hda, or a short
++# name, such as sdb, in which case /dev/ is prepended.
++#
++################################################################################
++sub init_disk_config {
++
++ # Initialise $disk
++ my ($disk) = @_;
++
++ $disk = &FAI::resolv_disk_shortname($disk);
++
+ # prepend PHY_
+ $FAI::device = "PHY_$disk";
+
+@@ -411,6 +429,7 @@
+ $FAI::configs{"VG_--ANY--"}{fstabkey} = $1;
+ }
+
++
+ option: /^preserve_always:(\d+(,\d+)*)/
+ {
+ # set the preserve flag for all ids in all cases
+@@ -456,6 +475,24 @@
+ # the information preferred for fstab device identifieres
+ $FAI::configs{$FAI::device}{fstabkey} = $1;
+ }
++ | /^sameas:disk(\d+)/
++ {
++ my $ref_dev = &FAI::resolv_disk_shortname($1);
++ defined($FAI::configs{"PHY_" . $ref_dev}) or die "Reference device $ref_dev not found in config\n";
++
++ use Storable qw(dclone);
++
++ $FAI::configs{$FAI::device} = dclone($FAI::configs{"PHY_" . $ref_dev});
++ }
++ | /^sameas:(\S+)/
++ {
++ my $ref_dev = &FAI::resolv_disk_shortname($1);
++ defined($FAI::configs{"PHY_" . $ref_dev}) or die "Reference device $ref_dev not found in config\n";
++
++ use Storable qw(dclone);
++
++ $FAI::configs{$FAI::device} = dclone($FAI::configs{"PHY_" . $ref_dev});
++ }
+
+ volume: /^vg\s+/ name devices vgcreateopt(s?)
+ | /^raid([0156]|10)\s+/
+Index: trunk/man/setup-storage.8
+===================================================================
+--- trunk.orig/man/setup-storage.8
++++ trunk/man/setup-storage.8
+@@ -234,7 +234,19 @@
+ .br
+ may be the device (/dev/xxx), a label given using \-L, or the uuid
+ .br
+- */
++ */
++.br
++ | sameas:(disk[[:digit:]]+|[^[:space:]]+)
++.br
++ /* Indicate that this disk will use the same scheme
++.br
++ as the given device. The referenced device must be
++.br
++ defined before the device using this option. Use only
++.br
++ with identical hardware.
++.br
++ */
+ .br
+
+
More information about the Fai-commit
mailing list