Bug 1413942

Summary: Support creation of a valid lvm thin snapshot
Product: Red Hat Enterprise Linux 7 Reporter: Jiri Konecny <jkonecny>
Component: python-blivetAssignee: Vratislav Podzimek <vpodzime>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: jkonecny, jstodola, lmiksik, pkotvan, vpodzime
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-blivet-0.61.15.60-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 23:12:17 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:
Bug Depends On: 1449963    
Bug Blocks: 1113207, 1444059    

Description Jiri Konecny 2017-01-17 11:59:59 UTC
Description of problem:

Blivet supports creation of LVM thin snapshots, however these Snapshots are not working properly. This feature needs to be polished to fix check if the snapshot is mounted, check if the snapshot exists and other similar issues.

Another problem is with the XFS filesystem. XFS has problems when mounting two devices with the same UUID which could be problematic when snapshots are used. There need to be some way how to change uuid of the snapshot after snapshot creation.


Version-Release number of selected component (if applicable):
blivet-0.61.15.59

How reproducible:
Always

Steps to Reproduce:
Try to create snapshot or use my support for snapshots in Anaconda:
Anaconda - https://github.com/jkonecny12/anaconda/tree/rhel7-snapshot
Pykickstart - https://github.com/jkonecny12/pykickstart/tree/rhel7-add-snapshot

You must add Pykickstart to an updates image.

Actual results:
Snapshots doesn't work.

Expected results:
Snapshots works properly.

Comment 2 Vratislav Podzimek 2017-03-21 12:28:56 UTC
https://github.com/rhinstaller/blivet/pull/563

Comment 4 Peter Kotvan 2017-05-11 06:16:10 UTC
Hello Jiri, could you please provide a step by step reproducer?

Comment 5 Jiri Konecny 2017-05-11 07:08:08 UTC
Hi Peter,

You should be able to reproduce it by using anaconda with the kickstart installation:

1) Create kickstart which will create LVM thin partitioning (it can be anything you just need the XFS format on at least one partition):
'''
clearpart --all --initlabel
zerombr
part /boot --fstype=ext4 --size=500 --ondisk=/dev/vda --label=BOOT_PART

part pv.01 --grow --size=1 --ondisk=/dev/vdb
part pv.02 --grow --size=1 --ondisk=/dev/vda
volgroup vg-00   pv.01 pv.02

logvol none --name=thinPool --size=600 --vgname=vg-00 --thinpool --grow                                                                                                
logvol / --name=lv-root --fstype=xfs --size=3000 --vgname=vg-00 --thin --poolname=thinPool
logvol swap --name=lv_swap --fstype=swap --size=1024 --vgname=vg-00
'''

2) Run the installation it should work correctly.
3) Reuse this kickstart and use existing LVM thin partitioning from the installation before and change KS above similar to this:
'''
# Reuse boot part (not required)
part /boot --fstype=ext4 --size=500 --onpart=LABEL=BOOT_PART --label=BOOT_PART

# Reuse VG
volgroup vg-00 --useexisting --noformat

# Reuse LV
logvol none --name=thinPool --vgname=vg-00 --thinpool --useexisting --noformat
logvol / --name=lv-root --fstype=xfs --vgname=vg-00 --thin --poolname=thinPool  --useexisting
logvol swap --name=lv_swap --fstype=swap --vgname=vg-00 --useexisting                                                                                                      

# Create snapshot before and after installation
snapshot vg-00/lv-root --name="root_pre_snap" --when=pre-install                                                                                                                               
snapshot vg-00/lv-root --name="root_post_snap" --when=post-install
'''

4) Run the installation on the same machine with this KS.

Expected result:
Everything should work correctly and you should see 2 snapshots "root_pre_snap" and "root_post_snap" in the `lvs -a` command after the installation. Also you can validate that these snapshots doesn't have the same UUID as `/` partition. 

Without this patch result:
You should see an exceptions in the process of reusing.



Another way how to test this issue is by writing python script and use blivet directly. However, it would be better to have someone from the team of Blivet to write this script correctly.

Comment 6 Peter Kotvan 2017-05-12 12:29:45 UTC
It seems that verification of this bug is blocked by bug 1449963.

Comment 7 Peter Kotvan 2017-05-29 10:18:20 UTC
Reproduced on RHEL-7.3 GA, fix verified on RHEL-7.4-20170525.7 with python-blivet-0.61.15.63-1.el7.

Thanks.

Comment 8 errata-xmlrpc 2017-08-01 23:12:17 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.

https://access.redhat.com/errata/RHBA-2017:2207