From b9152b925cadcda7781fe3a32317e362d76ab1b2 Mon Sep 17 00:00:00 2001 From: Logan V Date: Sat, 3 Sep 2016 17:58:01 -0500 Subject: [PATCH] Compress base container using parallel xz The package for pxz is installed but was not being used, so the base container compression was only using 1 core during compression. This change allows pxz to be used which will compress much faster when multiple cores are available. Change-Id: I7eee214a69762b36c9bb2b23edad5688189bb967 --- tasks/lxc_cache_create.yml | 2 +- vars/redhat-7.yml | 2 ++ vars/ubuntu-14.04.yml | 2 ++ vars/ubuntu-16.04.yml | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tasks/lxc_cache_create.yml b/tasks/lxc_cache_create.yml index 4c33810c..fd72ff96 100644 --- a/tasks/lxc_cache_create.yml +++ b/tasks/lxc_cache_create.yml @@ -25,7 +25,7 @@ # provide for the options needed to properly create an LXC image archive. - name: Create lxc image shell: | - tar -Opc -C /var/lib/lxc/LXC_NAME/rootfs . | xz -{{ lxc_image_compression_ratio }} -c - > rootfs.tar.xz + tar -Opc -C /var/lib/lxc/LXC_NAME/rootfs . | {{ lxc_xz_bin }} -{{ lxc_image_compression_ratio }} -c - > rootfs.tar.xz args: chdir: "{{ lxc_container_cache_path }}/{{ lxc_cache_map.distro }}/{{ lxc_cache_map.release }}/{{ lxc_cache_map.arch }}/default/" notify: Destroy base container diff --git a/vars/redhat-7.yml b/vars/redhat-7.yml index b17f4524..2e3eb813 100644 --- a/vars/redhat-7.yml +++ b/vars/redhat-7.yml @@ -39,6 +39,8 @@ lxc_hosts_distro_packages: - redhat-lsb - xz +lxc_xz_bin: xz + lxc_cache_map: distro: centos arch: amd64 diff --git a/vars/ubuntu-14.04.yml b/vars/ubuntu-14.04.yml index ddc5eab2..62aabe1a 100644 --- a/vars/ubuntu-14.04.yml +++ b/vars/ubuntu-14.04.yml @@ -36,6 +36,8 @@ lxc_hosts_distro_packages: - python3-lxc - pxz +lxc_xz_bin: pxz + system_config_dir: "/etc/default" lxc_cache_map: distro: ubuntu diff --git a/vars/ubuntu-16.04.yml b/vars/ubuntu-16.04.yml index a6e79a59..554ea861 100644 --- a/vars/ubuntu-16.04.yml +++ b/vars/ubuntu-16.04.yml @@ -37,6 +37,8 @@ lxc_hosts_distro_packages: - python3-lxc - pxz +lxc_xz_bin: pxz + system_config_dir: "/etc/default" lxc_cache_map: distro: ubuntu