Red Hat Bugzilla – Bug 861843
lvm2app value = lvm_lv_get_property(lvmLV, "snap_percent") segfaults on thin snapshots
Last modified: 2013-02-21 03:14:06 EST
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
Fix upstream (avoid detecting snap_percent on non-snap volume)
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).
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
int main(int argc, char *argv)
struct lvm_property_value v;
handle = lvm_init(NULL);
vg = lvm_vg_open(handle, argv, "r", 0);
lv = lvm_lv_from_name(vg, "snap");
v = lvm_lv_get_property(lv, "snap_percent");
Marking verified (Sanity Only), as snapshot testing of thin volumes is pretty solid in the latest rpms.
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
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.