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 1240518 - Display ancestors and descendants for thin snapshot/origin LVs
Summary: Display ancestors and descendants for thin snapshot/origin LVs
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: lvm2
Version: 7.2
Hardware: All
OS: Linux
medium
low
Target Milestone: rc
: ---
Assignee: Peter Rajnoha
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks: 1163895
TreeView+ depends on / blocked
 
Reported: 2015-07-07 07:33 UTC by Peter Rajnoha
Modified: 2023-03-08 07:27 UTC (History)
9 users (show)

Fixed In Version: lvm2-2.02.125-1.el7
Doc Type: Bug Fix
Doc Text:
Before, there was only "origin" reporting field to display an immediate ancestor of thin snapshot LV. However, unlike thick snapshots, thin snapshots do not have a limit on the number of items chained (the only limit is the amount of resources in available in the system). This way, we can have thin snapshot of thin snapshot of another thin snapshot etc. LVM2 now supports displaying full thin snapshot chain using new lv_ancestors and lv_descendants reporting fields which display the list of all ancestors and descendant of current thin LV.
Clone Of: 1163895
Environment:
Last Closed: 2015-11-19 12:46:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2147 0 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2015-11-19 11:11:07 UTC

Description Peter Rajnoha 2015-07-07 07:33:54 UTC
This is part of solution for original bug #1163895 so all the parts can be properly tested.

This bug is about adding a possibility to display existing ancestors and descendants for thin snapshot and origin LVs.

There are new fields lv_ancestors and lv_descendants (both are lists of LVs) which report these dependencies.

For example ("<--" is the "is snapsho" dependency):

lvol1 <-- lvol2 <-- lvol3 <-- lvol4

lvol2 <-- lvol5 <-- lvol6

To display the ancestor and descendant list, users can call:

$ lvs -o name,lv_ancestors,lv_descendants vg
  LV    Ancestors         Descendants                  
  lvol1                   lvol2,lvol3,lvol4,lvol5,lvol6
  lvol2 lvol1             lvol3,lvol4,lvol5,lvol6      
  lvol3 lvol2,lvol1       lvol4                        
  lvol4 lvol3,lvol2,lvol1                              
  lvol5 lvol2,lvol1       lvol6                        
  lvol6 lvol5,lvol2,lvol1 
  pool

Note that lv_ancestors and lv_descendants display *existing* dependencies. It's not tracking removed entries which can break dependency chain if we remove an LV in the middle of this chain.

For example:

$ lvremove -ff vg/lvol3
  Logical volume "lvol3" successfully removed

So we have now:

lvol1 <-- lvol2

lvol4

lvol2 <-- lvol5 <-- lvol6


$ lvs -o name,lv_ancestors,lv_descendants vg
  LV    Ancestors         Descendants      
  lvol1                   lvol2,lvol5,lvol6
  lvol2 lvol1             lvol5,lvol6      
  lvol4                                    
  lvol5 lvol2,lvol1       lvol6            
  lvol6 lvol5,lvol2,lvol1 
  pool

(Tracking of snapshot dependency chain even with removed entries will be a subject of another bz report as extension.)

Comment 1 Peter Rajnoha 2015-07-07 13:58:57 UTC
Note: the new lv_ancestors and lv_descendants fields are string lists so all the selection operators supported for string lists are available for these two fields (looking for the subset or strict set - see "lvs -S help")

Comment 3 Corey Marthaler 2015-08-25 01:21:29 UTC
Marking verified in the latest rpms.


3.10.0-306.el7.x86_64
lvm2-2.02.128-1.el7    BUILT: Tue Aug 18 03:45:17 CDT 2015
lvm2-libs-2.02.128-1.el7    BUILT: Tue Aug 18 03:45:17 CDT 2015
lvm2-cluster-2.02.128-1.el7    BUILT: Tue Aug 18 03:45:17 CDT 2015
device-mapper-1.02.105-1.el7    BUILT: Tue Aug 18 03:45:17 CDT 2015
device-mapper-libs-1.02.105-1.el7    BUILT: Tue Aug 18 03:45:17 CDT 2015
device-mapper-event-1.02.105-1.el7    BUILT: Tue Aug 18 03:45:17 CDT 2015
device-mapper-event-libs-1.02.105-1.el7    BUILT: Tue Aug 18 03:45:17 CDT 2015
device-mapper-persistent-data-0.5.5-1.el7    BUILT: Thu Aug 13 09:58:10 CDT 2015
cmirror-2.02.128-1.el7    BUILT: Tue Aug 18 03:45:17 CDT 2015
sanlock-3.2.4-1.el7    BUILT: Fri Jun 19 12:48:49 CDT 2015
sanlock-lib-3.2.4-1.el7    BUILT: Fri Jun 19 12:48:49 CDT 2015
lvm2-lockd-2.02.128-1.el7    BUILT: Tue Aug 18 03:45:17 CDT 2015




SCENARIO - [snap_of_thin_snaps]
Create a snapshot and then attempt multiple levels of snaps of snaps

[...]

Making snapshot of origin volume
lvcreate  -k n -s /dev/snapper_thinp/origin -n stack1

# Ancestors
lvcreate  -k n -s /dev/snapper_thinp/stack1 -n stack2
expected:origin stack1
actual:stack1 origin

lvcreate  -k n -s /dev/snapper_thinp/stack2 -n stack3
expected:origin stack2 stack1
actual:stack2 stack1 origin

lvcreate  -k n -s /dev/snapper_thinp/stack3 -n stack4
expected:origin stack3 stack2 stack1
actual:stack3 stack2 stack1 origin


# Descendants
lvs --noheadings -o lv_descendants snapper_thinp/stack2
Descendants:stack3 stack4

lvs --noheadings -o lv_descendants snapper_thinp/stack3
Descendants:stack4

lvs --noheadings -o lv_descendants snapper_thinp/stack4
Descendants:


Now break the chain in various spots, so only the last two should have ancestors or descendants
lvremove --yes --select 'lv_name=stack1 || origin=stack1'

[root@host-111 ~]# lvs -a -o +devices,lv_ancestors,lv_descendants
  LV              Attr       LSize   Pool Origin Data%  Meta% Devices        Ancestors    Descendants 
  POOL            twi-aotz--   1.00g             16.56  4.30  POOL_tdata(0)                           
  [POOL_tdata]    Twi-ao----   1.00g                          /dev/sda1(1)                            
  [POOL_tmeta]    ewi-ao----   4.00m                          /dev/sdd1(0)                            
  [lvol0_pmspare] ewi-------   4.00m                          /dev/sda1(0)                            
  origin          Vwi-a-tz--   1.00g POOL        16.14                                                
  other1          Vwi-a-tz--   1.00g POOL        0.00                                                 
  other2          Vwi-a-tz--   1.00g POOL        0.00                                                 
  other3          Vwi-a-tz--   1.00g POOL        0.00                                                 
  other4          Vwi-a-tz--   1.00g POOL        0.00                                                 
  other5          Vwi-a-tz--   1.00g POOL        0.00                                                 
  stack3          Vwi-aotz--   1.00g POOL        16.14                                    stack4      
  stack4          Vwi-aotz--   1.00g POOL stack3 16.14                       stack3

Comment 4 errata-xmlrpc 2015-11-19 12:46:47 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://rhn.redhat.com/errata/RHBA-2015-2147.html


Note You need to log in before you can comment on or make changes to this bug.