Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1335888

Summary: yum should avoid invoking expensive risky lvm operations unless configured to make lvm snapshots
Product: Red Hat Enterprise Linux 7 Reporter: mulhern <amulhern>
Component: yumAssignee: Michal Domonkos <mdomonko>
Status: CLOSED DUPLICATE QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: james.antill, mdomonko, qe-baseos-security, vmukhame
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1335250 Environment:
Last Closed: 2016-07-21 11:27:01 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-13 13:22:56 UTC
+++ This bug was initially created as a clone of Bug #1335250 +++

Description of problem:

lvm.listVgNames() method is invoked, even when yum is configured to not make snapshots.

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, it can be observed that _FSsnap constructor builds a list of vgs.

Steps to Reproduce:
1. I noticed this when encountering another bug.
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. I looked at yum configuration:

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

and it seemed to me that ultimately, with this configuration, no snapshot would
be taken, so there was no point in calculating the vgnames in the first place.


Actual results:

A stack trace due to computing vg names, even when configuration options indicate that lvm will not be used.

Expected results:

No computing of vg names if the value is going to turn out to be useless anyway because is configured not to take snapshots.

Additional info:

I guess removing the calculating from the _FSsnap constructor would be safest,
but using short-circuiting to check the configuration options before calling the construction would also probably work.

I note that the if condition above

  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

which is:

        if (self.conf.fssnap_automatic_pre or self.conf.fssnap_automatic_post) and not self.fssnap.available:

puts the self.fssnap.available clause after the configuration clauses, otherwise, I think the exception would have been raise there.

Comment 2 mulhern 2016-05-13 14:42:42 UTC
My attention was first drawn to this issue by bug: bz#1335065.

It might be reasonable to attempt to avoid loading the lvm python package altogether, unless it is required by the configuration options. That way yum avoids exposing Python interpreter to possiblity of lvm-related segfault unless the exposure is necessary.