]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fetch routers ports for metadata access from DB
authorSalvatore Orlando <salv.orlando@gmail.com>
Mon, 6 May 2013 15:33:44 +0000 (17:33 +0200)
committerSalvatore Orlando <salv.orlando@gmail.com>
Mon, 6 May 2013 22:53:26 +0000 (00:53 +0200)
Bug 1176963

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

Change-Id: If3529cc5694434e8cdc9d21a4043f94212146d2d

quantum/plugins/nicira/common/metadata_access.py

index d1e63b64fdb35244e74e3c94912284dbb9d6265c..2204344be22220864f3993785aa026f659ca9cd4 100644 (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