LVM: Retry lvextend commands on code 139

Retry lvextend commands upon segfault, similar to other
LVM calls.  This affects the volume extend path.

Change-Id: I0c0cb5308246a3dce736eade67b40be063aa78bb
Related-Bug: #1901783
Related-Bug: #1932188
Closes-Bug: #1940436
This commit is contained in:
Eric Harney 2021-08-18 09:19:58 -04:00
parent a22c913c79
commit c4b8956763
2 changed files with 2 additions and 3 deletions

View File

@ -832,8 +832,7 @@ class LVM(executor.Executor):
try:
cmd = LVM.LVM_CMD_PREFIX + ['lvextend', '-L', new_size,
'%s/%s' % (self.vg_name, lv_name)]
self._execute(*cmd, root_helper=self._root_helper,
run_as_root=True)
self._run_lvm_command(cmd)
except putils.ProcessExecutionError as err:
LOG.exception('Error extending Volume')
LOG.error('Cmd :%s', err.cmd)

View File

@ -456,7 +456,7 @@ class BrickLvmTestCase(test.TestCase):
@ddt.data(True, False)
def test_lv_extend(self, has_snapshot):
with mock.patch.object(self.vg, '_execute'):
with mock.patch.object(self.vg, '_execute', return_value=('', '')):
with mock.patch.object(self.vg, 'lv_has_snapshot'):
self.vg.deactivate_lv = mock.MagicMock()
self.vg.activate_lv = mock.MagicMock()