[Fai-commit] r4621 - people/michael/features/setup_harddisks_2/implementation

michael-guest at alioth.debian.org michael-guest at alioth.debian.org
Wed Oct 10 07:54:32 UTC 2007


Author: michael-guest
Date: 2007-10-10 07:54:32 +0000 (Wed, 10 Oct 2007)
New Revision: 4621

Modified:
   people/michael/features/setup_harddisks_2/implementation/shdd2-commands
Log:
properly mark LVM and RAID partitions


Modified: people/michael/features/setup_harddisks_2/implementation/shdd2-commands
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/shdd2-commands	2007-10-10 06:29:19 UTC (rev 4620)
+++ people/michael/features/setup_harddisks_2/implementation/shdd2-commands	2007-10-10 07:54:32 UTC (rev 4621)
@@ -110,6 +110,29 @@
       # the list of RAID devices
       my @devs = keys %{ $FAI::configs{$config}{"volumes"}{$id}{"devices"} };
 
+      # set proper partition types for RAID
+      foreach my $d (@devs)
+      {
+        # skip devices marked missing
+        next if( 1 ==
+          $FAI::configs{$config}{"volumes"}{$id}{"devices"}{$d}{"missing"} );
+        # only match physical partitions (this string of matchings is hopefully complete)
+        next unless( $d =~
+          m{^/dev/(cciss/c\dd\dp|ida/c\dd\dp|rd/c\dd\dp|ataraid/d\dp|sd[a-t]|hd[a-t])(\d+)$} );
+        my $disk = "/dev/$1";
+        my $part_no = $2;
+        # in case the name was /dev/cciss/c0d1p or the like, remove the trailing
+        # p to get the disk name
+        $disk =~ s/(\d)p$/$1/;
+        # 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 flag
+        push @FAI::commands,
+          "$FAI::system_commands{'parted'} $disk set "
+          . $part_no . " raid on";
+      }
+      
       # create the command
       push @FAI::commands,
         "yes | mdadm --create /dev/md$id --level=$level "
@@ -164,6 +187,26 @@
         or die "/dev/$vg/$lv can't be preserved, it does not exist.\n";
     }
 
+    # set proper partition types for LVM
+    foreach my $d (keys %{ $FAI::configs{$config}{"devices"} })
+    {
+      # only match physical partitions (this string of matchings is hopefully complete)
+      next unless( $d =~
+        m{^/dev/(cciss/c\dd\dp|ida/c\dd\dp|rd/c\dd\dp|ataraid/d\dp|sd[a-t]|hd[a-t])(\d+)$} );
+      my $disk = "/dev/$1";
+      my $part_no = $2;
+      # in case the name was /dev/cciss/c0d1p or the like, remove the trailing
+      # p to get the disk name
+      $disk =~ s/(\d)p$/$1/;
+      # 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 lvm flag
+      push @FAI::commands,
+        "$FAI::system_commands{'parted'} $disk set "
+        . $part_no . " lvm on";
+    }
+
     # create the volume group, if it doesn't exist already
     if ( !defined( $FAI::current_lvm_config{$vg} ) )
     {




More information about the Fai-commit mailing list