netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
16.33k stars 2.6k forks source link

17686 config option for disk divider #18011

Open Haeki opened 1 week ago

Haeki commented 1 week ago

Fixes: #17686 Ability to select disk divider

I added two new config options to specify the divider used to calculate the disk and ram sizes in different units. The default value is 1000 but can be changed to 1024 to get GiB instead of GB. Those config values are used in the humanize_megabytes method. I split this method into two separate methods, one for RAM and one for disk values. Additionally I added the disk config value to the disk migration so that users with GiB values get them converted to MiB. I tested the changes in my local environment and noticed no problems.

I'm open for feedback and I also didn't include any tests yet.