Updated prep_disks to read raidconf3 file for making MD devices with a name and speci ...
Kyle Sheumaker [Mon, 4 Apr 2016 23:23:20 +0000 (18:23 -0500)]
etc/cloner3/prep_disks.sh

index 97ed724..1029660 100755 (executable)
@@ -185,8 +185,46 @@ then
                done < $i
        done
 fi
-       
-if [ -e /cloner/setup/raidconf2 ]
+               
+if [ -e /cloner/setup/raidconf3 ]
+then
+       header "Setting up software RAID devices"
+
+       while read line
+       do
+               MD_DEVICE=`echo $line | awk '{print $1}'`
+               MD_NAME=`echo $line | awk '{print $2}'`
+               MD_UUID=`echo $line | awk '{print $3}'`
+               MD_LEVEL=`echo $line | awk '{print $4}'`
+               MD_METADATA=`echo $line | awk '{print $5}'`
+               MD_DISK_QTY=`echo $line | awk '{print $6}'`
+               MD_SPARE_QTY=`echo $line | awk '{print $7}'`
+               MD_DISKS=`echo $line | awk '{print $8}'`
+               MD_SPARES=`echo $line | awk '{print $9}'`
+
+               T1=`echo $MD_DISKS | sed 's/,/ /g'`
+               T2=`echo $MD_SPARES | sed 's/,/ /g'`
+               MD_DISK_STRING="${T1} ${T2}"
+               
+
+               msg -n "Creating ${ANSI_BLUE}${MD_DEVICE}${ANSI_DONE} - $MD_LEVEL on $MD_DISK_QTY disk(s)"
+               server_log "Creating ${MD_DEVICE} - ${MD_LEVEL} on ${MD_DISK_QTY} disk(s)" "${_node}"
+               if [ ${MD_LEVEL} == "raid0" ];
+               then
+                       /usr/bin/mdadm --create ${MD_DEVICE} --uuid=${MD_UUID} --name=${MD_NAME} --metadata=${MD_METADATA} --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} --uuid=${MD_UUID} --name=${MD_NAME} --metadata=${MD_METADATA} --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
+                       clone_fatal_error "Failed to create RAID device ${MD_DEVICE}"
+               else
+                       ok_msg
+               fi
+       done < /cloner/setup/raidconf3
+elif [ -e /cloner/setup/raidconf2 ]
 then
        header "Setting up software RAID devices"