+count_osts() {
+ do_facet mgs $LCTL get_param mgs.MGS.live.$FSNAME | grep OST | wc -l
+}
+
+test_59() {
+ start_mgsmds >> /dev/null
+ local C1=$(count_osts)
+ if [ $C1 -eq 0 ]; then
+ start_ost >> /dev/null
+ C1=$(count_osts)
+ fi
+ stopall
+ echo "original ost count: $C1 (expect > 0)"
+ [ $C1 -gt 0 ] || error "No OSTs in $FSNAME log"
+ start_mgsmds -o writeconf >> /dev/null || error "MDT start failed"
+ local C2=$(count_osts)
+ echo "after mdt writeconf count: $C2 (expect 0)"
+ [ $C2 -gt 0 ] && error "MDT writeconf should erase OST logs"
+ echo "OST start without writeconf should fail:"
+ start_ost >> /dev/null && error "OST start without writeconf didn't fail"
+ echo "OST start with writeconf should succeed:"
+ start_ost -o writeconf >> /dev/null || error "OST1 start failed"
+ local C3=$(count_osts)
+ echo "after ost writeconf count: $C3 (expect 1)"
+ [ $C3 -eq 1 ] || error "new OST writeconf should add:"
+ start_ost2 -o writeconf >> /dev/null || error "OST2 start failed"
+ local C4=$(count_osts)
+ echo "after ost2 writeconf count: $C4 (expect 2)"
+ [ $C4 -eq 2 ] || error "OST2 writeconf should add log"
+ stop_ost2 >> /dev/null
+ cleanup_nocli >> /dev/null
+}
+run_test 59 "writeconf mount option"
+