Skip to content

Commit

Permalink
Calculate usage of network based on ipv4 subnets only
Browse files Browse the repository at this point in the history
  • Loading branch information
mdujava committed Mar 23, 2022
1 parent 437edb0 commit 533b90f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion osia/installer/clouds/openstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ def _find_fit_network(osp_connection: Connection,
results = {}
for net_name in networks:
net_avail = osp_connection.network.get_network_ip_availability(named_networks[net_name])
results[net_name] = net_avail['total_ips'] / net_avail['used_ips']
subnet_usage = [(subnet['total_ips'], subnet['used_ips'])
for subnet in net_avail.subnet_ip_availability if subnet['ip_version'] == 4]
total_ips, used_ips = [sum(i) for i in zip(*subnet_usage)]
results[net_name] = total_ips / used_ips
result = _find_best_fit(results)
return named_networks[result]['id'], result

Expand Down

0 comments on commit 533b90f

Please sign in to comment.