]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
COMMON_PREFIXES cleanup - patch 5/5
authorarmando-migliaccio <armamig@gmail.com>
Thu, 2 Jul 2015 19:56:24 +0000 (12:56 -0700)
committerKyle Mestery <mestery@mestery.com>
Tue, 7 Jul 2015 04:26:54 +0000 (04:26 +0000)
Get rid of COMMON_PREFIXES, as now the prefix is a service's declaritive property.

Change-Id: I3d306131df94188f75e69edb13d262721d10bee5
Depends-on: I0450d0b2bf409d470a3a87bfd96518939759a84e
Depends-on: Ia34695967cbbec0a1cf0884dad82e096de8539b8
Depends-on: Ib9517b772fe426eaf0809c439aa3ba0448c7abaa

neutron/api/v2/resource_helper.py
neutron/plugins/common/constants.py

index 61090638b910d567199733e9210bfae0b4cbf89a..05e403d030da1cf1de5c408987b8b1693205773b 100644 (file)
@@ -14,6 +14,7 @@
 #    under the License.
 
 from oslo_config import cfg
+from oslo_log import log as logging
 
 from neutron.api import extensions
 from neutron.api.v2 import base
@@ -21,6 +22,8 @@ from neutron import manager
 from neutron.plugins.common import constants
 from neutron import quota
 
+LOG = logging.getLogger(__name__)
+
 
 def build_plural_mappings(special_mappings, resource_map):
     """Create plural to singular mapping for all resources.
@@ -68,6 +71,9 @@ def build_resource_info(plural_mappings, resource_map, which_service,
         plugin = manager.NeutronManager.get_service_plugins()[which_service]
     else:
         plugin = manager.NeutronManager.get_plugin()
+    path_prefix = getattr(plugin, "path_prefix", "")
+    LOG.debug('Service %(service)s assigned prefix: %(prefix)s'
+              % {'service': which_service, 'prefix': path_prefix})
     for collection_name in resource_map:
         resource_name = plural_mappings[collection_name]
         params = resource_map.get(collection_name, {})
@@ -82,8 +88,6 @@ def build_resource_info(plural_mappings, resource_map, which_service,
             allow_bulk=allow_bulk,
             allow_pagination=cfg.CONF.allow_pagination,
             allow_sorting=cfg.CONF.allow_sorting)
-        path_prefix = getattr(plugin, "path_prefix",
-                              constants.COMMON_PREFIXES.get(which_service, ""))
         resource = extensions.ResourceExtension(
             collection_name,
             controller,
index 401b01dd093b0395019849609d41d70bf96567c0..63947ae6fd1152eaf0592b2d52ce4acf63750a51 100644 (file)
@@ -34,13 +34,6 @@ EXT_TO_SERVICE_MAPPING = {
     'router': L3_ROUTER_NAT
 }
 
-COMMON_PREFIXES = {
-    LOADBALANCER: "/lb",
-    LOADBALANCERV2: "/lbaas",
-    FIREWALL: "/fw",
-    VPN: "/vpn",
-}
-
 # Service operation status constants
 ACTIVE = "ACTIVE"
 DOWN = "DOWN"