Merge "Adding retry ability to cinderclient calls"

This commit is contained in:
Jenkins 2015-05-28 04:02:29 +00:00 committed by Gerrit Code Review
commit a6066a543e
3 changed files with 4 additions and 4 deletions

View File

@ -193,7 +193,7 @@ def _get_cinder_limits():
avail_limits = {}
cinder = cinder_client.client()
lim = {}
for l in cinder.limits.get().absolute:
for l in b.execute_with_retries(cinder.limits.get).absolute:
lim[l.name] = l.value
avail_limits['volumes'] = _sub_limit(lim['maxTotalVolumes'],

View File

@ -124,7 +124,7 @@ def _create_attach_volume(ctx, instance, size, volume_type,
if volume_local_to_instance:
kwargs['scheduler_hints'] = {'local_to_instance': instance.instance_id}
volume = cinder.client().volumes.create(**kwargs)
volume = b.execute_with_retries(cinder.client().volumes.create, **kwargs)
conductor.append_volume(ctx, instance, volume.id)
_await_available(volume)
@ -239,7 +239,7 @@ def _delete_volume(volume_id):
LOG.debug("Deleting volume {volume}".format(volume=volume_id))
volume = cinder.get_volume(volume_id)
try:
volume.delete()
b.execute_with_retries(volume.delete)
except Exception:
LOG.error(_LE("Can't delete volume {volume}").format(
volume=volume.id))

View File

@ -98,4 +98,4 @@ def check_cinder_exists():
def get_volume(volume_id):
return client().volumes.get(volume_id)
return base.execute_with_retries(client().volumes.get, volume_id)