Support RAID0 and report failure to make RAID device
Jason D. Clinton [Mon, 29 Mar 2010 21:26:56 +0000 (16:26 -0500)]
etc/cloner/prep_disks.sh

index 24f8f1c..75fd721 100755 (executable)
@@ -87,8 +87,20 @@ then
                
 
                msg -n "Creating ${ANSI_BLUE}${MD_DEVICE}${ANSI_DONE} - $MD_LEVEL on $MD_DISK_QTY disk(s)"
-               /usr/bin/mdadm --create ${MD_DEVICE} --force --run --level=${MD_LEVEL} --chunk=128 --raid-devices=${MD_DISK_QTY} --spare-devices=${MD_SPARE_QTY} ${MD_DISK_STRING} >> /tmp/stdout.log 2>> /tmp/stderr.log
-       
+               if [ ${MD_LEVEL} == "raid0" ];
+               then
+                       /usr/bin/mdadm --create ${MD_DEVICE} --force --run --level=${MD_LEVEL} --chunk=128 --raid-devices=${MD_DISK_QTY} ${MD_DISK_STRING} >> /tmp/stdout.log 2>> /tmp/stderr.log
+               else
+                       /usr/bin/mdadm --create ${MD_DEVICE} --force --run --level=${MD_LEVEL} --chunk=128 --raid-devices=${MD_DISK_QTY} --spare-devices=${MD_SPARE_QTY} ${MD_DISK_STRING} >> /tmp/stdout.log 2>> /tmp/stderr.log
+               fi
+
+               if [ "$?" != "0" ];
+               then
+                       fail_msg
+                       fatal_error "Failed to create RAID device ${MD_DEVICE}"
+               else
+                       ok_msg
+               fi
        done < /cloner/setup/raidconf
 
 fi