1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0-or-later 3# Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz> 4# 5# Clean up LVM volume groups created by prepare_lvm.sh 6 7TST_TESTFUNC=cleanup_lvm 8TST_NEEDS_ROOT=1 9TST_NEEDS_CMDS="losetup umount vgremove" 10. tst_test.sh 11 12LVM_DIR="${LVM_DIR:-/tmp}" 13LVM_TMPDIR="$LVM_DIR/ltp/growfiles" 14LVM_IMGDIR="$LVM_DIR/ltp/imgfiles" 15 16cleanup_lvm() 17{ 18 DEVLIST=`losetup -lnO NAME,BACK-FILE | grep "$LVM_IMGDIR" | cut -d ' ' -f 1` 19 20 for dir in "$LVM_TMPDIR/"*; do 21 tst_umount $dir 22 done 23 24 ROD vgremove -y ltp_test_vg1 25 ROD vgremove -y ltp_test_vg2 26 27 for devname in $DEVLIST; do 28 ROD tst_device release $devname 29 done 30 31 rm -rf $LVM_DIR/ltp 32 tst_res TPASS "LVM configuration for LTP removed successfully." 33} 34 35tst_run 36