Skip to content

Commit b036efb

Browse files
authored
IFC-1819 Fix utilization percentage of IP prefixes (#7388)
If all the IP addresses of a prefix used as a pool has been created, marking the prefix as "not a pool" could end up in showing a percentage of utilisation greater than 100%.
1 parent e44c7ae commit b036efb

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

backend/infrahub/core/ipam/utilization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,4 @@ async def get_use_percentage(
152152
grand_total_space += prefix_total_space
153153
if grand_total_space == 0:
154154
return 0.0
155-
return (grand_total_used / grand_total_space) * 100
155+
return min((grand_total_used / grand_total_space) * 100, 100)

changelog/7388.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed prefix utilization showing as greater than 100% after setting the pool attribute to false

0 commit comments

Comments
 (0)