Bug 814737

Summary: Extend lvcreate to take thin snapshots of existing non-thinly-provisioned LVs
Product: Red Hat Enterprise Linux 6 Reporter: Alasdair Kergon <agk>
Component: lvm2Assignee: Zdenek Kabelac <zkabelac>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: agk, cmarthal, dwysocha, esandeen, heinzm, jbrassow, msnitzer, nperic, prajnoha, prockai, thornber, tlavigne, zkabelac
Target Milestone: rcKeywords: FutureFeature
Target Release: 6.4   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.02.100-1.el6 Doc Type: Enhancement
Doc Text:
Feature: Lvm2 has been extended with support for creation of thin snapshot of some existing non-thinly-provisioned LV. Reason: Thin-pool can be now used for snapshots of non-thin volumes with all the performance gains from thin pool target compared with traditional snapshot target. Result (if any): Original read-only inactive non-thinly-provisioned volume is converted into external origin for thin snapshot volume and stays unmodified and could be even used for multiple snapshots. Thin volume could be than used for any further modification of device instead. Note: current lvm2 version doesn't support merge feature, so unlike with older lvm2 snapshots, updated device cannot be merged back into its origin device.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 23:16:14 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 Alasdair Kergon 2012-04-20 15:00:54 UTC
Given an existing LV, extend lvcreate to "wrap" the LV with a snapshot in a (new or existing) thin pool.

Using this method, the data remains in situ.

Consider the options:  read-only vs. read-write; data remains in separate 'external' LV vs. old LV becomes part of pool.

Comment 1 Alasdair Kergon 2012-06-19 14:51:57 UTC
See also part of this thread:
  https://www.redhat.com/archives/dm-devel/2012-June/msg00107.html

Comment 2 RHEL Program Management 2012-07-10 06:07:47 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 3 RHEL Program Management 2012-07-10 23:57:03 UTC
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.

Comment 4 Corey Marthaler 2012-07-26 19:26:33 UTC
Adding QA ack for 6.4.

Devel will need to provide unit testing results however before this bug can be
ultimately verified by QA.

Comment 5 Zdenek Kabelac 2012-10-11 09:53:00 UTC
This feature is not yet ready, postponing for next release.

Comment 7 Zdenek Kabelac 2013-10-14 14:18:24 UTC
Feature is implemented, however there are some 'noticable' limitation.

2 ways to achieve the goal:

examples:

lvcreate -L10 -n lv1  vg

1st. way:
make 'lv1' inactive:
  lvchange -an vg/lv1
make 'lv1' read-only:
  lvchange -pr vg/lv1 

now lvcreate may take a snapshot into some existing pool
  lvcreate -s vg/lv1  --thinpool  vg/existingpool



2nd. way:
Live conversion of 'lv1' into a thin  volume and using 'origlv' name for the origin which will be read-only volume:
  lvconvert --thin vg/lv1  --thinpool vg/existingpool  --originname origlv


Both ways are possible - user has to select which version better fits.

Comment 11 Nenad Peric 2013-10-21 13:33:07 UTC
[root@virt-008 ~]# lvcreate -T --size 1G non_cluster/pool_lv
  Logical volume "lvol0" created
  Logical volume "pool_lv" created
[root@virt-008 ~]# lvcreate  -s non_cluster/lv1 --thinpool non_cluster/pool_lv
  Cannot use writable LV as the external origin.
[root@virt-008 ~]# lvchange -pr non_cluster/lv1
  Logical volume "lv1" changed.
[root@virt-008 ~]# lvcreate  -s non_cluster/lv1 --thinpool non_cluster/pool_lv
  Logical volume "lvol1" created



[root@virt-008 ~]# lvcreate -L10 -n lv1 non_cluster
  Rounding up size to full physical extent 12.00 MiB
  Logical volume "lv1" created
[root@virt-008 ~]# lvcreate -T --size 1G non_cluster/pool_lv
  Logical volume "lvol0" created
  Logical volume "pool_lv" created
[root@virt-008 ~]# lvconvert --thin non_cluster/lv1 --thinpool non_cluster/pool_lv --originname source_origin
  Logical volume "source_origin" created
  Converted non_cluster/source_origin to thin external origin.

Removal of origin draws the removal of thin LV as well with it. 
It is not really clear which LV is dependent in the message though (lvs -a helps)

[root@virt-008 ~]# lvremove non_cluster/source_origin
Removing external origin "source_origin" will remove 1 dependent volume(s). Proceed? [y/n]: y
Do you really want to remove active clustered logical volume lv1? [y/n]: y
  Logical volume "lv1" successfully removed
  Logical volume "source_origin" successfully removed


Tested on (VERIFIED):

lvm2-2.02.100-6.el6.x86_64
lvm2-cluster-2.02.100-6.el6.x86_64
device-mapper-1.02.79-6.el6.x86_64
kernel-2.6.32-424.el6.x86_64

Comment 12 errata-xmlrpc 2013-11-21 23:16:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1704.html