LXD configuration for OSM Release FIVE

From OSM Public Wiki
Revision as of 19:57, 5 December 2018 by Israelad (talk | contribs) (Created page with " == Summary == LXD is a pure container hypervisor that runs unmodified Linux guest operating systems with VM-style operations at incredible speed and density. This makes it p...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Summary

LXD is a pure container hypervisor that runs unmodified Linux guest operating systems with VM-style operations at incredible speed and density. This makes it particularly well-suited for developing complex systems. This is used by the VCA for the deployment of proxy charms.

Configuring LXD

LXD will be installed and configured as part of the OSM installation, but you can follow the steps below to install it manually or change it's default behaviour.

Installing LXD

Previous releases of OSM installed LXD via apt from the Ubuntu Archives. We now recommend installing from snap.

snap install lxd

Next, we'll configure LXD to create the lxdbr0 bridge and create a ZFS storage pool. ZFS using Copy on Write so creating containers is faster.

cat <<EOF | lxd init --preseed
config: {}
networks:
- config:
    ipv4.address: auto
    ipv6.address: none
  description: ""
  managed: false
  name: lxdbr0
  type: ""
storage_pools:
- config:
    size: 30GB
  description: ""
  name: default
  driver: zfs
profiles:
- config: {}
  description: ""
  devices:
    eth0:
      name: eth0
      nictype: bridged
      parent: lxdbr0
      type: nic
    root:
      path: /
      pool: default
      type: disk
  name: default
cluster: null
EOF

Testing LXD

To test that your LXD installation is correct, try to deploy a container and run 'apt-get update' from inside:

lxc launch ubuntu:16.04 test          # Create a container based on Ubuntu 16.04 with name 'test'
lxc exec test bash                    # Access the container
root@test:~# apt-get update           # Run command 'apt-get update' from inside the container
root@test:~# exit                     # Exit from the container
lxc stop test                         # Stop the container
lxc delete test                       # Delete the container

Troubleshooting

Fixing MTU mismatch

A MTU mismatch between the VM running your VNF and the container with its proxy charm can lead to packets being dropped, causing configuration via SSH to fail.

In cases like this, we can configure LXD's default device profile to set a specific MTU.

lxc profile device set default eth0 mtu 1446

New containers will have the updated MTU. Existing containers will need to be restarted via lxc restart in order for the new MTU to take effect.