[Fai-commit] r5261 - in trunk: bin conf debian examples/simple/class examples/simple/disk_config examples/simple/scripts/GRUB lib/setup-storage man

mt at alioth.debian.org mt at alioth.debian.org
Mon Feb 16 12:47:24 UTC 2009


Author: mt
Date: 2009-02-16 12:47:23 +0000 (Mon, 16 Feb 2009)
New Revision: 5261

Added:
   trunk/examples/simple/disk_config/LVM_XEN_SERVER
   trunk/examples/simple/disk_config/RAID_XEN_VIRTUAL
   trunk/examples/simple/scripts/GRUB/20-initramfs
Modified:
   trunk/bin/setup-storage
   trunk/conf/NFSROOT
   trunk/debian/changelog
   trunk/debian/control
   trunk/examples/simple/class/50-host-classes
   trunk/lib/setup-storage/Commands.pm
   trunk/lib/setup-storage/Exec.pm
   trunk/lib/setup-storage/Fstab.pm
   trunk/lib/setup-storage/Parser.pm
   trunk/lib/setup-storage/Sizes.pm
   trunk/lib/setup-storage/Volumes.pm
   trunk/man/setup-storage.8
Log:
First series of setup-storage related fixes that get merged from experimental;
merged:
- setup-storage_udevsettle-etch
- setup-storage_large-partition-check
- setup-storage_opt-d
- setup-storage_crypto-bugfixes
- setup-storage_initramfs-lvm-raid
- setup-storage_liblinux-lvm
- setup-storage_disk-id-support
Further merges and the update to experimental will follow soon.


Modified: trunk/bin/setup-storage
===================================================================
--- trunk/bin/setup-storage	2009-02-16 11:10:23 UTC (rev 5260)
+++ trunk/bin/setup-storage	2009-02-16 12:47:23 UTC (rev 5261)
@@ -52,7 +52,7 @@
 
 package FAI;
 
-my $version = "1.0.3";
+my $version = "1.0.4";
 
 # command line parameter handling
 use Getopt::Std;
@@ -89,6 +89,9 @@
 use Fstab;
 use Exec;
 
+# enable debug mode, if requested using -d
+$opt_d and $FAI::debug = 1;
+
 # the config source file
 my $config_file = undef;
 # use the config file, if given

Modified: trunk/conf/NFSROOT
===================================================================
--- trunk/conf/NFSROOT	2009-02-16 11:10:23 UTC (rev 5260)
+++ trunk/conf/NFSROOT	2009-02-16 12:47:23 UTC (rev 5261)
@@ -7,7 +7,7 @@
 dnsutils ntpdate dosfstools cvs jove xfsprogs xfsdump
 procinfo dialog discover mdetect
 console-tools console-common
-expect iproute udev subversion
+expect iproute udev subversion liblinux-lvm-perl
 
 # needed for the simple examples
 cfengine2 libapt-pkg-perl

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2009-02-16 11:10:23 UTC (rev 5260)
+++ trunk/debian/changelog	2009-02-16 12:47:23 UTC (rev 5261)
@@ -3,8 +3,31 @@
   [ Thomas Lange ]
   * ainsl: add test if target file exists
 
