[lxc-users] macvlan network - is lxc.network.macvlan.mode required?

Serge Hallyn serge.hallyn at ubuntu.com
Wed Mar 26 15:23:23 UTC 2014


Quoting bogdan.purcareata at freescale.com (bogdan.purcareata at freescale.com):
> Hello,
> 
> I'm running LXC 1.0 with a config file inspired from the lxc-macvlan.conf available in the repo. I get this error:
> 
> root at sandbox:~# cat lxc-macvlan.conf
> # Container with network virtualized using the macvlan device driver
> lxc.utsname = alpha
> lxc.network.type = macvlan
> lxc.network.flags = up
> lxc.network.link = eth0
> root at sandbox:~# lxc-create -n foo -t busybox -f lxc-macvlan.conf
> lxc_container: Failed to parse config: lxc.network.macvlan.mode = (invalid)
> 
> lxc_container: Error creating container foo
> 
> I'm assuming LXC 1.0 now requires an additional "lxc.network.macvlan.mode = <something>" along with "lxc.network.type = macvlan" in order to work. I added such a line in the config file and I was able to get the container created. LXC 0.9 did not require this additional option.
> 
> I haven't looked at the code in depth, hence I don't know what's the best approach:
> 1. submit a fix that would add a default mode for lxc.network.macvlan if it's not specified in the config file - I'm assuming this was the case prior to LXC 1.0.
> 2. rely on the user to always specify a mode for the macvlan - in this case, I think the lxc-macvlan.conf example file should be updated. It probably wouldn't hurt to update the lxc.container.conf man page to stress that this parameter is (now) required, either. 
> 
> Which approach do you think it's best? If it's the former, any futher comments regarding how to do that (code-wise) are greatly appreciated!

I don't known what introduced this change, but I'd say 1. is the way
to go.  In config_network_type() just set netdev->priv.macvlan_attr.mode
when setting the network type to macvlan.  I would have said that
bridge is the most sensible default, but the lxc.container.conf
manpage says the default is private, so let's stick to that.


More information about the lxc-users mailing list