From ee87df22ecc8e97a8ff1766a99e5db7d62ef9c77 Mon Sep 17 00:00:00 2001 From: He Jie Xu Date: Thu, 29 Jun 2017 20:17:59 +0800 Subject: [PATCH] Use plain routes list for os-security-groups instead of stevedore This patch adds os-security-groups 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: I3dde45b63cb633819d14b5fed55403f209347be4 --- nova/api/openstack/compute/routes.py | 13 +++++++++++++ nova/api/openstack/compute/security_groups.py | 4 +--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/nova/api/openstack/compute/routes.py b/nova/api/openstack/compute/routes.py index f1a0355a74..c0e9c31f76 100644 --- a/nova/api/openstack/compute/routes.py +++ b/nova/api/openstack/compute/routes.py @@ -249,6 +249,10 @@ quota_set_controller = functools.partial(_create_controller, quota_sets.QuotaSetsController, [], []) +security_group_controller = functools.partial(_create_controller, + security_groups.SecurityGroupController, [], []) + + server_controller = functools.partial(_create_controller, servers.ServersController, [ @@ -608,6 +612,15 @@ ROUTE_LIST = ( ('/os-quota-sets/{id}/defaults', { 'GET': [quota_set_controller, 'defaults'] }), + ('/os-security-groups', { + 'GET': [security_group_controller, 'index'], + 'POST': [security_group_controller, 'create'] + }), + ('/os-security-groups/{id}', { + 'GET': [security_group_controller, 'show'], + 'PUT': [security_group_controller, 'update'], + 'DELETE': [security_group_controller, 'delete'] + }), ('/os-server-external-events', { 'POST': [server_external_events_controller, 'create'] }), diff --git a/nova/api/openstack/compute/security_groups.py b/nova/api/openstack/compute/security_groups.py index 2911915b2b..888a39a806 100644 --- a/nova/api/openstack/compute/security_groups.py +++ b/nova/api/openstack/compute/security_groups.py @@ -507,8 +507,6 @@ class SecurityGroups(extensions.V21APIExtensionBase): return [] def get_resources(self): - secgrp_ext = extensions.ResourceExtension(ALIAS, - SecurityGroupController()) server_secgrp_ext = extensions.ResourceExtension( ALIAS, controller=ServerSecurityGroupController(), @@ -516,7 +514,7 @@ class SecurityGroups(extensions.V21APIExtensionBase): secgrp_rules_ext = extensions.ResourceExtension( 'os-security-group-rules', controller=SecurityGroupRulesController()) - return [secgrp_ext, server_secgrp_ext, secgrp_rules_ext] + return [server_secgrp_ext, secgrp_rules_ext] # NOTE(gmann): This function is not supposed to use 'body_deprecated_param'