Comparing profiles and container settings between servers

Greetings all,

We are working on some automation tools to help migrate containers between LXD 2.15 servers, and I need some help identifying the differences between servers. In the end, I need to make sure the network, CPU, and RAM settings match before spinning up the secondary container (think hot-backup).

Scenario 1: Assume I have two servers with the profile named “US_Sites_01”. How can I tell if the profile between the two servers match exactly? I can run “lxc profile show <profile_name>” on the two servers but I don’t see an easy way to get a “diff” between the two.

Scenario 2: Assume I have the same container name on two separate servers (hot backup). How can I tell if the container profiles match exactly?

I supposed we could have a generic/blank “default” profile and set the appropriate limits/network config per container (ie: lxc config set . Perhaps that is the best way to ensure the containers match?


The best is to compare “lxc config show --expanded” of the source and target containers.
That will get you the yaml representation of the entire container configuration with all profiles and other configuration applied to it.

You could also go direct to the REST API and compare “/1.0/containers/NAME” which would be effectively the same thing but dealing with the JSON representation rather than yaml.