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 1056454

Summary: Support lvconvert --splitsnapshot to split snapshot data and metadata out into a separate LV where it can be wiped before removing it
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: medium    
Priority: medium CC: agk, bmarzins, bmr, dwysocha, eharney, heinzm, jbrassow, jonathan, lvm-team, msnitzer, nperic, prajnoha, prockai, 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: 1006072 Environment:
Last Closed: 2014-06-13 10:23:13 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-22 09:12:45 UTC
Include this lvm2 functionality in RHEL7:

+++ This bug was initially created as a clone of Bug #1006072 +++

This is a request to add functionality to LVM to assist with the wiping of LVM volume and snapshot data.

OpenStack Cinder uses LVM to manage volumes containing data used by OpenStack VMs.  When a volume, or snapshot of a volume, is deleted, it Cinder currently performs a wipe of the data using dd if=/dev/zero.  This is done both to protect data from being exposed across different volumes and tenants, as well as to protect data from being accessed via any method (accessing the storage) after the volume/snapshot has been deleted.

This dd method is problematic because on "thick" snap LVs, the snapshot will fill up before the entire volume size has been written to the snapshot.  On thin-provisioned LVs, this has undesirable performance, since the entire snapshot is consumed by the wipe process.

https://bugzilla.redhat.com/show_bug.cgi?id=975052#c11 outlined two ideas for how to improve this situation by having LVM assist in the wipe process:
 1) Performing wipes similar to how discards are handled today
 2) Allow the delete process to detach the cow volume so that Cinder can wipe it and then delete the LV.

Current thinking is that #1 may not be suitable since it would hang other LVM operations for a long period of time.  #2 would be sufficient for this scenario.

--- Additional comment from Alasdair Kergon on 2013-12-03 02:51:17 CET ---

I am experimenting with option 2, to offer an inverse of lvconvert -s.

--- Additional comment from Alasdair Kergon on 2013-12-03 04:46:08 CET ---

# lvs
  LV    VG   Attr   LSize  Origin Snap%  Move Log Copy%  Convert
  lvol0 vg1  owi--- 12.00m                                      
  lvol1 vg1  swi--- 12.00m lvol0                

# lvconvert --splitsnapshot vg1/lvol1
  Logical Volume vg1/lvol1 split from its origin.

# lvs
  LV    VG   Attr   LSize  Origin Snap%  Move Log Copy%  Convert
  lvol0 vg1  -wi--- 12.00m                                      
  lvol1 vg1  -wi--- 12.00m                        

The snapshot may or may not be active when the command is run.

The origin may have other snapshots too which are left untouched.

After separation, provided no data got changed, the snapshot could be reinstated with lvconvert -s -Zn vg1/lvol0 vg1/lvol1.

At this stage I am only supporting the straightforward case of an original lvm2 snapshot of an origin LV without any thin volumes, mirrors, raid, pvmove, failed merging snapshots etc. involved.

If need be, we can consider support for other combinations in subsequent releases (not on this bugzilla).

--- Additional comment from Alasdair Kergon on 2013-12-04 03:14:42 CET ---

https://git.fedorahosted.org/cgit/lvm2.git/patch/?id=7b65363bf781cd58d45e2d9f12fdfed59b9dee55

Will be included in 2.02.105.

Comment 2 Nenad Peric 2014-03-31 12:57:40 UTC
Tested only with straightforward simple snapshots:

[root@virt-010 ~]# vgcreate test /dev/sda1 /dev/sdb1
  Clustered volume group "test" successfully created
[root@virt-010 ~]# lvcreate test -L 500M
  Logical volume "lvol0" created
[root@virt-010 ~]# mke2fs /dev/test/lvol0 
[root@virt-010 ~]# lvchange -an test/lvol0
[root@virt-010 ~]# lvchange -ae test/lvol0 (cluster needs exclusive activation)

[root@virt-010 ~]# lvcreate -s test/lvol0 -L 250M
  Rounding up size to full physical extent 252.00 MiB
  Logical volume "lvol1" created
[root@virt-010 ~]# lvcreate -s test/lvol0 -L 250M
  Rounding up size to full physical extent 252.00 MiB
  Logical volume "lvol2" created
[root@virt-010 ~]# lvcreate -s test/lvol0 -L 250M
  Rounding up size to full physical extent 252.00 MiB
  Logical volume "lvol3" created

[root@virt-010 ~]# lvs -a
  LV    VG            Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convert
  root  rhel_virt-010 -wi-ao----   6.71g                                             
  swap  rhel_virt-010 -wi-ao---- 820.00m                                             
  lvol0 test          owi-a-s--- 500.00m                                             
  lvol1 test          swi-a-s--- 252.00m      lvol0    0.00                          
  lvol2 test          swi-a-s--- 252.00m      lvol0    0.00                          
  lvol3 test          swi-a-s--- 252.00m      lvol0    0.00                          


[root@virt-010 ~]# lvconvert --splitsnapshot test/lvol1
Do you really want to split off active logical volume lvol1? [y/n]: y
  Logical Volume test/lvol1 split from its origin.
[root@virt-010 ~]# lvs -a
  LV    VG            Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convert
  root  rhel_virt-010 -wi-ao----   6.71g                                             
  swap  rhel_virt-010 -wi-ao---- 820.00m                                             
  lvol0 test          owi-a-s--- 500.00m                                             
  lvol1 test          -wi-a----- 252.00m                                             
  lvol2 test          swi-a-s--- 252.00m      lvol0    0.00                          
  lvol3 test          swi-a-s--- 252.00m      lvol0    0.00      

Bringing it back (no changes made):

[root@virt-010 ~]# lvconvert -s -Zn test/lvol0 test/lvol1
  WARNING: "lvol1" not zeroed
  Logical volume lvol1 converted to snapshot.
[root@virt-010 ~]# lvs -a
  LV    VG            Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convert
  root  rhel_virt-010 -wi-ao----   6.71g                                             
  swap  rhel_virt-010 -wi-ao---- 820.00m                                             
  lvol0 test          owi-a-s--- 500.00m                                             
  lvol1 test          swi-a-s--- 252.00m      lvol0    0.00                          
  lvol2 test          swi-a-s--- 252.00m      lvol0    0.00                          
  lvol3 test          swi-a-s--- 252.00m      lvol0    0.00  


Marking VERIFIED with: 

lvm2-2.02.105-14.el7    BUILT: Wed Mar 26 14:29:41 CET 2014
lvm2-libs-2.02.105-14.el7    BUILT: Wed Mar 26 14:29:41 CET 2014
lvm2-cluster-2.02.105-14.el7    BUILT: Wed Mar 26 14:29:41 CET 2014
device-mapper-1.02.84-14.el7    BUILT: Wed Mar 26 14:29:41 CET 2014
device-mapper-libs-1.02.84-14.el7    BUILT: Wed Mar 26 14:29:41 CET 2014
device-mapper-event-1.02.84-14.el7    BUILT: Wed Mar 26 14:29:41 CET 2014
device-mapper-event-libs-1.02.84-14.el7    BUILT: Wed Mar 26 14:29:41 CET 2014
device-mapper-persistent-data-0.2.8-5.el7    BUILT: Sat Mar  1 02:15:56 CET 2014
cmirror-2.02.105-14.el7    BUILT: Wed Mar 26 14:29:41 CET 2014

Comment 3 Ludek Smid 2014-06-13 10:23:13 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.