From: Elena Gryaznova Date: Tue, 28 Jul 2015 13:56:27 +0000 (+0300) Subject: LU-6913 test: fix conf-sanity test_30b defect X-Git-Tag: 2.7.59~27 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=8b0b0892da03dc5de5cd4025b9d31c9217b1e6f1;hp=861c70ff6e3371c752d53fcb71cdc54fe74cd3c2 LU-6913 test: fix conf-sanity test_30b defect 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 Seagate-bug-id: MRP-2749 Reviewed-by: Andriy Skulysh Change-Id: I2f7f163b84e4203ffa0ab12bc18b9d7ac535ec37 Reviewed-on: http://review.whamcloud.com/15772 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Emoly Liu Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 4c2aa80..b0a19ef 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -1274,30 +1274,35 @@ run_test 30a "Big config llog and conf_param deletion" 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. - 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" - 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" - 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 - # 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 @@ -1306,9 +1311,10 @@ test_30b() { 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 $?" }