[lvm-devel] master - lvconvert: Disallow mixing of cache and thin pools.

Alasdair Kergon agk at fedoraproject.org
Wed Sep 17 16:11:39 UTC 2014


Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a2a869afc8f55409fca0f2079facaf57f2539f24
Commit:        a2a869afc8f55409fca0f2079facaf57f2539f24
Parent:        bdb05cc05e3a0eac72b0921cb5eb500891346e12
Author:        Alasdair G Kergon <agk at redhat.com>
AuthorDate:    Wed Sep 17 17:11:01 2014 +0100
Committer:     Alasdair G Kergon <agk at redhat.com>
CommitterDate: Wed Sep 17 17:11:01 2014 +0100

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 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 295a4e5..eb96bc4 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,




More information about the lvm-devel mailing list