Skip to content

Abillity to select disk divider #17686

@AndreasSMoe

Description

@AndreasSMoe

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

Metadata

Metadata

Assignees

Labels

complexity: lowRequires minimal effort to implementnetboxstatus: needs ownerThis issue is tentatively accepted pending a volunteer committed to its implementationtype: featureIntroduction of new functionality to the application

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions