Whamcloud - gitweb
LU-6913 test: fix conf-sanity test_30b defect 72/15772/4
authorElena Gryaznova <elena.gryaznova@seagate.com>
Tue, 28 Jul 2015 13:56:27 +0000 (16:56 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 26 Aug 2015 15:51:23 +0000 (15:51 +0000)
test_30b does not take into account a failover nid set
before test started, which leads test always fails
on the setup with $ost1failover_HOST != $ost1_HOST;
Patch fixes this defect.

Signed-off-by: Elena Gryaznova <elena.gryaznova@seagate.com>
Seagate-bug-id: MRP-2749
Reviewed-by: Andriy Skulysh <andriy.skulysh@seagate.com>
Change-Id: I2f7f163b84e4203ffa0ab12bc18b9d7ac535ec37
Reviewed-on: http://review.whamcloud.com/15772
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/conf-sanity.sh

index 4c2aa80..b0a19ef 100644 (file)
@@ -1274,30 +1274,35 @@ run_test 30a "Big config llog and conf_param deletion"
 test_30b() {
        setup
 
 test_30b() {
        setup
 
+       local orignids=$($LCTL get_param -n \
+               osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
+
+       local orignidcount=$(echo "$orignids" | wc -w)
+
        # Make a fake nid.  Use the OST nid, and add 20 to the least significant
        # numerical part of it. Hopefully that's not already a failover address
        # for the server.
        # Make a fake nid.  Use the OST nid, and add 20 to the least significant
        # numerical part of it. Hopefully that's not already a failover address
        # for the server.
-       OSTNID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
-       ORIGVAL=$(echo $OSTNID | egrep -oi "[0-9]*@")
-       NEWVAL=$((($(echo $ORIGVAL | egrep -oi "[0-9]*") + 20) % 256))
-       NEW=$(echo $OSTNID | sed "s/$ORIGVAL/$NEWVAL@/")
+       local OSTNID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | \
+               awk '{print $1}')
+       local ORIGVAL=$(echo $OSTNID | egrep -oi "[0-9]*@")
+       local NEWVAL=$((($(echo $ORIGVAL | egrep -oi "[0-9]*") + 20) % 256))
+       local NEW=$(echo $OSTNID | sed "s/$ORIGVAL/$NEWVAL@/")
        echo "Using fake nid $NEW"
 
        echo "Using fake nid $NEW"
 
-       TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
+       local TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
                grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
        set_conf_param_and_check client "$TEST" \
                "$FSNAME-OST0000.failover.node" $NEW ||
                error "didn't add failover nid $NEW"
                grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
        set_conf_param_and_check client "$TEST" \
                "$FSNAME-OST0000.failover.node" $NEW ||
                error "didn't add failover nid $NEW"
-       NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
+       local NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
                grep failover_nids)
        echo $NIDS
                grep failover_nids)
        echo $NIDS
-       # The NIDS value is the failover nid strings and "[" and "]". So
-       # we need to subtract the space taken by the delimiters. This has
-       # changed from earlier version of Lustre but this test is run only
-       # locally so this change will not break interop. See LU-3386
-       NIDCOUNT=$(($(echo "$NIDS" | wc -w) - 3))
-       echo "should have 2 failover nids: $NIDCOUNT"
-       [ $NIDCOUNT -eq 2 ] || error "Failover nid not added"
+       local NIDCOUNT=$(echo "$NIDS" | wc -w)
+       echo "should have $((orignidcount + 1)) entries \
+               in failover nids string, have $NIDCOUNT"
+       [ $NIDCOUNT -eq $((orignidcount + 1)) ] ||
+               error "Failover nid not added"
+
        do_facet mgs "$LCTL conf_param -d $FSNAME-OST0000.failover.node" ||
                error "conf_param delete failed"
        umount_client $MOUNT
        do_facet mgs "$LCTL conf_param -d $FSNAME-OST0000.failover.node" ||
                error "conf_param delete failed"
        umount_client $MOUNT
@@ -1306,9 +1311,10 @@ test_30b() {
        NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
                grep failover_nids)
        echo $NIDS
        NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
                grep failover_nids)
        echo $NIDS
-       NIDCOUNT=$(($(echo "$NIDS" | wc -w) - 3))
-       echo "only 1 final nid should remain: $NIDCOUNT"
-       [ $NIDCOUNT -eq 1 ] || error "Failover nids not removed"
+       NIDCOUNT=$(echo "$NIDS" | wc -w)
+       echo "only $orignidcount final entries should remain \
+               in failover nids string, have $NIDCOUNT"
+       [ $NIDCOUNT -eq $orignidcount ] || error "Failover nids not removed"
 
        cleanup || error "cleanup failed with rc $?"
 }
 
        cleanup || error "cleanup failed with rc $?"
 }