From: Adam Israel Date: Fri, 28 Apr 2017 00:45:51 +0000 (-0400) Subject: Auto-detect the MTU on the default interface and use that for the lxd X-Git-Tag: v2.0.0~1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F24%2F1724%2F2;p=osm%2Fdevops.git Auto-detect the MTU on the default interface and use that for the lxd bridge Signed-off-by: Adam Israel Change-Id: If01abbd67fcdc86d0e953f3753bf5c5da1192191 --- diff --git a/jenkins/VCA/start_build b/jenkins/VCA/start_build index 45b0e94c..d6ccfd8c 100755 --- a/jenkins/VCA/start_build +++ b/jenkins/VCA/start_build @@ -56,6 +56,16 @@ 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 '/ifconfig lxdbr0 mtu/d' /etc/rc.local +sed -i "$ i ifconfig lxdbr0 mtu $DEFAULT_MTU" /etc/rc.local + INFO "Pre-caching Ubuntu:16.04 image (this may take several minutes)..." # Setup a daily cron to update the cached image