From a39dbbabe8378712f2120352f27cc9ba4cc5286b Mon Sep 17 00:00:00 2001 From: Stephen Champion Date: Tue, 29 Oct 2013 12:13:49 +0800 Subject: [PATCH] LU-4123 tests: use nodename in check_write_access Check for a file create using the remote nodename. When the node name of a host does not exactly match the host name passed via xxx_HOST parameters, check_write_access can check for creation of a filename different from what the remote node created. By querying and using the nodename from the remote host, the node initiating the tests can check for the same file name that the remote node creates. Test-Parameters: testlist=lfsck Signed-off-by: Stephen Champion Signed-off-by: Jian Yu Change-Id: I57f081597395578c1a37e16531477e6fa4867c8d Reviewed-on: http://review.whamcloud.com/8009 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/tests/functions.sh | 13 +++++++++++++ lustre/tests/test-framework.sh | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lustre/tests/functions.sh b/lustre/tests/functions.sh index 215a3a8..0bc4fa0 100644 --- a/lustre/tests/functions.sh +++ b/lustre/tests/functions.sh @@ -254,6 +254,19 @@ short_hostname() { echo $(sed 's/\..*//' <<< $1) } +### +# short_nodename +# +# Find remote nodename, stripped of any domain, etc. +# 'hostname -s' is easy, but not implemented on all systems +short_nodename() { + local rname=$(do_node $1 "uname -n" || echo -1) + if [[ "$rname" = "-1" ]]; then + rname=$1 + fi + echo $(short_hostname $rname) +} + print_opts () { local var diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index ca4e200..910743f 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -6113,7 +6113,7 @@ check_write_access() { local file for node in ${list//,/ }; do - file=$dir/check_file.$(short_hostname $node) + file=$dir/check_file.$(short_nodename $node) if [[ ! -f "$file" ]]; then # Logdir not accessible/writable from this node. return 1 -- 1.8.3.1