Use plain routes list for os-floating-ips-bulk endpoint instead of stevedore

This patch adds os-floating-ips-bulk 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: Ibd52a1dd8b1f0b89d6ed9547131ccfe25a36275a
This commit is contained in:
ghanshyam 2017-05-01 19:22:14 +03:00
parent ed0abdbc68
commit 79093584de
4 changed files with 16 additions and 23 deletions

View File

@ -207,6 +207,9 @@ hardcoded_extensions = [
{'name': 'FloatingIps',
'description': 'Floating IPs support.',
'alias': 'os-floating-ips'},
{'name': 'FloatingIpsBulk',
'description': 'Bulk handling of Floating IPs.',
'alias': 'os-floating-ips-bulk'},
{'name': 'Keypairs',
'description': 'Keypair Support.',
'alias': 'os-keypairs'}

View File

@ -31,9 +31,6 @@ from nova.policies import floating_ips_bulk as fib_policies
CONF = nova.conf.CONF
ALIAS = 'os-floating-ips-bulk'
class FloatingIPBulkController(wsgi.Controller):
@wsgi.Controller.api_version("2.1", MAX_PROXY_API_SUPPORT_VERSION)
@ -154,22 +151,3 @@ class FloatingIPBulkController(wsgi.Controller):
return net.iter_hosts()
except netaddr.AddrFormatError as exc:
raise exception.InvalidInput(reason=six.text_type(exc))
class FloatingIpsBulk(extensions.V21APIExtensionBase):
"""Bulk handling of Floating IPs."""
name = "FloatingIpsBulk"
alias = ALIAS
version = 1
def get_resources(self):
resource = [extensions.ResourceExtension(ALIAS,
FloatingIPBulkController())]
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

@ -37,6 +37,7 @@ 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 floating_ips_bulk
from nova.api.openstack.compute import hide_server_addresses
from nova.api.openstack.compute import keypairs
from nova.api.openstack.compute import lock_server
@ -110,6 +111,10 @@ floating_ips_controller = functools.partial(_create_controller,
floating_ips.FloatingIPController, [], [])
floating_ips_bulk_controller = functools.partial(_create_controller,
floating_ips_bulk.FloatingIPBulkController, [], [])
server_controller = functools.partial(_create_controller,
servers.ServersController,
[
@ -211,6 +216,14 @@ ROUTE_LIST = (
'GET': [floating_ips_controller, 'show'],
'DELETE': [floating_ips_controller, 'delete']
}),
('/os-floating-ips-bulk', {
'GET': [floating_ips_bulk_controller, 'index'],
'POST': [floating_ips_bulk_controller, 'create']
}),
('/os-floating-ips-bulk/{id}', {
'GET': [floating_ips_bulk_controller, 'show'],
'PUT': [floating_ips_bulk_controller, 'update']
}),
('/os-keypairs', {
'GET': [keypairs_controller, 'index'],
'POST': [keypairs_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_ips_bulk = nova.api.openstack.compute.floating_ips_bulk:FloatingIpsBulk
fping = nova.api.openstack.compute.fping:Fping
hosts = nova.api.openstack.compute.hosts:Hosts
hypervisors = nova.api.openstack.compute.hypervisors:Hypervisors