Start lxdbr0 bridge in VCA start_build before configuring mtu
[osm/devops.git] / jenkins / VCA / start_build
index 21d432c..f2b3c94 100755 (executable)
@@ -26,6 +26,7 @@ apt-get update
 apt-get install -y juju lxd squid-deb-proxy
 
 echo 'streams.canonical' > /etc/squid-deb-proxy/mirror-dstdomain.acl.d/20-juju-streams
+service squid-deb-proxy reload
 
 INFO "Configuring LXD"
 # ZFS doesn't work inside a nested container. ZFS should be configured in the host LXD.
@@ -55,6 +56,21 @@ EOF
 systemctl enable lxd-bridge
 systemctl start lxd-bridge
 
+DEFAULT_INTERFACE=$(route -n | awk '$1~/^0.0.0.0/ {print $8}')
+DEFAULT_MTU=$( ip addr show $DEFAULT_INTERFACE | perl -ne 'if (/mtu\s(\d+)/) {print $1;}')
+
+INFO "Setting lxdbr0 MTU to $DEFAULT_MTU"
+ifconfig lxdbr0 mtu $DEFAULT_MTU
+
+# Make the MTU change persistent between reboots
+sed -i '/lxc list/d' /etc/rc.local
+sed -i "$ i lxc list > /dev/null" /etc/rc.local
+sed -i '/ifconfig lxdbr0 mtu/d' /etc/rc.local
+sed -i "$ i ifconfig lxdbr0 mtu $DEFAULT_MTU" /etc/rc.local
+
+# Enable the rc-local service so our changes get executed upon boot
+systemctl enable rc-local.service
+
 INFO "Pre-caching Ubuntu:16.04 image (this may take several minutes)..."
 
 # Setup a daily cron to update the cached image