summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 55cd1f9)
raw | patch | inline | side by side (parent: 55cd1f9)
author | Benjamin Gilbert <bgilbert@cs.cmu.edu> | |
Wed, 16 Apr 2014 13:35:56 +0000 (09:35 -0400) | ||
committer | Benjamin Gilbert <bgilbert@cs.cmu.edu> | |
Wed, 16 Apr 2014 15:57:53 +0000 (11:57 -0400) |
The sum of the sizes reported by a volume group should equal the size
of the volume group. Virtual volumes do not directly correspond to
allocated storage (and, in fact, may be larger than the entire volume
group), so must be ignored.
of the volume group. Virtual volumes do not directly correspond to
allocated storage (and, in fact, may be larger than the entire volume
group), so must be ignored.
src/lvm.c | patch | blob | history |
diff --git a/src/lvm.c b/src/lvm.c
index 606acc70befb95b120e2155cfb5ace5758a387e0..1677f0567073339f8a9a065e9bee2b4af8c35d22 100644 (file)
--- a/src/lvm.c
+++ b/src/lvm.c
{
struct dm_list *lvs;
struct lvm_lv_list *lvl;
+ char const *attrs;
lvm_submit (vg_name, "free", lvm_vg_get_free_size(vg));
lvs = lvm_vg_list_lvs(vg);
dm_list_iterate_items(lvl, lvs) {
- lvm_submit(vg_name, lvm_lv_get_name(lvl->lv), lvm_lv_get_size(lvl->lv));
+ attrs = lvm_lv_get_attr(lvl->lv);
+ if (attrs == NULL)
+ continue;
+ /* Condition on volume type. We want the reported sizes in the
+ volume group to sum to the size of the volume group, so we ignore
+ virtual volumes. */
+ switch (attrs[0]) {
+ case 't':
+ /* Thin pool virtual volume. We report the underlying data
+ and metadata volumes, not this one. Ignore. */
+ continue;
+ case 'v':
+ /* Virtual volume. Ignore. */
+ continue;
+ case 'V':
+ /* Thin volume or thin snapshot. Ignore. */
+ continue;
+ }
+ lvm_submit(vg_name, lvm_lv_get_name(lvl->lv), lvm_lv_get_size(lvl->lv));
}
}