Update LVM volume extend

- do *not* skip fsck when extending
- have extend resize the filesystem itself
  rather than making a separate execution
  of ``resize2fs``

Due to an issue with Gerrit, we're unable
to preserve the Change-ID for this change.
The change-id in stable/ussuri and in the
main branch is I67ac549e790322c56d02db4424ec01a5449e6633

Closes-bug: #1887694
Change-Id: Ieebd69ec9671d48f2d9de0ae3e110518cba4f6f9
(cherry picked from commit c94e1deff1)
(cherry picked from commit 2a3c18edcd)
(cherry picked from commit 2063c93c07)
(cherry picked from commit e378f44598)
(cherry picked from commit d8c433044b)
This commit is contained in:
Tom Barron 2020-07-10 11:15:22 -04:00
parent 6383da68b7
commit eee6c4218f
2 changed files with 2 additions and 5 deletions

View File

@ -108,7 +108,7 @@ class LVMMixin(driver.ExecuteMixin):
device_name, run_as_root=True)
def _extend_container(self, share, device_name, size):
cmd = ['lvextend', '-L', '%sG' % size, '-n', device_name]
cmd = ['lvextend', '-L', '%sG' % size, '-r', device_name]
self._try_execute(*cmd, run_as_root=True)
def _deallocate_container(self, share_name):
@ -392,7 +392,6 @@ class LVMShareDriver(LVMMixin, driver.ShareDriver):
def extend_share(self, share, new_size, share_server=None):
device_name = self._get_local_path(share)
self._extend_container(share, device_name, new_size)
self._execute('resize2fs', device_name, run_as_root=True)
def revert_to_snapshot(self, context, snapshot, share_access_rules,
snapshot_access_rules, share_server=None):

View File

@ -487,8 +487,6 @@ class LVMShareDriverTestCase(test.TestCase):
self._driver.extend_share(self.share, 3)
self._driver._extend_container.assert_called_once_with(self.share,
local_path, 3)
self._driver._execute.assert_called_once_with('resize2fs', local_path,
run_as_root=True)
def test_ssh_exec_as_root(self):
command = ['fake_command']
@ -511,7 +509,7 @@ class LVMShareDriverTestCase(test.TestCase):
'lvextend',
'-L',
'3G',
'-n',
'-r',
'device_name',
run_as_root=True)