summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-02-02 16:30:02 +0000
committerGerrit Code Review <review@openstack.org>2013-02-02 16:30:02 +0000
commitb633a27a308290ddbe455ea4a0fa931fecefe414 (patch)
tree6512e6dfdbe9992b13571b048877d0f5c6995b1c /nova/api
parentd4f50bac65a420f9610bf958480f2b5a0462c871 (diff)
parent8d68cf8608a863dff384c3a701a1d969d4453e49 (diff)
Merge "Condense multiple authorizers into a single one."
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/volumes.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/nova/api/openstack/compute/contrib/volumes.py b/nova/api/openstack/compute/contrib/volumes.py
index 3fc503217..0ab93db35 100644
--- a/nova/api/openstack/compute/contrib/volumes.py
+++ b/nova/api/openstack/compute/contrib/volumes.py
@@ -33,14 +33,8 @@ from nova import volume
LOG = logging.getLogger(__name__)
authorize = extensions.extension_authorizer('compute', 'volumes')
-authorize_attach_index = extensions.extension_authorizer('compute',
- 'volume_attachments:index')
-authorize_attach_show = extensions.extension_authorizer('compute',
- 'volume_attachments:show')
-authorize_attach_create = extensions.extension_authorizer('compute',
- 'volume_attachments:create')
-authorize_attach_delete = extensions.extension_authorizer('compute',
- 'volume_attachments:delete')
+authorize_attach = extensions.extension_authorizer('compute',
+ 'volume_attachments')
def _translate_volume_detail_view(context, vol):
@@ -339,7 +333,7 @@ class VolumeAttachmentController(wsgi.Controller):
def index(self, req, server_id):
"""Returns the list of volume attachments for a given instance."""
context = req.environ['nova.context']
- authorize_attach_index(context)
+ authorize_attach(context, action='index')
return self._items(req, server_id,
entity_maker=_translate_attachment_summary_view)
@@ -348,7 +342,7 @@ class VolumeAttachmentController(wsgi.Controller):
"""Return data about the given volume attachment."""
context = req.environ['nova.context']
authorize(context)
- authorize_attach_show(context)
+ authorize_attach(context, action='show')
volume_id = id
try:
@@ -389,7 +383,7 @@ class VolumeAttachmentController(wsgi.Controller):
"""Attach a volume to an instance."""
context = req.environ['nova.context']
authorize(context)
- authorize_attach_create(context)
+ authorize_attach(context, action='create')
if not self.is_valid_body(body, 'volumeAttachment'):
raise exc.HTTPUnprocessableEntity()
@@ -436,7 +430,7 @@ class VolumeAttachmentController(wsgi.Controller):
"""Detach a volume from an instance."""
context = req.environ['nova.context']
authorize(context)
- authorize_attach_delete(context)
+ authorize_attach(context, action='delete')
volume_id = id
LOG.audit(_("Detach volume %s"), volume_id, context=context)