brick's lvm thin pool creation is broken

Bug #1390081 reported by David Pineau
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
High
David Pineau

Bug Description

After recent refactor/optimization patches on brick's lvm utility class, it is now impossible to create a lvm_type="thin" pool.

How it should work:

Instanciate the LVM object with parameters creat=True and lvm_type="thin"
-> Creates the Volume group
-> Checks if the pool exists by calling an internal method to call the lvm utility "lvs"
-> See that the pool does not exist
-> Create the pool
-> Activate the pool
-> Everyone is happy

What changed:
The internal methods changed, believeing the patch, in order to reduce the number of actuall calls to the lvm utility CLI tools, with the patchset: dcda67053df5dc0240c743537dc1b9c4a3231b61

What does not work anymore:
To check if a pool exists, the code now calls the lvs utility with the volume_group_name/thin_pool path. This has for effect that lvm cannot find the volume, and the processutil code thus raises an exception (lvs returns a code != 0).
Thus, the constructor of the LVM class cannot check if the pool exists or not, failing any volume creation relying on thin-provisionning.
Actually the order of actions is now:
-> Creates the Volume group
-> Checks if the pool exists by calling lvs on the pool
    -> lvs cannot find the LV
       -> processutil raises an exception
-> The exception isn't caught by anything (and even if it did, it would not be a proper way to detect absence of thin-pool
-> constructor fails.

Changed in cinder:
assignee: nobody → David Pineau (dav-pineau)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/133042

Revision history for this message
Gary W. Smith (gary-w-smith) wrote :

This bug has the same root cause as that which causes bug 1390267: the the 'lvs' command throws an exception when the lv is not present, and this should be caught rather than propagated.

Changed in cinder:
importance: Undecided → High
milestone: none → kilo-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/133042
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=f782b9c4fe1aaa6ffb455dd2ef4ea9c14bc6ca69
Submitter: Jenkins
Branch: master

commit f782b9c4fe1aaa6ffb455dd2ef4ea9c14bc6ca69
Author: David Pineau <email address hidden>
Date: Thu Nov 6 15:01:13 2014 +0100

    Fix the LV NotFound situation for thin-type LVM

    If the logical volume is not found, LVM displays on the error output
    that the volumes could not be found. So here, we filter on this very
    specific situation, and let all the other cases go through the stack.

    Added a test for this new code path, which raises an exception of the
    proper type to be caught by the new code.

    Change-Id: I703af8ccd87c6332d9f88eff63fcf26ebed234f4
    Closes-Bug: #1390081

Changed in cinder:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to cinder (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/136438

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to cinder (master)

Reviewed: https://review.openstack.org/136438
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=8a08a6cdd3688e799ae2db4bd94b8b14dc50f2a9
Submitter: Jenkins
Branch: master

commit 8a08a6cdd3688e799ae2db4bd94b8b14dc50f2a9
Author: Eric Harney <email address hidden>
Date: Fri Nov 21 11:50:48 2014 -0500

    Brick LVM: LV not found logging and error handling

    Fix up two things in get_lv_info/get_volume:
    1. ProcessExecutionError should be handled where we call the
       command. We can just return an empty list for this case
       which makes things simple for callers and consistent with
       querying a VG.
    2. Not found errors should be logged as info and not warning
       since this is generally not actionable by the admin (and not
       a problem).

    Fix typo in lvm command output for not found test.

    Add test for get_lv_info not found error.

    Change-Id: Iebccf7b8f252303f586b36aad33b85945ea5c927
    Related-Bug: #1390081

Thierry Carrez (ttx)
Changed in cinder:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: kilo-1 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.