I'm trying to use cloud-init to control network configuration of a Lxd container. Here's the config I use:
#cloud-config.yml network: version: 1 config: - type: physical name: eth0 subnets: - type: static ipv4: true address: 10.10.10.20 netmask: 255.255.255.0 gateway: 10.10.10.1 control: auto - type: nameserver address: 10.10.10.1 I'm launching the container on Ubuntu 16.04 (v2.0.9) with the following: lxc launch ubuntu: CONTAINER -c user.network-config="$(cat cloud-config.yml)" In the container, cloud-init fail to apply the network configuration. /var/lib/cloud/seed/nocloud-net/network-config : file created /etc/network/interfaces.d/50-cloud-init.cfg : file not created In cloud-init.log : 2017-03-13 20:51:44,436 - stages.py[DEBUG]: applying net config names for {'config': {'user.network-config': 'version: 1\nconfig:\n - type: physical\n name: eth0\n subnets:\n - type: static\n ipv4: true\n address: 10.10.10.20\n netmask: 255.255.255.0\n gateway: 10.10.10.1\n control: auto\n - type: nameserver\n address: 10.10.10.1\n'}} 2017-03-13 20:51:44,436 - stages.py[DEBUG]: Using distro class <class 'cloudinit.distros.ubuntu.Distro'> 2017-03-13 20:51:44,437 - stages.py[WARNING]: Failed to rename devices: 'str' object has no attribute 'get' 2017-03-13 20:51:44,438 - stages.py[INFO]: Applying network configuration from ds bringup=False: {'config': {'user.network-config': 'version: 1\nconfig:\n - type: physical\n name: eth0\n subnets:\n - type: static\n ipv4: true\n address: 10.10.10.20\n netmask: 255.255.255.0\n gateway: 10.10.10.1\n control: auto\n - type: nameserver\n address: 10.10.10.1\n'}} 2017-03-13 20:51:44,439 - util.py[WARNING]: failed stage init-local 2017-03-13 20:51:44,439 - util.py[DEBUG]: failed stage init-local Traceback (most recent call last): File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 513, in status_wrapper ret = functor(name, args) File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 269, in main_init init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL)) File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 641, in apply_network_config return self.distro.apply_network_config(netcfg, bring_up=bring_up) File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 150, in apply_network_config dev_names = self._write_network_config(netconfig) File "/usr/lib/python3/dist-packages/cloudinit/distros/debian.py", line 84, in _write_network_config self._net_renderer.render_network_state("/", ns) File "/usr/lib/python3/dist-packages/cloudinit/net/eni.py", line 446, in render_network_state util.write_file(fpeni, header + self._render_interfaces(network_state)) File "/usr/lib/python3/dist-packages/cloudinit/net/eni.py", line 404, in _render_interfaces for iface in network_state.iter_interfaces(): AttributeError: 'NoneType' object has no attribute 'iter_interfaces' Claude
_______________________________________________ lxc-users mailing list lxc-users@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-users