Skip to contentSkip to conversation

lvconvert: require pool arg to match thin or cache

PATCH New David Teigland 1 participant 1 message Sep 2, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lvconvert: require pool arg to match thin or cache

A --thinpool arg should not be a cache pool, and
a --cachepool arg should not be a thin pool.

---
 tools/lvconvert.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
tools/lvconvert.c +10 -0
index ba7c4bad29b4..1e106cf3abf8 100644
@@ -2867,6 +2867,16 @@ static int _lvconvert_pool(struct cmd_context *cmd,
 			return 0;
 		}
 
+		if (arg_str_value(cmd, cachepool_ARG, NULL) && lv_is_thin_pool(pool_lv)) {
+			log_error("Error: cachepool arg is a thin pool");
+			return 0;
+		}
+
+		if (arg_str_value(cmd, thinpool_ARG, NULL) && lv_is_cache_pool(pool_lv)) {
+			log_error("Error: thinpool arg is a cache pool");
+			return 0;
+		}
+
 		/* FIXME cache pool */
 		if (lv_is_thin_pool(pool_lv) && pool_is_active(pool_lv)) {
 			/* If any volume referencing pool active - abort here */
Signature · 1 line
1.8.3.1