- -- Thomas Lange <lange at debian.org>  Tue, 03 Feb 2009 12:00:28 +0100
+  [ Michael Tautschnig ]
+  * setup-storage: Bumped version number to 1.0.4
+  * setup-storage/Exec.pm: Use --timeout=10 instead of --timeout 10 to stay
+    compatible with etch (thanks Vincent Fortier)
+  * setup-storage/Sizes.pm: Immediately fail if partitions > 2TB are to be
+    created on msdos disk labels
+  * setup-storage: Enable debug mode if -d was given on the command line
+  * setup-storage/Fstab.pm, setup-storage/Commands.pm: Proper perl text
+    replace syntax and additional random initialization of partition
+    (thanks William Famy)
+  * examples/simple/scripts/GRUB/20-initramfs: Update the initramfs in case
+    lvm2 or mdadm have been installed.
+  * example/simple/classes/50-host-classes: Added hosts bear (class
+    LVM_XEN_SERVER) and puma (RAID_XEN_VIRTUAL)
+  * example/simple/disk_config/{LVM_XEN_SERVER,RAID_XEN_VIRTUAL}: Added
+    corresponding disk_config examples that have a large LVM and a software
+    RAID configured
+  * conf/NFSROOT, debian/control, setup-storage/Volumes.pm: Moving back to
+    Linux::LVM perl module for parsing LVM command output as #488205 has been
+    fixed.
+  * setup-storage/Parser.pm, setup-storage.8: Added and documented support for
+    glob patterns in device names (e.g., /dev/disk/by-id/scsi-*)
 
+ -- Thomas Lange <lange at debian.org>  Mon, 16 Feb 2009 13:39:38 +0100
+
 fai (3.2.16) unstable; urgency=high
 
   [ Thomas Lange ]

Modified: trunk/debian/control
===================================================================
--- trunk/debian/control	2009-02-16 11:10:23 UTC (rev 5260)
+++ trunk/debian/control	2009-02-16 12:47:23 UTC (rev 5261)
@@ -12,7 +12,7 @@
 Package: fai-client
 Architecture: all
 Section: admin
-Depends: perl, file, libapt-pkg-perl, libparse-recdescent-perl
+Depends: perl, file, libapt-pkg-perl, libparse-recdescent-perl, liblinux-lvm-perl
 Recommends: debconf-utils, cfengine2
 Suggests: ntfsprogs, dmsetup, cryptsetup
 Conflicts: fai, fai-kernels

Modified: trunk/examples/simple/class/50-host-classes
===================================================================
--- trunk/examples/simple/class/50-host-classes	2009-02-16 11:10:23 UTC (rev 5260)
+++ trunk/examples/simple/class/50-host-classes	2009-02-16 12:47:23 UTC (rev 5261)
@@ -12,6 +12,10 @@
 	echo "FAIBASE DHCPC DEMO XORG GNOME";;
     atom*)
 	echo "FAIBASE DHCPC DEMO" ;;
+    bear)
+	echo "FAIBASE DHCPC LVM_XEN_SERVER" ;;
+    puma)
+	echo "FAIBASE DHCPC RAID_XEN_VIRTUAL" ;;
     *)
 	echo "FAIBASE DHCPC" ;;
 esac

