Detach volumes when unavailable

This patch makes sure we detach a volume if is unavailable before
raising a DeviceUnavailable exception.
This commit is contained in:
Gorka Eguileor 2018-09-06 11:55:36 +02:00
parent 0c2a82a8bf
commit f6cb4ed3b3
2 changed files with 5 additions and 0 deletions

View File

@ -5,6 +5,10 @@ History
0.2.3 (2018-MM-DD)
------------------
- Bug fixes:
- Detach a volume when it's unavailable.
- Features:
- Provide better message when device is not available.

View File

@ -726,6 +726,7 @@ class Connection(Object, LazyVolumeAttr):
LOG.exception(error_msg)
if error_msg:
self.detach(force=True, ignore_errors=True)
raise cinder_exception.DeviceUnavailable(
path=self.path, attach_info=self._ovo.connection_information,
reason=error_msg)