Detailed network configuration during INIT

Hello there,

I’ve spent quite a few hours attempting to properly configure networking of container in “init” phase. (Including googling here and there … :wink: )
I want to have the configuration as simple as possible, so I do not want to use profiles or configure device after the container is initiated.

I am using lxc & lxd setup on Bionic within OpenStack instance with multiple virtual network interfaces and I want to bind that virtual NICs directly to lxc containers as nictype=physical.
Name of NIC is chosen randomly, therefore, the profile would have to be reconfigured every time.
OpenStack’s Neutron gives network configuration upon DHCP request and it is working fine.

Problem is that container initiated by command shown below has correct everything but nictype=macvlan.

lxc init ubuntu:18.10 c2 --no-profiles --storage default --network ens7

The output of request send to LXD:

DBUG[10-31|11:13:39] 
        {
                "architecture": "",
                "devices": {
                        "ens7": {
                                "nictype": "macvlan",
                                "parent": "ens7",
                                "type": "nic"
                        },
                        "root": {
                                "path": "/",
                                "pool": "default",
                                "type": "disk"
                        }
                },
                "ephemeral": false,
                "profiles": [],
                "stateful": false,
                "description": "",
                "name": "c2",
                "source": {
                        "type": "image",
                        "certificate": "",
                        "alias": "18.10",
                        "server": "https://cloud-images.ubuntu.com/releases",
                        "protocol": "simplestreams",
                        "mode": "pull"
                },
                "instance_type": ""
        }

I have tried these variants but every single one ended neighter with error or unwanted outcome like nictype still macvlan.

lxc init ubuntu:18.10 c2 --no-profiles --storage default --config nictype=physical --network ens7
lxc init ubuntu:18.10 c2 --no-profiles --storage default --config device.nictype=physical --network ens7
lxc init ubuntu:18.10 c2 --no-profiles --storage default --config=nictype=physical --network ens7
lxc init ubuntu:18.10 c2 --no-profiles --storage default --config device.eth0.nictype=physical --network ens7
lxc init ubuntu:18.10 c2 --no-profiles --storage default --config devices.eth0.nictype=physical --network ens7
lxc init ubuntu:18.10 c2 --no-profiles --storage default --config devices.ens7.nictype=physical --network ens7
lxc init ubuntu:18.10 c2 --no-profiles --storage default --config user.network-config.type=physical --network ens7
lxc init ubuntu:18.10 c2 --no-profiles --storage default --config user.network-config.ens7.type=physical --network ens7
lxc init ubuntu:18.10 c2 --no-profiles --storage default --config lxc.net.0.type=physical --network ens7

What am I doing wrong or is there no such configuration possibility at all? Therefore I can write an issue on github to request this feature or os …

Thank you a lot :wink:

Environment: :computer:

# lxc --version
3.0.1
# lxd --version
3.0.1
# uname -a
Linux test-lxc1 4.15.0-30-generic #32-Ubuntu SMP Thu Jul 26 17:42:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux