From 26221a267d36b14be1135507ff77ebb9e63daa69 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Sun, 30 Dec 2018 09:10:45 -0600 Subject: [PATCH] Use libeatmydata during nspawn cache prep The nspawn cache prep is timing out regularly so use eatmydata to minimise pressure on the filesystem during package installation. dpkg calls fsync for each file installed from each package which can result in very poor performance on some filesystems. This patch gives around a 4x improvement in "slow" gate runs, and 2x on esxi hdd storage. Change-Id: I80efd3f8044f377a497492f09689c459c6094742 Signed-off-by: Kevin Carter Co-authored-by: Jonathan Rosser --- tasks/nspawn_cache.yml | 6 ------ templates/prep-scripts/nspawn_ubuntu_prep.sh.j2 | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tasks/nspawn_cache.yml b/tasks/nspawn_cache.yml index 326c999..d75c31a 100644 --- a/tasks/nspawn_cache.yml +++ b/tasks/nspawn_cache.yml @@ -93,9 +93,3 @@ with_items: "{{ (nspawn_copy_from_host | union(nspawn_container_cache_files_from_host)) | list }}" when: - nspawn_image_cache_refresh | bool - -- name: Create static MACs in the container - copy: - src: "/etc/systemd/network/99-default.link" - dest: "/var/lib/machines/{{ nspawn_container_base_name }}/etc/systemd/network/99-default.link" - remote_src: true diff --git a/templates/prep-scripts/nspawn_ubuntu_prep.sh.j2 b/templates/prep-scripts/nspawn_ubuntu_prep.sh.j2 index 90a5425..4f589d9 100644 --- a/templates/prep-scripts/nspawn_ubuntu_prep.sh.j2 +++ b/templates/prep-scripts/nspawn_ubuntu_prep.sh.j2 @@ -28,8 +28,10 @@ export DEBIAN_FRONTEND=noninteractive apt-get remove -y --purge snap* nspawn* lxd* resolvconf || true apt-get update -apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes {{ nspawn_container_distro_required_packages | join(' ') }} +apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes eatmydata +export LD_PRELOAD=/usr/lib/{{ ansible_architecture }}-linux-gnu/libeatmydata.so +apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes {{ nspawn_container_distro_required_packages | join(' ') }} apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes {{ nspawn_container_distro_packages | join(' ') }} apt-get upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes apt-get clean