From a2a869afc8f55409fca0f2079facaf57f2539f24 Mon Sep 17 00:00:00 2001 From: Alasdair G Kergon Date: Wed, 17 Sep 2014 17:11:01 +0100 Subject: [PATCH] lvconvert: Disallow mixing of cache and thin pools. --cachepool can't take a thin pool and --thinpool can't take a cache pool. --- tools/lvconvert.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/lvconvert.c b/tools/lvconvert.c index 295a4e548..eb96bc48c 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -2733,6 +2733,18 @@ 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,