Skip to contentSkip to conversation

main - vgremove: remove forgotten pmspare

PATCH Zdenek Kabelac 1 participant 1 message Jul 21, 2021

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5042463c5083cc71546297344058bd0fa523aa5c
Commit:        5042463c5083cc71546297344058bd0fa523aa5c
Parent:        d38fdb25e4debc035f1e4585432c2627460d5e50
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Jul 20 22:28:13 2021 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Jul 21 13:19:51 2021 +0200

vgremove: remove forgotten pmspare

As pmspare is an invisible LV it's not getting automatically removed since vgremove removes only visible LVs and it depending LVs. If there was no other thin/cache pool volume, such pmspare stayed undeleted and caused command failure.

So handle explicitelly such forgotten pmspare and remove it.

---
 tools/vgremove.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/vgremove.c +4 -0
index 8f73297dc..b6685ae2a 100644
@@ -65,6 +65,10 @@ static int _vgremove_single(struct cmd_context *cmd, const char *vg_name,
 		}
 	}
 
+	if (vg->pool_metadata_spare_lv &&
+	    !lvremove_single(cmd, vg->pool_metadata_spare_lv, &void_handle))
+		return_ECMD_FAILED;
+
 	if (!lockd_free_vg_before(cmd, vg, 0))
 		return_ECMD_FAILED;