This page is dedicated to more advanced topics related to using LXD with Juju. The main page is Using LXD with Juju.
The topics presented here are:
- Charms and LXD profiles
LXD profiles define a way to create and modify instances using configuration files. More information about LXD profiles can be found in their documentation.
Charms and LXD profiles
v.2.5.0) supports LXD profiles for charms. This is implemented by including file
lxd-profile.yaml in a charm’s root directory. For example, here is a simple two-line file (this is taken from the Openvswitch charm):
config: linux.kernel_modules: openvswitch,ip_tables,ip6_tables
The profile will be applied to a LXD container that the charm is deployed into. The following functionality is built in:
- A validity check is performed on the profile(s) during the deployment of the charm. This is based on a hardcoded list of allowed items, everything else being denied. The
--forceoption can be used to bypass this check but this is not recommended. The list is:
config -boot -limits -migration devices unix-char unix-block gpu usb
- Profiles are upgraded during the upgrade of the charm (
- Profiles are displayed at the machine level by using either the
show-machinecommand or the
status --format=yamlcommand. Below is an example of the kind of information that can be obtained from either of these two commands:
lxd-profiles: juju-default-lxd-profile-0: config: environment.http_proxy: "" linux.kernel_modules: openvswitch,nbd,ip_tables,ip6_tables security.nesting: "true" security.privileged: "true" description: lxd profile for testing, black list items grouped commented out devices: bdisk: source: /dev/loop0 type: unix-block sony: productid: 51da type: usb vendorid: 0fce tun: path: /dev/net/tun type: unix-char
See the LXD documentation to learn about the valid profile configuration options.