diff --git a/fuel_agent/manager.py b/fuel_agent/manager.py index 8455f799..052a7e27 100644 --- a/fuel_agent/manager.py +++ b/fuel_agent/manager.py @@ -543,6 +543,11 @@ class Manager(object): fs_options=fs.options, fs_label=fs.label, dev=str(fs.device)) + if fs.type == 'ext4': + LOG.debug('Trying to disable journaling for ext4 ' + 'in order to speed up the build') + utils.execute('tune2fs', '-O', '^has_journal', + str(fs.device)) # mounting all images into chroot tree self.mount_target(chroot, treat_mtab=False, pseudo=False) @@ -633,6 +638,16 @@ class Manager(object): self.umount_target(chroot, pseudo=False, try_lazy_umount=False) for image in self.driver.image_scheme.images: + # find fs with the same loop device object + # as image.target_device + fs = self.driver.partition_scheme.fs_by_device( + image.target_device) + + if fs.type == 'ext4': + LOG.debug('Trying to re-enable journaling for ext4') + utils.execute('tune2fs', '-O', 'has_journal', + str(fs.device)) + LOG.debug('Deattaching loop device from file: %s', image.img_tmp_file) bu.deattach_loop(str(image.target_device)) diff --git a/fuel_agent/tests/test_manager.py b/fuel_agent/tests/test_manager.py index f8d99b16..04fd0b99 100644 --- a/fuel_agent/tests/test_manager.py +++ b/fuel_agent/tests/test_manager.py @@ -447,6 +447,10 @@ class TestManager(test_base.BaseTestCase): mock_bu.add_apt_preference.call_args_list) mock_utils.makedirs_if_not_exists.assert_called_once_with( '/tmp/imgdir/proc') + self.assertEqual([ + mock.call('tune2fs', '-O', '^has_journal', '/dev/loop0'), + mock.call('tune2fs', '-O', 'has_journal', '/dev/loop0')], + mock_utils.execute.call_args_list) mock_fu.mount_bind.assert_called_once_with('/tmp/imgdir', '/proc') mock_bu.run_apt_get.assert_called_once_with( '/tmp/imgdir', packages=['fakepackage1', 'fakepackage2'])