Bug 1016006 - blivet.reset() fails when thin storage is present
Summary: blivet.reset() fails when thin storage is present
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-blivet
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: David Lehman
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-07 09:35 UTC by Jan Synacek
Modified: 2013-11-06 19:08 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-11-06 19:08:53 UTC
Type: Bug


Attachments (Terms of Use)

Description Jan Synacek 2013-10-07 09:35:18 UTC
Description of problem:

The following snippet fails when there is a thin pool and a thin volume on my system.

----- snip -----
import blivet
b = blivet.Blivet()
b.reset()
----- snip -----

Running the snippet produces:

Traceback (most recent call last):
  File "blivet-ipython.start", line 4, in <module>
    b.reset()
  File "/usr/lib/python2.7/site-packages/blivet/__init__.py", line 417, in reset
    self.devicetree.populate(cleanupOnly=cleanupOnly)
  File "/usr/lib/python2.7/site-packages/blivet/devicetree.py", line 1859, in populate
    self._populate()
  File "/usr/lib/python2.7/site-packages/blivet/devicetree.py", line 1915, in _populate
    self.addUdevDevice(dev)
  File "/usr/lib/python2.7/site-packages/blivet/devicetree.py", line 1075, in addUdevDevice
    self.handleUdevDeviceFormat(info, device)
  File "/usr/lib/python2.7/site-packages/blivet/devicetree.py", line 1692, in handleUdevDeviceFormat
    self.handleUdevLVMPVFormat(info, device)
  File "/usr/lib/python2.7/site-packages/blivet/devicetree.py", line 1405, in handleUdevLVMPVFormat
    self.handleVgLvs(vg_device)
  File "/usr/lib/python2.7/site-packages/blivet/devicetree.py", line 1274, in handleVgLvs
    raid[name]["meta"] += lv_sizes[index]
KeyError: 'vg1-lvol0_pmspare'

I have no idea where 'lvol0_pmspare' comes from. It appears to be some kind of internal thing of the lvm when managing thin volumes.

Additionally:
# vgs
  VG   #PV #LV #SN Attr   VSize VFree
  vg1    3   4   0 wz--n- 2.84g 1.00g

# lvs
  LV       VG   Attr       LSize   Pool     Origin Data%  Move Log Cpy%Sync Convert
  lv1      vg1  -wi-a-----  96.00m                                                 
  lv2      vg1  -wi-a-----  96.00m                                                 
  thin1    vg1  Vwi-a-tz-- 100.00g thinpool          0.05                          
  thinpool vg1  twi---tz--   1.59g                   3.32                          

# find /dev/ -name '*vg1*' 
/dev/vg1
/dev/disk/by-id/dm-name-vg1-thin1
/dev/disk/by-id/dm-name-vg1-lv2
/dev/disk/by-id/dm-name-vg1-lv1
/dev/mapper/vg1-thin1
/dev/mapper/vg1-thinpool-tpool
/dev/mapper/vg1-lv2
/dev/mapper/vg1-lv1
/dev/mapper/vg1-thinpool_tmeta
/dev/mapper/vg1-thinpool_tdata


Version-Release number of selected component (if applicable):
python-blivet-0.22-1.fc21.noarch


Steps to Reproduce:
1. See description


Actual results:
Blivet initialization fails.


Expected results:
Blivet initialization finishes as expected.

Comment 1 Jan Synacek 2013-10-07 12:04:22 UTC
Apparently, there *is* an internal LV called 'lvol0_pmspare' on the system...

# lvs -a
# lvs -a
  LV               VG   Attr       LSize   Pool     Origin Data%  Move Log Cpy%Sync Convert
  lv1              vg1  -wi-a-----  96.00m                                                 
  lv2              vg1  -wi-a-----  96.00m                                                 
  [lvol0_pmspare]  vg1  ewi-------  32.00m                                                 
  thin1            vg1  Vwi-a-tz-- 100.00g thinpool          0.05                          
  thinpool         vg1  twi-a-tz--   1.59g                   3.32                          
  [thinpool_tdata] vg1  Twi-ao----   1.59g                                                 
  [thinpool_tmeta] vg1  ewi-ao----  32.00m                       

So, I don't think that blivet should be listing the internal LVs.

In devicelibs/lvm.py:

def lvs(vg_name):
    args = ["lvs",
            "-a", "--unit", "k", "--nosuffix", "--nameprefixes", "--rows",
            "--unquoted", "--noheadings",
            "-olv_name,lv_uuid,lv_size,lv_attr,segtype"] + \
            _getConfigArgs(read_only_locking=True) + \
            [vg_name]                        
                                             
    rc = util.capture_output(["lvm"] + args) 
    ...

Comment 2 David Lehman 2013-11-06 19:08:53 UTC
This bug report completely fails to indicate the version of blivet it is reported against, but this should nonetheless be fixed in python-blivet-0.24-1 (on master/rawhide) and 0.23.1-1 (f20-branch).


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