Package: fai-client
Version: 3.2.14
Severity: normal
Tags: patch

Hi,

I made a very simple disk config with raid1 and raid0:

disk_config sda fstabkey:device bootable:1
primary  -      2G      -               -
primary  swap   1G      swap            sw
primary  -      0-      -               -

disk_config sdb fstabkey:device bootable:1
primary  -      2G      -               -
primary  swap   1G      swap            sw
primary  -      0-      -               -

disk_config raid fstabkey:device
raid1   /       sda1,sdb1  ext3    rw,errors=remount-ro
raid0   /local  sda3,sdb3  ext3    rw

But when build the raid, mdadm return an error:
Executing: udevsettle --timeout 10 && yes | mdadm --create /dev/md1 
--level=raid0 --force --run --raid-devices=2 --spare-devices=0 /dev/sda3 
/dev/sdb3
Command udevsettle --timeout 10 && yes | mdadm --create /dev/md1 --level=raid0 
--force --run --raid-devices=2 --spare-devices=0 /dev/sda3 /dev/sdb3  had exit 
code 2

When launching it by hand I get:
# mdadm --create /dev/md1 --level=raid0 --force --run --raid-devices=2 
--spare-devices=0 /dev/sda3 /dev/sdb3
mdadm: spare-devices setting is incompatible with raid level 0

and without the spare-devices option, it works perfectly:
# mdadm --create /dev/md1 --level=raid0 --force --run --raid-devices=2 
/dev/sda3 /dev/sdb3
mdadm: /dev/sda3 appears to contain an ext2fs file system
    size=10490240K  mtime=Mon Dec  8 17:34:30 2008
mdadm: /dev/sda3 appears to be part of a raid array:
    level=raid0 devices=2 ctime=Mon Dec  8 17:34:24 2008
mdadm: /dev/sdb3 appears to be part of a raid array:
    level=raid0 devices=2 ctime=Mon Dec  8 17:34:24 2008
mdadm: array /dev/md1 started.

I made this very quick and dirty patch:
--- Commands.pm.orig    2008-12-08 15:56:58.000000000 +0100
+++ Commands.pm 2008-12-08 17:33:23.000000000 +0100
@@ -224,7 +224,7 @@
       $pre_req =~ s/^,//;
       &FAI::push_command(
         "yes | mdadm --create /dev/md$id --level=$level --force --run 
--raid-devices="
-          . scalar(@eff_devs) . " --spare-devices=" . scalar(@spares) . " "
+          . scalar(@eff_devs) . (scalar(@spares) !=0 ? " --spare-devices=" . 
scalar(@spares) : "") . " "
           . join(" ", @eff_devs) . " " . join(" ", @spares),
         "$pre_req", "exist_/dev/md$id" );

for information, my version of mdadm is:
ii  mdadm                                  2.6.7.1-1                            
  tool to administer Linux MD arrays (software RAID)

Best regards,
Camille

-- System Information:
Debian Release: 5.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-1-amd64 (SMP w/1 CPU core)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages fai-client depends on:
ii  file                       4.26-1        Determines file type using "magic"
ii  libapt-pkg-perl            0.1.22+b1     Perl interface to libapt-pkg
ii  libparse-recdescent-perl   1.95.1+dfsg-3 generates recursive-descent parser
ii  perl                       5.10.0-18     Larry Wall's Practical Extraction 

Versions of packages fai-client recommends:
ii  cfengine2                     2.2.8-1    Tool for configuring and maintaini
ii  debconf-utils                 1.5.24     debconf utilities

Versions of packages fai-client suggests:
pn  cryptsetup                    <none>     (no description available)
pn  dmsetup                       <none>     (no description available)
pn  ntfsprogs                     <none>     (no description available)

-- no debconf information
disk_config sda fstabkey:device bootable:1
primary  -      2G      -               -  
primary  swap   1G      swap            sw
primary  -      0-      -               -

disk_config sdb fstabkey:device bootable:1
primary  -      2G      -               -  
primary  swap   1G      swap            sw
primary  -      0-      -               -

disk_config raid fstabkey:device
raid1   /       sda1,sdb1  ext3    rw,errors=remount-ro   
raid0   /local  sda3,sdb3  ext3    rw

--- Commands.pm.orig    2008-12-08 15:56:58.000000000 +0100
+++ Commands.pm 2008-12-08 17:33:23.000000000 +0100
@@ -224,7 +224,7 @@
       $pre_req =~ s/^,//;
       &FAI::push_command(
         "yes | mdadm --create /dev/md$id --level=$level --force --run 
--raid-devices="
-          . scalar(@eff_devs) . " --spare-devices=" . scalar(@spares) . " "
+          . scalar(@eff_devs) . (scalar(@spares) !=0 ? " --spare-devices=" . 
scalar(@spares) : "") . " "
           . join(" ", @eff_devs) . " " . join(" ", @spares),
         "$pre_req", "exist_/dev/md$id" );
 

Reply via email to