From c0f1018f204a242ab025caa1e0e2dd9f3a0ec499 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Mon, 13 Aug 2018 16:13:53 -0500 Subject: [PATCH] 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 (cherry picked from commit 49f3c57d977e009f715ba21dc7175c931bbb3f70) (cherry picked from commit 1e3a08addffd9d38a83f8a498cc7f9f88c7adc21) --- cinder/brick/local_dev/lvm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cinder/brick/local_dev/lvm.py b/cinder/brick/local_dev/lvm.py index 6c05d588ff4..342720863ed 100644 --- a/cinder/brick/local_dev/lvm.py +++ b/cinder/brick/local_dev/lvm.py @@ -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)