Bug 1168751

Summary: broken lvm-set-filter API with newer lvm2
Product: Red Hat Enterprise Linux 6 Reporter: Pino Toscano <ptoscano>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.6CC: huzhan, jherrman, leiwang, mbooth, ptoscano, wshi
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libguestfs-1.20.11-12.el6 Doc Type: Bug Fix
Doc Text:
The way in which the lvm-set-filter API handles the lvm.conf file has been rewritten, so that lvm-set-filter is properly able to change the LVM device filter.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 05:56:22 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 Pino Toscano 2014-11-27 17:58:07 UTC
Description of problem:
With recent lvm2 versions, like the one updated in RHEL 6.6, the lvm-set-filter API breaks (test test-lvm-filtering.sh fails).

This happens because in libguestfs < 1.26.9 the lvm-set-filter API manually edits, in a copy of lvm.conf, the uncommented 'filter =' line with the devices to be handled by lvm; recent lvm2 versions do not have any uncommented filter line anymore, and thus the previous libguestfs way breaks.

Further details and upstream fixes are in the following thread:
https://www.redhat.com/archives/libguestfs/2014-August/msg00213.html

How reproducible:
Every time.

Steps to Reproduce:
1. Use lvm-set-filter to set some filter
2. Query the vg's using the vgs API

Actual results:
All the vg's.

Expected results:
Only the vg's matching the set filter.

Additional info:
This has been fixed using three commits (and a cleanup/fixup later one):
9b501fa5c6365958de362ecaf0f4e90c147978a2
abb0b47e3f1b8b86d2d39c2a91782ac5ed4b134e
c916ea5b680776f70f21ecb224e0e2ca7031c0f4
d82cf08ce12ffd86e9f1588881dbe3f0ffd12294

The third one brings an own version of the lvm lens of Augeas; most probably we can have the changes directly in Augeas itself.

Comment 2 Chao Zhang 2014-12-11 10:09:54 UTC
Verify with libguestfs-1.20.11-12.el6


Steps:
1. add images into guestfish
$ guestfish -a test1.img -a RHEL-Server-7.0-64-hvm.raw
><fs>run

2. list the LVM volume groups
><fs>vgs
VG
rhel_dhcp-11-144

3. set filter and list vgs
><fs>list-devices
/dev/sda
/dev/sdb
><fs>lvm-set-filter /dev/sda
><fs>vgs
VG
><fs>lvm-set-filter /dev/sdb
rhel_dhcp-11-144
><fs>lvm-clear-filter
><fs>vgs
VG
rhel_dhcp-11-144

Comment 4 errata-xmlrpc 2015-07-22 05:56:22 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-2015-1444.html