Howto add hwaddr to nic created with profile?

Is there a way to add hwaddr to nic created with profile?
for example I got profile macvlan:
devices:
eth0:
nictype: macvlan
parent: enp0s31f6
type: nic

and i cant setup hwaddr for eth0

lxc config device set container eth0 hwaddr 00:50:56:01:32:22
Error: The device doesn’t exist

regards

You can do:

lxc config device override <instance> <device> hwaddr 00:50:56:01:32:22

The override command copies the NIC config from the profile into the instance and then modifies the config key(s) you provide.

wow it works! thx
but
is it normal that now
volatile.eth0.hwaddr is missing from container config
when i set up
eth hwaddr option?

regards

Yes that is normal, what’s happened there is in overriding the profile device, it will have removed the profile device from the instance (clearing any associated volatile keys) and then added a new instance device (with the profile config plus the overridden hwaddr) to the instance which then doesn’t create a volatile key.

thx for clarification
I assume that volatile.eth0.hwaddr automatically will be back when i remove hwaddr from nic eth0?

regards

Yep thats right.

nice thx