1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-07 04:58:47 +03:00

lvconvert: require different LV for pool

When convering an LV to a cache or thin LV, require
that an LV being converted to cache pool or thin pool
at the same time be a different LV.
This commit is contained in:
David Teigland 2017-04-11 12:15:10 -05:00
parent a96c8b46b6
commit 04d7444afa

View File

@ -3826,6 +3826,12 @@ static int _lvconvert_to_cache_vol_single(struct cmd_context *cmd,
goto out;
}
if (cachepool_lv == lv) {
log_error("Use a different LV for cache pool LV and cache LV %s.",
display_lvname(cachepool_lv));
goto out;
}
if (!_lvconvert_to_pool(cmd, cachepool_lv, lv, 0, 1, &vg->pvs)) {
log_error("LV %s could not be converted to a cache pool.",
display_lvname(cachepool_lv));
@ -3924,6 +3930,12 @@ static int _lvconvert_to_thin_with_external_single(struct cmd_context *cmd,
goto out;
}
if (thinpool_lv == lv) {
log_error("Use a different LV for thin pool LV and thin LV %s.",
display_lvname(thinpool_lv));
goto out;
}
if (!_lvconvert_to_pool(cmd, thinpool_lv, lv, 1, 0, &vg->pvs)) {
log_error("LV %s could not be converted to a thin pool.",
display_lvname(thinpool_lv));