mirror of
git://sourceware.org/git/lvm2.git
synced 2025-09-19 01:44:19 +03:00
pools: move removal of _pmspare
Since _pmspare is internal volume move it to lv_remove_single - so it's automatically removed with last remove thin-pool. lv_remove_with_dependencies() is not always used for pool removal.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
Version 2.02.112 -
|
Version 2.02.112 -
|
||||||
=====================================
|
=====================================
|
||||||
|
Always remove spare LV with last removed pool volume.
|
||||||
Support lvconvert --splitcache and --uncache of cached LV.
|
Support lvconvert --splitcache and --uncache of cached LV.
|
||||||
Option --cache has also shortcut -H (i.e. lvcreate -H).
|
Option --cache has also shortcut -H (i.e. lvcreate -H).
|
||||||
Refactor lvcreate code and better preserve --type argument.
|
Refactor lvcreate code and better preserve --type argument.
|
||||||
|
@@ -5369,6 +5369,8 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
struct logical_volume *pool_lv = NULL;
|
struct logical_volume *pool_lv = NULL;
|
||||||
struct lv_segment *cache_seg = NULL;
|
struct lv_segment *cache_seg = NULL;
|
||||||
int ask_discard;
|
int ask_discard;
|
||||||
|
struct lv_list *lvl;
|
||||||
|
int is_last_pool;
|
||||||
|
|
||||||
vg = lv->vg;
|
vg = lv->vg;
|
||||||
|
|
||||||
@@ -5463,6 +5465,27 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
return_0;
|
return_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lv_is_pool(lv) && lv->vg->pool_metadata_spare_lv) {
|
||||||
|
/* When removing last pool, also remove the spare */
|
||||||
|
is_last_pool = 1;
|
||||||
|
dm_list_iterate_items(lvl, &lv->vg->lvs)
|
||||||
|
if (lv_is_pool(lvl->lv) &&
|
||||||
|
lvl->lv != lv) {
|
||||||
|
is_last_pool = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (is_last_pool) {
|
||||||
|
/* This is purely internal LV volume, no question */
|
||||||
|
if (!deactivate_lv(cmd, lv->vg->pool_metadata_spare_lv)) {
|
||||||
|
log_error("Unable to deactivate logical volume %s",
|
||||||
|
display_lvname(lv->vg->pool_metadata_spare_lv));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (!lv_remove(lv->vg->pool_metadata_spare_lv))
|
||||||
|
return_0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (lv_is_cache_pool(lv)) {
|
if (lv_is_cache_pool(lv)) {
|
||||||
/* Cache pool removal drops cache layer
|
/* Cache pool removal drops cache layer
|
||||||
* If the cache pool is not linked, we can simply remove it. */
|
* If the cache pool is not linked, we can simply remove it. */
|
||||||
@@ -5580,10 +5603,8 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *
|
|||||||
{
|
{
|
||||||
dm_percent_t snap_percent;
|
dm_percent_t snap_percent;
|
||||||
struct dm_list *snh, *snht;
|
struct dm_list *snh, *snht;
|
||||||
struct lv_list *lvl;
|
|
||||||
struct lvinfo info;
|
struct lvinfo info;
|
||||||
struct logical_volume *origin;
|
struct logical_volume *origin;
|
||||||
int is_last_pool;
|
|
||||||
|
|
||||||
if (lv_is_cow(lv)) {
|
if (lv_is_cow(lv)) {
|
||||||
/*
|
/*
|
||||||
@@ -5661,24 +5682,6 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *
|
|||||||
!_lv_remove_segs_using_this_lv(cmd, lv, force, level, "pool"))
|
!_lv_remove_segs_using_this_lv(cmd, lv, force, level, "pool"))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
if ((lv_is_thin_pool(lv) || lv_is_cache_pool(lv)) &&
|
|
||||||
lv->vg->pool_metadata_spare_lv) {
|
|
||||||
/* When removing last pool, also remove the spare */
|
|
||||||
is_last_pool = 1;
|
|
||||||
dm_list_iterate_items(lvl, &lv->vg->lvs)
|
|
||||||
if ((lv_is_thin_pool(lvl->lv) ||
|
|
||||||
lv_is_cache_pool(lvl->lv)) &&
|
|
||||||
lvl->lv != lv) {
|
|
||||||
is_last_pool = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_last_pool &&
|
|
||||||
!lv_remove_with_dependencies(cmd, lv->vg->pool_metadata_spare_lv,
|
|
||||||
DONT_PROMPT, level + 1))
|
|
||||||
return_0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lv_is_pool_metadata_spare(lv) &&
|
if (lv_is_pool_metadata_spare(lv) &&
|
||||||
(force == PROMPT) &&
|
(force == PROMPT) &&
|
||||||
(yes_no_prompt("Removal of pool metadata spare logical volume"
|
(yes_no_prompt("Removal of pool metadata spare logical volume"
|
||||||
|
Reference in New Issue
Block a user