diff options
author | Brassow Jonathan <jbrassow@redhat.com> | 2016-09-06 09:29:14 -0500 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2016-09-07 16:42:32 +0200 |
commit | 5838c41a356eec05218395e734b90d21487f271c (patch) | |
tree | e62afc2203f272e96b07b392eed530e0d0f157d4 | |
parent | 01cc0dfae9ec5486fe313c0be4d3bb31e82a0456 (diff) | |
download | lvm2-5838c41a356eec05218395e734b90d21487f271c.tar.gz |
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>
-rw-r--r-- | WHATS_NEW | 1 | ||||
-rw-r--r-- | test/shell/lvchange-syncaction-raid.sh | 11 | ||||
-rw-r--r-- | tools/lvchange.c | 29 |
3 files changed, 40 insertions, 1 deletions
@@ -1,5 +1,6 @@ Version 2.02.166 - ===================================== + Support raid scrubbing on cache origin LV. Version 2.02.165 - 7th September 2016 ===================================== diff --git a/test/shell/lvchange-syncaction-raid.sh b/test/shell/lvchange-syncaction-raid.sh index 1997bc632..2baaaf6c5 100644 --- a/test/shell/lvchange-syncaction-raid.sh +++ b/test/shell/lvchange-syncaction-raid.sh @@ -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 diff --git a/tools/lvchange.c b/tools/lvchange.c index e0d91fc8e..4810392dc 100644 --- a/tools/lvchange.c +++ b/tools/lvchange.c @@ -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; |