lxd: disable ipv6 when creating a new-style bridge #6430

Merged
merged 5 commits into from Oct 12, 2016

Conversation

Projects
None yet
6 participants
Contributor

tych0 commented Oct 11, 2016

Also add a check in case the default bridge for eth0 has ipv6, which looks
something like:

$ juju bootstrap lxd lxd
ERROR creating LXD client: juju doesn't support ipv6. Please disable LXD's IPV6:

$ lxc network set lxdbr0 ipv6.address none

and rebootstrap

Signed-off-by: Tycho Andersen tycho.andersen@canonical.com

lxd: disable ipv6 when creating a new-style bridge
Also add a check in case the default bridge for eth0 has ipv6, which looks
something like:

$ juju bootstrap lxd lxd
ERROR creating LXD client: juju doesn't support ipv6. Please disable LXD's IPV6:

	$ lxc network set lxdbr0 ipv6.address none

and rebootstrap

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>

LGTM - other than lacking a test which can come in a follow-up. It would be better if Andy or Dimiter, who know more about lxd network configuration, took a look at it too.

Contributor

frobware commented Oct 12, 2016

Taking a look - also wanting to understand why this happens since we landed #6338.

Tested with LXD 2.0 on xenial and everything seems to work fine. I can't repro the bug, but at least this fix doesn't break the default case.

Note that #6338 will fix the case where we have both public IPv4 and IPv6 addresses (we will prefer IPv4). It won't handle where we have a public IPv6 address and only a cloud local IPv4 one (requesting public address will return the IPv6 one as it is the better scope match). We could change address selection to prefer a cloud local IPv4 over a public IPv6 if that's what we want.

frobware is seeing if he can repro the bug, and I'm preparing a PR with the change described above (to "always" prefer IPv4 even if there is a better match with an IPv6 one).

PR #6437 changes address selection to prefer IPv4 addresses in more situations. This changes address selection quite dramatically so we need to consider it before landing. If someone who can repro the bug can try PR #6437 to see if it fixes it.

Please fix that comment. The default/custom network config detection code will have to stay as it is for now. Please file a bug about that so we can track the need to improve it later.

tools/lxdclient/client.go
@@ -271,7 +271,7 @@ func verifyDefaultProfileBridgeConfig(client *lxd.Client, networkAPISupported bo
return "", errors.Trace(err)
}
- // If the default profile doesn't have eth0 in it, then the user has messed
+ // If the default profile has eth0 in it, then the user has messed
@dooferlad

dooferlad Oct 12, 2016

Contributor

This comment contradicts the error message on line 289, which is returning an error because eth0 wasn't found.

@dooferlad

dooferlad Oct 12, 2016

Contributor

Checking for eth0 is also a poor way of checking to see if the network config has been changed. We need a better way of communicating default/custom.

@tych0

tych0 Oct 12, 2016

Contributor

Yeah, I'll just delete it all together. It was wrong before, and it's wrong now :)

Contributor

frobware commented Oct 12, 2016

I explicitly QA'd this change and it worked as advertised. LGTM.

ubuntu@nuc03:~$ juju bootstrap lxd lxd --config ~/maas19-config.yaml
ERROR creating LXD client: couldn't create default bridge: juju doesn't support ipv6. Please disable LXD's IPV6:

    $ lxc network set lxdbr0 ipv6.address none

and rebootstrap
ubuntu@nuc03:~$ lxc network set lxdbr0 ipv6.address none
ubuntu@nuc03:~$ juju bootstrap lxd lxd --config ~/maas19-config.yaml
Creating Juju controller "lxd" on lxd/localhost
Looking for packaged Juju agent version 2.0.0 for amd64
No packaged binary found, preparing local Juju agent binary
To configure your system to better support LXD containers, please see: https://github.com/lxc/lxd/blob/master/doc/production-setup.md
Launching controller instance(s) on lxd/localhost...
 - juju-91cd60-0 (arch=amd64)                                                          
Fetching Juju GUI 2.2.1
Waiting for address
Attempting to connect to 10.199.221.171:22
Logging to /var/log/cloud-init-output.log on the bootstrap machine
Installing curl, cpu-checker, bridge-utils, cloud-utils, tmux
Installing Juju machine agent
Starting Juju machine agent (service jujud-machine-0)
Bootstrap agent now started
Contacting Juju controller at 10.199.221.171 to verify accessibility...
Bootstrap complete, "lxd" controller now available.
Controller machines are in the "controller" model.
Initial model "default" added.

ubuntu@nuc03:~$ juju status -m controller
Model       Controller  Cloud/Region   Version
controller  lxd         lxd/localhost  2.0.0.1

App  Version  Status  Scale  Charm  Store  Rev  OS  Notes

Unit  Workload  Agent  Machine  Public address  Ports  Message

Machine  State    DNS             Inst id        Series  AZ
0        started  10.199.221.171  juju-91cd60-0  xenial  
+ }
+
+ if n.Config["ipv6.address"] != "none" {
+ return errors.Errorf(`juju doesn't support ipv6. Please disable LXD's IPV6:
@dimitern

dimitern Oct 12, 2016

Contributor

"Juju does not fully support IPv6-only LXD network config.
Please, disable the IPv6 network address by running:
$ lxc network set %s ipv6.address none
and re-bootstrap." ?

@tych0

tych0 Oct 12, 2016

Contributor

I guess I'm slightly confused. This isn't about ipv6 only: the default LXD network has ipv4 connectivity. I thought the whole point was to disable ipv6 entirely in all cases, because it wasn't supported. The error message you've suggested makes me think that it should work in this case, since the LXD bridge has ipv4 connectivity too.

Tycho Andersen and others added some commits Oct 12, 2016

get rid of incorrect comment
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
disallow ipv6 on LXD < 2.3
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
change error message when ipv6 bridge config is present
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
fix up test for previous commit
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>

I tried the changes with LXD 2.0 and LXD 2.4.1. In both cases the error messages were presented when IPv6 was enabled. I removed IPv6 support as advertised by the message and was then able to bootstrap.

Contributor

frobware commented Oct 12, 2016

$$merge$$

Contributor

jujubot commented Oct 12, 2016

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit b127c3e into juju:master Oct 12, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment