On Wed, Oct 20, 2004 at 01:30:38PM +0200, Christian Perrier wrote:
> Quoting Andrew Pollock ([EMAIL PROTECTED]):
> 
> > That's a shame. I would have thought it'd be relatively easy to implement,
> > but I haven't given the innards of what's involved close inspection...
> 
> Well, the non easiest thing is maybe getting someone volunteering for
> implementing this..:-)
> 

:-)

Patch attached. Will submit it to the BTS shortly. I'm doing some tests with
qemu, but it's slooow. Would appreciate some testing by others...

regards

Andrew

-- 
linux.conf.au 2005   -  http://lca2005.linux.org.au/  -  Birthplace of Tux
April 18th to 23rd   -  http://lca2005.linux.org.au/  -       LINUX
Canberra, Australia  -  http://lca2005.linux.org.au/  -    Get bitten!
Common subdirectories: mdcfg-1.06/debian and mdcfg-1.07/debian
diff -u mdcfg-1.06/mdcfg.sh mdcfg-1.07/mdcfg.sh
--- mdcfg-1.06/mdcfg.sh 2004-09-30 05:59:27.000000000 +1000
+++ mdcfg-1.07/mdcfg.sh 2004-10-24 14:15:30.000000000 +1000
@@ -222,19 +222,12 @@
        db_get mdcfg/raid1sparecount
        SPARE_COUNT="${RET}"
        REQUIRED=$(($DEV_COUNT + $SPARE_COUNT))
-       if [ "$REQUIRED" -gt "$NUM_PART" ] ; then
-               db_subst mdcfg/notenoughparts NUM_PART "${NUM_PART}"
-               db_subst mdcfg/notenoughparts REQUIRED "${REQUIRED}"
-               db_input critical mdcfg/notenoughparts
-               db_go mdcfg/notenoughparts
-               return
-       fi
 
        db_set mdcfg/raid1devs ""
        SELECTED=0
 
-       # Loop until the correct amount of active devices has been selected
-       while [ "${SELECTED}" -ne "${DEV_COUNT}" ]; do
+       # Loop until at least one device has been selected
+       until [ "${SELECTED}" -gt "0" -a "${SELECTED}" -le "${DEV_COUNT}" ]; do
                db_subst mdcfg/raid1devs COUNT "${DEV_COUNT}"
                db_subst mdcfg/raid1devs PARTITIONS "${PARTITIONS}"
                db_input critical mdcfg/raid1devs
@@ -251,6 +244,12 @@
                done
        done
 
+       # Add "missing" for as many devices as weren't selected
+       while [ "${SELECTED}" -lt "${DEV_COUNT}" ]; do
+               MISSING_DEVICES="${MISSING_DEVICES} missing"
+               let SELECTED++
+       done
+
        # Remove partitions selected in raid1devs from the PARTITION list
        db_get mdcfg/raid1devs
 
@@ -310,7 +309,7 @@
        echo "Raid devices count: ${DEV_COUNT}"
        echo "Spare devices count: ${SPARE_COUNT}"
        echo "Commandline:"
-       `mdadm --create /dev/md/${MD_NUM} --force -R -l raid1 -n ${DEV_COUNT} -x 
${SPARE_COUNT} ${RAID_DEVICES} ${SPARE_DEVICES} ${MISSING_SPARES}`
+       `mdadm --create /dev/md/${MD_NUM} --force -R -l raid1 -n ${DEV_COUNT} -x 
${SPARE_COUNT} ${RAID_DEVICES} ${MISSING_DEVICES} ${SPARE_DEVICES} ${MISSING_SPARES}`
 }
 
 md_create_raid5() {
Only in mdcfg-1.07/: .mdcfg.sh.swp

Attachment: signature.asc
Description: Digital signature

Reply via email to