1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix idempotent issue when using lvol with %VG or %PVS size options and VG is fully allocated (#229) (#1250)

* Fix rounding issues with percentages

Changed the behavior when using %VG or %PVS to make the size_requested an even modulus with the VGs physical extents by rounding down.  This makes the usage of %VG or $PVE idempotent when the calculated size_requested does not end on a physical extent boundary.

* Added ansible changelog fragment.

* Forgot the module in the changelog fragment.

* Added URL to the PR to the changelog fragment.

* Update changelogs/fragments/229_lvol_percentage_fix.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 4fe87879ff)

Co-authored-by: JuddTracy-DAS <38507478+JuddTracy-DAS@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2020-11-09 07:49:37 +00:00 committed by GitHub
parent eba42c9eb9
commit 2233c94a6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- lvol - fix idempotency issue when using lvol with ``%VG`` or ``%PVS`` size options and VG is fully allocated (https://github.com/ansible-collections/community.general/pull/229).

View file

@ -473,6 +473,10 @@ def main():
size_requested = size_percent * this_vg['size'] / 100
else: # size_whole == 'FREE':
size_requested = size_percent * this_vg['free'] / 100
# Round down to the next lowest whole physical extent
size_requested -= (size_requested % this_vg['ext_size'])
if '+' in size:
size_requested += this_lv['size']
if this_lv['size'] < size_requested: