struct lv_segment *seg;
if (!validate_lv_cache_create_pool(pool_lv) ||
- !validate_lv_cache_create_origin(origin_lv))
+ !validate_lv_cache_create_origin(cache_lv))
return_NULL;
+ if (lv_is_thin_pool(cache_lv))
+ cache_lv = seg_lv(first_seg(cache_lv), 0); /* cache _tdata */
+
if (!(segtype = get_segtype_from_string(cmd, "cache")))
return_NULL;
struct logical_volume *pool_lv = lp->pool_data_lv;
struct logical_volume *cache_lv;
- if (!validate_lv_cache_create_pool(pool_lv) ||
- !validate_lv_cache_create_origin(origin_lv))
+ if (!validate_lv_cache_create_pool(pool_lv))
return_0;
if (!archive(origin_lv->vg))
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_origin(lv))
- return_ECMD_FAILED;
- }
+ /* Validate origin prior we start conversion of pool */
+ if (lp->cache &&
+ !validate_lv_cache_create_origin(lv))
+ return_ECMD_FAILED;
if (lp->thin) {
if (lv_is_cache_type(lv) ||