Use plain routes list for os-floating-ip-pools endpoint instead of stevedore

This patch adds os-floating-ip-pools related routes by a plain list, instead
of using stevedore. After all the Nova API endpoints moves to
the plain routes list, the usage of stevedore for API loading will be
removed from Nova.

Partial-implement-blueprint api-no-more-extensions-pike

Change-Id: I50de6ca3fa7ad6bd1ca317682fd0ab0362ea9e29
This commit is contained in:
ghanshyam 2017-05-01 19:01:16 +03:00
parent 0710fdaf4e
commit ed0abdbc68
4 changed files with 11 additions and 23 deletions

View File

@ -201,6 +201,9 @@ hardcoded_extensions = [
{'name': 'FlavorAccess',
'description': 'Flavor access support.',
'alias': 'os-flavor-access'},
{'name': 'FloatingIpPools',
'description': 'Floating IPs support.',
'alias': 'os-floating-ip-pools'},
{'name': 'FloatingIps',
'description': 'Floating IPs support.',
'alias': 'os-floating-ips'},

View File

@ -20,9 +20,6 @@ from nova import network
from nova.policies import floating_ip_pools as fip_policies
ALIAS = 'os-floating-ip-pools'
def _translate_floating_ip_view(pool_name):
return {
'name': pool_name,
@ -51,22 +48,3 @@ class FloatingIPPoolsController(wsgi.Controller):
context.can(fip_policies.BASE_POLICY_NAME)
pools = self.network_api.get_floating_ip_pools(context)
return _translate_floating_ip_pools_view(pools)
class FloatingIpPools(extensions.V21APIExtensionBase):
"""Floating IPs support."""
name = "FloatingIpPools"
alias = ALIAS
version = 1
def get_resources(self):
resource = [extensions.ResourceExtension(ALIAS,
FloatingIPPoolsController())]
return resource
def get_controller_extensions(self):
"""It's an abstract function V21APIExtensionBase and the extension
will not be loaded without it.
"""
return []

View File

@ -35,6 +35,7 @@ from nova.api.openstack.compute import flavor_manage
from nova.api.openstack.compute import flavor_rxtx
from nova.api.openstack.compute import flavors
from nova.api.openstack.compute import flavors_extraspecs
from nova.api.openstack.compute import floating_ip_pools
from nova.api.openstack.compute import floating_ips
from nova.api.openstack.compute import hide_server_addresses
from nova.api.openstack.compute import keypairs
@ -101,6 +102,10 @@ flavor_extraspec_controller = functools.partial(_create_controller,
flavors_extraspecs.FlavorExtraSpecsController, [], [])
floating_ip_pools_controller = functools.partial(_create_controller,
floating_ip_pools.FloatingIPPoolsController, [], [])
floating_ips_controller = functools.partial(_create_controller,
floating_ips.FloatingIPController, [], [])
@ -195,6 +200,9 @@ ROUTE_LIST = (
('/os-aggregates/{id}/action', {
'POST': [aggregates_controller, 'action'],
}),
('/os-floating-ip-pools', {
'GET': [floating_ip_pools_controller, 'index'],
}),
('/os-floating-ips', {
'GET': [floating_ips_controller, 'index'],
'POST': [floating_ips_controller, 'create']

View File

@ -86,7 +86,6 @@ nova.api.v21.extensions =
extension_info = nova.api.openstack.compute.extension_info:ExtensionInfo
fixed_ips = nova.api.openstack.compute.fixed_ips:FixedIps
floating_ip_dns = nova.api.openstack.compute.floating_ip_dns:FloatingIpDns
floating_ip_pools = nova.api.openstack.compute.floating_ip_pools:FloatingIpPools
floating_ips_bulk = nova.api.openstack.compute.floating_ips_bulk:FloatingIpsBulk
fping = nova.api.openstack.compute.fping:Fping
hosts = nova.api.openstack.compute.hosts:Hosts