Bug 1335250

Summary: lvm.LibLVMError not handled (but raised in middle of transaction)
Product: Red Hat Enterprise Linux 7 Reporter: mulhern <amulhern>
Component: yumAssignee: Michal Domonkos <mdomonko>
Status: CLOSED ERRATA QA Contact: Eva Mrakova <emrakova>
Severity: medium Docs Contact:
Priority: high    
Version: 7.2CC: asakpal, emrakova, james.antill, ksrot, mdomonko, mmalik, vmukhame, wasfv
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: yum-3.4.3-147.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1335888 (view as bug list) Environment:
Last Closed: 2016-11-04 05:32:09 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:

Description mulhern 2016-05-11 16:52:36 UTC
Description of problem:

lvm exceptions not caught/handled when in midst of transaction.

Version-Release number of selected component (if applicable):

Installed Packages
Name        : yum
Arch        : noarch
Version     : 3.4.3
Release     : 132.el7
Size        : 5.5 M
Repo        : installed
From repo   : RHEL-7.2
Summary     : RPM package installer/updater/manager

How reproducible:

Always, in a sense. That is, if raised, exceptions will not be caught, AFAICT. On the other hand, creating the conditions that cause a specific exception to be raised isn't that easy.

Steps to Reproduce:
1. I did a bunch of things that finally resulted in a stack trace. They were a complicated sequence of downgrades and upgrades using local repos, and I'm not even sure that they were the root of the problem. However, they did cause an exception to be raised.
2. I observed a stack trace:

Running transaction
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 365, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 271, in main
    return_code = base.doTransaction()
  File "/usr/share/yum-cli/cli.py", line 773, in doTransaction
    resultobject = self.runTransaction(cb=cb)
  File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 1736, in runTransaction
    if self.fssnap.available and ((self.conf.fssnap_automatic_pre or
  File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 1126, in <lambda>
    fssnap = property(fget=lambda self: self._getFSsnap(),
  File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 1062, in _getFSsnap
    devices=devices)
  File "/usr/lib/python2.7/site-packages/yum/fssnapshots.py", line 158, in __init__
    self._vgnames = _list_vg_names() if self.available else []
  File "/usr/lib/python2.7/site-packages/yum/fssnapshots.py", line 56, in _list_vg_names
    names = lvm.listVgNames()
lvm.LibLVMError: (-1, 'Request to list VGs in lvmetad failed after device filter mismatch.')

3. A quick look at the source seems to indicate that lvm raised exceptions aren't being caught.

Actual results:

Stack trace in middle of transaction.

Expected results:

Better handling of lvm exceptions, especially in this case where there is a check for the result being the empty list already and especially when it occurs in the
middle of a transaction (which are generally considered important not to fail).

Additional info:

None.

Comment 2 mulhern 2016-05-13 13:09:22 UTC
Note that the yum configuration options are:

fssnap_abort_on_errors = any
fssnap_automatic_keep = 1
fssnap_automatic_post = False
fssnap_automatic_pre = False
fssnap_devices = !*/swap,
   !*/lv_swap
fssnap_percentage = 100

AFAIU, this should mean that no snapshot would be taken, so I'm a bit surprised
at seeing the code that caused the stacktrace to be executing at all.

It might be reasonable to not calculate the vgnames in the _FSSnap constructor, but to defer the calculation until the value actually turns out to be needed, which in this case, should be never, I think.

Comment 3 mulhern 2016-05-13 13:24:34 UTC
I cloned the issue raised in Comment#2 to a separate bug, bz#1335888, since it is actually fairly distinct.

Comment 9 Michal Domonkos 2016-07-21 11:27:01 UTC
*** Bug 1335888 has been marked as a duplicate of this bug. ***

Comment 14 errata-xmlrpc 2016-11-04 05:32:09 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.

https://rhn.redhat.com/errata/RHBA-2016-2397.html

Comment 15 Valentina Mukhamedzhanova 2017-07-10 15:18:46 UTC
*** Bug 1405005 has been marked as a duplicate of this bug. ***