diff --git a/nova/api/openstack/compute/security_groups.py b/nova/api/openstack/compute/security_groups.py index 53e79dcd4b80..9801f46dcd77 100644 --- a/nova/api/openstack/compute/security_groups.py +++ b/nova/api/openstack/compute/security_groups.py @@ -540,14 +540,3 @@ class SecurityGroupsOutputController(wsgi.Controller): @wsgi.extends def detail(self, req, resp_obj): self._extend_servers(req, list(resp_obj.obj['servers'])) - - -# NOTE(gmann): This function is not supposed to use 'body_deprecated_param' -# parameter as this is placed to handle scheduler_hint extension for V2.1. -def server_create(server_dict, create_kwargs, body_deprecated_param): - security_groups = server_dict.get(ATTRIBUTE_NAME) - if security_groups is not None: - create_kwargs['security_groups'] = [ - sg['name'] for sg in security_groups if sg.get('name')] - create_kwargs['security_groups'] = list( - set(create_kwargs['security_groups'])) diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index f348c9f565ea..f24d9450cbdb 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -35,7 +35,6 @@ from nova.api.openstack.compute import keypairs from nova.api.openstack.compute import multiple_create from nova.api.openstack.compute import scheduler_hints from nova.api.openstack.compute.schemas import servers as schema_servers -from nova.api.openstack.compute import security_groups from nova.api.openstack.compute.views import servers as views_servers from nova.api.openstack import wsgi from nova.api import validation @@ -74,7 +73,6 @@ class ServersController(wsgi.Controller): keypairs.server_create, multiple_create.server_create, scheduler_hints.server_create, - security_groups.server_create, ] @staticmethod @@ -435,6 +433,12 @@ class ServersController(wsgi.Controller): # all of extended code into ServersController. self._create_by_func_list(server_dict, create_kwargs, body) create_kwargs['user_data'] = server_dict.get('user_data') + security_groups = server_dict.get('security_groups') + if security_groups is not None: + create_kwargs['security_groups'] = [ + sg['name'] for sg in security_groups if sg.get('name')] + create_kwargs['security_groups'] = list( + set(create_kwargs['security_groups'])) availability_zone = server_dict.pop("availability_zone", None)