From 18e9918d320228d4a0551eb9feaaebd5f82c9941 Mon Sep 17 00:00:00 2001 From: pengyuesheng Date: Thu, 4 Apr 2019 17:55:31 +0800 Subject: [PATCH] Adjusts subnet_free_ips to 0 when it is negative In subnet page under admin panel, Subnet_free_ips is negative if the subnet's allocation_pools range is less than the used IPs of the subnet. This patch adjusts subnet_free_ips to 0 when it is negative. Change-Id: I3f1441bf5e4eb3017024db2865adf3296127793e Closes-Bug: #1823149 --- openstack_dashboard/dashboards/admin/networks/subnets/tables.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openstack_dashboard/dashboards/admin/networks/subnets/tables.py b/openstack_dashboard/dashboards/admin/networks/subnets/tables.py index 707913cd52..f4136b7604 100644 --- a/openstack_dashboard/dashboards/admin/networks/subnets/tables.py +++ b/openstack_dashboard/dashboards/admin/networks/subnets/tables.py @@ -156,6 +156,8 @@ class SubnetsTab(project_tabs_subnets_tab): subnet_used_ips = subnet_usage.get("used_ips") subnet_total_ips = subnet_usage.get("total_ips") subnet_free_ips = subnet_total_ips - subnet_used_ips + if subnet_free_ips < 0: + subnet_free_ips = 0 for item in subnets_dict: id = item.get("id") if id == subnet_id: