From 79093584deb973bae19eec4352ee6f15c1eacc47 Mon Sep 17 00:00:00 2001 From: ghanshyam Date: Mon, 1 May 2017 19:22:14 +0300 Subject: [PATCH] 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 --- nova/api/openstack/compute/extension_info.py | 3 +++ .../openstack/compute/floating_ips_bulk.py | 22 ------------------- nova/api/openstack/compute/routes.py | 13 +++++++++++ setup.cfg | 1 - 4 files changed, 16 insertions(+), 23 deletions(-) diff --git a/nova/api/openstack/compute/extension_info.py b/nova/api/openstack/compute/extension_info.py index 07d9e9773807..af4e16b90e67 100644 --- a/nova/api/openstack/compute/extension_info.py +++ b/nova/api/openstack/compute/extension_info.py @@ -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'} diff --git a/nova/api/openstack/compute/floating_ips_bulk.py b/nova/api/openstack/compute/floating_ips_bulk.py index c0114fe70cbe..ea973b98d69f 100644 --- a/nova/api/openstack/compute/floating_ips_bulk.py +++ b/nova/api/openstack/compute/floating_ips_bulk.py @@ -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 [] diff --git a/nova/api/openstack/compute/routes.py b/nova/api/openstack/compute/routes.py index e738a494a486..73586284fc4d 100644 --- a/nova/api/openstack/compute/routes.py +++ b/nova/api/openstack/compute/routes.py @@ -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'] diff --git a/setup.cfg b/setup.cfg index 8289c3bbbdd8..337b604a179b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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