1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

cleanup: detect unsupported options earlier

Avoid unnecessary converions of pool.
This commit is contained in:
Zdenek Kabelac 2014-09-17 23:31:51 +02:00
parent 8cbb04563a
commit 31548e4e7c

View File

@ -2674,6 +2674,18 @@ static int _lvconvert_pool(struct cmd_context *cmd,
return 0;
}
if (arg_is_set(cmd, cachepool_ARG) && lv_is_thin_pool(pool_lv)) {
log_error("--cachepool requires a cache pool. %s is a thin pool.",
display_lvname(pool_lv));
return 0;
}
if (arg_is_set(cmd, thinpool_ARG) && lv_is_cache_pool(pool_lv)) {
log_error("--thinpool requires a thin pool. %s is a cache pool.",
display_lvname(pool_lv));
return 0;
}
if (lp->pool_metadata_lv_name) {
if (!(lp->pool_metadata_lv = find_lv(vg, lp->pool_metadata_lv_name))) {
log_error("Unknown pool metadata LV %s.", lp->pool_metadata_lv_name);
@ -2763,18 +2775,6 @@ static int _lvconvert_pool(struct cmd_context *cmd,
if (lv_is_pool(pool_lv)) {
lp->pool_data_lv = pool_lv;
if (arg_is_set(cmd, cachepool_ARG) && lv_is_thin_pool(pool_lv)) {
log_error("--cachepool requires a cache pool. %s is a thin pool.",
display_lvname(pool_lv));
return 0;
}
if (arg_is_set(cmd, thinpool_ARG) && lv_is_cache_pool(pool_lv)) {
log_error("--thinpool requires a thin pool. %s is a cache pool.",
display_lvname(pool_lv));
return 0;
}
if (!metadata_lv) {
if (arg_from_list_is_set(cmd, "is invalid with existing pool",
cachemode_ARG,chunksize_ARG, discards_ARG,