virtual-machine memory always rounds down #7019

Closed
opened 2025-12-29 19:47:56 +01:00 by adam · 1 comment
Owner

Originally created by @eric-eisenhart on GitHub (Sep 23, 2022).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.3.1

Python version

3.9

Steps to Reproduce

  1. Create a virtual-machine
  2. Edit memory to a number that isn't an even multiple of 1024, such as "2045", "2560", or "4095"
  3. Save and view the virtual-machine

Expected Behavior

Memory should display as a more reasonably rounded number or include a single digit after the decimal.

For 2045MB, any of "2.0 GB" or "2 GB" would be better.

For 4095MB, any of "4.0 GB" or "4 GB" would be better.

For 2560MB, either "2.5 GB" or "3 GB" would be an improvement over "2 GB".

Observed Behavior

A number rounded down by as much as 1023 is displayed:

  • 2047 MB = "1 GB"
  • 4095 MB = "3 GB"
  • 2560 MB = "2 GB"
Originally created by @eric-eisenhart on GitHub (Sep 23, 2022). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.3.1 ### Python version 3.9 ### Steps to Reproduce 1. Create a virtual-machine 2. Edit memory to a number that isn't an even multiple of 1024, such as "2045", "2560", or "4095" 3. Save and view the virtual-machine ### Expected Behavior Memory should display as a more reasonably rounded number or include a single digit after the decimal. For 2045MB, any of "2.0 GB" or "2 GB" would be better. For 4095MB, any of "4.0 GB" or "4 GB" would be better. For 2560MB, either "2.5 GB" or "3 GB" would be an improvement over "2 GB". ### Observed Behavior A number rounded down by as much as 1023 is displayed: - 2047 MB = "1 GB" - 4095 MB = "3 GB" - 2560 MB = "2 GB"
adam added the type: bugstatus: accepted labels 2025-12-29 19:47:56 +01:00
adam closed this issue 2025-12-29 19:47:57 +01:00
Author
Owner

@jeremystretch commented on GitHub (Sep 26, 2022):

To avoid any confusion resulting from rounding, we should convey the exact value unless it can be expressed as an exact number of gigabytes or terabytes.

@jeremystretch commented on GitHub (Sep 26, 2022): To avoid any confusion resulting from rounding, we should convey the exact value unless it can be expressed as an exact number of gigabytes or terabytes.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7019