Retry on closing of luks encrypted volume in case device is busy

We're seeing races in the gate on detach of an encrypted volume where
the device is busy so the detach fails, which causes the delete of the
volume on the cinder side to fail because the volume is still in use and
then Tempest times out waiting for the volume to be deleted.

This simply adds a retry to close the encryption device.  I use
attempts=3 since that's what we use for lvremove.

Closes-Bug: #1374458

Change-Id: Ia0667da7dee247ba8c3338b296244b2a71d1045d
This commit is contained in:
Matt Riedemann 2014-09-26 07:31:49 -07:00
parent 3b43f769c5
commit eef97cdf4b
1 changed files with 2 additions and 1 deletions

View File

@ -102,4 +102,5 @@ class LuksEncryptor(cryptsetup.CryptsetupEncryptor):
"""Closes the device (effectively removes the dm-crypt mapping)."""
LOG.debug("closing encrypted volume %s", self.dev_path)
utils.execute('cryptsetup', 'luksClose', self.dev_name,
run_as_root=True, check_exit_code=True)
run_as_root=True, check_exit_code=True,
attempts=3)