Skip to content

BUG: Convert disk size from MB to GB for Aquilon#49

Merged
jrha merged 2 commits into
mainfrom
patch-disk-size
May 26, 2026
Merged

BUG: Convert disk size from MB to GB for Aquilon#49
jrha merged 2 commits into
mainfrom
patch-disk-size

Conversation

@meoflynn
Copy link
Copy Markdown
Contributor

@meoflynn meoflynn commented May 26, 2026

An update in NetBox has changed the disk size to be stored in MB instead of GB since v4.1.0 (https://github.com/netbox-community/netbox/releases/tag/v4.1.0). This results in the code setting the disk size in Aquilon to be too large e.g. if a disk is 1024 MB in NetBox, the disk is set for the device as 1024 GB in Aquilon.

This PR converts virtual disk and machine disk sizes from MB to GB and should fix #48.

The test data has also been updated to reflect the change in how the disk size is stored.

Note: This PR needs to be tested before it can be merged

@meoflynn meoflynn added the bug Something isn't working label May 26, 2026
@meoflynn meoflynn changed the title BUG: Convert disk from MB to GB for Aquilon BUG: Convert disk size from MB to GB for Aquilon May 26, 2026
@meoflynn meoflynn force-pushed the patch-disk-size branch 3 times, most recently from b6b567d to 7e36616 Compare May 26, 2026 14:12
An update in NetBox has changed the disk size to be stored in MB
instead of GB. This results in the code setting the disk size in Aquilon
to be too large e.g. if a disk is 1024 MB in NetBox, the disk is set for
the device as 1024 GB in Aquilon. Added a line to convert the disk size
to GB.
@meoflynn meoflynn marked this pull request as ready for review May 26, 2026 14:24
@jrha
Copy link
Copy Markdown
Member

jrha commented May 26, 2026

I've tested this against a few of out VMs with more complex disk layouts and was surprised to see disk sizes coming out smaller than before, sure enough the transition script in NetBox v4.1.0 multiplied existing values by 1000 rather than 1024. I'm not sure whether we should follow this example or not.

@jrha
Copy link
Copy Markdown
Member

jrha commented May 26, 2026

Netbox defines GB as SI/1000 and GiB as EIC/1024.
Correcting formula for converting from MB to GB.
@jrha jrha merged commit af1b216 into main May 26, 2026
8 checks passed
@jrha jrha deleted the patch-disk-size branch May 26, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

netbox2aquilon: Disk size not converted correctly from MB to GB

2 participants