master - cache: drop _cpool suffix from unused cache-pool
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=23f660cf98fd966525672309ee821348edebd014 Commit: 23f660cf98fd966525672309ee821348edebd014 Parent: a5f8e7a96cd26afd14a8ddc6ab1a64a32dcf6fc6 Author: Zdenek Kabelac <[email protected]> AuthorDate: Mon Oct 21 09:22:32 2019 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Mon Oct 21 12:14:15 2019 +0200
cache: drop _cpool suffix from unused cache-pool
Drop _cpool prefix if present and cache-pool is going to be unused.
--- tools/lvconvert.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
tools/lvconvert.c +10 -0
@@ -1913,6 +1913,8 @@ static int _lvconvert_split_and_keep_cachepool(struct cmd_context *cmd,struct logical_volume *lv, struct logical_volume *lv_fast) { + char name[NAME_LEN]; +if (!archive (lv->vg)) return_0;
@@ -1926,6 +1928,14 @@ static int _lvconvert_split_and_keep_cachepool(struct cmd_context *cmd,if (!lv_cache_remove (lv)) return_0; +/* Cut off suffix _cpool */ +if (!drop_lvname_suffix (name, lv_fast->name,"cpool" )) { +/* likely older instance of metadata */ +log_debug ("LV %s has no suffix for cachepool (skipping rename)." , +display_lvname (lv_fast)); + }else if (!lv_uniq_rename_update (cmd, lv_fast, name,0 )) + return_0; +if (!vg_write (lv->vg) || !vg_commit (lv->vg)) return_0;