I have several containers using a profile called “macvlan”; this profile is basically just the default profile, but instead of a bridged ethernet it uses a macvlan-device. I use a profile for this, so I can easily move the containers between servers without any extra steps needed; on e.g. server1, the profile is set to use enp4s0 as the parent-device and on server2 it’s set to use enp0s25 – all I need to do to move a container from one to another is “lxc stop containerHere && lxc move containerHere server2:containerHere && lxc start server2:containerHere”
Alas, this setup changes the MAC-address those containers use and I can’t specify the MAC-address in the profile, since the profile is used by multiple containers. Also, it would appear that LXD doesn’t allow me to “extend” the profile with container-specific settings, like e.g. “lxc config set containerHere eth0.hwaddr=macAddressHere” doesn’t work, since the NIC is configured in the profile instead of in the container’s own config.
Now, I realize there may be better ways of doing what I’m doing and I’ll happily listen to any suggestions, but I also wonder: is there any way of specifying devices, like e.g. NICs, in a profile and then configure container-specific settings for those devices in the container’s own config? Could this be something to add in a future version of LXD?
Addendum: at the moment, when moving a container from one server to another, I have to add the extra step of “lxc config set remoteServer:containerHere volatile.eth0.hwaddr=$(lxc config get containerHere volatile.eth0.hwaddr)”, which works, but is kinda clunky.
EDIT: I just realized that I should just make a MACVLAN-network using “lxc create network” and use that, instead of profiles. Welp, that renders this question both stupid and redundant.
There must be some sort of a misunderstanding here, since I just used “lxc network create --type=macvlan parent=nichere” to create an LXD-managed MACVLAN-network.
I must have used copy, instead of move when I had it happen. At least I can’t make it happen at the moment. Besides which, that wasn’t really the point with this thread in the first place, since I want to be able to retain the hwaddr regardless of whether I am moving or copying the containers.