1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

lvrename: always allow to rename pools

Since we mark cache-pool as 'hidden/private' while it is in-use,
we may still allow user to change it's name.

It should not cause any harm and user may prefer better naming
for a cache-pool in use.
This commit is contained in:
Zdenek Kabelac 2015-12-09 13:52:47 +01:00
parent bf4b74c5eb
commit cd8e95d933

View File

@ -4230,8 +4230,12 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
struct volume_group *vg = lv->vg;
struct lv_names lv_names = { .old = lv->name };
/* rename is not allowed on sub LVs */
if (!lv_is_visible(lv)) {
/*
* rename is not allowed on sub LVs except for pools
* (thin pool is 'visible', but cache may not)
*/
if (!lv_is_pool(lv) &&
!lv_is_visible(lv)) {
log_error("Cannot rename internal LV \"%s\".", lv->name);
return 0;
}
@ -4265,7 +4269,7 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
if (lv_is_cow(lv))
lv = origin_from_cow(lv);
if (update_mda && !lv_update_and_reload(lv))
if (update_mda && !lv_update_and_reload((struct logical_volume *)lv_lock_holder(lv)))
return_0;
return 1;