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

thin: fix merging messages

Correct reported message when thin snapshot has been already merged.
So lvm2 is no longer reporting "Mergins of snapshot X will occur..."
(even with swapped names).
This commit is contained in:
Zdenek Kabelac 2017-10-30 11:00:31 +01:00
parent 90ee7783b4
commit af21263cb3
3 changed files with 16 additions and 15 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.176 - Version 2.02.176 -
=================================== ===================================
Fix printed message when thin snapshot was already merged.
Remove created spare LV when creation of thin-pool failed. Remove created spare LV when creation of thin-pool failed.
Avoid reading ignored metadata when mda gets used again. Avoid reading ignored metadata when mda gets used again.
Fix detection of moved PVs in vgsplit. (2.02.175) Fix detection of moved PVs in vgsplit. (2.02.175)

View File

@ -45,7 +45,8 @@ touch mntsnap/test_snap
lvs -o+tags,thin_id $vg lvs -o+tags,thin_id $vg
lvconvert --merge $vg/snap lvconvert --merge $vg/snap &>out
grep "Merging of thin snapshot $vg/snap will occur on next activation of $vg/${lv1}." out
umount mnt umount mnt
@ -115,7 +116,8 @@ check lv_field $vg/$lv1 thin_id "3"
# Check --mergethin # Check --mergethin
lvcreate -s -n snap $vg/$lv1 lvcreate -s -n snap $vg/$lv1
check lv_field $vg/snap thin_id "4" check lv_field $vg/snap thin_id "4"
lvconvert --mergethin $vg/snap lvconvert --mergethin $vg/snap &>out
grep "Volume $vg/snap replaced origin $vg/${lv1}." out
check lv_field $vg/$lv1 thin_id "4" check lv_field $vg/$lv1 thin_id "4"
vgremove -ff $vg vgremove -ff $vg

View File

@ -2098,7 +2098,7 @@ static int _lvconvert_merge_old_snapshot(struct cmd_context *cmd,
static int _lvconvert_merge_thin_snapshot(struct cmd_context *cmd, static int _lvconvert_merge_thin_snapshot(struct cmd_context *cmd,
struct logical_volume *lv) struct logical_volume *lv)
{ {
int origin_is_active = 0, r = 0; int origin_is_active = 0;
struct lv_segment *snap_seg = first_seg(lv); struct lv_segment *snap_seg = first_seg(lv);
struct logical_volume *origin = snap_seg->origin; struct logical_volume *origin = snap_seg->origin;
@ -2151,16 +2151,18 @@ static int _lvconvert_merge_thin_snapshot(struct cmd_context *cmd,
* replace the origin LV with its snapshot LV. * replace the origin LV with its snapshot LV.
*/ */
if (!thin_merge_finish(cmd, origin, lv)) if (!thin_merge_finish(cmd, origin, lv))
goto_out; return_0;
log_print_unless_silent("Volume %s replaced origin %s.",
display_lvname(origin), display_lvname(lv));
if (origin_is_active && !activate_lv(cmd, lv)) { if (origin_is_active && !activate_lv(cmd, lv)) {
log_error("Failed to reactivate origin %s.", log_error("Failed to reactivate origin %s.",
display_lvname(lv)); display_lvname(lv));
goto out; return 0;
} }
r = 1; return 1;
goto out;
} }
init_snapshot_merge(snap_seg, origin); init_snapshot_merge(snap_seg, origin);
@ -2169,16 +2171,12 @@ static int _lvconvert_merge_thin_snapshot(struct cmd_context *cmd,
if (!vg_write(lv->vg) || !vg_commit(lv->vg)) if (!vg_write(lv->vg) || !vg_commit(lv->vg))
return_0; return_0;
r = 1; log_print_unless_silent("Merging of thin snapshot %s will occur on "
out: "next activation of %s.",
display_lvname(lv), display_lvname(origin));
backup(lv->vg); backup(lv->vg);
if (r) return 1;
log_print_unless_silent("Merging of thin snapshot %s will occur on "
"next activation of %s.",
display_lvname(lv), display_lvname(origin));
return r;
} }
static int _lvconvert_thin_pool_repair(struct cmd_context *cmd, static int _lvconvert_thin_pool_repair(struct cmd_context *cmd,