diff options
author | Alasdair G Kergon <agk@redhat.com> | 2014-09-17 17:11:01 +0100 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2014-09-17 17:11:01 +0100 |
commit | a2a869afc8f55409fca0f2079facaf57f2539f24 (patch) | |
tree | 6d2acd7fdfe6b10111d79793c2cfb65031f67977 | |
parent | bdb05cc05e3a0eac72b0921cb5eb500891346e12 (diff) | |
download | lvm2-a2a869afc8f55409fca0f2079facaf57f2539f24.tar.gz |
lvconvert: Disallow mixing of cache and thin pools.
--cachepool can't take a thin pool and --thinpool can't take a
cache pool.
-rw-r--r-- | tools/lvconvert.c | 12 |
1 files changed, 12 insertions, 0 deletions
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, |