diff --git a/nova/api/openstack/compute/server_groups.py b/nova/api/openstack/compute/server_groups.py index ffed5b6bf2..f484eb0769 100644 --- a/nova/api/openstack/compute/server_groups.py +++ b/nova/api/openstack/compute/server_groups.py @@ -84,7 +84,7 @@ class ServerGroupController(wsgi.Controller): @wsgi.response(204) @extensions.expected_errors(404) def delete(self, req, id): - """Delete an server group.""" + """Delete a server group.""" context = _authorize_context(req, 'delete') try: sg = objects.InstanceGroup.get_by_uuid(context, id) diff --git a/nova/policies/server_groups.py b/nova/policies/server_groups.py index bd303a627d..4edfef955e 100644 --- a/nova/policies/server_groups.py +++ b/nova/policies/server_groups.py @@ -27,21 +27,54 @@ server_groups_policies = [ policy.RuleDefault( name=POLICY_ROOT % 'discoverable', check_str=base.RULE_ANY), + # TODO(Kevin_Zheng): remove this rule as this not used by any API policy.RuleDefault( name=BASE_POLICY_NAME, check_str=base.RULE_ADMIN_OR_OWNER), - policy.RuleDefault( - name=POLICY_ROOT % 'create', - check_str=BASE_POLICY_RULE), - policy.RuleDefault( - name=POLICY_ROOT % 'delete', - check_str=BASE_POLICY_RULE), - policy.RuleDefault( - name=POLICY_ROOT % 'index', - check_str=BASE_POLICY_RULE), - policy.RuleDefault( - name=POLICY_ROOT % 'show', - check_str=BASE_POLICY_RULE), + base.create_rule_default( + POLICY_ROOT % 'create', + BASE_POLICY_RULE, + "Create a new server group", + [ + { + 'path': '/os-server-groups', + 'method': 'POST' + } + ] + ), + base.create_rule_default( + POLICY_ROOT % 'delete', + BASE_POLICY_RULE, + "Delete a server group", + [ + { + 'path': '/os-server-groups/{server_group_id}', + 'method': 'DELETE' + } + ] + ), + base.create_rule_default( + POLICY_ROOT % 'index', + BASE_POLICY_RULE, + "List all server groups", + [ + { + 'path': '/os-server-groups', + 'method': 'GET' + } + ] + ), + base.create_rule_default( + POLICY_ROOT % 'show', + BASE_POLICY_RULE, + "Show details of a server group", + [ + { + 'path': '/os-server-groups/{server_group_id}', + 'method': 'GET' + } + ] + ), ]