1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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>
This commit is contained in:
Brassow Jonathan 2016-09-06 09:29:14 -05:00 committed by Zdenek Kabelac
parent 01cc0dfae9
commit 5838c41a35
3 changed files with 40 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.166 -
=====================================
Support raid scrubbing on cache origin LV.
Version 2.02.165 - 7th September 2016
=====================================

View File

@ -82,4 +82,15 @@ 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

View File

@ -1049,6 +1049,18 @@ static int _lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
lv_is_virtual_origin(origin = origin_from_cow(lv)))
lv = origin;
/* Use cache origin LV for 'raid' actions */
if (lv_is_cache(lv) &&
arg_from_list_is_set(cmd, NULL,
/* FIXME: we want to support more ops here */
//resync_ARG,
syncaction_ARG,
-1)) {
lv = seg_lv(first_seg(lv), 0);
log_debug("Using cache origin volume %s for lvchange instead.",
display_lvname(lv));
}
if ((lv_is_thin_pool_data(lv) || lv_is_thin_pool_metadata(lv) ||
lv_is_cache_pool_data(lv) || lv_is_cache_pool_metadata(lv)) &&
!arg_is_set(cmd, activate_ARG) &&
@ -1056,7 +1068,22 @@ static int _lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
!arg_is_set(cmd, setactivationskip_ARG))
/* Rest can be changed for stacked thin pool meta/data volumes */
;
else if (!lv_is_visible(lv) && !lv_is_virtual_origin(lv)) {
else if (lv_is_cache_origin(lv) && lv_is_raid(lv)) {
if (vg_is_clustered(lv->vg)) {
log_error("Unable to change internal LV %s directly in a cluster.",
display_lvname(lv));
return ECMD_FAILED;
}
/*
* FIXME: For now, we don't want to allow all kinds of
* operations on this cache origin sub-LV. We are going
* to restrict it to non-clustered, RAID. This way, we
* can change the syncaction as needed (e.g. initiate
* scrubbing).
*
* Later pass all 'cache' actions on cache origin.
*/
} else if (!lv_is_visible(lv) && !lv_is_virtual_origin(lv)) {
log_error("Unable to change internal LV %s directly.",
display_lvname(lv));
return ECMD_FAILED;