Remove unneeded calls to shade_exceptions

Change-Id: I3dce6e9a9e25e763e4daa2be0495521876a27fd4
Signed-off-by: Rosario Di Somma <rosario.disomma@dreamhost.com>
This commit is contained in:
Rosario Di Somma 2017-06-08 17:56:32 +00:00
parent 187e278ffb
commit 40c4f3ca15
2 changed files with 17 additions and 17 deletions

View File

@ -1684,11 +1684,12 @@ class OpenStackCloud(
:returns: A list of volume ``munch.Munch``.
"""
with _utils.shade_exceptions("Error fetching volume_type list"):
data = self._volume_client.get(
'/types', params=dict(is_public='None'))
return self._normalize_volume_types(
data.get('volume_types', []))
data = self._volume_client.get(
'/types',
params=dict(is_public='None'),
error_message='Error fetching volume_type list')
return self._normalize_volume_types(
data.get('volume_types', []))
@_utils.cache_on_arguments()
def list_availability_zone_names(self, unavailable=False):
@ -3839,10 +3840,11 @@ class OpenStackCloud(
if 'scheduler_hints' in kwargs:
payload['OS-SCH-HNT:scheduler_hints'] = kwargs.pop(
'scheduler_hints', None)
with _utils.shade_exceptions("Error in creating volume"):
data = self._volume_client.post(
'/volumes', json=dict(payload))
volume = data.get('volume', {})
data = self._volume_client.post(
'/volumes',
json=dict(payload),
error_message='Error in creating volume')
volume = data.get('volume', {})
self.list_volumes.invalidate(self)
if volume['status'] == 'error':

View File

@ -1987,14 +1987,12 @@ class OperatorCloud(openstackcloud.OpenStackCloud):
raise OpenStackCloudException(
"VolumeType not found: %s" % name_or_id)
with _utils.shade_exceptions(
"Unable to get volume type access {name}".format(
name=name_or_id)):
data = self._volume_client.get(
'/types/{id}/os-volume-type-access'.format(
id=volume_type.id))
return self._normalize_volume_type_accesses(
data.get('volume_type_access', []))
data = self._volume_client.get(
'/types/{id}/os-volume-type-access'.format(id=volume_type.id),
error_message="Unable to get volume type access"
" {name}".format(name=name_or_id))
return self._normalize_volume_type_accesses(
data.get('volume_type_access', []))
def add_volume_type_access(self, name_or_id, project_id):
"""Grant access on a volume_type to a project.