[lxc-devel] [PATCH] lxc-test-usernic: avoid extra downloads

Serge Hallyn serge.hallyn at ubuntu.com
Thu Aug 21 16:01:38 UTC 2014


If the host has the ubuntu trusty download image in /var/cache/lxc,
copy that into lxc-user-nic's account so we can avoid the extra
download.

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
 src/tests/lxc-test-usernic.in | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/tests/lxc-test-usernic.in b/src/tests/lxc-test-usernic.in
index 395c453..1e9485b 100755
--- a/src/tests/lxc-test-usernic.in
+++ b/src/tests/lxc-test-usernic.in
@@ -109,6 +109,13 @@ fi
 mkdir -p /run/user/$(id -u usernic-user)
 chown -R usernic-user: /run/user/$(id -u usernic-user) /home/usernic-user
 
+# Copy in the cached trusty download image if the host has it
+if [ -d /var/cache/lxc/download/ubuntu/trusty/amd64/default ]; then
+	run_cmd "mkdir -p /home/usernic-user/.cache/lxc/download/ubuntu/trusty/amd64/default/"
+	cp /var/cache/lxc/download/ubuntu/trusty/amd64/default/* /home/usernic-user/.cache/lxc/download/ubuntu/trusty/amd64/default/
+	chown -R usernic-user: /home/usernic-user/.cache
+fi
+
 # Create two test bridges
 brctl addbr usernic-br0
 brctl addbr usernic-br1
-- 
2.1.0.rc1



More information about the lxc-devel mailing list