1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-17 06:04:23 +03:00

lvconvert: cache and thin conversion validation

More test for supported conversion.
This commit is contained in:
Zdenek Kabelac 2014-10-06 13:44:59 +02:00
parent ee344f1a9e
commit 60d2a63368
2 changed files with 27 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.112 -
=====================================
Fix detection of unsupported cache and thin pool lvconversions.
Fix detection of unsupported lvconversion of cache to snapshot.
Improve code for creation of cache and cache pool volumes.
Check cluster-wide (not local) active status before removing LV.

View File

@ -2802,13 +2802,18 @@ static int _lvconvert_pool(struct cmd_context *cmd,
}
if (lv_is_thin_pool(pool_lv) && (segtype_is_cache_pool(lp->segtype) || lp->cache)) {
log_error("Cannot convert thin pool volume %s as cache pool data volume.",
log_error("Can't convert thin pool LV %s.", display_lvname(pool_lv));
return 0;
}
if (lv_is_cache(pool_lv) && !segtype_is_thin_pool(lp->segtype)) {
log_error("Cached LV %s could be only converted into a thin pool volume.",
display_lvname(pool_lv));
return 0;
}
if (lv_is_cache_pool(pool_lv) && (segtype_is_thin_pool(lp->segtype) || lp->thin)) {
log_error("Cannot convert cache pool %s as thin pool data volume.",
log_error("Cannot convert cache pool %s as pool data volume.",
display_lvname(pool_lv));
return 0;
}
@ -3250,6 +3255,25 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
return ECMD_PROCESSED;
}
if (lp->cache) {
if (lv_is_thin_pool(lv))
lv = seg_lv(first_seg(lv), 0); /* cache _tdata */
if (!validate_lv_cache_create(NULL, lv))
return_ECMD_FAILED;
}
if (lp->thin) {
if (lv_is_cache_type(lv) ||
lv_is_pool(lv) ||
lv_is_thin_pool_data(lv) ||
lv_is_thin_pool_metadata(lv)) {
log_error("Can't convert %s %s to external origin.",
first_seg(lv)->segtype->name,
display_lvname(lv));
return ECMD_FAILED;
}
}
if (arg_count(cmd, repair_ARG)) {
if (lv_is_pool(lv)) {
if (!_lvconvert_pool_repair(cmd, lv, lp))