Fix: unable to delete instance when cinder is down
Ignore any cinder related exceptions that arise when you try to delete
an instance, so that the delete instance workflow isn't abruptly
interrupted (skipping necessary clean-up, etc).
In this case, we are intentionally catching all exceptions in addition
to a specific set of exceptions, so that the instance and related
resources aren't left in an unmanageable state when an unexpected
exception occurs. For example, currently you can't delete an instance
that's attached to a volume when cinder is down.
The existing error messages were also updated to include the block
device mapping volume id that triggered the exception.
Change-Id: Iba7b4cc4b59f88b0817c4618e7a4429161d6c2a9
Closes-Bug: #1563547
(cherry picked from commit 27e869bb88
)
This commit is contained in:
parent
4260ae7366
commit
167bd70028
|
@ -2366,12 +2366,20 @@ class ComputeManager(manager.Manager):
|
|||
instance=instance)
|
||||
except (cinder_exception.EndpointNotFound,
|
||||
keystone_exception.EndpointNotFound) as exc:
|
||||
LOG.warning(_LW('Ignoring EndpointNotFound: %s'), exc,
|
||||
LOG.warning(_LW('Ignoring EndpointNotFound for '
|
||||
'volume %(volume_id)s: %(exc)s'),
|
||||
{'exc': exc, 'volume_id': bdm.volume_id},
|
||||
instance=instance)
|
||||
except cinder_exception.ClientException as exc:
|
||||
LOG.warning(_LW('Ignoring Unknown cinder exception: %s'), exc,
|
||||
LOG.warning(_LW('Ignoring unknown cinder exception for '
|
||||
'volume %(volume_id)s: %(exc)s'),
|
||||
{'exc': exc, 'volume_id': bdm.volume_id},
|
||||
instance=instance)
|
||||
except Exception as exc:
|
||||
LOG.warning(_LW('Ignoring unknown exception for '
|
||||
'volume %(volume_id)s: %(exc)s'),
|
||||
{'exc': exc, 'volume_id': bdm.volume_id},
|
||||
instance=instance)
|
||||
|
||||
if vol_bdms:
|
||||
LOG.info(_LI('Took %(time).2f seconds to detach %(num)s volumes '
|
||||
'for instance.'),
|
||||
|
|
|
@ -1111,6 +1111,10 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase):
|
|||
exc = exception.DiskNotFound(location="not\\here")
|
||||
self._test_shutdown_instance_exception(exc)
|
||||
|
||||
def test_shutdown_instance_other_exception(self):
|
||||
exc = Exception('some other exception')
|
||||
self._test_shutdown_instance_exception(exc)
|
||||
|
||||
def _test_init_instance_retries_reboot(self, instance, reboot_type,
|
||||
return_power_state):
|
||||
instance.host = self.compute.host
|
||||
|
|
Loading…
Reference in New Issue