Skip to content
Commit fdb7e9fe authored by Mike Fleetwood's avatar Mike Fleetwood Committed by Curtis Gedak
Browse files

Correctly show multiple "unknown device" LVM2 VG members (#670171)

If an LVM2 Volume Group has two or more missing Physical Volumes, the VG
is displayed as only having one "unknown device" because
get_vg_members() only adds unique names to the list of members.

    # lvm pvcreate /dev/sda11 /dev/sda12 /dev/sda13
    # lvm vgcreate Test-VG1 /dev/sda11 /dev/sda12 /dev/sda13
    # wipefs -a /dev/sda12
    # wipefs -a /dev/sda13
    View partition information in GParted

The simplest fix would be to include the PV's UUID in the cache of LVM2
information and add PV names based on unique UUIDs being a member of the
relevant VG.  Unfortunately "lvm pvs" seems to have a bug when
displaying Logical Volume attributes, and there are two or more missing
PVs, which causes one of the PVs to be displayed multiple times, rather
than displaying each PV once.

Without LV attributes, every PV is listed:

    # lvm pvs --nosuffix --separator , --units b -o pv_name,pv_uuid,vg_name,vg_attr 2> /dev/null
      PV,PV UUID,VG,Attr
      /dev/sda11,pJ3R51-AOPP-rKlr-CKCT-nfPS-G5FP-B5Vyjm,Test-VG1,wz-pn-
      unknown device,Y72oSm-uBcE-ktZL-OIFA-Q129-Uv1B-x5IsrA,Test-VG1,wz-pn-
      unknown device,1ESORF-7wlR-0tnO-fy2z-nOL1-MrnJ-2O5yjK,Test-VG1,wz-pn-

With LV attributes, one missing PV is repeated:

    # lvm pvs --nosuffix --separator , --units b -o pv_name,pv_uuid,vg_name,vg_attr,lv_name,lv_attr 2> /dev/null
      PV,PV UUID,VG,Attr,LV,Attr
      /dev/sda11,pJ3R51-AOPP-rKlr-CKCT-nfPS-G5FP-B5Vyjm,Test-VG1,wz-pn-,,
      unknown device,Y72oSm-uBcE-ktZL-OIFA-Q129-Uv1B-x5IsrA,Test-VG1,wz-pn-,,
      unknown device,Y72oSm-uBcE-ktZL-OIFA-Q129-Uv1B-x5IsrA,Test-VG1,wz-pn-,,

Also "lvm vgs" and "lvm lvs" don't display anything when including both
VG and LV attributes.

Instead query the LVM2 information in two separate commands, one
querying PV attributes and one querying VG and LV attributes, saving the
results in lvm_pv_cache and lvm_vg_cache respectively.

Bug #670171 - Add LVM PV read-write support
parent fbc4e9e9
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment