1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00
lvm2/test/shell/lvchange-syncaction-raid.sh
Brassow Jonathan 5838c41a35 cache: scrubbing for cache origin LV - Bug 1169495
Allow RAID scrubbing on cache origin sub-LV

This patch adds the ability to perform RAID scrubbing on the cache
origin sub-LV (https://bugzilla.redhat.com/1169495).  Cache origin
operations are restricted to non-clustered RAID LVs until there can
be further testing in a cluster (even for exclusive activation).

User can either specify directly _corig LV
or he can specify cache LV and operation  --syncation is
passed ONLY to   _corig LV.

If users wants to manipulation with cache-pool devices - he
needs to specify this object name.

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
2016-09-07 16:42:32 +02:00

97 lines
2.8 KiB
Bash

#!/bin/sh
# Copyright (C) 2014-2015 Red Hat, Inc. All rights reserved.
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# test activation race for raid's --syncaction check
SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
. lib/inittest
# Proper mismatch count 1.5.2+ upstream, 1.3.5 < x < 1.4.0 in RHEL6
aux have_raid 1 3 5 &&
! aux have_raid 1 4 0 ||
aux have_raid 1 5 2 || skip
aux prepare_vg 3
lvcreate -n $lv1 $vg -l1 --type raid1
aux wait_for_sync $vg $lv1
START=$(get pv_field "$dev2" pe_start --units 1k)
METASIZE=$(get lv_field $vg/${lv1}_rmeta_1 size -a --units 1k)
SEEK=$((${START%\.00k} + ${METASIZE%\.00k}))
# Overwrite some portion of _rimage_1
#aux delay_dev "$dev2" 10 10
dd if=/dev/urandom of="$dev2" bs=1K count=1 seek=$SEEK oflag=direct
# FIXME
# Some delay - there is currently race in upstream kernel
# test may occasionaly fail with:
# device-mapper: message ioctl on failed: Device or resource busy
#
# Heinz's kernel seems to fix this particular issue but
# has some other problem for now
aux udev_wait
lvchange --syncaction check $vg/$lv1
# Wait till scrubbing is finished
aux wait_for_sync $vg $lv1
check lv_field $vg/$lv1 raid_mismatch_count "128"
# Let's deactivate
lvchange -an $vg/$lv1
lvchange -ay $vg/$lv1
# noone has it open and target is read & running
dmsetup info -c | grep $vg
#sleep 10 < "$DM_DEV_DIR/$vg/$lv1" &
# "check" should find discrepancies but not change them
# 'lvs' should show results
# FIXME
# this looks like some race with 'write' during activation
# and syncaction...
# For now it fails with:
# device-mapper: message ioctl on failed: Device or resource busy
#
# As solution for now - user needs to run --synaction on synchronous raid array
#
aux wait_for_sync $vg $lv1
# Check raid array doesn't know about error yet
check lv_field $vg/$lv1 raid_mismatch_count "0"
# Start scrubbing
lvchange --syncaction check $vg/$lv1
# Wait till scrubbing is finished
aux wait_for_sync $vg $lv1
# Retest mistmatch exists
check lv_field $vg/$lv1 raid_mismatch_count "128"
lvremove -ff $vg
# Bug 1169495 - RFE: allow raid scrubbing on cache origin raid volumes
# lvcreate RAID1 origin, lvcreate cache-pool, and lvconvert to cache
# then test that the origin can be scrubbed.
lvcreate --type raid1 -m 1 --nosync -l 2 -n $lv1 $vg
lvcreate --type cache-pool -l 1 -n ${lv1}_cachepool $vg
lvconvert --cache -Zy --cachepool $vg/${lv1}_cachepool $vg/$lv1
lvchange --syncaction check $vg/${lv1}_corig
# Check may go too quickly to verify with check of syncaction
vgremove -ff $vg