1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #10445: Avoid rounding virtual machine memory values

This commit is contained in:
jeremystretch
2022-09-26 15:45:58 -04:00
parent 96784640e3
commit a0b17887fd
2 changed files with 3 additions and 2 deletions

View File

@ -7,6 +7,7 @@
* [#9497](https://github.com/netbox-community/netbox/issues/9497) - Adjust non-racked device filter on site and location detailed view
* [#10435](https://github.com/netbox-community/netbox/issues/10435) - Fix exception when filtering VLANs by virtual machine with no cluster assigned
* [#10439](https://github.com/netbox-community/netbox/issues/10439) - Fix form widget styling for DeviceType airflow field
* [#10445](https://github.com/netbox-community/netbox/issues/10445) - Avoid rounding virtual machine memory values
---

View File

@ -73,9 +73,9 @@ def humanize_megabytes(mb):
"""
if not mb:
return ''
if mb >= 1048576:
if not mb % 1048576: # 1024^2
return f'{int(mb / 1048576)} TB'
if mb >= 1024:
if not mb % 1024:
return f'{int(mb / 1024)} GB'
return f'{mb} MB'