Hello, I am trying to deploy a machine charm that requires 2 network interfaces using Juju on my local LXD cloud. I’m creating a new lxd network, and deploying the charm with this space:
However I am getting consistent issues from Juju and LXD because both network interfaces “are connected to same network”. I’m not sure I understand what exactly is the issue here and how I should go ahead.
Logs
LXC
INFO [2024-02-12T16:49:48-05:00] Creating instance ephemeral=false instance=juju-e42af0-7 instanceType=container project=default
ERROR [2024-02-12T16:49:48-05:00] Failed add validation for device, skipping add action device=eth0 err="Instance DNS name \"juju-e42af0-7\" conflict between \"eth0\" and \"eth3\" because both are connected to same network" instance=juju-e42af0-7 instanceType=container project=default
DEBUG [2024-02-12T16:49:48-05:00] Adding device device=eth1 instance=juju-e42af0-7 instanceType=container project=default type=nic
DEBUG [2024-02-12T16:49:48-05:00] Adding device device=eth2 instance=juju-e42af0-7 instanceType=container project=default type=nic
Juju
controller-0: 18:04:37 WARNING juju.worker.provisioner machine 15 failed to start in availability zone potiron: Failed start validation for device "eth0": Instance DNS name "juju-e42af0-15" conflict between "eth0" and "eth2" because both are connected to same network
The error is coming from LXD, when calling the checkAddressConflict() method. The comment for that method says:
// checkAddressConflict checks for conflicting IP/MAC addresses on another NIC connected to same network.
// Can only validate this when the instance is supplied (and not doing profile validation).
// Returns api.StatusError with status code set to http.StatusConflict if conflicting address found.
It seems that the bridge that is being created is conflicting with the NIC on the LXD instance spun up to deploy the charm. I’m wondering why you might be creating a new bridge instead of enrolling the existing subnets with which LXD has been configured into a space. Using the space constraint as you have done should then ensure that the provisioned instance comes up with a NIC in a subnet belonging to that space. There may be some LXD requirement I’m not aware of though, as I’ve not done much with spaces on LXD.
I didn’t know any better, I haven’t found a guide anywhere that explains deploying a charm with multiple network interfaces with LXD. How can I “enroll the existing subnets with which LXD has been configured into a space.”?
@gruyaume what subnets do you see when you list them from juju after adding the network in lxd? you could then move the subnets needed to the space you are going to use as constraint Juju | How to manage subnets