diff --git a/WHATS_NEW b/WHATS_NEW index e419a46e9..047e2eda1 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.98 - ================================= + Fix lvm2api origin reporting for thin snapshot volume. Add configure --enable-python_bindings for liblvm2app to new python subdir. Add implementation of lvm2api function lvm_percent_to_float. Allow non power of 2 thin chunk sizes if thin pool driver supports that. diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c index 33e3270e3..4032f347c 100644 --- a/lib/metadata/lv.c +++ b/lib/metadata/lv.c @@ -160,6 +160,10 @@ char *lv_origin_dup(struct dm_pool *mem, const struct logical_volume *lv) { if (lv_is_cow(lv)) return lv_name_dup(mem, origin_from_cow(lv)); + + if (lv_is_thin_volume(lv) && first_seg(lv)->origin) + return lv_name_dup(mem, first_seg(lv)->origin); + return NULL; } diff --git a/test/api/thin_percent.c b/test/api/thin_percent.c index 533816496..2c8b19b04 100644 --- a/test/api/thin_percent.c +++ b/test/api/thin_percent.c @@ -57,6 +57,10 @@ int main(int argc, char *argv[]) assert(v.is_valid); assert(v.value.integer == PERCENT_INVALID); + v = lvm_lv_get_property(lv, "origin"); + assert(v.is_valid); + assert(strcmp(v.value.string, "thin") == 0); + lvm_vg_close(vg); lvm_quit(handle);