#!/bin/bash # Copyright (c) 2016 Red Hat, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Author: LiLin source ../include/ec.sh || exit 200 tlog "running $0" rpm -q device-mapper-multipath || yum -y install device-mapper device-mapper-multipath cleanup trun "rm /etc/multipath.conf" trun "mpathconf --enable" trun "service multipathd stop" trun "modprobe scsi_debug num_tgts=1 vpd_use_hostno=0 add_host=2 delay=20 max_luns=2 no_lun_0=1 opts=2" sleep 5 trun "multipath" sleep 5 trun "multipath -l" trun "multipath -l | grep scsi_debug | awk '{print \$1}' | head -1" mpathdev=$tSTDOUT assert '[[ -n "$mpathdev" ]]' trun "multipath -l $mpathdev | grep 'active undef' | wc -l" before_active=$tSTDOUT trun "dd if=/dev/zero of=/dev/mapper/$mpathdev bs=1024 seek=2330 count=10 2>&1 | grep -o 'Input/output error'" IO_error=$tSTDOUT assert '[[ -n "$IO_error" ]]' #after_active=`multipath -l $mpathdev | grep "active undef" | wc -l` trun "multipath -l $mpathdev | grep 'active undef' | wc -l" after_active=$tSTDOUT tok '[[ "$before_active" -eq "$after_active" ]]' cleanup tend