Add retry to LVM deactivation

We are seeing occassional failures to deactivate logical volumes in
tempest runs. We retry on the wait for the state change, but we if that
doesn't succeed we just give up.

This adds a retry to the whole deactivation process to see if requesting
again has better luck deactivating the volume.

Change-Id: I1f9546c39ea05abe524e6f38395754d331b201cd
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
(cherry picked from commit 49f3c57d97)
(cherry picked from commit 1e3a08addf)
This commit is contained in:
Sean McGinnis 2018-08-13 16:13:53 -05:00
parent 80e29d3ad5
commit c0f1018f20
1 changed files with 2 additions and 1 deletions

View File

@ -621,6 +621,7 @@ class LVM(executor.Executor):
return True
return False
@utils.retry(exception.VolumeNotDeactivated, retries=1, interval=2)
def deactivate_lv(self, name):
lv_path = self.vg_name + '/' + self._mangle_lv_name(name)
cmd = ['lvchange', '-a', 'n']
@ -630,7 +631,7 @@ class LVM(executor.Executor):
root_helper=self._root_helper,
run_as_root=True)
except putils.ProcessExecutionError as err:
LOG.exception('Error deactivating LV')
LOG.exception('Error deactivating LV, retry may be possible')
LOG.error('Cmd :%s', err.cmd)
LOG.error('StdOut :%s', err.stdout)
LOG.error('StdErr :%s', err.stderr)