Protect cinder list against permission issues

When listing all cinder volumes the user may not have
permissions to see the volume transfers.
This patch makes it so the call to transfer_list
is protected against Forbiden errir so the user can still
see the volume list.

Change-Id: I575ffebcd5084165e72f6e100ed43b4d3f358e98
Closes-Bug: #1541094
This commit is contained in:
Itxaka 2016-02-08 08:39:50 +01:00
parent 4b5886d276
commit 64499a730d

View File

@ -682,8 +682,12 @@ def transfer_list(request, detailed=True, search_opts=None):
search option: {'all_tenants': 1}
"""
c_client = cinderclient(request)
return [VolumeTransfer(v) for v in c_client.transfers.list(
detailed=detailed, search_opts=search_opts)]
try:
return [VolumeTransfer(v) for v in c_client.transfers.list(
detailed=detailed, search_opts=search_opts)]
except cinder_exception.Forbidden as error:
LOG.error(error)
return []
def transfer_get(request, transfer_id):