Prevent unnecessary database read by l3 agent

Fixes bug 1088129

Change-Id: I887facf321f3267c16c101a1448827f6c046bb2c
This commit is contained in:
Gary Kotton 2012-12-09 06:33:13 +00:00
parent 61a5870b71
commit 340684b4dd

View File

@ -864,6 +864,8 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
my_ports = subnet_id_ports_dict.get(fixed_ip['subnet_id'], [])
my_ports.append(port)
subnet_id_ports_dict[fixed_ip['subnet_id']] = my_ports
if not subnet_id_ports_dict:
return
filters = {'id': subnet_id_ports_dict.keys()}
fields = ['id', 'cidr', 'gateway_ip']
subnet_dicts = self.get_subnets(context, filters, fields)