Fetch routers ports for metadata access from DB

Bug 1176963

There is no need to retrieve the ports from the NVP backend, so
a DB query will be enough.

Change-Id: If3529cc5694434e8cdc9d21a4043f94212146d2d
This commit is contained in:
Salvatore Orlando 2013-05-06 17:33:44 +02:00
parent 9ad0ba1ae3
commit 0fee496538

View File

@ -121,9 +121,11 @@ class NvpMetadataAccess(object):
device_filter = {'device_id': [router_id],
'device_owner': [l3_db.DEVICE_OWNER_ROUTER_INTF]}
with ctx_elevated.session.begin(subtransactions=True):
ports = self.get_ports(ctx_elevated, filters=device_filter)
# Filter out ports without an IP (those are 'stale' router ports)
ports = [port for port in ports if port['fixed_ips']]
# Retrieve ports without going to plugin
ports = [self._make_port_dict(port)
for port in self._get_ports_query(
ctx_elevated, filters=device_filter)
if port['fixed_ips']]
try:
if ports:
if (do_create and