Whamcloud - gitweb
LU-7428 test: commit the label change to disk 71/18871/2
authorHongchao Zhang <hongchao.zhang@intel.com>
Thu, 10 Dec 2015 13:20:55 +0000 (21:20 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 6 Apr 2016 01:39:32 +0000 (01:39 +0000)
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 <hongchao.zhang@intel.com>
Reviewed-on: http://review.whamcloud.com/18871
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/test-framework.sh

index 8270f99..24790da 100755 (executable)
@@ -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}