From: Hongchao Zhang Date: Thu, 10 Dec 2015 13:20:55 +0000 (+0800) Subject: LU-7428 test: commit the label change to disk X-Git-Tag: 2.8.52~32 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=4635d6235f8c8f4bb212aa59710c4f68db6acd7a LU-7428 test: commit the label change to disk when mounting some Lustre target (MDT or OST), the device label will be changed if it is mounted for the first time, and it's better to commit the change to disk. Change-Id: I36125356bf19f0aedcb1a6939e7461911c1a749d Signed-off-by: Hongchao Zhang Reviewed-on: http://review.whamcloud.com/18871 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 8270f99..24790da 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -1223,6 +1223,8 @@ mount_facet() { local opt=${facet}_opt local mntpt=$(facet_mntpt $facet) local opts="${!opt} $@" + local fstype=$(facet_fstype $facet) + local devicelabel module_loaded lustre || load_modules @@ -1236,6 +1238,16 @@ mount_facet() { import_zpool $facet || return ${PIPESTATUS[0]} fi + case $fstype in + ldiskfs) + devicelabel=$(do_facet ${facet} "$E2LABEL ${!dev}");; + zfs) + devicelabel=$(do_facet ${facet} "$ZFS get -H -o value \ + lustre:svname ${!dev}");; + *) + error "unknown fstype!";; + esac + echo "Starting ${facet}: $opts ${!dev} $mntpt" # for testing LU-482 error handling in mount_facets() and test_0a() if [ -f $TMP/test-lu482-trigger ]; then @@ -1261,7 +1273,6 @@ mount_facet() { if [[ $opts =~ .*nosvc.* ]]; then echo "Start ${!dev} without service" else - local fstype=$(facet_fstype $facet) case $fstype in ldiskfs) @@ -1279,6 +1290,12 @@ mount_facet() { esac fi + # commit the device label change to disk + if [[ $devicelabel =~ (:[a-zA-Z]{3}[0-9]{4}) ]]; then + do_facet $facet "sync; sync; sync" + fi + + label=$(devicelabel ${facet} ${!dev}) [ -z "$label" ] && echo no label for ${!dev} && exit 1 eval export ${facet}_svc=${label}