summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2016-12-09 16:21:14 -0600
committerDavid Teigland <teigland@redhat.com>2016-12-09 16:21:14 -0600
commit22d61138400420d51b92e415234dcbbe355d2dc2 (patch)
tree7c82f1dff7032b48033556f4cdfedb691f347ad7
parent52cedd892ed38ed6884c3ad94294f739c51f84ea (diff)
downloadlvm2-22d61138400420d51b92e415234dcbbe355d2dc2.tar.gz
lvconvert: fixes for to_pool and to_cache_vol
-rw-r--r--tools/lvconvert.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index d9d891644..552439f0a 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2868,6 +2868,9 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
if ((policy_name || policy_settings) &&
!cache_set_policy(seg, policy_name, policy_settings))
return_0;
+
+ if (policy_settings)
+ dm_config_destroy(policy_settings);
} else {
const char *discards_name;
@@ -3003,6 +3006,9 @@ static int _lvconvert_to_cache_vol(struct cmd_context *cmd,
if (!cache_set_policy(first_seg(cache_lv), policy_name, policy_settings))
return_0;
+ if (policy_settings)
+ dm_config_destroy(policy_settings);
+
cache_check_for_warns(first_seg(cache_lv));
if (!lv_update_and_reload(cache_lv))
@@ -4246,6 +4252,11 @@ static int _lvconvert_to_cache_vol_single(struct cmd_context *cmd,
goto out;
}
} else {
+ if (!dm_list_empty(&cachepool_lv->segs_using_this_lv)) {
+ log_error("Cache pool %s is already in use.", cachepool_name);
+ goto out;
+ }
+
if (arg_is_set(cmd, chunksize_ARG))
chunk_size = arg_uint_value(cmd, chunksize_ARG, 0);
if (!chunk_size)