Merge "block_device: Rollback volumes to in-use on DeviceDetachFailed" into stable/pike

This commit is contained in:
Zuul 2018-08-25 05:45:13 +00:00 committed by Gerrit Code Review
commit b612a63c36
2 changed files with 3 additions and 0 deletions

View File

@ -239,6 +239,8 @@ class TestDriverBlockDevice(test.NoDBTestCase):
self.context, inst, vol_api, virt)
self.assertFalse(log.exception.called)
self.assertTrue(log.warning.called)
vol_api.roll_detaching.assert_called_once_with(self.context,
driver_bdm.volume_id)
def test_no_device_raises(self):
for name, cls in self.driver_classes.items():

View File

@ -285,6 +285,7 @@ class DriverVolumeBlockDevice(DriverBlockDevice):
with excutils.save_and_reraise_exception():
LOG.warning('Guest refused to detach volume %(vol)s',
{'vol': volume_id}, instance=instance)
volume_api.roll_detaching(context, volume_id)
except Exception:
with excutils.save_and_reraise_exception():
LOG.exception('Failed to detach volume '