Merge "Add snapshot_metadata operations to policy.json"

This commit is contained in:
Jenkins 2016-05-07 04:11:11 +00:00 committed by Gerrit Code Review
commit 8182058fd6
3 changed files with 9 additions and 0 deletions

View File

@ -27,6 +27,9 @@
"volume:get_snapshot": "",
"volume:get_all_snapshots": "",
"volume:update_snapshot": "",
"volume:get_snapshot_metadata": "",
"volume:delete_snapshot_metadata": "",
"volume:update_snapshot_metadata": "",
"volume:extend": "",
"volume:migrate_volume": "rule:admin_api",
"volume:migrate_volume_completion": "rule:admin_api",

View File

@ -1057,6 +1057,7 @@ class API(base.Base):
resource=volume)
return db_meta
@wrap_check_policy
def get_snapshot_metadata(self, context, snapshot):
"""Get all metadata associated with a snapshot."""
snapshot_obj = self.get_snapshot(context, snapshot.id)
@ -1064,6 +1065,7 @@ class API(base.Base):
resource=snapshot)
return snapshot_obj.metadata
@wrap_check_policy
def delete_snapshot_metadata(self, context, snapshot, key):
"""Delete the given metadata item from a snapshot."""
snapshot_obj = self.get_snapshot(context, snapshot.id)
@ -1071,6 +1073,7 @@ class API(base.Base):
LOG.info(_LI("Delete snapshot metadata completed successfully."),
resource=snapshot)
@wrap_check_policy
def update_snapshot_metadata(self, context,
snapshot, metadata,
delete=False):

View File

@ -19,6 +19,9 @@
"volume:create_snapshot": "rule:admin_or_owner",
"volume:delete_snapshot": "rule:admin_or_owner",
"volume:update_snapshot": "rule:admin_or_owner",
"volume:get_snapshot_metadata": "rule:admin_or_owner",
"volume:delete_snapshot_metadata": "rule:admin_or_owner",
"volume:update_snapshot_metadata": "rule:admin_or_owner",
"volume:extend": "rule:admin_or_owner",
"volume:update_readonly_flag": "rule:admin_or_owner",
"volume:retype": "rule:admin_or_owner",