Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abillity to select disk divider #17686

Open
AndreasSMoe opened this issue Oct 7, 2024 · 9 comments · May be fixed by #18011
Open

Abillity to select disk divider #17686

AndreasSMoe opened this issue Oct 7, 2024 · 9 comments · May be fixed by #18011
Labels
complexity: low Requires minimal effort to implement netbox status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation type: feature Introduction of new functionality to the application

Comments

@AndreasSMoe
Copy link

NetBox version

v4.1.3

Feature type

Change to existing functionality

Proposed functionality

Disk size changed from GB to MB, but divider is set to 1000 instead of 1024. Import to Netbox that uses Bytes will show wrong disk size
see bug report
#17631

Use case

Field used to be GB, is now MB
Field collected from VMM is in Bytes, 1024 Bytes is 1KB, 1024KB is 1MB, 1024MB is 1GB, 1024GB is 1TB
Netbox uses 1000 Bytes as 1KB, 1000MB as 1GB
Example
Importing a value of 50000 MB on virtual disk is shown as 50GB
While converting from bytes to MB
52428800 Bytes is 51200MB

In Netbox, 51200 MB is converted to 51,2GB which is not correct

if I convert the bytes
52428800/1MB = 51200 MB which is correct, but shown wrong
(52428800/1GB)*1000 = 50000MB which is wrong, but shown correctly

Problems occur if the disk is larger than 1TB

(1 073 741 824/1GB)*1000 = 1024GB which is wrong, will be shown as 1.02 TB

Correct would be to not use humanizenumbers as conversion will be wrong
A posible solution would be to add ability in configuration to choose between 1000 and 1024

image
vs edit
image

To get value 60GB, the MB value should be 61440MB

But if I change value the converted value shown under virual disk is
image

We use netbox as source for our billing, and as a workaround they now divide the MB number by 1000
The correct way would be for billing to devide by 1024

Database changes

Not sure, but is it possible to add a setting in configuration.py to enable selection between 1000 and 1024

External dependencies

None that I can think of

@AndreasSMoe AndreasSMoe added status: needs triage This issue is awaiting triage by a maintainer type: feature Introduction of new functionality to the application labels Oct 7, 2024
@DanSheps DanSheps added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation complexity: low Requires minimal effort to implement and removed status: needs triage This issue is awaiting triage by a maintainer labels Oct 10, 2024
@DanSheps
Copy link
Member

Default of this should operate on the existing methodology (conversion == 1000, not 1024).

Do add tests to ensure that the configuration parameter works as intended too.

@drose0
Copy link

drose0 commented Oct 23, 2024

Upvote on this. Would like the ability to specify whether we want to use GB or GiB, and then have the correct conversion.

@mbchristoff
Copy link

Another upvote, other applications linked to Netbox use GiB so provisioning and billing need some ugly fixes.

@jonaagenilsen
Copy link

Upvoted. We need this feature.

@jeremystretch jeremystretch added the netbox label Nov 1, 2024 — with Linear
@rhcinos
Copy link

rhcinos commented Nov 5, 2024

A vote from us also. Also VM RAM display seems to have changed from GiB to GB, could this setting affect RAM also?

@rhcinos
Copy link

rhcinos commented Nov 5, 2024

Perhaps out of scope of this specific FR, but could the upgrade script respect this configuration paramter, and mutliply existing values by 1024 instead of 1000 if set?

For context, we were due to upgrade our Netbox this week but have decided to hold off as it would cause all of our disk sizes to be wrong, as we use GiB and MiB currently.

Happy to raise a new FR if that is more appropriate.

Haeki pushed a commit to Haeki/netbox that referenced this issue Nov 13, 2024
@Haeki
Copy link

Haeki commented Nov 13, 2024

We also noted the problem this week while preparing for an update to 4.1
I looked a bit at the code and the changes seem to be pretty straight forward.
Maybe someone can give some feedback for the solution I pushed to my fork and if positiv I will create a pull request.
I created two new config options, one for the disk and one for the RAM divisor. I also included this setting in the migration script.
Haeki@09b7715

@rhcinos
Copy link

rhcinos commented Nov 13, 2024

Conceptually looks great to me, thanks!

@Haeki Haeki linked a pull request Nov 14, 2024 that will close this issue
@netsandbox
Copy link
Contributor

Isn't it common to use for memory (RAM) size calculations a base of 1000 and for disk size calculations a base of 1024?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: low Requires minimal effort to implement netbox status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants