COMMON_PREFIXES cleanup - patch 2/5

Add path prefixes to LBaaS plugins. This change also stops relying
on a Neutron internal data structure that is meant to go away. This
is part of a chainset initiated by [1].

[1] I95cd71dfc35e266f6f3cc5715ab8a0deb10058e7

Change-Id: I0450d0b2bf409d470a3a87bfd96518939759a84e
This commit is contained in:
armando-migliaccio 2015-07-02 12:41:57 -07:00
parent 053030f239
commit 8853ca1c39
7 changed files with 13 additions and 9 deletions

View File

@ -105,8 +105,7 @@ class Lbaas_agentscheduler(extensions.ExtensionDescriptor):
base.FAULT_MAP)
exts.append(extensions.ResourceExtension(
LOADBALANCER_AGENT, controller, parent,
path_prefix=plugin_const.
COMMON_PREFIXES[plugin_const.LOADBALANCER]))
path_prefix=loadbalancer.LOADBALANCER_PREFIX))
return exts
def get_extended_resources(self, version):

View File

@ -25,6 +25,7 @@ from neutron import policy
from neutron import wsgi
from neutron_lbaas.extensions import loadbalancer
from neutron_lbaas.extensions import loadbalancerv2
from neutron_lbaas.services.loadbalancer import constants as lb_const
LOADBALANCER = 'agent-loadbalancer'
@ -106,8 +107,7 @@ class Lbaas_agentschedulerv2(extensions.ExtensionDescriptor):
LbaasAgentHostingLoadBalancerController(), base.FAULT_MAP)
exts.append(extensions.ResourceExtension(
LOADBALANCER_AGENT, controller, parent,
path_prefix=plugin_const.
COMMON_PREFIXES[plugin_const.LOADBALANCERV2]))
path_prefix=loadbalancerv2.LOADBALANCERV2_PREFIX))
return exts
def get_extended_resources(self, version):

View File

@ -27,6 +27,8 @@ from neutron import manager
from neutron.plugins.common import constants
from neutron.services import service_base
LOADBALANCER_PREFIX = "/lb"
# Loadbalancer Exceptions
class DelayOrTimeoutInvalid(nexception.BadRequest):
@ -378,7 +380,7 @@ class Loadbalancer(extensions.ExtensionDescriptor):
resource = extensions.ResourceExtension(
collection_name,
controller, parent,
path_prefix=constants.COMMON_PREFIXES[constants.LOADBALANCER],
path_prefix=LOADBALANCER_PREFIX,
attr_map=params)
resources.append(resource)

View File

@ -30,6 +30,8 @@ from neutron.services import service_base
from neutron_lbaas.services.loadbalancer import constants as lb_const
LOADBALANCERV2_PREFIX = "/lbaas"
# Loadbalancer Exceptions
# This exception is only for a workaround when having v1 and v2 lbaas extension
@ -431,8 +433,7 @@ class Loadbalancerv2(extensions.ExtensionDescriptor):
resource = extensions.ResourceExtension(
collection_name,
controller, parent,
path_prefix=constants.COMMON_PREFIXES[
constants.LOADBALANCERV2],
path_prefix=LOADBALANCERV2_PREFIX,
attr_map=params)
resources.append(resource)

View File

@ -67,6 +67,7 @@ class LoadBalancerPlugin(ldb.LoadBalancerPluginDb,
supported_extension_aliases = ["lbaas",
"lbaas_agent_scheduler",
"service-type"]
path_prefix = lb_ext.LOADBALANCER_PREFIX
# lbaas agent notifiers to handle agent update operations;
# can be updated by plugin drivers while loading;
@ -374,6 +375,7 @@ class LoadBalancerPluginv2(loadbalancerv2.LoadBalancerPluginBaseV2):
supported_extension_aliases = ["lbaasv2",
"lbaas_agent_schedulerv2",
"service-type"]
path_prefix = loadbalancerv2.LOADBALANCERV2_PREFIX
agent_notifiers = (
agent_scheduler_v2.LbaasAgentSchedulerDbMixin.agent_notifiers)

View File

@ -110,7 +110,7 @@ class NoopLbaaSDriver(abstract_driver.LoadBalancerAbstractDriver):
class LoadBalancerTestMixin(object):
resource_prefix_map = dict(
(k, constants.COMMON_PREFIXES[constants.LOADBALANCER])
(k, loadbalancer.LOADBALANCER_PREFIX)
for k in loadbalancer.RESOURCE_ATTRIBUTE_MAP.keys()
)

View File

@ -59,7 +59,7 @@ _subnet_id = "0c798ed8-33ba-11e2-8b28-000c291c4d14"
class LbaasTestMixin(object):
resource_prefix_map = dict(
(k, constants.COMMON_PREFIXES[constants.LOADBALANCERV2])
(k, loadbalancerv2.LOADBALANCERV2_PREFIX)
for k in loadbalancerv2.RESOURCE_ATTRIBUTE_MAP.keys()
)