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

View File

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