Skip to contentSkip to conversation

master - lvm2app: lvm_vg_list_lvs filter hidden LVs

PATCH tasleson 3 participants 4 messages Jul 23, 2013

lore
Share & tools
lore

tasleson

author
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a2b51476007aae91acfc121a7fd2ce04f3b08781
Commit:        a2b51476007aae91acfc121a7fd2ce04f3b08781
Parent:        31de670318c9794690601468def392cd7e4eb0fc
Author:        Tony Asleson <[email protected]>
AuthorDate:    Tue Jul 23 14:57:53 2013 -0400
Committer:     Tony Asleson <[email protected]>
CommitterDate: Tue Jul 23 14:01:20 2013 -0500

lvm2app: lvm_vg_list_lvs filter hidden LVs

The function lvm_vg_list_lvs was returning all logical volumes, including *_tmeta and *_tdata. Added check to verify that LV is visible before including in list of returned logical volumes.

---
 liblvm/lvm_vg.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
liblvm/lvm_vg.c +8 -6
index 3f4968e..f0da83b 100644
@@ -250,13 +250,15 @@ struct dm_list *lvm_vg_list_lvs(vg_t vg)
 	dm_list_init(list);
 
 	dm_list_iterate_items(lvl, &vg->lvs) {
-		if (!(lvs = dm_pool_zalloc(vg->vgmem, sizeof(*lvs)))) {
-			log_errno(ENOMEM,
-				"Memory allocation fail for lvm_lv_list.");
-			return NULL;
+		if (lv_is_visible(lvl->lv)) {
+			if (!(lvs = dm_pool_zalloc(vg->vgmem, sizeof(*lvs)))) {
+				log_errno(ENOMEM,
+					"Memory allocation fail for lvm_lv_list.");
+				return NULL;
+			}
+			lvs->lv = lvl->lv;
+			dm_list_add(list, &lvs->list);
 		}
-		lvs->lv = lvl->lv;
-		dm_list_add(list, &lvs->list);
 	}
 	return list;
 }
#1 lore raw

Dne 23.7.2013 21:03, tasleson napsal(a):

Quoted 8 lines
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a2b51476007aae91acfc121a7fd2ce04f3b08781
Commit:        a2b51476007aae91acfc121a7fd2ce04f3b08781
Parent:        31de670318c9794690601468def392cd7e4eb0fc
Author:        Tony Asleson <[email protected]>
AuthorDate:    Tue Jul 23 14:57:53 2013 -0400
Committer:     Tony Asleson <[email protected]>
CommitterDate: Tue Jul 23 14:01:20 2013 -0500
Quoted 6 lines

lvm2app: lvm_vg_list_lvs filter hidden LVs

The function lvm_vg_list_lvs was returning all logical volumes, including *_tmeta and *_tdata. Added check to verify that LV is visible before including in list of returned logical volumes.

I'm afraid you can't break API this way.
If there is a need for filtered list - you need to filter list passed from this function - or add something like lvm_vg_list_visible_lvs.

Zdenek

#2 lore raw
Quoted 18 lines · Zdenek Kabelac

Dne 23.7.2013 21:03, tasleson napsal(a):

Quoted 10 lines

Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a2b51476007aae91acfc121a7fd2ce04f3b08781

Commit:        a2b51476007aae91acfc121a7fd2ce04f3b08781
Parent:        31de670318c9794690601468def392cd7e4eb0fc
Author:        Tony Asleson <[email protected]>
AuthorDate:    Tue Jul 23 14:57:53 2013 -0400
Committer:     Tony Asleson <[email protected]>
CommitterDate: Tue Jul 23 14:01:20 2013 -0500
Quoted 6 lines

lvm2app: lvm_vg_list_lvs filter hidden LVs

The function lvm_vg_list_lvs was returning all logical volumes, including *_tmeta and *_tdata. Added check to verify that LV is visible before including in list of returned logical volumes.

Quoted 4 lines

I'm afraid you can't break API this way.
If there is a need for filtered list - you need to filter list passed from this function - or add something like lvm_vg_list_visible_lvs.

What kind of modifications are users doing to the hidden meta-data/data components of a LV thin pool that they would reference each part individually?

Thanks,
Tony

#3 lore raw

Dne 23.7.2013 21:58, Tony Asleson napsal(a):

Quoted 19 lines · Zdenek Kabelac
Quoted 18 lines

Dne 23.7.2013 21:03, tasleson napsal(a):

Quoted 16 lines

Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a2b51476007aae91acfc121a7fd2ce04f3b08781

Commit:        a2b51476007aae91acfc121a7fd2ce04f3b08781
Parent:        31de670318c9794690601468def392cd7e4eb0fc
Author:        Tony Asleson <[email protected]>
AuthorDate:    Tue Jul 23 14:57:53 2013 -0400
Committer:     Tony Asleson <[email protected]>
CommitterDate: Tue Jul 23 14:01:20 2013 -0500

lvm2app: lvm_vg_list_lvs filter hidden LVs

The function lvm_vg_list_lvs was returning all logical volumes, including *_tmeta and *_tdata. Added check to verify that LV is visible before including in list of returned logical volumes.

Quoted 8 lines
Quoted 4 lines

I'm afraid you can't break API this way.
If there is a need for filtered list - you need to filter list passed from this function - or add something like lvm_vg_list_visible_lvs.

What kind of modifications are users doing to the hidden meta-data/data components of a LV thin pool that they would reference each part individually?

i.e. you could convert _tmeta into mirror.
And there are other hidden volumes which could be legally removed.

Zdenek