Added: trunk/examples/simple/disk_config/LVM_XEN_SERVER
===================================================================
--- trunk/examples/simple/disk_config/LVM_XEN_SERVER	                        (rev 0)
+++ trunk/examples/simple/disk_config/LVM_XEN_SERVER	2009-02-16 12:47:23 UTC (rev 5261)
@@ -0,0 +1,64 @@
+disk_config disk1  fstabkey:uuid
+primary /boot       100       ext3    rw
+primary swap        256       swap    sw
+primary /           2000      ext3    rw
+logical /tmp        1000      ext3    rw,nosuid
+logical /usr        2000      ext3    rw
+logical /var        2000      ext3    rw
+logical -           0-        -       -
+
+disk_config lvm
+vg      XENU        disk1.8
+XENU-worm_      -  2000  ext3  -
+XENU-wormswap   -  500   swap  -
+XENU-worm_tmp   -  500   ext3  -
+XENU-worm_usr   -  2000  ext3  -
+XENU-worm_var   -  2000  ext3  -
+XENU-gnat_      -  2000  ext3  -
+XENU-gnatswap   -  500   swap  -
+XENU-gnat_tmp   -  500   ext3  -
+XENU-gnat_usr   -  2000  ext3  -
+XENU-gnat_var   -  2000  ext3  -
+XENU-swan_      -  2000  ext3  -
+XENU-swanswap   -  500   swap  -
+XENU-swan_tmp   -  500   ext3  -
+XENU-swan_usr   -  2000  ext3  -
+XENU-swan_var   -  2000  ext3  -
+XENU-goat_      -  2000  ext3  -
+XENU-goatswap   -  500   swap  -
+XENU-goat_tmp   -  500   ext3  -
+XENU-goat_usr   -  2000  ext3  -
+XENU-goat_var   -  2000  ext3  -
+XENU-goat_var_spool   -  4000  ext3  -
+XENU-lynx_      -  2000  ext3  -
+XENU-lynxswap   -  500   swap  -
+XENU-lynx_tmp   -  500   ext3  -
+XENU-lynx_usr   -  2000  ext3  -
+XENU-lynx_var   -  2000  ext3  -
+XENU-lynx_home   -  20000  ext3  -
+XENU-joey_      -  2000  ext3  -
+XENU-joeyswap   -  500   swap  -
+XENU-joey_tmp   -  500   ext3  -
+XENU-joey_usr   -  2000  ext3  -
+XENU-joey_var   -  2000  ext3  -
+XENU-coke_      -  2000  ext3  -
+XENU-cokeswap   -  500   swap  -
+XENU-coke_tmp   -  500   ext3  -
+XENU-coke_usr   -  12000  ext3  -
+XENU-coke_var   -  2000  ext3  -
+XENU-coke_nobackup   -  8000  ext3  -
+XENU-bull_      -  2000  ext3  -
+XENU-bullswap   -  500   swap  -
+XENU-bull_tmp   -  500   ext3  -
+XENU-bull_usr   -  2000  ext3  -
+XENU-bull_var   -  2000  ext3  -
+XENU-bull_var_spool   -  4000  ext3  -
+XENU-bull_var_mail   -  100000  ext3  -
+XENU-bush_   -  50000  ext3  -
+# migration dummies
+XENU-puma_      -  1  ext3  -
+XENU-pumaswap   -  1  swap  -
+XENU-puma_tmp   -  1  ext3  -
+XENU-puma_usr   -  1  ext3  -
+XENU-puma_var   -  1  ext3  -
+

Added: trunk/examples/simple/disk_config/RAID_XEN_VIRTUAL
===================================================================
--- trunk/examples/simple/disk_config/RAID_XEN_VIRTUAL	                        (rev 0)
+++ trunk/examples/simple/disk_config/RAID_XEN_VIRTUAL	2009-02-16 12:47:23 UTC (rev 5261)
@@ -0,0 +1,20 @@
+disk_config hda virtual
+primary -        2000     -    -
+primary -        500      -    -
+primary -        500      -    -
+primary -        2000     -    -
+primary -        2000     -    -
+
+disk_config sda virtual
+primary -        2000     -    -
+primary -        500      -    -
+primary -        500      -    -
+primary -        2000     -    -
+primary -        2000     -    -
+
+disk_config raid
+raid1 /           hda1,sda1     ext3    rw
+raid1 swap        hda2,sda2      swap    sw
+raid1 /tmp        hda3,sda3      ext3    rw,nosuid
+raid1 /usr        hda4,sda4     ext3    rw
+raid1 /var        hda5,sda5     ext3    rw

