LXD profiles as a pattern like OpenStack flavors

I am looking at implementing software in Open Source MANO (OSM) that will use LXD in a similar manner to OpenStack. In OSM, VM sizing is specified in a template with CPU, RAM and Disks. For OpenStack, a flavor must be created and referenced for launching the VM.

With LXD, I have a choice:

  1. Use LXD profiles to mimic the flavor usage in OpenStack. Profiles would be created and deleted by OSM, or
  2. Simply create the LXD VM using limits for CPU and RAM, and use config device to specify the disks

Which is the more “LXD” way of doing things?

I don’t know that there is a recommended approach here, it more depends on what your usage pattern will be.

For example, if you expect to need to change the settings for multiple VMs based on a “group” or “flavour” profile, then if you don’t go with the profiles approach, then you would need to manage identifying which VMs need changing and applying the changes manually. Whereas if you used profiles then you would just modify the profile (and perhaps need to restart VMs that use that profile, but that can be identified).

The other thing to be aware of is that you an layer profiles, so you can have a base profile, and then one or more additional override profiles, which can then be applied to an instance, with the last one overriding any conflicting keys from the previous ones.

You can also then apply specific instance config overrides ontop of any profiles applied to the instance.