Update LVM volume extend

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

Closes-bug: #1887694
Change-Id: I67ac549e790322c56d02db4424ec01a5449e6633
This commit is contained in:
Tom Barron 2020-07-10 11:15:22 -04:00 committed by Goutham Pacha Ravi
parent ece804038f
commit c94e1deff1
2 changed files with 2 additions and 5 deletions

View File

@ -98,7 +98,7 @@ class LVMMixin(driver.ExecuteMixin):
device_name, run_as_root=True) device_name, run_as_root=True)
def _extend_container(self, share, device_name, size): 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) self._try_execute(*cmd, run_as_root=True)
def _deallocate_container(self, share_name): def _deallocate_container(self, share_name):
@ -379,7 +379,6 @@ class LVMShareDriver(LVMMixin, driver.ShareDriver):
def extend_share(self, share, new_size, share_server=None): def extend_share(self, share, new_size, share_server=None):
device_name = self._get_local_path(share) device_name = self._get_local_path(share)
self._extend_container(share, device_name, new_size) 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, def revert_to_snapshot(self, context, snapshot, share_access_rules,
snapshot_access_rules, share_server=None): snapshot_access_rules, share_server=None):

View File

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