Added: trunk/examples/simple/scripts/GRUB/20-initramfs
===================================================================
--- trunk/examples/simple/scripts/GRUB/20-initramfs	                        (rev 0)
+++ trunk/examples/simple/scripts/GRUB/20-initramfs	2009-02-16 12:47:23 UTC (rev 5261)
@@ -0,0 +1,21 @@
+#! /bin/bash
+
+error=0 ; trap "error=$((error|1))" ERR
+
+not_up2date() {
+  if [ $# -eq 0 ] ; then
+    echo "No package name given!"
+    return 127
+  fi
+
+  egrep -q "(^Unpacking $1 |^Unpacking replacement $1 )" $LOGDIR/*.log
+  return $?
+}
+
+if [ `not_up2date lvm2` -o `not_up2date mdadm` ] ; then
+  $ROOTCMD update-initramfs -k all -u
+fi
+
+
+exit $error
+

Modified: trunk/lib/setup-storage/Commands.pm
===================================================================
--- trunk/lib/setup-storage/Commands.pm	2009-02-16 11:10:23 UTC (rev 5260)
+++ trunk/lib/setup-storage/Commands.pm	2009-02-16 12:47:23 UTC (rev 5261)
@@ -80,7 +80,7 @@
   ($fs eq "swap") and $create_tool = "mkswap";
   ($fs eq "xfs") and $create_options = "$create_options -f" unless ($create_options =~ m/-f/);
   my $pre_encrypt = "exist_$device";
-  $pre_encrypt = "encrypt_$device" if ($partition->{encrypt});
+  $pre_encrypt = "encrypted_$device" if ($partition->{encrypt});
   &FAI::push_command( "$create_tool $create_options $device", $pre_encrypt,
     "has_fs_$device" );
 
@@ -115,7 +115,7 @@
 
   # encryption requested, rewrite the device name
   my $enc_dev_name = $device;
-  $enc_dev_name =~ "s#/#_#g";
+  $enc_dev_name =~ s#/#_#g;
   my $enc_dev_short_name = "crypt$enc_dev_name";
   $enc_dev_name = "/dev/mapper/$enc_dev_short_name";
   my $keyfile = "$ENV{LOGDIR}/$enc_dev_short_name";
@@ -124,14 +124,16 @@
   &FAI::push_command( 
     "head -c 2048 /dev/urandom | head -n 47 | tail -n 46 | od | tee $keyfile",
     "", "keyfile_$device" );
-
   # prepare encryption
   &FAI::push_command(
+    "dd if=/dev/urandom of=$device",
+    "exist_$device", "random_init_$device" );
+  &FAI::push_command(
     "yes YES | cryptsetup luksFormat $device $keyfile -c aes-cbc-essiv:sha256 -s 256",
-    "exist_$device,keyfile_$device", "crypt_format_$device" );
+    "random_init_$device,keyfile_$device", "crypt_format_$device" );
   &FAI::push_command(
     "cryptsetup luksOpen $device $enc_dev_short_name --key-file $keyfile",
-    "crypt_format_$device", "encrypted_$device" );
+    "crypt_format_$device", "encrypted_$enc_dev_name" );
 
   # add entries to crypttab
   push @FAI::crypttab, "$enc_dev_short_name\t$device\t$keyfile\tluks";

Modified: trunk/lib/setup-storage/Exec.pm
===================================================================
--- trunk/lib/setup-storage/Exec.pm	2009-02-16 11:10:23 UTC (rev 5260)
+++ trunk/lib/setup-storage/Exec.pm	2009-02-16 12:47:23 UTC (rev 5261)
@@ -246,7 +246,7 @@
 ################################################################################
 sub execute_with_udevsettle {
   my ($command, $stdout, $stderr) = @_;
-  return &execute_command("udevsettle --timeout 10 && $command", $stdout,
+  return &execute_command("udevsettle --timeout=10 && $command", $stdout,
     $stderr);
 }
 

Modified: trunk/lib/setup-storage/Fstab.pm
===================================================================
--- trunk/lib/setup-storage/Fstab.pm	2009-02-16 11:10:23 UTC (rev 5260)
+++ trunk/lib/setup-storage/Fstab.pm	2009-02-16 12:47:23 UTC (rev 5261)
@@ -163,7 +163,7 @@
         my $device_name = &FAI::make_device_name($device, $p_ref->{number});
         if ($p_ref->{encrypt}) {
           # encryption requested, rewrite the device name
-          $device_name =~ "s#/#_#g";
+          $device_name =~ s#/#_#g;
           $device_name = "/dev/mapper/crypt$device_name";
         }
 
@@ -213,7 +213,7 @@
         my $device_name = "/dev/$device/$l";
         if ($l_ref->{encrypt}) {
           # encryption requested, rewrite the device name
-          $device_name =~ "s#/#_#g";
+          $device_name =~ s#/#_#g;
           $device_name = "/dev/mapper/crypt$device_name";
         } else {
           $device_name = $fstab_key[0];
@@ -247,7 +247,7 @@
         my $device_name = "/dev/md$r";
         if ($r_ref->{encrypt}) {
           # encryption requested, rewrite the device name
-          $device_name =~ "s#/#_#g";
+          $device_name =~ s#/#_#g;
           $device_name = "/dev/mapper/crypt$device_name";
         } 
 

Modified: trunk/lib/setup-storage/Parser.pm
===================================================================
--- trunk/lib/setup-storage/Parser.pm	2009-02-16 11:10:23 UTC (rev 5260)
+++ trunk/lib/setup-storage/Parser.pm	2009-02-16 12:47:23 UTC (rev 5261)
@@ -99,6 +99,10 @@
   # test, whether the device name starts with a / and prepend /dev/, if
   # appropriate
   ($disk =~ m{^/}) or $disk = "/dev/$disk";
+  my @candidates = glob($disk);
+  die "Failed to resolve $disk to a unique device name\n" if (scalar(@candidates) > 1);
+  $disk = $candidates[0] if (scalar(@candidates) == 1);
+  die "Device name $disk could not be substituted\n" if ($disk =~ m{[\*\?\[\{\~]});
 
   # prepend PHY_
   $FAI::device = "PHY_$disk";
@@ -606,6 +610,8 @@
                 $dev = "/dev/$dev";
               }
             }
+            my @candidates = glob($dev);
+
             # options are only valid for RAID
             defined ($2) and ($FAI::device ne "RAID") and die "Option $2 invalid in a non-RAID context\n";
             if ($FAI::device eq "RAID") {
@@ -616,6 +622,13 @@
                 ($2 =~ /spare/) and $spare = 1;
                 ($2 =~ /missing/) and $missing = 1;
               }
+              if ($missing) {
+                die "Failed to resolve $dev to a unique device name\n" if (scalar(@candidates) > 1);
+                $dev = $candidates[0] if (scalar(@candidates) == 1);
+              } else {
+                die "Failed to resolve $dev to a unique device name\n" if (scalar(@candidates) != 1);
+                $dev = $candidates[0];
+              }
               # each device may only appear once
               defined ($FAI::partition_pointer->{devices}->{$dev}) and 
                 die "$dev is already part of the RAID volume\n";
@@ -625,6 +638,8 @@
                 "missing" => $missing
               };
             } else {
+              die "Failed to resolve $dev to a unique device name\n" if (scalar(@candidates) != 1);
+              $dev = $candidates[0];
               # create an empty hash for each device
               $FAI::configs{$FAI::device}{devices}{$dev} = {};
             }

Modified: trunk/lib/setup-storage/Sizes.pm
===================================================================
--- trunk/lib/setup-storage/Sizes.pm	2009-02-16 11:10:23 UTC (rev 5260)
+++ trunk/lib/setup-storage/Sizes.pm	2009-02-16 12:47:23 UTC (rev 5261)
@@ -680,6 +680,10 @@
         ($next_start, $min_req_total_space) = &FAI::do_partition_real($part_id, 
           $config, $current_disk, $next_start, $min_req_total_space, \@worklist);
 
+        # msdos does not support partitions larger than 2TB
+        ($part->{size}->{eff_size} > (&FAI::convert_unit("2TB") * 1024.0 *
+            1024.0)) and die "msdos disklabel does not support partitions > 2TB, please use disklabel:gpt\n"
+          if ($FAI::configs{$config}{disklabel} eq "msdos");
         # partition done
         shift @worklist;
       }

Modified: trunk/lib/setup-storage/Volumes.pm
===================================================================
--- trunk/lib/setup-storage/Volumes.pm	2009-02-16 11:10:23 UTC (rev 5260)
+++ trunk/lib/setup-storage/Volumes.pm	2009-02-16 12:47:23 UTC (rev 5261)
@@ -290,137 +290,37 @@
 ################################################################################
 sub get_current_lvm {
 
-  # use Linux::LVM, once #488205
+  use Linux::LVM;
 
-  # the list to hold the output of vgdisplay commands as parsed below
-  my @vgdisplay_print = ();
-
-  # try to obtain the list of volume groups
-  my $error =
-    &FAI::execute_ro_command( "vgdisplay --units m -s", \@vgdisplay_print, 0 );
-
-  # the expected output (if any) contains lines like the following
-  #
-  # $ vgdisplay -s
-  #   "XENU" 453.36 MB [451.93 MB used / 1.43 MB free]
-
-  # parse the output line by line and call vgdisplay -v <VG>
-  foreach my $line (@vgdisplay_print) {
-    ( 
-      # example output with an empty vg:
-      #   "my_pv" 267476.00 MB [0 MB      used / 267476.00 MB free]
-      $line =~
-/^\s*"(\S+)"\s+\d+\.\d+ MB\s+\[\d+\.*\d* MB\s+used \/ \d+\.\d+ MB\s+free\]$/
-    ) or die "Unexpected vgdisplay output $line";
-
-    # the name of the volume group
-    my $vg = $1;
-    
+  # get the existing volume groups
+  foreach my $vg (get_volume_group_list()) {
     # initialise the hash entry
-    $FAI::current_lvm_config{$vg}{"physical_volumes"} = ();
+    $FAI::current_lvm_config{$vg}{physical_volumes} = ();
     &FAI::push_command( "true", "", "vg_created_$vg" );
 
-    # get the detailed configuration for $vg
-    my @vgdisplay_v_print = ();
+    # store the vg size in MB
+    my %vg_info = get_volume_group_information($vg);
+    $FAI::current_lvm_config{$vg}{size} =
+      &FAI::convert_unit( $vg_info{alloc_pe_size} .
+        $vg_info{alloc_pe_size_unit} );
 
-    # try to obtain the detailed information for the volume group $vg
-    my $error = &FAI::execute_ro_command( "vgdisplay --units m -v $vg",
-      \@vgdisplay_v_print, 0 );
-
-    # the expected output (if any) looks like this:
-    # $ vgdisplay -v XENU
-    #     Using volume group(s) on command line
-    #     Finding volume group "XENU"
-    #   --- Volume group ---
-    #   VG Name               XENU
-    #   System ID
-    #   Format                lvm2
-    #   Metadata Areas        4
-    #   Metadata Sequence No  65
-    #   VG Access             read/write
-    #   VG Status             resizable
-    #   MAX LV                0
-    #   Cur LV                53
-    #   Open LV               46
-    #   Max PV                0
-    #   Cur PV                4
-    #   Act PV                4
-    #   VG Size               453.36 MB
-    #   PE Size               4.00 MB
-    #   Total PE              116060
-    #   Alloc PE / Size       115693 / 451.93 MB
-    #   Free  PE / Size       367 / 1.43 MB
-    #   VG UUID               09JCPv-v2RU-NWEZ-ilNA-mNLk-Scw3-aURtE6
-    #
-    #   --- Logical volume ---
-    #   LV Name                /dev/XENU/mole_
-    #   VG Name                XENU
-    #   LV UUID                WBcBDw-1z2J-F3b2-FGAk-u7Ki-IEgF-lMEURK
-    #   LV Write Access        read/write
-    #   LV Status              available
-    #   # open                 1
-    #   LV Size                1000.00 MB
-    #   Current LE             250
-    #   Segments               1
-    #   Allocation             inherit
-    #   Read ahead sectors     0
-    #   Block device           254:0
-    #
-    #   --- Physical volumes ---
-    #   PV Name               /dev/sda8
-    #   PV UUID               4i7Tpi-k9io-Ud44-gWJd-nSuG-hbh7-CE1m43
-    #   PV Status             allocatable
-    #   Total PE / Free PE    29015 / 0
-    #
-    #   PV Name               /dev/sda9
-    #   PV UUID               VXSxq1-vEwU-5VrY-QVC8-3Wf1-AY45-ayD9KY
-    #   PV Status             allocatable
-    #   Total PE / Free PE    29015 / 0
-    #
-
-    # parse the output to select the interesting parts
-    # there are 3 main groups: the volume group, logical volumes and physical
-    # volumes; use mode to indicate this
-    my $mode = "";
-
-    # we need to remember the logical volume name across the lines
-    my $lv_name = "";
-
-    # do the line-wise parsing
-    foreach my $line_v (@vgdisplay_v_print) {
-      $mode = "vg" if ( $line_v =~ /^\s*--- Volume group ---\s*$/ );
-      $mode = "lv" if ( $line_v =~ /^\s*--- Logical volume ---\s*$/ );
-      $mode = "pv" if ( $line_v =~ /^\s*--- Physical volumes ---\s*$/ );
-      $mode = "" if ( $mode ne "pv" && $line_v =~ /^\s*$/ );
-      next if ( $mode eq "" );
-
-      # Now select the interesting information for each mode
-      if ( $mode eq "vg" ) {
-
-        # for a volume group only the size is needed
-        # extract the floatingpoint value
-        $FAI::current_lvm_config{$vg}{"size"} = $1
-          if ( $line_v =~ /^\s*Alloc PE \/ Size\s+\d+ \/ (\d+\.\d+) MB\s*$/ );
-      } elsif ( $mode eq "lv" ) {
-
-        # we need the name and the size of each existing logical volume
-        if ( $line_v =~ /^\s*LV Name\s+\/dev\/\Q$vg\E\/(\S+)\s*$/ ) {
-          $lv_name = $1;
-          &FAI::push_command( "true", "", "exist_/dev/$vg/$lv_name" );
-        }
-
-        # the size of the logical volume
-        # extract the floatingpoint value
-        $FAI::current_lvm_config{$vg}{"volumes"}{$lv_name}{"size"} = $1
-          if ( $line_v =~ /^\s*LV Size\s+(\d+\.\d+) MB\s*$/ );
-      } elsif ( $mode eq "pv" ) {
-
-        # get the physical devices that are part of this volume group
-        push @{ $FAI::current_lvm_config{$vg}{"physical_volumes"} }, $1
-          if ( $line_v =~ /^\s*PV Name\s+(\S+)\s*$/ );
-      }
+      # store the logical volumes and their sizes
+    my %lv_info = get_logical_volume_information($vg);
+    foreach my $lv_name (sort keys %lv_info) {
+      my $short_name = $lv_name;
+      $short_name =~ "s{/dev/\Q$vg\E/}{}";
+      $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
+    my %pv_info = get_physical_volume_information($vg);
+    @{ $FAI::current_lvm_config{$vg}{physical_volumes} } =
+      sort keys %pv_info;
   }
+
 }
 
 ################################################################################

Modified: trunk/man/setup-storage.8
===================================================================
--- trunk/man/setup-storage.8	2009-02-16 11:10:23 UTC (rev 5260)
+++ trunk/man/setup-storage.8	2009-02-16 12:47:23 UTC (rev 5261)
@@ -144,8 +144,10 @@
 .br
            /* fully qualified device-path or short form, like hda, whereby full
 .br
-            * path is assumed to be /dev/hda */
+            * path is assumed to be /dev/hda; may contain shell globbing such
 .br
+            * as /dev/disk/by-id/scsi-* */
+.br
            | <volume>
 .br
 




More information about the Fai-commit mailing list