[Fai-commit] r4855 - people/michael/features/setup_harddisks_2/implementation/lib

mt at alioth.debian.org mt at alioth.debian.org
Fri Mar 28 15:08:57 UTC 2008


Author: mt
Date: 2008-03-28 15:08:56 +0000 (Fri, 28 Mar 2008)
New Revision: 4855

Modified:
   people/michael/features/setup_harddisks_2/implementation/lib/commands.pm
Log:
now handling spares as well...


Modified: people/michael/features/setup_harddisks_2/implementation/lib/commands.pm
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/lib/commands.pm	2008-03-28 13:01:04 UTC (rev 4854)
+++ people/michael/features/setup_harddisks_2/implementation/lib/commands.pm	2008-03-28 15:08:56 UTC (rev 4855)
@@ -129,9 +129,16 @@
 
       # the list of RAID devices
       my @devs = keys %{ $vol->{devices} };
+      my @eff_devs = ();
+      my @spares = ();
 
       # set proper partition types for RAID
       foreach my $d (@devs) {
+        if ($vol->{devices}->{$d}->{spare}) {
+          push @spares, $d;
+        } else {
+          push @eff_devs, $d;
+        }
         # skip devices marked missing
         next if $vol->{devices}{$d}{missing};
         &FAI::set_partition_type_on_phys_dev($d, "raid");
@@ -141,8 +148,9 @@
       
       # create the command
       push @FAI::commands,
-        "yes | mdadm --create /dev/md$id --level=$level --raid-devices="
-        . scalar(@devs) . " " . join(" ", @devs);
+        "yes | mdadm --create /dev/md$id --level=$level --force --run --raid-devices="
+        . scalar(@eff_devs) . " --spare-devices=" . scalar(@spares) . " "
+        . join(" ", @eff_devs) . " " . join(" ", @spares);
 
       # create the filesystem on the volume
       &FAI::build_mkfs_commands("/dev/md$id",




More information about the Fai-commit mailing list