diff --git a/cinder/brick/local_dev/lvm.py b/cinder/brick/local_dev/lvm.py index ea75b8fecd9..61a3c23faf0 100644 --- a/cinder/brick/local_dev/lvm.py +++ b/cinder/brick/local_dev/lvm.py @@ -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) diff --git a/cinder/tests/unit/brick/test_brick_lvm.py b/cinder/tests/unit/brick/test_brick_lvm.py index df092b3ad71..b4605446b58 100644 --- a/cinder/tests/unit/brick/test_brick_lvm.py +++ b/cinder/tests/unit/brick/test_brick_lvm.py @@ -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()