From 75136bb5cdf5e65bfa8bd3ecf55a70e8afa7232a Mon Sep 17 00:00:00 2001 From: He Jie Xu Date: Thu, 29 Jun 2017 20:21:40 +0800 Subject: [PATCH] Use plain routes list for server-security-groups instead of stevedore This patch adds server-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: I8bd7676ccb37a041548ef2df729130b8bdf7a28c --- nova/api/openstack/compute/routes.py | 7 +++++++ nova/api/openstack/compute/security_groups.py | 6 +----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/nova/api/openstack/compute/routes.py b/nova/api/openstack/compute/routes.py index c0e9c31f76e4..cf8c6ec4ab09 100644 --- a/nova/api/openstack/compute/routes.py +++ b/nova/api/openstack/compute/routes.py @@ -327,6 +327,10 @@ server_remote_consoles_controller = functools.partial(_create_controller, remote_consoles.RemoteConsolesController, [], []) +server_security_groups_controller = functools.partial(_create_controller, + security_groups.ServerSecurityGroupController, [], []) + + server_tags_controller = functools.partial(_create_controller, server_tags.ServerTagsController, [], []) @@ -744,6 +748,9 @@ ROUTE_LIST = ( ('/servers/{server_id}/remote-consoles', { 'POST': [server_remote_consoles_controller, 'create'] }), + ('/servers/{server_id}/os-security-groups', { + 'GET': [server_security_groups_controller, 'index'] + }), ('/servers/{server_id}/tags', { 'GET': [server_tags_controller, 'index'], 'PUT': [server_tags_controller, 'update_all'], diff --git a/nova/api/openstack/compute/security_groups.py b/nova/api/openstack/compute/security_groups.py index 888a39a806e2..965d4d795997 100644 --- a/nova/api/openstack/compute/security_groups.py +++ b/nova/api/openstack/compute/security_groups.py @@ -507,14 +507,10 @@ class SecurityGroups(extensions.V21APIExtensionBase): return [] def get_resources(self): - server_secgrp_ext = extensions.ResourceExtension( - ALIAS, - controller=ServerSecurityGroupController(), - parent=dict(member_name='server', collection_name='servers')) secgrp_rules_ext = extensions.ResourceExtension( 'os-security-group-rules', controller=SecurityGroupRulesController()) - return [server_secgrp_ext, secgrp_rules_ext] + return [secgrp_rules_ext] # NOTE(gmann): This function is not supposed to use 'body_deprecated_param'