Fix idempotent issue when using lvol with %VG or %PVS size options and VG is fully allocated (#229)
* 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>pull/1254/head
parent
42999867b4
commit
4fe87879ff
|
@ -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).
|
|
@ -473,6 +473,10 @@ def main():
|
||||||
size_requested = size_percent * this_vg['size'] / 100
|
size_requested = size_percent * this_vg['size'] / 100
|
||||||
else: # size_whole == 'FREE':
|
else: # size_whole == 'FREE':
|
||||||
size_requested = size_percent * this_vg['free'] / 100
|
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:
|
if '+' in size:
|
||||||
size_requested += this_lv['size']
|
size_requested += this_lv['size']
|
||||||
if this_lv['size'] < size_requested:
|
if this_lv['size'] < size_requested:
|
||||||
|
|
Loading…
Reference in New Issue