Use GB (gigabyte) as display unit for virtual machine "Memory" field #5032

Closed
opened 2025-12-29 19:23:22 +01:00 by adam · 3 comments
Owner

Originally created by @jensrudolf on GitHub (Jun 25, 2021).

NetBox version

v2.11.7

Feature type

Change to existing functionality

Proposed functionality

Change the displayed unit of VM memory from MB (megabyte) to GB (gigabyte) or make the unit selectable when creating / editing the VM.

Use case

We have a lot of VMs documented in NetBox. Many of them are Linux and Windows Servers which today usually have memory resources > 1 GB. Documenting a memory capacity of several gigabytes in MB makes it (at least in my opinion) less readable and harder to import from let's say sources like VMware vSphere. Therefore, I propose to change the unit to gigabyte or let the user select between gigabyte or megabyte.

Database changes

No response

External dependencies

No response

Originally created by @jensrudolf on GitHub (Jun 25, 2021). ### NetBox version v2.11.7 ### Feature type Change to existing functionality ### Proposed functionality Change the displayed unit of VM memory from MB (megabyte) to GB (gigabyte) or make the unit selectable when creating / editing the VM. ### Use case We have a lot of VMs documented in NetBox. Many of them are Linux and Windows Servers which today usually have memory resources > 1 GB. Documenting a memory capacity of several gigabytes in MB makes it (at least in my opinion) less readable and harder to import from let's say sources like VMware vSphere. Therefore, I propose to change the unit to gigabyte or let the user select between gigabyte or megabyte. ### Database changes _No response_ ### External dependencies _No response_
adam added the status: acceptedtype: feature labels 2025-12-29 19:23:22 +01:00
adam closed this issue 2025-12-29 19:23:22 +01:00
Author
Owner

@DZ945brH commented on GitHub (Aug 31, 2021):

@jeremystretch
Hi there, thanks for this change.
It introduced a small UI bug:
image

We think the problem results here ({{ object.memory|humanize_megabytes }} MB):

<th scope="row"><i class="mdi mdi-chip"></i> Memory</th>
<td>
{% if object.memory %}
{{ object.memory|humanize_megabytes }} MB
{% else %}
<span class="text-muted">&mdash;</span>
{% endif %}
</td>

seems to always add MB regardless of the result of humanize_megabytes

@DZ945brH commented on GitHub (Aug 31, 2021): @jeremystretch Hi there, thanks for this change. It introduced a small UI bug: ![image](https://user-images.githubusercontent.com/42635243/131511755-1a0e461c-20a5-400d-801a-065cedfd5747.png) We think the problem results here (**{{ object.memory|humanize_megabytes }} MB**): ``` <th scope="row"><i class="mdi mdi-chip"></i> Memory</th> <td> {% if object.memory %} {{ object.memory|humanize_megabytes }} MB {% else %} <span class="text-muted">&mdash;</span> {% endif %} </td> ``` seems to always add MB regardless of the result of humanize_megabytes
Author
Owner

@DZ945brH commented on GitHub (Aug 31, 2021):

@jeremystretch
88e382e7a1 (diff-f6bfbfaa26e6babdbc7322fcd237850c6875ba144341128c3978a82e86afcea4)
You just need to remove the MB on line 145 becrause humanize_megabytes already includes the unit

@DZ945brH commented on GitHub (Aug 31, 2021): @jeremystretch https://github.com/netbox-community/netbox/commit/88e382e7a1da2033c7e37e2887d798c090c4abc2#diff-f6bfbfaa26e6babdbc7322fcd237850c6875ba144341128c3978a82e86afcea4 You just need to remove the MB on line 145 becrause humanize_megabytes already includes the unit
Author
Owner

@jeremystretch commented on GitHub (Aug 31, 2021):

This issue has been closed for two months and no further action will be taken on it. Please see #7083.

@jeremystretch commented on GitHub (Aug 31, 2021): This issue has been closed for two months and no further action will be taken on it. Please see #7083.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5032