canonical / lxd

Powerful system container and virtual machine manager
https://canonical.com/lxd
GNU Affero General Public License v3.0
4.32k stars 926 forks source link

Failed instance creation: Create container: Create LXC container: Interfaces must have a MAC address #6366

Closed ghost closed 4 years ago

ghost commented 4 years ago

6266 Required information

Issue description

Creating testcontainer Error: Failed instance creation: Create container: Create LXC container: Interfaces must have a MAC address

Steps to reproduce

  1. setup a maas server
  2. deploy a LTS 18.04
  3. install LXD on the host
  4. run lxd init with cluster settings, MAAS settings using a predefined Bridge (unmanaged) from MAAS and a new local storage pool
  5. lxc launch images:ubuntu/bionic/amd64 c1 will result in the given error

Information to attach

Creating testcontainer Error: Failed instance creation: Create container: Create LXC container: Interfaces must have a MAC address

If I set manually a Mac address for the default profile: config: {} description: Default LXD profile devices: eth0: hwaddr: 00:16:3e:6f:79:4d maas.subnet.ipv4: MAAS name: eth0 nictype: bridged parent: br-eno1 type: nic root: path: / pool: local type: disk name: default used_by: []

the container will be created but as you may already guess ... if I try to create a 2 container because the Mac address is the same ... that is not gonna happen and I will receive:

Creating testcontainer2 Error: Failed instance creation: Create container: Create LXC container: {"mac_addresses": ["MAC address 00:16:3e:6f:79:4d already in use on testcontainer."]}

So I think there is something wrong in the whole process of generating the Mac address for the container if a network is not managed by the lxd network because if I just generate an FAN network it works

stgraber commented 4 years ago

Looks like some kind of regression we must have caused when we re-did the device support in LXD, should be reasonably straightforward to track down and fix.

stgraber commented 4 years ago

reproduced the issue

stgraber commented 4 years ago

Fixed