-function install_lxd() {
- [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
- # Apply sysctl production values for optimal performance
- sudo cp ${OSM_DEVOPS}/installers/60-lxd-production.conf /etc/sysctl.d/60-lxd-production.conf
- sudo sysctl --system
-
- # Install LXD snap
- sudo apt-get remove --purge -y liblxc1 lxc-common lxcfs lxd lxd-client
- sudo snap install lxd --channel $LXD_VERSION/stable
-
- # Configure LXD
- sudo usermod -a -G lxd `whoami`
- cat ${OSM_DEVOPS}/installers/lxd-preseed.conf | sed 's/^config: {}/config:\n core.https_address: '$DEFAULT_IP':8443/' | sg lxd -c "lxd init --preseed"
- sg lxd -c "lxd waitready"
- DEFAULT_IF=$(ip route list|awk '$1=="default" {print $5; exit}')
- [ -z "$DEFAULT_IF" ] && DEFAULT_IF=$(route -n |awk '$1~/^0.0.0.0/ {print $8; exit}')
- [ -z "$DEFAULT_IF" ] && FATAL "Not possible to determine the interface with the default route 0.0.0.0"
- DEFAULT_MTU=$(ip addr show ${DEFAULT_IF} | perl -ne 'if (/mtu\s(\d+)/) {print $1;}')
- sg lxd -c "lxc profile device set default eth0 mtu $DEFAULT_MTU"
- sg lxd -c "lxc network set lxdbr0 bridge.mtu $DEFAULT_MTU"
- #sudo systemctl stop lxd-bridge
- #sudo systemctl --system daemon-reload
- #sudo systemctl enable lxd-bridge
- #sudo systemctl start lxd-bridge
- [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
-}
-