From c2d3e80658801ca2ac91899479e525538f233fb1 Mon Sep 17 00:00:00 2001 From: He Jie Xu Date: Tue, 2 May 2017 11:21:47 +0800 Subject: [PATCH] Add description to policies in extended_status and extended_volumes This updates the policy doc for extended_status.py and extended_volumes.py Partial implement blueprint policy-docs Change-Id: I980eff5fd118601ecdf61c558013f3abba56a6ce --- nova/policies/extended_status.py | 25 ++++++++++++++++++++----- nova/policies/extended_volumes.py | 20 +++++++++++++++----- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/nova/policies/extended_status.py b/nova/policies/extended_status.py index 04ae6882dced..049a3d1b02f5 100644 --- a/nova/policies/extended_status.py +++ b/nova/policies/extended_status.py @@ -13,8 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_policy import policy - from nova.policies import base @@ -22,9 +20,26 @@ BASE_POLICY_NAME = 'os_compute_api:os-extended-status' extended_status_policies = [ - policy.RuleDefault( - name=BASE_POLICY_NAME, - check_str=base.RULE_ADMIN_OR_OWNER), + base.create_rule_default( + BASE_POLICY_NAME, + base.RULE_ADMIN_OR_OWNER, + """Return extended status in the response of server. + +This policy will control the visibility for a set of attributes: + OS-EXT-STS:task_state + OS-EXT-STS:vm_state + OS-EXT-STS:power_state +""", + [ + { + 'method': 'GET', + 'path': '/servers/{id}' + }, + { + 'method': 'GET', + 'path': '/servers/detail' + } + ]), ] diff --git a/nova/policies/extended_volumes.py b/nova/policies/extended_volumes.py index 574117a79963..d3bf93c4e8a9 100644 --- a/nova/policies/extended_volumes.py +++ b/nova/policies/extended_volumes.py @@ -13,8 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_policy import policy - from nova.policies import base @@ -22,9 +20,21 @@ BASE_POLICY_NAME = 'os_compute_api:os-extended-volumes' extended_volumes_policies = [ - policy.RuleDefault( - name=BASE_POLICY_NAME, - check_str=base.RULE_ADMIN_OR_OWNER), + base.create_rule_default( + BASE_POLICY_NAME, + base.RULE_ADMIN_OR_OWNER, + "Return 'os-extended-volumes:volumes_attached' in the response of " + "server.", + [ + { + 'method': 'GET', + 'path': '/servers/{id}' + }, + { + 'method': 'GET', + 'path': '/servers/detail' + } + ]), ]