Bug 861843

Summary: lvm2app value = lvm_lv_get_property(lvmLV, "snap_percent") segfaults on thin snapshots
Product: Red Hat Enterprise Linux 6 Reporter: benscott
Component: lvm2Assignee: Zdenek Kabelac <zkabelac>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: unspecified Docs Contact:
Priority: high    
Version: 6.5CC: agk, cmarthal, coughlan, dwysocha, heinzm, jbrassow, msnitzer, prajnoha, prockai, thornber, zkabelac
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.02.98-1.el6 Doc Type: Enhancement
Doc Text:
Feature: The lvm2app library now reports the data_percent field which indicates how full snapshots, thin pools and volumes are. (The Logical Volume needs to be active to obtain this information.) Reason: Thin snapshots have a new different way of reporting its usage.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 08:14:06 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 benscott 2012-10-01 05:40:23 UTC
Description of problem:

When using liblvm2app on a thin snapshot
the following code causes a segfault:

value = lvm_lv_get_property(lvmLV, "snap_percent"); 

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

  LVM version:     2.02.98(2)-git (2012-08-24)
  Library version: 1.02.77-git (2012-08-24)
  Driver version:  4.22.0

Comment 2 Zdenek Kabelac 2012-10-08 11:58:06 UTC
Fix upstream  (avoid detecting snap_percent on non-snap volume)

https://www.redhat.com/archives/lvm-devel/2012-October/msg00026.html


NB:  thin snapshot doesn't have  'snap_percent' property - only 'data_percent' since thin_pool shares all the space between all its volume. Thus you could only obtain value of 'mapped' spaces (just like with any other thin volume).

Comment 4 Zdenek Kabelac 2012-10-12 09:24:34 UTC
Here is simple    lvm2api test program which should pass now:

----
# Create pool & thin & snap LVs

lvcreate -L5M -T vg/pool
lvcreate -V1M -T vg/pool -n thin
lvcreate -s vg/thin -n snap

----
#include "lvm2app.h"

int main(int argc, char *argv[])
{
	lvm_t handle;
	vg_t vg;
	lv_t lv;
	struct lvm_property_value v;

	handle = lvm_init(NULL);
	vg = lvm_vg_open(handle, argv[1], "r", 0);
	lv = lvm_lv_from_name(vg, "snap");
	v = lvm_lv_get_property(lv, "snap_percent");

	lvm_vg_close(vg);
	lvm_quit(handle);

	return 0;
}

Comment 7 Corey Marthaler 2013-01-03 00:09:13 UTC
Marking verified (Sanity Only), as snapshot testing of thin volumes is pretty solid in the latest rpms.


2.6.32-348.el6.x86_64
lvm2-2.02.98-6.el6    BUILT: Thu Dec 20 07:00:04 CST 2012
lvm2-libs-2.02.98-6.el6    BUILT: Thu Dec 20 07:00:04 CST 2012
lvm2-cluster-2.02.98-6.el6    BUILT: Thu Dec 20 07:00:04 CST 2012
udev-147-2.43.el6    BUILT: Thu Oct 11 05:59:38 CDT 2012
device-mapper-1.02.77-6.el6    BUILT: Thu Dec 20 07:00:04 CST 2012
device-mapper-libs-1.02.77-6.el6    BUILT: Thu Dec 20 07:00:04 CST 2012
device-mapper-event-1.02.77-6.el6    BUILT: Thu Dec 20 07:00:04 CST 2012
device-mapper-event-libs-1.02.77-6.el6    BUILT: Thu Dec 20 07:00:04 CST 2012
cmirror-2.02.98-6.el6    BUILT: Thu Dec 20 07:00:04 CST 2012

Comment 8 errata-xmlrpc 2013-02-21 08:14:06 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.

http://rhn.redhat.com/errata/RHBA-2013-0501.html