Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Device-mapper Development (http://www.linux-archive.org/device-mapper-development/)
-   -   Align lv sizes when adding to vg total space used. (http://www.linux-archive.org/device-mapper-development/498476-align-lv-sizes-when-adding-vg-total-space-used.html)

David Cantrell 03-07-2011 10:00 PM

Align lv sizes when adding to vg total space used.
 
Ack once all the flags are set.

David Lehman <dlehman@redhat.com> wrote:

> This is for rhel6-branch and for master.
>
> Go back to using lv.vgSpaceUsed instead of lv.size, which will
> take into account striped lvs. Also, remove snapshots from
> vgSpaceUsed since they are tracked all together in vg.snapshotSpace.
>
> Resolves: rhbz#682156
> ---
> storage/devices.py | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/storage/devices.py b/storage/devices.py
> index e6b7087..4b89901 100644
> --- a/storage/devices.py
> +++ b/storage/devices.py
> @@ -2164,7 +2164,7 @@ class LVMVolumeGroupDevice(DMDevice):
>
> # total the sizes of any LVs
> log.debug("%s size is %dMB" % (self.name, self.size))
> - used = sum(lv.size for lv in self.lvs) + self.snapshotSpace
> + used = sum(lv.vgSpaceUsed for lv in self.lvs) + self.snapshotSpace
> free = self.size - used
> log.debug("vg %s has %dMB free" % (self.name, free))
> return free
> @@ -2347,7 +2347,9 @@ class LVMLogicalVolumeDevice(DMDevice):
>
> @property
> def vgSpaceUsed(self):
> - return self.size * self.stripes + self.logSize + self.snapshotSpace
> + """ Space occupied by this LV, not including snapshots. """
> + return (self.vg.align(self.size, roundup=True) * self.stripes
> + + self.logSize)
>
> @property
> def vg(self):
> --
> 1.7.3.4
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

--
David Cantrell <dcantrell@redhat.com>
Supervisor, Installer Engineering Team
Red Hat, Inc. | Honolulu, HI | UTC-10

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 09:42 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.