Skip to content

Commit

Permalink
Use plain routes list for os-security-group-default-rules instead of …
Browse files Browse the repository at this point in the history
…stevedore

This patch adds os-security-group-default-rules 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: Ifd7c8fc508c0afdb3ce14a4514862805a1569a8b
  • Loading branch information
soulxu committed Jul 12, 2017
1 parent c4a9509 commit 7f48413
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
13 changes: 13 additions & 0 deletions nova/api/openstack/compute/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
from nova.api.openstack.compute import quota_sets
from nova.api.openstack.compute import remote_consoles
from nova.api.openstack.compute import rescue
from nova.api.openstack.compute import security_group_default_rules
from nova.api.openstack.compute import security_groups
from nova.api.openstack.compute import server_diagnostics
from nova.api.openstack.compute import server_external_events
Expand Down Expand Up @@ -253,6 +254,10 @@ def _create_controller(main_controller, controller_list,
security_groups.SecurityGroupController, [], [])


security_group_default_rules_controller = functools.partial(_create_controller,
security_group_default_rules.SecurityGroupDefaultRulesController, [], [])


security_group_rules_controller = functools.partial(_create_controller,
security_groups.SecurityGroupRulesController, [], [])

Expand Down Expand Up @@ -620,6 +625,14 @@ def _create_controller(main_controller, controller_list,
('/os-quota-sets/{id}/defaults', {
'GET': [quota_set_controller, 'defaults']
}),
('/os-security-group-default-rules', {
'GET': [security_group_default_rules_controller, 'index'],
'POST': [security_group_default_rules_controller, 'create']
}),
('/os-security-group-default-rules/{id}', {
'GET': [security_group_default_rules_controller, 'show'],
'DELETE': [security_group_default_rules_controller, 'delete']
}),
('/os-security-group-rules', {
'POST': [security_group_rules_controller, 'create']
}),
Expand Down
20 changes: 0 additions & 20 deletions nova/api/openstack/compute/security_group_default_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
from nova.policies import security_group_default_rules as sgdr_policies


ALIAS = "os-security-group-default-rules"


class SecurityGroupDefaultRulesController(sg.SecurityGroupControllerBase,
wsgi.Controller):

Expand Down Expand Up @@ -135,20 +132,3 @@ def _format_security_group_default_rule(self, rule):
sg_rule['ip_range'] = {}
sg_rule['ip_range'] = {'cidr': rule['cidr']}
return sg_rule


class SecurityGroupDefaultRules(extensions.V21APIExtensionBase):
"""Default rules for security group support."""
name = "SecurityGroupDefaultRules"
alias = ALIAS
version = 1

def get_resources(self):
resources = [
extensions.ResourceExtension(ALIAS,
SecurityGroupDefaultRulesController())]

return resources

def get_controller_extensions(self):
return []
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ wsgi_scripts =
nova.api.v21.extensions =
baremetal_nodes = nova.api.openstack.compute.baremetal_nodes:BareMetalNodes
extension_info = nova.api.openstack.compute.extension_info:ExtensionInfo
security_group_default_rules = nova.api.openstack.compute.security_group_default_rules:SecurityGroupDefaultRules
versions = nova.api.openstack.compute.versionsV21:Versions
volumes = nova.api.openstack.compute.volumes:Volumes

Expand Down

0 comments on commit 7f48413

Please sign in to comment.