fuel_agent: image build directory can be passed via command line
Make it possible to set the image build directory via the command line. Also create the image build directory if it doesn't exist. The default image build directory (/tmp) can be too slow/small. In particular if fuel_agent runs in a container (which is the case on the Fuel master node) /tmp resides in the container filesystem which is backed by dm-snapshot. dm-snapshot is known to have a poor write performance, especially for large(er) files like OS images. By default docker storage is a loopback file residing in /var/lib/docker. Thus the data written to the OS image being built goes through a number of layers: ext4 -> loop -> dm-snapshot (/var/lib/docker-> loop -> -> ext4 (/var/lib/docker) -> dm-linear (os-varlibdocker) -> -> hard drive which causes substantial IO overhead. If the master node runs on a VM rather than a physcial hardware the above chain gets even more complicated (and write performance gets really afwul): ext4 -> loop -> dm-snapshot (/var/lib/docker-> loop -> -> ext4 (/var/lib/docker) -> dm-linear (os-varlibdocker) -> -> virtual hard drive (qemu) -> qcow2 -> ext4 (host) Using a host volume (mounted at /var/lib/fuel/ibp) as an image build directory eliminates the extra layers so the written data goes through ext4 -> loop -> ext4 -> dm-linear (os-var) -> hard drive so the IBP image build time gets reasonable. Related-Bug: #1457643 Change-Id: Idcafd23e659fcc7c0d7e6087501799834234b34c
This commit is contained in:
parent
21f4b55f16
commit
d28f340a7c
|
@ -67,11 +67,6 @@ opts = [
|
|||
default='empty_rule',
|
||||
help='Correct empty rule for udev daemon',
|
||||
),
|
||||
cfg.StrOpt(
|
||||
'image_build_dir',
|
||||
default='/tmp',
|
||||
help='Directory where the image is supposed to be built',
|
||||
),
|
||||
cfg.StrOpt(
|
||||
'image_build_suffix',
|
||||
default='.fuel-agent-image',
|
||||
|
@ -85,6 +80,11 @@ cli_opts = [
|
|||
default='nailgun',
|
||||
help='Data driver'
|
||||
),
|
||||
cfg.StrOpt(
|
||||
'image_build_dir',
|
||||
default='/tmp',
|
||||
help='Directory where the image is supposed to be built',
|
||||
),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
@ -508,6 +508,7 @@ class Manager(object):
|
|||
'Starting build process.')
|
||||
try:
|
||||
LOG.debug('Creating temporary chroot directory')
|
||||
utils.makedirs_if_not_exists(CONF.image_build_dir)
|
||||
chroot = tempfile.mkdtemp(
|
||||
dir=CONF.image_build_dir, suffix=CONF.image_build_suffix)
|
||||
LOG.debug('Temporary chroot: %s', chroot)
|
||||
|
|
|
@ -445,8 +445,10 @@ class TestManager(test_base.BaseTestCase):
|
|||
chroot='/tmp/imgdir',
|
||||
uri='http://fakemos')],
|
||||
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('/tmp'),
|
||||
mock.call('/tmp/imgdir/proc')],
|
||||
mock_utils.makedirs_if_not_exists.call_args_list)
|
||||
self.assertEqual([
|
||||
mock.call('tune2fs', '-O', '^has_journal', '/dev/loop0'),
|
||||
mock.call('tune2fs', '-O', 'has_journal', '/dev/loop0')],
|
||||
|
|
Loading…
Reference in New Issue