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 11LVM_DIR="${LVM_DIR:-/tmp}" 12LVM_TMPDIR="$LVM_DIR/ltp/growfiles" 13LVM_IMGDIR="$LVM_DIR/ltp/imgfiles" 14 15cleanup_lvm() 16{ 17 DEVLIST=`losetup -lnO NAME,BACK-FILE | grep "$LVM_IMGDIR" | cut -d ' ' -f 1` 18 19 for dir in "$LVM_TMPDIR/"*; do 20 tst_umount $dir 21 done 22 23 ROD vgremove -y ltp_test_vg1 24 ROD vgremove -y ltp_test_vg2 25 26 for devname in $DEVLIST; do 27 ROD tst_device release $devname 28 done 29 30 rm -rf $LVM_DIR/ltp 31 tst_res TPASS "LVM configuration for LTP removed successfully." 32} 33 34. tst_test.sh 35tst_run 36