#!/bin/sh
# Copyright (C) 2007-2008 Red Hat, Inc. All rights reserved.
# Copyright (C) 2007-2008 NEC Corporation
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
lv_devices_() {
local d
local lv=$1
shift
local devices=$*
local devs=$(lvs -a -odevices --noheadings $lv | sed 's/([0-9]*)//g' |
sed 's/ //g' | sed 's/,/ /g')
for d in $devs; do
(echo $devices | grep -q $d) || return 1
devices=$(echo $devices | sed "s/$d//")
done
[ "$(echo $devices | sed 's/ //g')" = "" ]
}
lv_mirror_log_() {
local lv=$1
echo $(lvs -a -omirror_log --noheadings $lv | sed 's/ //g')
}
lv_convert_lv_() {
local lv=$1
echo $(lvs -a -oconvert_lv --noheadings $lv | sed 's/ //g')
}
# ---------------------------------------------------------------------
# Initialize PVs and VGs
aux prepare_vg 5 80
# ---------------------------------------------------------------------
# Common environment setup/cleanup for each sub testcases
prepare_lvs_() {
lvremove -ff $vg
if dmsetup table|grep $vg; then
echo "ERROR: lvremove did leave some some mappings in DM behind!"
return 1
fi
:
}
check_and_cleanup_lvs_() {
lvs -a -o+devices $vg
lvremove -ff $vg
if dmsetup table|grep $vg; then
echo "ERROR: lvremove did leave some some mappings in DM behind!"
return 1
fi
}
# Temporary mirror log should have "_mlogtmp_<n>" suffix
# but currently lvconvert doesn't have an option to add the log.
# If such feature is added in future, a test for that should
# be added.