Bug 798267

Summary: [lvmetad] pvcreate creating PV with PSize 16e
Product: Red Hat Enterprise Linux 6 Reporter: Marian Csontos <mcsontos>
Component: lvm2Assignee: Petr Rockai <prockai>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: high Docs Contact:
Priority: high    
Version: 6.3CC: agk, cmarthal, dwysocha, heinzm, jbrassow, mbroz, nperic, prajnoha, prockai, thornber, zkabelac
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.02.95-1.el6 Doc Type: Bug Fix
Doc Text:
No technical note required.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 15:02:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
output of pvcreate -vvvv /dev/sda1 none

Description Marian Csontos 2012-02-28 13:37:56 UTC
Created attachment 566307 [details]
output of pvcreate -vvvv /dev/sda1

Description of problem:
When creating PV, PSize is set to 16e.

Version-Release number of selected component (if applicable):
lvm2-2.02.94-0.56.el6.x86_64

How reproducible:
high - up to 100%

Steps to Reproduce:
1. pvcreate, pvs -av
  
Actual results:
PSize of PV is 16e, PV does not survive lvm2-lvmetad restart.

Expected results:
PSize equal to DevSize, PV survives restart of the service

Additional info:

after `pvremove /dev/sda1` and `pvcreate /dev/sda1` it's back to 16e

(07:28:33) [root@node02:~]$ pvs -v /dev/sda1
    Using physical volume(s) on command line
  PV         VG   Fmt  Attr PSize  PFree  DevSize PV UUID                               
  /dev/sda1       lvm2 a--  16.00e 16.00e  43.14g FFxIKL-Ca3b-d0Cf-BjBe-OBVj-pY0j-r9DovZ

after restarting lvmetad PV is unused:

(07:33:18) [root@node02:~]$ service lvm2-lvmetad restart
Signaling LVM metadata daemon to exit:                     [  OK  ]
Starting LVM metadata daemon:                              [  OK  ]
  Reading all physical volumes.  This may take a while...
  Found volume group "VolGroup" using metadata type lvm2
(07:33:23) [root@node02:~]$ pvs -v /dev/sda1
    Using physical volume(s) on command line
  Request to lookup PVs  in lvmetad has failed. Reason: device not found
  Failed to read physical volume "/dev/sda1"

Comment 2 Marian Csontos 2012-02-28 20:43:37 UTC
So far the "reproducer" goes like this:

host with RHEL6.2, VM with nightly RHEL6.3.

on host run:

                freespace=SEEMS_ANY_NUMBER_IS_FINE

                mkdir -p /sts-storage; # storage dir
                dd if=/dev/zero of=/sts-storage/disk-01.img bs=1k count=0 seek=$freespace; # sparse file to host disk image

                service tgtd start;
                chkconfig tgtd on;
                tgt-setup-lun -n sts-disk-01 -d /sts-storage/disk-01.img;

on VM run:

                service iscsi start; iscsiadm -m discovery -t st -p 192.168.122.1;  iscsiadm -m node --login; chkconfig iscsi on;

lvmetad is on in lvm.conf

After this any pvcreate is creating PV with PSize 16e while DevSize is correct.
Without lvmetad running, everything is fine.

lvmetad -ddd prints:

    [D] creating /var/run/lvm/lvmetad.socket
    [D 140712707229600] initialised state: vgid_to_metadata = 0x249f230
    [D 140712677381888] pv_lookup: could not find device 2048
    [D 140712677381888] pv_found vJ6uKd-0F2a-wRa4-Apkf-Xslb-U7H8-XJzt6N, vgid = (null), device = 2048
    [D 140712677381888] pv_gone: (null) / 2048
    [D 140712677381888] pv_gone (updated): vJ6uKd-0F2a-wRa4-Apkf-Xslb-U7H8-XJzt6N / 2048

Comment 3 Petr Rockai 2012-03-01 20:42:43 UTC
Fix checked in.

Comment 5 Alasdair Kergon 2012-03-02 01:53:01 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
No technical note required.

Comment 6 Marian Csontos 2012-03-05 11:55:33 UTC
This is not reproducible with lvm2-2.02.94. Thanks. I guess we can close this bug.

Comment 8 Nenad Peric 2012-04-24 14:41:25 UTC
checked with lvm2-2.02.95-5.el6.x86_64

The creation of PVs with lvmetad running works properly. 
Sizes reported correctly.
The restarts of lvmetad do not break it as it is expected. 

(09:50:06) [root@node01:~]$ pvs -v
    Scanning for physical volume names
  PV         VG       Fmt  Attr PSize   PFree   DevSize PV UUID                               
  /dev/sdc1           lvm2 a--    1.91g   1.91g   1.91g nXEkEU-Fq64-0zuD-NHkW-hvrh-Oa0i-f7DaMm
  /dev/sde2           lvm2 a--    1.91g   1.91g   1.91g fb2g4x-u6DH-uFXs-lG5L-31gN-OQOC-JQj1dR
  /dev/sdf1           lvm2 a--    1.91g   1.91g   1.91g 9mZadt-iFii-fmMR-o6VQ-CiPx-jufM-zHkYVa
  /dev/sdi2           lvm2 a--  972.69m 972.69m 972.69m KgNV8Q-iJNb-q0Zm-sIee-yrTb-DHLz-zyOl0V

Comment 10 errata-xmlrpc 2012-06-20 15:02: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-2012-0962.html