diff --git a/nova/policies/aggregates.py b/nova/policies/aggregates.py index 030815911..c4d708de6 100644 --- a/nova/policies/aggregates.py +++ b/nova/policies/aggregates.py @@ -22,33 +22,89 @@ POLICY_ROOT = 'os_compute_api:os-aggregates:%s' aggregates_policies = [ - policy.RuleDefault( - name=POLICY_ROOT % 'set_metadata', - check_str=base.RULE_ADMIN_API), - policy.RuleDefault( - name=POLICY_ROOT % 'add_host', - check_str=base.RULE_ADMIN_API), + base.create_rule_default( + POLICY_ROOT % 'set_metadata', + base.RULE_ADMIN_API, + "Create or replace metadata for an aggregate", + [ + { + 'path': '/os-aggregates/{aggregate_id}/action (set_metadata)', + 'method': 'POST' + } + ]), + base.create_rule_default( + POLICY_ROOT % 'add_host', + base.RULE_ADMIN_API, + "Add a host to an aggregate.", + [ + { + 'path': '/os-aggregates/{aggregate_id}/action (add_host)', + 'method': 'POST' + } + ]), policy.RuleDefault( name=POLICY_ROOT % 'discoverable', check_str=base.RULE_ANY), - policy.RuleDefault( - name=POLICY_ROOT % 'create', - check_str=base.RULE_ADMIN_API), - policy.RuleDefault( - name=POLICY_ROOT % 'remove_host', - check_str=base.RULE_ADMIN_API), - policy.RuleDefault( - name=POLICY_ROOT % 'update', - check_str=base.RULE_ADMIN_API), - policy.RuleDefault( - name=POLICY_ROOT % 'index', - check_str=base.RULE_ADMIN_API), - policy.RuleDefault( - name=POLICY_ROOT % 'delete', - check_str=base.RULE_ADMIN_API), - policy.RuleDefault( - name=POLICY_ROOT % 'show', - check_str=base.RULE_ADMIN_API), + base.create_rule_default( + POLICY_ROOT % 'create', + base.RULE_ADMIN_API, + "Create an aggregate", + [ + { + 'path': '/os-aggregates', + 'method': 'POST' + } + ]), + base.create_rule_default( + POLICY_ROOT % 'remove_host', + base.RULE_ADMIN_API, + "Remove a host from an aggregate", + [ + { + 'path': '/os-aggregates/{aggregate_id}/action (remove_host)', + 'method': 'POST' + } + ]), + base.create_rule_default( + POLICY_ROOT % 'update', + base.RULE_ADMIN_API, + "Update name and/or availability zone for an aggregate", + [ + { + 'path': '/os-aggregates/{aggregate_id}', + 'method': 'PUT' + } + ]), + base.create_rule_default( + POLICY_ROOT % 'index', + base.RULE_ADMIN_API, + "List all aggregates", + [ + { + 'path': '/os-aggregates', + 'method': 'GET' + } + ]), + base.create_rule_default( + POLICY_ROOT % 'delete', + base.RULE_ADMIN_API, + "Delete an aggregate", + [ + { + 'path': '/os-aggregates/{aggregate_id}', + 'method': 'DELETE' + } + ]), + base.create_rule_default( + POLICY_ROOT % 'show', + base.RULE_ADMIN_API, + "Show details for an aggregate.", + [ + { + 'path': '/os-aggregates/{aggregate_id}', + 'method': 'GET' + } + ]), ]