Merge "Improve exception msg when attaching/detaching volumes"

This commit is contained in:
Jenkins 2016-02-27 04:38:30 +00:00 committed by Gerrit Code Review
commit a9b6e2759e
1 changed files with 12 additions and 4 deletions

View File

@ -413,9 +413,13 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
_('Failed to attach volume %s') % volume['id']) _('Failed to attach volume %s') % volume['id'])
time.sleep(1) time.sleep(1)
else: else:
err_msg = {
'volume_id': volume['id'],
'max_time': self.configuration.max_time_to_attach
}
raise exception.ManilaException( raise exception.ManilaException(
_('Volume have not been attached in %ss. Giving up') % _('Volume %(volume_id)s has not been attached in '
self.configuration.max_time_to_attach) '%(max_time)ss. Giving up.') % err_msg)
return do_attach(volume) return do_attach(volume)
def _get_volume_name(self, share_id): def _get_volume_name(self, share_id):
@ -506,9 +510,13 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
break break
time.sleep(1) time.sleep(1)
else: else:
err_msg = {
'volume_id': volume['id'],
'max_time': self.configuration.max_time_to_attach
}
raise exception.ManilaException( raise exception.ManilaException(
_('Volume have not been detached in %ss. Giving up') _('Volume %(volume_id)s has not been detached in '
% self.configuration.max_time_to_attach) '%(max_time)ss. Giving up.') % err_msg)
do_detach() do_detach()
def _allocate_container(self, context, share, snapshot=None): def _allocate_container(self, context, share, snapshot=None):