Merge "Handle BadRequest in VolumeDetachTask"

This commit is contained in:
Jenkins 2013-10-03 00:34:06 +00:00 committed by Gerrit Code Review
commit d61a8980bf
2 changed files with 9 additions and 3 deletions

View File

@ -230,8 +230,9 @@ class VolumeDetachTask(object):
try:
server_api.delete_server_volume(self.server_id, self.volume_id)
except clients.novaclient.exceptions.NotFound:
logger.warning('%s - not found' % str(self))
except (clients.novaclient.exceptions.BadRequest,
clients.novaclient.exceptions.NotFound) as e:
logger.warning('%s - %s' % (str(self), str(e)))
yield
@ -244,7 +245,8 @@ class VolumeDetachTask(object):
try:
server_api.delete_server_volume(self.server_id,
self.volume_id)
except clients.novaclient.exceptions.NotFound:
except (clients.novaclient.exceptions.BadRequest,
clients.novaclient.exceptions.NotFound):
pass
vol.get()

View File

@ -302,6 +302,10 @@ class VolumeTest(HeatTestCase):
self.cinder_fc.volumes.get('vol-123').AndReturn(fva)
self.fc.volumes.delete_server_volume(
'WikiDatabase', 'vol-123').AndRaise(
clients.novaclient.exceptions.BadRequest('Already detached'))
self.fc.volumes.delete_server_volume(
'WikiDatabase', 'vol-123').AndRaise(
clients.novaclient.exceptions.NotFound('Not found'))