Delete unnecessary judgment when getting the neutron quota

Nova and cinder quotas data does not contain networks, subnets, and
routers. So, some judgments are not necessary when getting the neutron
quota.

Change-Id: Icad9fdf34199942a976def23905d586739ef25df
This commit is contained in:
wei.ying 2017-08-28 13:54:23 +08:00
parent 2130c3b8e5
commit 233680f541
1 changed files with 3 additions and 18 deletions

View File

@ -221,30 +221,15 @@ def get_tenant_quota_data(request, disabled_quotas=None, tenant_id=None):
sec_quota = neutron_quotas.get('security_group').limit sec_quota = neutron_quotas.get('security_group').limit
qs.add(base.QuotaSet({'security_groups': sec_quota})) qs.add(base.QuotaSet({'security_groups': sec_quota}))
if 'network' in disabled_quotas: if 'network' not in disabled_quotas:
for item in qs.items:
if item.name == 'networks':
qs.items.remove(item)
break
else:
net_quota = neutron_quotas.get('network').limit net_quota = neutron_quotas.get('network').limit
qs.add(base.QuotaSet({'networks': net_quota})) qs.add(base.QuotaSet({'networks': net_quota}))
if 'subnet' in disabled_quotas: if 'subnet' not in disabled_quotas:
for item in qs.items:
if item.name == 'subnets':
qs.items.remove(item)
break
else:
net_quota = neutron_quotas.get('subnet').limit net_quota = neutron_quotas.get('subnet').limit
qs.add(base.QuotaSet({'subnets': net_quota})) qs.add(base.QuotaSet({'subnets': net_quota}))
if 'router' in disabled_quotas: if 'router' not in disabled_quotas:
for item in qs.items:
if item.name == 'routers':
qs.items.remove(item)
break
else:
router_quota = neutron_quotas.get('router').limit router_quota = neutron_quotas.get('router').limit
qs.add(base.QuotaSet({'routers': router_quota})) qs.add(base.QuotaSet({'routers': router_quota}))