Bug 836663

Summary: vgname missing from pvs output when PV contains ignored mda
Product: Red Hat Enterprise Linux 6 Reporter: Alasdair Kergon <agk>
Component: lvm2Assignee: Alasdair Kergon <agk>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: medium Docs Contact:
Priority: high    
Version: 6.4CC: abaron, acathrow, agk, cmarthal, dwysocha, heinzm, jbrassow, jpallich, lyarwood, msnitzer, nperic, prajnoha, prockai, sputhenp, thornber, zkabelac
Target Milestone: rcKeywords: ZStream
Target Release: 6.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.02.97-2.el6 Doc Type: Bug Fix
Doc Text:
When processing a PV that appears to be an orphan but contains an ignored mda, a scan needed to be triggered before the VG name field can be relied upon. The field is now displayed correctly first time.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 08:11:06 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:    
Bug Blocks: 773665, 798635, 836720, 843808, 896505    

Description Alasdair Kergon 2012-06-29 20:54:39 UTC
When processing a PV that appears to be an orphan but contains an ignored mda,
a scan needs to be triggered before the VG name field can be relied upon.

   > pvs -o +mda_count,vg_mda_count /dev/loop[0123]
      PV         VG   Fmt  Attr PSize  PFree  #PMda #VMda
      /dev/loop0 vg3  lvm2 a-   96.00m 96.00m     0     1
      /dev/loop1 vg3  lvm2 a-   96.00m 96.00m     1     1
      /dev/loop2 vg2  lvm2 a-   96.00m 96.00m     1     2
      /dev/loop3 vg2  lvm2 a-   28.00m 28.00m     1     2
    
    > pvs /dev/loop2 /dev/loop3 /dev/loop0 /dev/loop1 --unbuffered
      PV         VG   Fmt  Attr PSize   PFree
      /dev/loop2      lvm2 a--  100.00m 100.00m
      /dev/loop3 vg2  lvm2 a--   28.00m  28.00m
      /dev/loop0      lvm2 a--  100.00m 100.00m
      /dev/loop1 vg3  lvm2 a--   96.00m  96.00m
    
The blank VG entries should contain vg2 and vg3.

Comment 1 Alasdair Kergon 2012-06-29 20:56:32 UTC
Proposed fix:

https://lists.fedorahosted.org/pipermail/lvm2-commits/2012-June/000053.html

In process_each_pv() if we haven't yet scanned and the PV appears
to be an orphan, we must scan the other PVs looking for mdas that
reference it to find out what VG it is in.

1. If the PV has no mdas, we must scan.
2. If the PV has an mda that is not ignored we do not need to scan.
3. If the PV has an mda that is ignored, we do need to scan.

Comment 3 Alasdair Kergon 2012-06-29 21:02:40 UTC
Bug dates back to the introduction of ignored mdas in 2.02.69 in June 2010.

Comment 5 Corey Marthaler 2012-07-26 19:24:38 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 7 Alasdair Kergon 2012-08-08 12:18:23 UTC
See the linked commit message - testing involves creating PVs with/without mdas, putting them into VGs, then running 'pvs' with the PVs listed in various orders and seeing that the output in the VG column is always correct and doesn't depend on the order of the PVs on the command line.

Comment 12 Nenad Peric 2012-12-12 10:50:44 UTC
Tested and marking verified with 

lvm2-2.02.98-4.el6

The order of PVs in pvs did not change the output when there was a mix of MDA-containing and MDA-ignored devices.

Comment 13 errata-xmlrpc 2013-02-21 08:11:06 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-0501.html