1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

cache: drop _cpool suffix from unused cache-pool

Drop _cpool prefix if present and cache-pool is going to be unused.
This commit is contained in:
Zdenek Kabelac 2019-10-21 09:22:32 +02:00
parent a5f8e7a96c
commit 23f660cf98

View File

@ -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;