Merge "Added ext2 into extend_fs method in fuel_agent"
This commit is contained in:
commit
2c31e26618
@ -24,21 +24,30 @@ class TestFSUtils(test_base.BaseTestCase):
|
||||
|
||||
@mock.patch.object(utils, 'execute')
|
||||
def test_make_fs(self, mock_exec):
|
||||
fu.make_fs('ext4', ' -F ', ' -L fake_label ', '/dev/fake')
|
||||
fu.make_fs('ext4', '-F', '-L fake_label', '/dev/fake')
|
||||
mock_exec.assert_called_once_with('mkfs.ext4', '-F', '-L',
|
||||
'fake_label', '/dev/fake')
|
||||
|
||||
@mock.patch.object(utils, 'execute')
|
||||
def test_make_fs_swap(self, mock_exec):
|
||||
fu.make_fs('swap', ' -f ', ' -L fake_label ', '/dev/fake')
|
||||
fu.make_fs('swap', '-f', '-L fake_label', '/dev/fake')
|
||||
mock_exec.assert_called_once_with('mkswap', '-f', '-L', 'fake_label',
|
||||
'/dev/fake')
|
||||
|
||||
@mock.patch.object(utils, 'execute')
|
||||
def test_extend_fs_ok_ext2(self, mock_exec):
|
||||
fu.extend_fs('ext2', '/dev/fake')
|
||||
expected_calls = [
|
||||
mock.call('e2fsck', '-yf', '/dev/fake', check_exit_code=[0]),
|
||||
mock.call('resize2fs', '/dev/fake', check_exit_code=[0])
|
||||
]
|
||||
self.assertEqual(mock_exec.call_args_list, expected_calls)
|
||||
|
||||
@mock.patch.object(utils, 'execute')
|
||||
def test_extend_fs_ok_ext3(self, mock_exec):
|
||||
fu.extend_fs('ext3', '/dev/fake')
|
||||
expected_calls = [
|
||||
mock.call('e2fsck', ' -f', '/dev/fake', check_exit_code=[0]),
|
||||
mock.call('e2fsck', '-yf', '/dev/fake', check_exit_code=[0]),
|
||||
mock.call('resize2fs', '/dev/fake', check_exit_code=[0])
|
||||
]
|
||||
self.assertEqual(mock_exec.call_args_list, expected_calls)
|
||||
@ -47,7 +56,7 @@ class TestFSUtils(test_base.BaseTestCase):
|
||||
def test_extend_fs_ok_ext4(self, mock_exec):
|
||||
fu.extend_fs('ext4', '/dev/fake')
|
||||
expected_calls = [
|
||||
mock.call('e2fsck', ' -f', '/dev/fake', check_exit_code=[0]),
|
||||
mock.call('e2fsck', '-yf', '/dev/fake', check_exit_code=[0]),
|
||||
mock.call('resize2fs', '/dev/fake', check_exit_code=[0])
|
||||
]
|
||||
self.assertEqual(mock_exec.call_args_list, expected_calls)
|
||||
|
@ -31,10 +31,10 @@ def make_fs(fs_type, fs_options, fs_label, dev):
|
||||
|
||||
|
||||
def extend_fs(fs_type, fs_dev):
|
||||
if fs_type in ('ext3', 'ext4'):
|
||||
if fs_type in ('ext2', 'ext3', 'ext4'):
|
||||
# ext3,4 file system can be mounted
|
||||
# must be checked with e2fsck -f
|
||||
utils.execute('e2fsck', ' -f', fs_dev, check_exit_code=[0])
|
||||
utils.execute('e2fsck', '-yf', fs_dev, check_exit_code=[0])
|
||||
utils.execute('resize2fs', fs_dev, check_exit_code=[0])
|
||||
elif fs_type == 'xfs':
|
||||
# xfs file system must be mounted
|
||||
|
Loading…
Reference in New Issue
Block a user