summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Brassow <jbrassow@redhat.com>2013-04-10 16:47:04 -0500
committerJonathan Brassow <jbrassow@redhat.com>2013-04-10 16:47:04 -0500
commitcbcbb677313aa8a4116bcfd13ceccef05fb1f9a9 (patch)
treed812126c3cc664a642fdcfee527f3e9ee1179ece
parent95d28735ea3ad54be972707e40ee0211106ef1d1 (diff)
downloadlvm2-cbcbb677313aa8a4116bcfd13ceccef05fb1f9a9.tar.gz
mirror: Fix overly-concerning warning on mirror up-convert failure.
Attempting to up-convert an inactive mirror when there is insufficient space leads to the following message: Unable to allocate extents for mirror(s). ABORTING: Failed to remove temporary mirror layer inactive_mimagetmp_3. Manual cleanup with vgcfgrestore and dmsetup may be required. This is caused by a failure to execute the 'deactivate_lv' function in the error condition. The deactivate returns an error because the LV is already inactive. This patch checks if the LV is activate and calls deactivate_lv only if it is. This allows the error cleanup code to work properly in this condition. It wasn't that big of a deal anyway, since there was no previous vg_commit that needed to be reverted. IOW, no harm was done if the allocation failed. The message was scary and useless.
-rw-r--r--tools/lvconvert.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 318ac9b93..7b4bb6e3e 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1303,7 +1303,8 @@ static int _lvconvert_mirrors_aux(struct cmd_context *cmd,
MIRROR_BY_LV)) {
layer_lv = seg_lv(first_seg(lv), 0);
if (!remove_layer_from_lv(lv, layer_lv) ||
- !deactivate_lv(cmd, layer_lv) ||
+ (lv_is_active(layer_lv) &&
+ !deactivate_lv(cmd, layer_lv)) ||
!lv_remove(layer_lv) || !vg_write(lv->vg) ||
!vg_commit(lv->vg)) {
log_error("ABORTING: Failed to remove "