Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1053586

Summary: lvconvert --merge support for a snapshot of a thinly provisioned LV
Product: Red Hat Enterprise Linux 7 Reporter: Peter Rajnoha <prajnoha>
Component: lvm2Assignee: LVM and device-mapper development team <lvm-team>
lvm2 sub component: Default / Unclassified QA Contact: cluster-qe <cluster-qe>
Status: CLOSED CURRENTRELEASE Docs Contact:
Severity: low    
Priority: medium CC: agk, bmarzins, bmr, cmarthal, dwysocha, heinzm, jbrassow, jonathan, lvm-team, msnitzer, prajnoha, prockai, thornber, zkabelac
Version: 7.0Keywords: Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.02.105-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 957881 Environment:
Last Closed: 2014-06-13 10:29:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Peter Rajnoha 2014-01-15 12:59:20 UTC
Description of problem:
Add support for merging a snapshot into it's thinly provisioned origin volume.

Will serve as a fundamental command used during system rollback (e.g. after a failed or undesirable upgrade).

--- Additional comment from Zdenek Kabelac on 2013-12-05 14:45:27 CET ---

Upstream support has been commited - starting with:

https://www.redhat.com/archives/lvm-devel/2013-December/msg00017.html


Usage:

lvconvert --merge  vg/thinsnap

This will merge thinsnap into its origin device - effectively thinsnap replaces origin and origin is deleted. This works only in the case both volumes could be deactivated. If they are i.e. mounted, merge is deferred to the next activation of merged (origin) LV.

While vg/thinsnap is 'merged' and deferred it's not longer accessible for lv commands - so it cannot be deactivated  (only volume for deactivation is  origin), but its still visible via  'lvs -a' as and invisible volume.

For some use-cases see:

https://www.redhat.com/archives/lvm-devel/2013-December/msg00026.html

--- Additional comment from Corey Marthaler on 2014-01-10 21:17:59 CET ---

I think we need a rhel7 version of this bugzilla created and added to the lvm errata (RHBA-2013:15731-01) to track this feature.

Comment 2 Corey Marthaler 2014-01-27 21:08:25 UTC
So only *one* thin snap is ever allowed to be merged back since the origin is deleted one a merge happens? Do the other snaps just become regular thin volumes once another snap is merged?


# Create thin pool and virtual origin volume
[root@host-050 ~]# lvs -a -o +devices
  LV              Attr       LSize   Pool Origin Data%   Devices
  POOL            twi-a-tz--   1.00g               0.00  POOL_tdata(0)
  [POOL_tdata]    Twi-ao----   1.00g                     /dev/sdf1(1)
  [POOL_tmeta]    ewi-ao----   4.00m                     /dev/sdb1(0)
  [lvol0_pmspare] ewi-------   4.00m                     /dev/sdf1(0)
  origin          Vwi-a-tz--   1.00g POOL          0.00

# Create thin snaps to attempt to merge back into origin
[root@host-050 ~]# lvcreate -K -s /dev/snapper_thinp/origin -n merge1
  Logical volume "merge1" created
[root@host-050 ~]# lvcreate -K -s /dev/snapper_thinp/origin -n merge2
  Logical volume "merge2" created
[root@host-050 ~]# lvcreate -K -s /dev/snapper_thinp/origin -n merge3
  Logical volume "merge3" created
[root@host-050 ~]# lvcreate -K -s /dev/snapper_thinp/origin -n merge4
  Logical volume "merge4" created
[root@host-050 ~]# lvs -a -o +devices
  LV              Attr       LSize   Pool Origin Data%   Devices
  POOL            twi-a-tz--   1.00g               0.00  POOL_tdata(0)
  [POOL_tdata]    Twi-ao----   1.00g                     /dev/sdf1(1)
  [POOL_tmeta]    ewi-ao----   4.00m                     /dev/sdb1(0)
  [lvol0_pmspare] ewi-------   4.00m                     /dev/sdf1(0)
  merge1          Vwi-a-tz-k   1.00g POOL origin   0.00
  merge2          Vwi-a-tz-k   1.00g POOL origin   0.00
  merge3          Vwi-a-tz-k   1.00g POOL origin   0.00
  merge4          Vwi-a-tz-k   1.00g POOL origin   0.00
  origin          Vwi-a-tz--   1.00g POOL          0.00

# Attempt to merge thin snaps
[root@host-050 ~]# lvconvert --merge snapper_thinp/merge4
[root@host-050 ~]# lvconvert --merge snapper_thinp/merge3
  "merge3" is not a mergeable logical volume.
  Unable to merge LV "merge3" into its origin.
[root@host-050 ~]# lvconvert --merge snapper_thinp/merge1
  "merge1" is not a mergeable logical volume.
  Unable to merge LV "merge1" into its origin.



lvm2-2.02.105-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
lvm2-libs-2.02.105-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
lvm2-cluster-2.02.105-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
device-mapper-1.02.84-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
device-mapper-libs-1.02.84-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
device-mapper-event-1.02.84-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
device-mapper-event-libs-1.02.84-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
device-mapper-persistent-data-0.2.8-3.el7    BUILT: Fri Dec 27 13:40:56 CST 2013
cmirror-2.02.105-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014

Comment 3 Zdenek Kabelac 2014-01-28 08:09:09 UTC
(In reply to Corey Marthaler from comment #2)
> So only *one* thin snap is ever allowed to be merged back since the origin
> is deleted one a merge happens? Do the other snaps just become regular thin
> volumes once another snap is merged?
> 

Yes - once the origin is deleted, all snapshots are detached and they become regular thin volumes. There is some plan to support more advanced history, but it's not yet even designed.


> # Attempt to merge thin snaps
> [root@host-050 ~]# lvconvert --merge snapper_thinp/merge4
> [root@host-050 ~]# lvconvert --merge snapper_thinp/merge3
>   "merge3" is not a mergeable logical volume.
>   Unable to merge LV "merge3" into its origin.

Ok, since merge3 origin has been already deleted.

Comment 4 Corey Marthaler 2014-02-28 21:43:28 UTC
Feature verified in the latest rpms.

3.10.0-90.el7.x86_64
lvm2-2.02.105-8.el7    BUILT: Thu Feb 27 07:35:52 CST 2014
lvm2-libs-2.02.105-8.el7    BUILT: Thu Feb 27 07:35:52 CST 2014
lvm2-cluster-2.02.105-8.el7    BUILT: Thu Feb 27 07:35:52 CST 2014
device-mapper-1.02.84-8.el7    BUILT: Thu Feb 27 07:35:52 CST 2014
device-mapper-libs-1.02.84-8.el7    BUILT: Thu Feb 27 07:35:52 CST 2014
device-mapper-event-1.02.84-8.el7    BUILT: Thu Feb 27 07:35:52 CST 2014
device-mapper-event-libs-1.02.84-8.el7    BUILT: Thu Feb 27 07:35:52 CST 2014
device-mapper-persistent-data-0.2.8-4.el7    BUILT: Fri Jan 24 14:28:55 CST 2014
cmirror-2.02.105-8.el7    BUILT: Thu Feb 27 07:35:52 CST 2014

Comment 5 Ludek Smid 2014-06-13 10:29:10 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.